(PSP/CTR) Should fix lifecycle state menu toggling

This commit is contained in:
twinaphex 2015-07-12 10:46:20 +02:00
parent 23348f41ac
commit 7fb1265227
4 changed files with 17 additions and 12 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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) &&

View File

@ -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)