From 4658a6cd2c1c8ea45a4a6eaa2b2c8a16ce723dec Mon Sep 17 00:00:00 2001 From: evilynux Date: Sun, 14 Jan 2007 21:33:03 +0000 Subject: [PATCH] - Centralized NDS keypad update. - Fixed X and Y keys. --- desmume/src/cli/main.c | 8 ++------ desmume/src/gtk-glade/callbacks_IO.c | 6 +++--- desmume/src/gtk-glade/main.c | 6 +++--- desmume/src/gtk/main.c | 6 +++--- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/desmume/src/cli/main.c b/desmume/src/cli/main.c index f5d89d0dd..45f665e4e 100644 --- a/desmume/src/cli/main.c +++ b/desmume/src/cli/main.c @@ -36,8 +36,8 @@ const u16 Default_Joypad_Config[NB_KEYS] = 23, // Down -- End of cheating. 7, // R 6, // L - 3, // Y 4, // X + 3, // Y -1, // BOOST -1 // DEBUG }; @@ -107,11 +107,7 @@ int main(int argc, char ** argv) { mouse.click = FALSE; } - /* Update keypad */ - ((unsigned short *)ARM9Mem.ARM9_REG)[0x130>>1] = ~(keypad & 0x3FF); - ((unsigned short *)MMU.ARM7_REG)[0x130>>1] = ~((keypad >> 10) & 0x3); - -/* NDS_exec(1120380, FALSE); */ + update_keypad(keypad); /* Update keypad */ last_cycle = NDS_exec((560190 << 1) - last_cycle, FALSE); SPU_Emulate(); Draw(); diff --git a/desmume/src/gtk-glade/callbacks_IO.c b/desmume/src/gtk-glade/callbacks_IO.c index 7c53cf6c0..12aac632a 100755 --- a/desmume/src/gtk-glade/callbacks_IO.c +++ b/desmume/src/gtk-glade/callbacks_IO.c @@ -53,7 +53,7 @@ gboolean on_wMainW_key_press_event (GtkWidget *widget, GdkEventKey *event, g } else if (Key != 0) { Cur_Keypad |= Key; - if(desmume_running()) desmume_keypad(Cur_Keypad); + if(desmume_running()) update_keypad(Cur_Keypad); } return 1; } @@ -62,7 +62,7 @@ gboolean on_wMainW_key_release_event (GtkWidget *widget, GdkEventKey *event, g u16 Key = lookup_key(event->keyval); if (Key != 0) { Cur_Keypad &= ~Key; - if(desmume_running()) desmume_keypad(Cur_Keypad); + if(desmume_running()) update_keypad(Cur_Keypad); } return 1; } @@ -255,7 +255,7 @@ const char * DESMUME_KEY_NAMES[DESMUME_NB_KEYS]={ "A", "B", "Select", "Start", "Right", "Left", "Up", "Down", - "R", "L", "Y", "X", "DEBUG", "Boost" + "R", "L", "X", "Y", "DEBUG", "Boost" }; gint Keypad_Temp[DESMUME_NB_KEYS]; guint temp_Key=0; diff --git a/desmume/src/gtk-glade/main.c b/desmume/src/gtk-glade/main.c index d58c5175e..a575cd7e3 100755 --- a/desmume/src/gtk-glade/main.c +++ b/desmume/src/gtk-glade/main.c @@ -74,8 +74,8 @@ const u16 Default_Joypad_Config[DESMUME_NB_KEYS] = 23, // Down -- End of cheating. 7, // R 6, // L - 3, // Y 4, // X + 3, // Y -1, // DEBUG -1 // BOOST }; @@ -92,8 +92,8 @@ const char *Ini_Keypad_Values[DESMUME_NB_KEYS] = "KEY_DOWN", "KEY_R", "KEY_L", - "KEY_Y", "KEY_X", + "KEY_Y", "KEY_DEBUG", "KEY_BOOST" }; @@ -110,8 +110,8 @@ const gint Default_Keypad_Config[DESMUME_NB_KEYS] = GDK_Down, GDK_KP_Decimal, GDK_KP_0, - GDK_y, GDK_x, + GDK_y, GDK_p, GDK_o }; diff --git a/desmume/src/gtk/main.c b/desmume/src/gtk/main.c index be59c2ebb..c2450a17e 100644 --- a/desmume/src/gtk/main.c +++ b/desmume/src/gtk/main.c @@ -137,8 +137,8 @@ const u16 Default_Joypad_Config[DESMUME_NB_KEYS] = 23, // Down -- End of cheating. 7, // R 6, // L - 3, // Y 4, // X + 3, // Y -1 // DEBUG }; @@ -421,7 +421,7 @@ static gint Key_Press(GtkWidget *w, GdkEventKey *e) { Key = DESMUME_KEYMASK_(i); Cur_Keypad &= ~Key; - if(desmume_running()) desmume_keypad(~Cur_Keypad); + if(desmume_running()) update_keypad(~Cur_Keypad); } //fprintf(stderr,"P:%d(%d)->%X => [%X]\n", e->keyval, e->hardware_keycode, Key, Cur_Keypad); @@ -439,7 +439,7 @@ static gint Key_Release(GtkWidget *w, GdkEventKey *e) { Key = DESMUME_KEYMASK_(i); Cur_Keypad |= Key; - if(desmume_running()) desmume_keypad(~Cur_Keypad); + if(desmume_running()) update_keypad(~Cur_Keypad); } //fprintf(stderr,"R:%d(%d)->%X => [%X]\n", e->keyval, e->hardware_keycode, Key, Cur_Keypad);