From 94f6fe5a55e9809dc6d823c407885f75bbab98d3 Mon Sep 17 00:00:00 2001 From: evilynux Date: Sun, 14 Jan 2007 21:37:36 +0000 Subject: [PATCH] - Centralized NDS keypad update. --- desmume/src/gtk/desmume.c | 15 ++------------- desmume/src/gtk/desmume.h | 2 -- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/desmume/src/gtk/desmume.c b/desmume/src/gtk/desmume.c index 1440ed036..6295b6909 100644 --- a/desmume/src/gtk/desmume.c +++ b/desmume/src/gtk/desmume.c @@ -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); -} diff --git a/desmume/src/gtk/desmume.h b/desmume/src/gtk/desmume.h index fb9b90ba0..8b89f223b 100644 --- a/desmume/src/gtk/desmume.h +++ b/desmume/src/gtk/desmume.h @@ -32,7 +32,5 @@ extern BOOL desmume_running(); extern void desmume_cycle(); -extern void desmume_keypad(u16 k); - #endif /*__DESMUME_H__*/