sdl: disable rumble when rumble power is set to 0
Issue #1766 Issue #1783
This commit is contained in:
parent
9bfd48cf40
commit
9038ef6d8a
|
@ -303,8 +303,12 @@ public:
|
||||||
SDL_JoystickSetPlayerIndex(sdl_joystick, port <= 3 ? port : -1);
|
SDL_JoystickSetPlayerIndex(sdl_joystick, port <= 3 ? port : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 getRumbleIntensity(float power) {
|
u16 getRumbleIntensity(float power)
|
||||||
return (u16)std::min(power * 65535.f / std::pow(1.06f, 100.f - rumblePower), 65535.f);
|
{
|
||||||
|
if (rumblePower == 0)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return (u16)std::min(power * 65535.f / std::pow(1.06f, 100.f - rumblePower), 65535.f);
|
||||||
}
|
}
|
||||||
void doRumble(float power, u32 duration_ms)
|
void doRumble(float power, u32 duration_ms)
|
||||||
{
|
{
|
||||||
|
@ -389,6 +393,7 @@ public:
|
||||||
SDL_HapticStopAll(haptic);
|
SDL_HapticStopAll(haptic);
|
||||||
if (hasAutocenter)
|
if (hasAutocenter)
|
||||||
SDL_HapticSetAutocenter(haptic, 0);
|
SDL_HapticSetAutocenter(haptic, 0);
|
||||||
|
vib_inclination = 0;
|
||||||
}
|
}
|
||||||
if (!hapticRumble)
|
if (!hapticRumble)
|
||||||
rumble(0, 0, 0);
|
rumble(0, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue