mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
(PS3) Build fix + implement rumble function callback in ps3 joypad driver
This commit is contained in:
parent
06f84b6f25
commit
6862c70328
@ -220,25 +220,12 @@ static bool ps3_input_set_sensor_state(void *data, unsigned port,
|
||||
static bool ps3_input_set_rumble(void *data, unsigned port,
|
||||
enum retro_rumble_effect effect, uint16_t strength)
|
||||
{
|
||||
CellPadActParam params;
|
||||
ps3_input_t *ps3 = (ps3_input_t*)data;
|
||||
|
||||
switch (effect)
|
||||
{
|
||||
case RETRO_RUMBLE_WEAK:
|
||||
if (strength > 1)
|
||||
strength = 1;
|
||||
params.motor[0] = strength;
|
||||
break;
|
||||
case RETRO_RUMBLE_STRONG:
|
||||
if (strength > 255)
|
||||
strength = 255;
|
||||
params.motor[1] = strength;
|
||||
break;
|
||||
}
|
||||
|
||||
cellPadSetActDirect(port, ¶ms);
|
||||
|
||||
return true;
|
||||
if (ps3 && ps3->joypad)
|
||||
return input_joypad_set_rumble(ps3->joypad,
|
||||
port, effect, strength);
|
||||
return false;
|
||||
}
|
||||
|
||||
static const rarch_joypad_driver_t *ps3_input_get_joypad_driver(void *data)
|
||||
|
@ -64,7 +64,7 @@ static bool ps3_joypad_button(unsigned port_num, uint16_t joykey)
|
||||
|
||||
static int16_t ps3_joypad_axis(unsigned port_num, uint32_t joyaxis)
|
||||
{
|
||||
int val = 0. axis = -1;
|
||||
int val = 0, axis = -1;
|
||||
bool is_neg = false, is_pos = false;
|
||||
|
||||
if (joyaxis == AXIS_NONE || port_num >= MAX_PADS)
|
||||
@ -210,12 +210,36 @@ static bool ps3_joypad_query_pad(unsigned pad)
|
||||
return pad < MAX_PLAYERS && pad_state[pad];
|
||||
}
|
||||
|
||||
static bool ps3_joypad_rumble(unsigned pad,
|
||||
enum retro_rumble_effect effect, uint16_t strength)
|
||||
{
|
||||
CellPadActParam params;
|
||||
|
||||
switch (effect)
|
||||
{
|
||||
case RETRO_RUMBLE_WEAK:
|
||||
if (strength > 1)
|
||||
strength = 1;
|
||||
params.motor[0] = strength;
|
||||
break;
|
||||
case RETRO_RUMBLE_STRONG:
|
||||
if (strength > 255)
|
||||
strength = 255;
|
||||
params.motor[1] = strength;
|
||||
break;
|
||||
}
|
||||
|
||||
cellPadSetActDirect(pad, ¶ms);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ps3_joypad_destroy(void)
|
||||
{
|
||||
cellPadEnd();
|
||||
}
|
||||
|
||||
|
||||
rarch_joypad_driver_t ps3_joypad = {
|
||||
ps3_joypad_init,
|
||||
ps3_joypad_query_pad,
|
||||
@ -223,7 +247,7 @@ rarch_joypad_driver_t ps3_joypad = {
|
||||
ps3_joypad_button,
|
||||
ps3_joypad_axis,
|
||||
ps3_joypad_poll,
|
||||
NULL,
|
||||
ps3_joypad_rumble,
|
||||
ps3_joypad_name,
|
||||
"ps3",
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user