sdl: disable rumble when rumble power is set to 0

Issue #1766
Issue #1783
This commit is contained in:
Flyinghead 2024-12-26 16:31:23 +01:00 committed by flyinghead
parent 0606f3e63e
commit a3902fc278
1 changed files with 7 additions and 2 deletions

View File

@ -303,8 +303,12 @@ public:
SDL_JoystickSetPlayerIndex(sdl_joystick, port <= 3 ? port : -1);
}
u16 getRumbleIntensity(float power) {
return (u16)std::min(power * 65535.f / std::pow(1.06f, 100.f - rumblePower), 65535.f);
u16 getRumbleIntensity(float power)
{
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)
{
@ -389,6 +393,7 @@ public:
SDL_HapticStopAll(haptic);
if (hasAutocenter)
SDL_HapticSetAutocenter(haptic, 0);
vib_inclination = 0;
}
if (!hapticRumble)
rumble(0, 0, 0);