diff --git a/desmume/src/gtk-glade/desmume.c b/desmume/src/gtk-glade/desmume.c index e7d81fc6e..2deef6fe7 100755 --- a/desmume/src/gtk-glade/desmume.c +++ b/desmume/src/gtk-glade/desmume.c @@ -89,27 +89,16 @@ void desmume_cycle() u16 keypad; /* Joystick events */ /* Retrieve old value: can use joysticks w/ another device (from our side) */ - keypad = ~((unsigned short *)MMU.ARM7_REG)[0x130>>1]; - keypad = (keypad & 0x3) << 10; - keypad |= ~((unsigned short *)ARM9Mem.ARM9_REG)[0x130>>1] & 0x3FF; - /* Look for queued events */ + keypad = get_keypad(); + /* Process joystick events if any */ keypad = process_ctrls_events(keypad); /* Update keypad value */ - desmume_keypad(keypad); + update_keypad(keypad); desmume_last_cycle = NDS_exec((560190 << 1) - desmume_last_cycle, FALSE); SPU_Emulate(); } -void desmume_keypad(u16 k) -{ - unsigned short k_ext = (k >> 10) & 0x3; - unsigned short k_pad = k & 0x3FF; - ((unsigned short *)ARM9Mem.ARM9_REG)[0x130>>1] = ~k_pad; - ((unsigned short *)MMU.ARM7_REG)[0x130>>1] = ~k_ext; -} - - /////////////////////////////// TOOLS MANAGEMENT /////////////////////////////// #if 0 //#include "dTool.h" diff --git a/desmume/src/gtk-glade/desmume.h b/desmume/src/gtk-glade/desmume.h index dc9f6ff94..6a33f4334 100755 --- a/desmume/src/gtk-glade/desmume.h +++ b/desmume/src/gtk-glade/desmume.h @@ -35,9 +35,8 @@ #define DESMUME_KEY_Down 8 #define DESMUME_KEY_R 9 #define DESMUME_KEY_L 10 - -#define DESMUME_KEY_Y 11 -#define DESMUME_KEY_X 12 +#define DESMUME_KEY_X 11 +#define DESMUME_KEY_Y 12 #define DESMUME_KEY_DEBUG 13 #define DESMUME_KEY_BOOST 14 @@ -54,8 +53,5 @@ extern void desmume_toggle(); extern BOOL desmume_running(); extern void desmume_cycle(); - -extern void desmume_keypad(u16 k); - #endif /*__DESMUME_H__*/