From 23348f41ac76858de77f0782376220ecc965e742 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 12 Jul 2015 10:41:32 +0200 Subject: [PATCH] (GX) Menu button toggle should work again --- input/drivers/gx_input.c | 5 ++++- input/drivers_joypad/gx_joypad.c | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/input/drivers/gx_input.c b/input/drivers/gx_input.c index 8850b14006..11dcc6d4f7 100644 --- a/input/drivers/gx_input.c +++ b/input/drivers/gx_input.c @@ -33,6 +33,8 @@ #define MAX_PADS 4 #endif +uint64_t lifecycle_state; + typedef struct gx_input { bool blocked; @@ -95,7 +97,8 @@ 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 input_joypad_pressed(gx->joypad, 0, settings->input.binds[0], key); + return (BIT64_GET(lifecycle_state, key)) || + 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/gx_joypad.c b/input/drivers_joypad/gx_joypad.c index 742b8c6949..aeb409f2bf 100644 --- a/input/drivers_joypad/gx_joypad.c +++ b/input/drivers_joypad/gx_joypad.c @@ -114,7 +114,7 @@ enum #define GC_JOYSTICK_THRESHOLD (48 * 256) #define WII_JOYSTICK_THRESHOLD (40 * 256) -static uint64_t lifecycle_state; +extern 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]; @@ -201,8 +201,7 @@ static bool gx_joypad_button(unsigned port, uint16_t key) { if (port >= MAX_PADS) return false; - return (lifecycle_state & (UINT64_C(1) << key)) || - (pad_state[port] & (UINT64_C(1) << key)); + return (pad_state[port] & (UINT64_C(1) << key)); } static uint64_t gx_joypad_get_buttons(unsigned port) @@ -542,7 +541,8 @@ static void gx_joypad_poll(void) uint64_t *state_p1 = &pad_state[0]; - lifecycle_state &= ~((UINT64_C(1) << RARCH_MENU_TOGGLE)); + + BIT64_CLEAR(lifecycle_state, RARCH_MENU_TOGGLE); if (g_menu) { @@ -555,7 +555,7 @@ static void gx_joypad_poll(void) | (UINT64_C(1) << GX_CLASSIC_HOME) #endif )) - lifecycle_state |= (UINT64_C(1) << RARCH_MENU_TOGGLE); + BIT64_SET(lifecycle_state, RARCH_MENU_TOGGLE); } static bool gx_joypad_init(void *data)