mirror of
https://github.com/libretro/RetroArch
synced 2025-03-17 10:21:26 +00:00
Merge pull request #11789 from dmrlawson/fix-udev-rumble
Fix udev rumble
This commit is contained in:
commit
6932a49135
@ -386,9 +386,16 @@ static bool udev_set_rumble(unsigned i,
|
||||
{
|
||||
/* Create new or update old playing state. */
|
||||
struct ff_effect e = {0};
|
||||
/* This defines the length of the effect and
|
||||
the delay before playing it. This means there
|
||||
is a limit on the maximum vibration time, but
|
||||
it's hopefully sufficient for most cases. Maybe
|
||||
there's a better way? */
|
||||
struct ff_replay replay = {0xffff, 0};
|
||||
|
||||
e.type = FF_RUMBLE;
|
||||
e.id = old_effect;
|
||||
e.replay = replay;
|
||||
|
||||
switch (effect)
|
||||
{
|
||||
@ -653,7 +660,7 @@ static int16_t udev_joypad_axis_state(
|
||||
int16_t val = pad->axes[AXIS_NEG_GET(joyaxis)];
|
||||
/* Deal with analog triggers that report -32767 to 32767 */
|
||||
if ((
|
||||
(AXIS_NEG_GET(joyaxis) == ABS_Z) ||
|
||||
(AXIS_NEG_GET(joyaxis) == ABS_Z) ||
|
||||
(AXIS_NEG_GET(joyaxis) == ABS_RZ))
|
||||
&& (pad->neg_trigger[AXIS_NEG_GET(joyaxis)]))
|
||||
val = (val + 0x7fff) / 2;
|
||||
@ -665,7 +672,7 @@ static int16_t udev_joypad_axis_state(
|
||||
int16_t val = pad->axes[AXIS_POS_GET(joyaxis)];
|
||||
/* Deal with analog triggers that report -32767 to 32767 */
|
||||
if ((
|
||||
(AXIS_POS_GET(joyaxis) == ABS_Z) ||
|
||||
(AXIS_POS_GET(joyaxis) == ABS_Z) ||
|
||||
(AXIS_POS_GET(joyaxis) == ABS_RZ))
|
||||
&& (pad->neg_trigger[AXIS_POS_GET(joyaxis)]))
|
||||
val = (val + 0x7fff) / 2;
|
||||
@ -704,12 +711,12 @@ static int16_t udev_joypad_state(
|
||||
const uint32_t joyaxis = (binds[i].joyaxis != AXIS_NONE)
|
||||
? binds[i].joyaxis : joypad_info->auto_binds[i].joyaxis;
|
||||
if (
|
||||
(uint16_t)joykey != NO_BTN
|
||||
(uint16_t)joykey != NO_BTN
|
||||
&& udev_joypad_button_state(pad, port_idx, (uint16_t)joykey)
|
||||
)
|
||||
ret |= ( 1 << i);
|
||||
else if (joyaxis != AXIS_NONE &&
|
||||
((float)abs(udev_joypad_axis_state(pad, port_idx, joyaxis))
|
||||
((float)abs(udev_joypad_axis_state(pad, port_idx, joyaxis))
|
||||
/ 0x8000) > joypad_info->axis_threshold)
|
||||
ret |= (1 << i);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user