Fix r4862 and make the input system a bit saner.

This commit is contained in:
thelemonman 2013-11-12 02:41:02 +00:00
parent 6ea032a191
commit f838938887
3 changed files with 8 additions and 18 deletions

View File

@ -406,9 +406,6 @@ process_joystick_events( u16 *keypad) {
if(SDL_JoystickEventState(SDL_QUERY) == SDL_IGNORE)
SDL_JoystickEventState(SDL_ENABLE);
/* Reset the keypad bits */
*keypad = 0;
/* There's an event waiting to be processed? */
while (SDL_PollEvent(&event))
{

View File

@ -75,16 +75,6 @@ bool desmume_running( void)
void desmume_cycle( void)
{
u16 keypad;
/* Joystick events */
/* Retrieve old value: can use joysticks w/ another device (from our side) */
keypad = get_keypad();
/* Look for queued events */
process_joystick_events( &keypad);
/* Update keypad value */
update_keypad(keypad);
FCEUMOV_AddInputState();
NDS_exec<false>();
SPU_Emulate_user();

View File

@ -493,7 +493,7 @@ struct modify_key_ctx {
u8 key_id;
};
static u16 Cur_Keypad = 0;
static u16 keys_latch = 0;
static u16 gdk_shift_pressed = 0;
u16 Keypad_Temp[NB_KEYS];
@ -1476,8 +1476,7 @@ static gint Key_Press(GtkWidget *w, GdkEventKey *e, gpointer data)
if( (e->state & mask) == 0){
u16 Key = lookup_key(e->keyval);
if(Key){
ADD_KEY( Cur_Keypad, Key );
if(desmume_running()) update_keypad(Cur_Keypad);
ADD_KEY( keys_latch, Key );
return 1;
}
}
@ -1502,8 +1501,7 @@ static gint Key_Release(GtkWidget *w, GdkEventKey *e, gpointer data)
return 1;
}
u16 Key = lookup_key(e->keyval);
RM_KEY( Cur_Keypad, Key );
if(desmume_running()) update_keypad(Cur_Keypad);
RM_KEY( keys_latch, Key );
return 1;
}
@ -1974,6 +1972,11 @@ gboolean EmuLoop(gpointer data)
skipped_frames = 0;
}
/* Merge the joystick keys with the keyboard ones */
process_joystick_events(&keys_latch);
/* Update! */
update_keypad(keys_latch);
desmume_cycle(); /* Emule ! */
for (i = 0; i < Frameskip; i++) {
NDS_SkipNextFrame();