mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
(VITA) Add vibration for PSTV
This commit is contained in:
parent
7f0624ff32
commit
e3b5fdd815
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user