diff --git a/config.def.h b/config.def.h index 46c82fd4cc..81cf1ddebc 100644 --- a/config.def.h +++ b/config.def.h @@ -525,7 +525,9 @@ static unsigned menu_toggle_gamepad_combo = 2; static unsigned menu_toggle_gamepad_combo = 0; #endif +#ifdef ANDROID static bool back_as_menu_toggle_enable = true; +#endif /* Crop overscanned frames. */ static const bool crop_overscan = true; diff --git a/input/drivers/gx_input.c b/input/drivers/gx_input.c index 178f2690e9..8850b14006 100644 --- a/input/drivers/gx_input.c +++ b/input/drivers/gx_input.c @@ -37,7 +37,6 @@ typedef struct gx_input { bool blocked; const input_device_driver_t *joypad; - uint64_t lifecycle_state; } gx_input_t; static int16_t gx_input_state(void *data, const struct retro_keybind **binds, @@ -96,8 +95,7 @@ static bool gx_input_key_pressed(void *data, int key) { settings_t *settings = config_get_ptr(); gx_input_t *gx = (gx_input_t*)data; - return (gx->lifecycle_state & (1ULL << key)) || - input_joypad_pressed(gx->joypad, 0, settings->input.binds[0], key); + return input_joypad_pressed(gx->joypad, 0, settings->input.binds[0], key); } static uint64_t gx_input_get_capabilities(void *data) diff --git a/input/drivers_joypad/ctr_joypad.c b/input/drivers_joypad/ctr_joypad.c index 320619602d..88cb2ec4ab 100644 --- a/input/drivers_joypad/ctr_joypad.c +++ b/input/drivers_joypad/ctr_joypad.c @@ -61,13 +61,13 @@ static bool ctr_joypad_init(void *data) return true; } -static bool ctr_joypad_button(unsigned port_num, uint16_t joykey) +static bool ctr_joypad_button(unsigned port_num, uint16_t key) { if (port_num >= MAX_PADS) return false; return (ctr->lifecycle_state & (1ULL << key)) || - (pad_state & (1ULL << joykey)); + (pad_state & (1ULL << key)); } static uint64_t ctr_joypad_get_buttons(unsigned port_num) diff --git a/input/drivers_joypad/gx_joypad.c b/input/drivers_joypad/gx_joypad.c index 00df9a0918..b09256be1b 100644 --- a/input/drivers_joypad/gx_joypad.c +++ b/input/drivers_joypad/gx_joypad.c @@ -114,6 +114,7 @@ enum #define GC_JOYSTICK_THRESHOLD (48 * 256) #define WII_JOYSTICK_THRESHOLD (40 * 256) +static uint64_t lifecycle_state; static uint64_t pad_state[MAX_PADS]; static uint32_t pad_type[MAX_PADS] = { WPAD_EXP_NOCONTROLLER, WPAD_EXP_NOCONTROLLER, WPAD_EXP_NOCONTROLLER, WPAD_EXP_NOCONTROLLER }; static int16_t analog_state[MAX_PADS][2][2]; @@ -196,11 +197,12 @@ static void handle_hotplug(unsigned port, uint32_t ptype) } } -static bool gx_joypad_button(unsigned port, uint16_t joykey) +static bool gx_joypad_button(unsigned port, uint16_t key) { if (port >= MAX_PADS) return false; - return pad_state[port] & (1ULL << joykey); + return (lifecycle_state & (1ULL << key)) || + (pad_state[port] & (1ULL << key)); } static uint64_t gx_joypad_get_buttons(unsigned port) @@ -350,7 +352,6 @@ static void gx_joypad_poll(void) { unsigned i, j, port; uint8_t gcpad = 0; - gx_input_t *gx = (gx_input_t*)input_driver_get_ptr(); pad_state[0] = 0; pad_state[1] = 0; @@ -541,7 +542,7 @@ static void gx_joypad_poll(void) uint64_t *state_p1 = &pad_state[0]; - gx->lifecycle_state &= ~((1ULL << RARCH_MENU_TOGGLE)); + lifecycle_state &= ~((1ULL << RARCH_MENU_TOGGLE)); if (g_menu) { @@ -554,7 +555,7 @@ static void gx_joypad_poll(void) | (1ULL << GX_CLASSIC_HOME) #endif )) - gx->lifecycle_state |= (1ULL << RARCH_MENU_TOGGLE); + lifecycle_state |= (1ULL << RARCH_MENU_TOGGLE); } static bool gx_joypad_init(void *data) diff --git a/input/input_driver.c b/input/input_driver.c index b3c655c324..81e121a7d0 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -178,14 +178,6 @@ static const input_driver_t *input_get_ptr(driver_t *driver) return driver->input; } -input_driver_t *input_driver_get_ptr(void) -{ - driver_t *driver = driver_get_ptr(); - if (!driver) - return NULL; - return (input_driver_t*)driver->input_data; -} - /** * input_driver_set_rumble_state: * @port : User number. diff --git a/input/input_driver.h b/input/input_driver.h index d921bc2236..9d0414529b 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -98,8 +98,6 @@ extern input_driver_t input_qnx; extern input_driver_t input_rwebinput; extern input_driver_t input_null; -input_driver_t *input_driver_get_ptr(void); - /** * input_driver_find_handle: * @index : index of driver to get handle to.