diff --git a/input/drivers/ctr_input.c b/input/drivers/ctr_input.c index 1764d52908..3c9f204831 100644 --- a/input/drivers/ctr_input.c +++ b/input/drivers/ctr_input.c @@ -31,6 +31,8 @@ typedef struct ctr_input const input_device_driver_t *joypad; } ctr_input_t; +uint64_t lifecycle_state; + static void ctr_input_poll(void *data) { ctr_input_t *ctr = (ctr_input_t*)data; @@ -86,7 +88,8 @@ static bool ctr_input_key_pressed(void *data, int key) settings_t *settings = config_get_ptr(); ctr_input_t *ctr = (ctr_input_t*)data; - return (input_joypad_pressed(ctr->joypad, 0, settings->input.binds[0], key); + return (BIT64_GET(lifecycle_state, key)) || + (input_joypad_pressed(ctr->joypad, 0, settings->input.binds[0], key); } static uint64_t ctr_input_get_capabilities(void *data) diff --git a/input/drivers/psp_input.c b/input/drivers/psp_input.c index 8a7b797213..8cfc1cc44d 100644 --- a/input/drivers/psp_input.c +++ b/input/drivers/psp_input.c @@ -45,6 +45,8 @@ typedef struct psp_input const input_device_driver_t *joypad; } psp_input_t; +uint64_t lifecycle_state; + static void psp_input_poll(void *data) { psp_input_t *psp = (psp_input_t*)data; @@ -101,7 +103,8 @@ static bool psp_input_key_pressed(void *data, int key) settings_t *settings = config_get_ptr(); psp_input_t *psp = (psp_input_t*)data; - return input_joypad_pressed(psp->joypad, 0, settings->input.binds[0], key); + return (BIT64_GET(lifecycle_state, key)) || + input_joypad_pressed(psp->joypad, 0, settings->input.binds[0], key); } static uint64_t psp_input_get_capabilities(void *data) diff --git a/input/drivers_joypad/ctr_joypad.c b/input/drivers_joypad/ctr_joypad.c index 5f72118c30..bd51a61769 100644 --- a/input/drivers_joypad/ctr_joypad.c +++ b/input/drivers_joypad/ctr_joypad.c @@ -29,7 +29,7 @@ static uint64_t pad_state; static int16_t analog_state[1][2][2]; -static uint64_t lifecycle_state; +extern uint64_t lifecycle_state; static const char *ctr_joypad_name(unsigned pad) { @@ -66,8 +66,7 @@ static bool ctr_joypad_button(unsigned port_num, uint16_t key) if (port_num >= MAX_PADS) return false; - return (ctr->lifecycle_state & (UINT64_C(1) << key)) || - (pad_state & (UINT64_C(1) << key)); + return (pad_state & (UINT64_C(1) << key)); } static uint64_t ctr_joypad_get_buttons(unsigned port_num) @@ -156,10 +155,10 @@ static void ctr_joypad_poll(void) if (analog_state[0][i][j] == -0x8000) analog_state[0][i][j] = -0x7fff; - lifecycle_state &= ~((UINT64_C(1) << RARCH_MENU_TOGGLE)); + BIT64_CLEAR(lifecycle_state, RARCH_MENU_TOGGLE); if(state_tmp & KEY_TOUCH) - lifecycle_state |= (UINT64_C(1) << RARCH_MENU_TOGGLE); + BIT64_SET(lifecycle_state, RARCH_MENU_TOGGLE); /* panic button */ if((state_tmp & KEY_START) && diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c index 881f0733ba..b2429b64ad 100644 --- a/input/drivers_joypad/psp_joypad.c +++ b/input/drivers_joypad/psp_joypad.c @@ -18,7 +18,8 @@ static uint64_t pad_state; static int16_t analog_state[1][2][2]; -static uint64_t lifecycle_state; + +extern uint64_t lifecycle_state; static const char *psp_joypad_name(unsigned pad) { @@ -55,8 +56,7 @@ static bool psp_joypad_button(unsigned port_num, uint16_t key) if (port_num >= MAX_PADS) return false; - return (lifecycle_state & (UINT64_C(1) << key)) || - (pad_state & (UINT64_C(1) << key)); + return (pad_state & (UINT64_C(1) << key)); } static uint64_t psp_joypad_get_buttons(unsigned port_num) @@ -153,7 +153,7 @@ static void psp_joypad_poll(void) if (analog_state[0][i][j] == -0x8000) analog_state[0][i][j] = -0x7fff; - lifecycle_state &= ~((UINT64_C(1) << RARCH_MENU_TOGGLE)); + BIT64_CLEAR(lifecycle_state, RARCH_MENU_TOGGLE); #ifdef HAVE_KERNEL_PRX if (STATE_BUTTON(state_tmp) & PSP_CTRL_NOTE) @@ -165,7 +165,7 @@ static void psp_joypad_poll(void) && (pad_state & (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_START)) ) #endif - lifecycle_state |= (UINT64_C(1) << RARCH_MENU_TOGGLE); + BIT64_SET(lifecycle_state, RARCH_MENU_TOGGLE); } static bool psp_joypad_query_pad(unsigned pad)