(GX) Menu button toggle should work again

This commit is contained in:
twinaphex 2015-07-12 10:41:32 +02:00
parent 01ce2eaf31
commit 23348f41ac
2 changed files with 9 additions and 6 deletions

View File

@ -33,6 +33,8 @@
#define MAX_PADS 4 #define MAX_PADS 4
#endif #endif
uint64_t lifecycle_state;
typedef struct gx_input typedef struct gx_input
{ {
bool blocked; bool blocked;
@ -95,7 +97,8 @@ static bool gx_input_key_pressed(void *data, int key)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
gx_input_t *gx = (gx_input_t*)data; 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) static uint64_t gx_input_get_capabilities(void *data)

View File

@ -114,7 +114,7 @@ enum
#define GC_JOYSTICK_THRESHOLD (48 * 256) #define GC_JOYSTICK_THRESHOLD (48 * 256)
#define WII_JOYSTICK_THRESHOLD (40 * 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 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 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]; 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) if (port >= MAX_PADS)
return false; return false;
return (lifecycle_state & (UINT64_C(1) << key)) || return (pad_state[port] & (UINT64_C(1) << key));
(pad_state[port] & (UINT64_C(1) << key));
} }
static uint64_t gx_joypad_get_buttons(unsigned port) 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]; 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) if (g_menu)
{ {
@ -555,7 +555,7 @@ static void gx_joypad_poll(void)
| (UINT64_C(1) << GX_CLASSIC_HOME) | (UINT64_C(1) << GX_CLASSIC_HOME)
#endif #endif
)) ))
lifecycle_state |= (UINT64_C(1) << RARCH_MENU_TOGGLE); BIT64_SET(lifecycle_state, RARCH_MENU_TOGGLE);
} }
static bool gx_joypad_init(void *data) static bool gx_joypad_init(void *data)