[PATCH v2 1/5] winebus.sys: Only call SDL_HapticRumbleInit if supported, as a fallback.

Rémi Bernon rbernon at codeweavers.com
Mon Feb 14 10:26:16 CST 2022


The SDL_HAPTIC_LEFTRIGHT effect should be preferred when available.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

v2: Avoid passing possibly NULL impl->sdl_haptic as a parameter.

 dlls/winebus.sys/bus_sdl.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c
index eba8a959cb4..d036ec2b98e 100644
--- a/dlls/winebus.sys/bus_sdl.c
+++ b/dlls/winebus.sys/bus_sdl.c
@@ -187,11 +187,10 @@ static BOOL descriptor_add_haptic(struct sdl_device *impl)
     else
     {
         impl->effect_support = pSDL_HapticQuery(impl->sdl_haptic);
-        if (pSDL_HapticRumbleSupported(impl->sdl_haptic))
+        if (!(impl->effect_support & EFFECT_SUPPORT_HAPTICS) &&
+            pSDL_HapticRumbleSupported(impl->sdl_haptic) &&
+            pSDL_HapticRumbleInit(impl->sdl_haptic) == 0)
             impl->effect_support |= WINE_SDL_HAPTIC_RUMBLE;
-
-        pSDL_HapticStopAll(impl->sdl_haptic);
-        pSDL_HapticRumbleInit(impl->sdl_haptic);
     }
 
     if (!(impl->effect_support & EFFECT_SUPPORT_HAPTICS) && pSDL_JoystickRumble &&
-- 
2.34.1




More information about the wine-devel mailing list