Rémi Bernon : winebus.sys: Only use SDL_JoystickRumble as a fallback.

Alexandre Julliard julliard at winehq.org
Mon Oct 18 16:16:30 CDT 2021


Module: wine
Branch: master
Commit: 2369cdc180e59fac82569e5e087cf490860bfd02
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2369cdc180e59fac82569e5e087cf490860bfd02

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon Oct 18 17:16:44 2021 +0200

winebus.sys: Only use SDL_JoystickRumble as a fallback.

If nothing else is supported, and pass the duration_ms parameter too.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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

diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c
index 16e7a2f6f30..f1c20692b29 100644
--- a/dlls/winebus.sys/bus_sdl.c
+++ b/dlls/winebus.sys/bus_sdl.c
@@ -192,7 +192,8 @@ static BOOL descriptor_add_haptic(struct sdl_device *impl)
         pSDL_HapticRumbleInit(impl->sdl_haptic);
     }
 
-    if (pSDL_JoystickRumble && !pSDL_JoystickRumble(impl->sdl_joystick, 0, 0, 0))
+    if (!(impl->effect_support & EFFECT_SUPPORT_HAPTICS) && pSDL_JoystickRumble &&
+        !pSDL_JoystickRumble(impl->sdl_joystick, 0, 0, 0))
         impl->effect_support |= WINE_SDL_JOYSTICK_RUMBLE;
 
     if (impl->effect_support & EFFECT_SUPPORT_HAPTICS)
@@ -394,9 +395,10 @@ NTSTATUS sdl_device_haptics_start(struct unix_device *iface, DWORD duration_ms,
     effect.leftright.large_magnitude = rumble_intensity;
     effect.leftright.small_magnitude = buzz_intensity;
 
-    if (impl->sdl_haptic) pSDL_HapticStopAll(impl->sdl_haptic);
     if (impl->effect_support & WINE_SDL_JOYSTICK_RUMBLE)
         pSDL_JoystickRumble(impl->sdl_joystick, 0, 0, 0);
+    else if (impl->sdl_haptic)
+        pSDL_HapticStopAll(impl->sdl_haptic);
     if (!effect.leftright.large_magnitude && !effect.leftright.small_magnitude)
         return STATUS_SUCCESS;
 
@@ -416,7 +418,7 @@ NTSTATUS sdl_device_haptics_start(struct unix_device *iface, DWORD duration_ms,
     else if (impl->effect_support & WINE_SDL_JOYSTICK_RUMBLE)
     {
         pSDL_JoystickRumble(impl->sdl_joystick, effect.leftright.large_magnitude,
-                            effect.leftright.small_magnitude, -1);
+                            effect.leftright.small_magnitude, duration_ms);
     }
 
     return STATUS_SUCCESS;




More information about the wine-cvs mailing list