From 351b3fe3f6c1cdbf5209f5e29b6651302b0f764d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Mon, 8 Aug 2016 12:56:30 +0200 Subject: [PATCH 1/3] (VITA) Workaround for PSVita Controls vs PSTV --- config.def.h | 4 ++++ input/drivers_joypad/psp_joypad.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/config.def.h b/config.def.h index 5d7e7184eb..365065d26d 100644 --- a/config.def.h +++ b/config.def.h @@ -796,7 +796,11 @@ static const bool input_descriptor_label_show = true; static const bool input_descriptor_hide_unbound = false; +#if defined(PSP) || defined(VITA) +static const unsigned input_max_users = 1; +#else static const unsigned input_max_users = 5; +#endif static const unsigned input_poll_type_behavior = 2; diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c index 4823af486e..bfb072674e 100644 --- a/input/drivers_joypad/psp_joypad.c +++ b/input/drivers_joypad/psp_joypad.c @@ -124,11 +124,17 @@ static int16_t psp_joypad_axis(unsigned port_num, uint32_t joyaxis) static void psp_joypad_poll(void) { + settings_t *settings = config_get_ptr(); + unsigned player; unsigned players_count = PSP_MAX_PADS; #ifdef PSP sceCtrlSetSamplingCycle(0); +#else + if(settings->input.max_usersinput.max_users; #endif + sceCtrlSetSamplingMode(DEFAULT_SAMPLING_MODE); BIT64_CLEAR(lifecycle_state, RARCH_MENU_TOGGLE); From 8dde35f2219234d3578aee21992382ef759fe80a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Mon, 8 Aug 2016 17:10:52 +0200 Subject: [PATCH 2/3] (VITA) Final Fix for controls --- config.def.h | 4 ---- input/drivers_joypad/psp_joypad.c | 10 ++++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/config.def.h b/config.def.h index 365065d26d..5d7e7184eb 100644 --- a/config.def.h +++ b/config.def.h @@ -796,11 +796,7 @@ static const bool input_descriptor_label_show = true; static const bool input_descriptor_hide_unbound = false; -#if defined(PSP) || defined(VITA) -static const unsigned input_max_users = 1; -#else static const unsigned input_max_users = 5; -#endif static const unsigned input_poll_type_behavior = 2; diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c index bfb072674e..f5ff556dae 100644 --- a/input/drivers_joypad/psp_joypad.c +++ b/input/drivers_joypad/psp_joypad.c @@ -130,9 +130,6 @@ static void psp_joypad_poll(void) unsigned players_count = PSP_MAX_PADS; #ifdef PSP sceCtrlSetSamplingCycle(0); -#else - if(settings->input.max_usersinput.max_users; #endif sceCtrlSetSamplingMode(DEFAULT_SAMPLING_MODE); @@ -152,11 +149,16 @@ static void psp_joypad_poll(void) unsigned p = (player == 1) ? 2 : player; int32_t ret = CtrlPeekBufferPositive(p, &state_tmp, 1); +#if defined(SN_TARGET_PSP2) || defined(VITA) + if(ret<0){ + continue; + } +#endif + #ifdef HAVE_KERNEL_PRX state_tmp.Buttons = (state_tmp.Buttons & 0x0000FFFF) | (read_system_buttons() & 0xFFFF0000); #endif - (void)ret; analog_state[i][0][0] = analog_state[i][0][1] = analog_state[i][1][0] = analog_state[i][1][1] = 0; From d0f96ed5358f8d33d637497ede63fcb66ef3d92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Mon, 8 Aug 2016 17:12:52 +0200 Subject: [PATCH 3/3] (VITA) Small fix --- input/drivers_joypad/psp_joypad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c index f5ff556dae..6272411afc 100644 --- a/input/drivers_joypad/psp_joypad.c +++ b/input/drivers_joypad/psp_joypad.c @@ -149,6 +149,8 @@ static void psp_joypad_poll(void) unsigned p = (player == 1) ? 2 : player; int32_t ret = CtrlPeekBufferPositive(p, &state_tmp, 1); + pad_state[i] = 0; + #if defined(SN_TARGET_PSP2) || defined(VITA) if(ret<0){ continue; @@ -162,7 +164,6 @@ static void psp_joypad_poll(void) analog_state[i][0][0] = analog_state[i][0][1] = analog_state[i][1][0] = analog_state[i][1][1] = 0; - pad_state[i] = 0; pad_state[i] |= (STATE_BUTTON(state_tmp) & PSP_CTRL_LEFT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0; pad_state[i] |= (STATE_BUTTON(state_tmp) & PSP_CTRL_DOWN) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0; pad_state[i] |= (STATE_BUTTON(state_tmp) & PSP_CTRL_RIGHT) ? (UINT64_C(1) << RETRO_DEVICE_ID_JOYPAD_RIGHT) : 0;