(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,
|
static bool ps3_input_set_rumble(void *data, unsigned port,
|
||||||
enum retro_rumble_effect effect, uint16_t strength)
|
enum retro_rumble_effect effect, uint16_t strength)
|
||||||
{
|
{
|
||||||
CellPadActParam params;
|
ps3_input_t *ps3 = (ps3_input_t*)data;
|
||||||
|
|
||||||
switch (effect)
|
if (ps3 && ps3->joypad)
|
||||||
{
|
return input_joypad_set_rumble(ps3->joypad,
|
||||||
case RETRO_RUMBLE_WEAK:
|
port, effect, strength);
|
||||||
if (strength > 1)
|
return false;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const rarch_joypad_driver_t *ps3_input_get_joypad_driver(void *data)
|
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)
|
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;
|
bool is_neg = false, is_pos = false;
|
||||||
|
|
||||||
if (joyaxis == AXIS_NONE || port_num >= MAX_PADS)
|
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];
|
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)
|
static void ps3_joypad_destroy(void)
|
||||||
{
|
{
|
||||||
cellPadEnd();
|
cellPadEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rarch_joypad_driver_t ps3_joypad = {
|
rarch_joypad_driver_t ps3_joypad = {
|
||||||
ps3_joypad_init,
|
ps3_joypad_init,
|
||||||
ps3_joypad_query_pad,
|
ps3_joypad_query_pad,
|
||||||
|
@ -223,7 +247,7 @@ rarch_joypad_driver_t ps3_joypad = {
|
||||||
ps3_joypad_button,
|
ps3_joypad_button,
|
||||||
ps3_joypad_axis,
|
ps3_joypad_axis,
|
||||||
ps3_joypad_poll,
|
ps3_joypad_poll,
|
||||||
NULL,
|
ps3_joypad_rumble,
|
||||||
ps3_joypad_name,
|
ps3_joypad_name,
|
||||||
"ps3",
|
"ps3",
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue