From 7f0624ff3282e8f3744ab49443f716eae73ba44a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Tue, 30 Aug 2016 14:27:12 +0200 Subject: [PATCH 1/2] (VITA) Update to latest sdk --- libretro-common/features/features_cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index 01ca84b5c9..1fbc2023a8 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -154,7 +154,7 @@ retro_perf_tick_t cpu_features_get_perf_counter(void) #elif defined(GEKKO) time_ticks = gettime(); #elif defined(PSP) || defined(VITA) - sceRtcGetCurrentTick(&time_ticks); + sceRtcGetCurrentTick((SceRtcTick *)&time_ticks); #elif defined(_3DS) time_ticks = svcGetSystemTick(); #elif defined(__mips__) From e3b5fdd81523aad6204336927f9f83ea625aafa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Jos=C3=A9=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Tue, 30 Aug 2016 14:29:19 +0200 Subject: [PATCH 2/2] (VITA) Add vibration for PSTV --- input/drivers/psp_input.c | 8 ++++---- input/drivers_joypad/psp_joypad.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/input/drivers/psp_input.c b/input/drivers/psp_input.c index eb04e6a969..05bfc8b023 100644 --- a/input/drivers/psp_input.c +++ b/input/drivers/psp_input.c @@ -140,11 +140,11 @@ static void psp_input_grab_mouse(void *data, bool state) static bool psp_input_set_rumble(void *data, unsigned port, enum retro_rumble_effect effect, uint16_t strength) { - (void)data; - (void)port; - (void)effect; - (void)strength; + psp_input_t *psp = (psp_input_t*)data; + if (psp && psp->joypad) + return input_joypad_set_rumble(psp->joypad, + port, effect, strength); return false; } diff --git a/input/drivers_joypad/psp_joypad.c b/input/drivers_joypad/psp_joypad.c index b8e8134533..5c97aa0eb3 100644 --- a/input/drivers_joypad/psp_joypad.c +++ b/input/drivers_joypad/psp_joypad.c @@ -197,6 +197,33 @@ static bool psp_joypad_query_pad(unsigned pad) return pad < PSP_MAX_PADS && pad_state[pad]; } +static bool psp_joypad_rumble(unsigned pad, + enum retro_rumble_effect effect, uint16_t strength) +{ + struct SceCtrlActuator params = { + 0, + 0 + }; + + switch (effect) + { + case RETRO_RUMBLE_WEAK: + if (strength > 1) + strength = 1; + params.unk = strength; + break; + case RETRO_RUMBLE_STRONG: + if (strength > 255) + strength = 255; + params.enable = strength; + break; + } + unsigned p = (pad == 1) ? 2 : pad; + sceCtrlSetActuator(p, ¶ms); + + return true; +} + static void psp_joypad_destroy(void) { @@ -210,7 +237,7 @@ input_device_driver_t psp_joypad = { psp_joypad_get_buttons, psp_joypad_axis, psp_joypad_poll, - NULL, + psp_joypad_rumble, psp_joypad_name, #ifdef VITA "vita",