- Centralized NDS keypad update.

This commit is contained in:
evilynux 2007-01-14 21:37:36 +00:00
parent 4658a6cd2c
commit 94f6fe5a55
2 changed files with 2 additions and 15 deletions

View File

@ -65,24 +65,13 @@ 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;
keypad = get_keypad();
/* Look for queued events */
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_pad;
MMU.ARM7_REG[0x136] = (k_ext & 0x3) | (MMU.ARM7_REG[0x136] & ~0x3);
}

View File

@ -32,7 +32,5 @@ extern BOOL desmume_running();
extern void desmume_cycle();
extern void desmume_keypad(u16 k);
#endif /*__DESMUME_H__*/