- Centralized NDS keypad update.

This commit is contained in:
evilynux 2007-01-14 21:31:42 +00:00
parent cf35dbd115
commit 37485aaaa8
2 changed files with 5 additions and 20 deletions

View File

@ -89,27 +89,16 @@ void desmume_cycle()
u16 keypad; u16 keypad;
/* Joystick events */ /* Joystick events */
/* Retrieve old value: can use joysticks w/ another device (from our side) */ /* Retrieve old value: can use joysticks w/ another device (from our side) */
keypad = ~((unsigned short *)MMU.ARM7_REG)[0x130>>1]; keypad = get_keypad();
keypad = (keypad & 0x3) << 10; /* Process joystick events if any */
keypad |= ~((unsigned short *)ARM9Mem.ARM9_REG)[0x130>>1] & 0x3FF;
/* Look for queued events */
keypad = process_ctrls_events(keypad); keypad = process_ctrls_events(keypad);
/* Update keypad value */ /* Update keypad value */
desmume_keypad(keypad); update_keypad(keypad);
desmume_last_cycle = NDS_exec((560190 << 1) - desmume_last_cycle, FALSE); desmume_last_cycle = NDS_exec((560190 << 1) - desmume_last_cycle, FALSE);
SPU_Emulate(); 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 /////////////////////////////// /////////////////////////////// TOOLS MANAGEMENT ///////////////////////////////
#if 0 #if 0
//#include "dTool.h" //#include "dTool.h"

View File

@ -35,9 +35,8 @@
#define DESMUME_KEY_Down 8 #define DESMUME_KEY_Down 8
#define DESMUME_KEY_R 9 #define DESMUME_KEY_R 9
#define DESMUME_KEY_L 10 #define DESMUME_KEY_L 10
#define DESMUME_KEY_X 11
#define DESMUME_KEY_Y 11 #define DESMUME_KEY_Y 12
#define DESMUME_KEY_X 12
#define DESMUME_KEY_DEBUG 13 #define DESMUME_KEY_DEBUG 13
#define DESMUME_KEY_BOOST 14 #define DESMUME_KEY_BOOST 14
@ -54,8 +53,5 @@ extern void desmume_toggle();
extern BOOL desmume_running(); extern BOOL desmume_running();
extern void desmume_cycle(); extern void desmume_cycle();
extern void desmume_keypad(u16 k);
#endif /*__DESMUME_H__*/ #endif /*__DESMUME_H__*/