Ivo Ivanov : winebus.sys: Use SDL_HAPTIC_INFINITY for the infinity durations in the SDL backend.

Alexandre Julliard julliard at winehq.org
Thu Dec 9 15:34:29 CST 2021


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

Author: Ivo Ivanov <logos128 at gmail.com>
Date:   Thu Dec  9 14:44:12 2021 +0100

winebus.sys: Use SDL_HAPTIC_INFINITY for the infinity durations in the SDL backend.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51922
Signed-off-by: Ivo Ivanov <logos128 at gmail.com>
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 | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c
index 76d90ab7912..37d75d0bc95 100644
--- a/dlls/winebus.sys/bus_sdl.c
+++ b/dlls/winebus.sys/bus_sdl.c
@@ -515,7 +515,7 @@ static NTSTATUS sdl_device_physical_effect_control(struct unix_device *iface, BY
         pSDL_HapticStopAll(impl->sdl_haptic);
         /* fallthrough */
     case PID_USAGE_OP_EFFECT_START:
-        pSDL_HapticRunEffect(impl->sdl_haptic, id, iterations);
+        pSDL_HapticRunEffect(impl->sdl_haptic, id, (iterations == 0xff ? SDL_HAPTIC_INFINITY : iterations));
         break;
     case PID_USAGE_OP_EFFECT_STOP:
         pSDL_HapticStopEffect(impl->sdl_haptic, id);
@@ -592,7 +592,7 @@ static NTSTATUS sdl_device_physical_effect_update(struct unix_device *iface, BYT
     case PID_USAGE_ET_TRIANGLE:
     case PID_USAGE_ET_SAWTOOTH_UP:
     case PID_USAGE_ET_SAWTOOTH_DOWN:
-        effect.periodic.length = params->duration;
+        effect.periodic.length = (params->duration == 0xffff ? SDL_HAPTIC_INFINITY : params->duration);
         effect.periodic.delay = params->start_delay;
         effect.periodic.button = params->trigger_button;
         effect.periodic.interval = params->trigger_repeat_interval;
@@ -613,7 +613,7 @@ static NTSTATUS sdl_device_physical_effect_update(struct unix_device *iface, BYT
     case PID_USAGE_ET_DAMPER:
     case PID_USAGE_ET_INERTIA:
     case PID_USAGE_ET_FRICTION:
-        effect.condition.length = params->duration;
+        effect.condition.length = (params->duration == 0xffff ? SDL_HAPTIC_INFINITY : params->duration);
         effect.condition.delay = params->start_delay;
         effect.condition.button = params->trigger_button;
         effect.condition.interval = params->trigger_repeat_interval;
@@ -641,7 +641,7 @@ static NTSTATUS sdl_device_physical_effect_update(struct unix_device *iface, BYT
         break;
 
     case PID_USAGE_ET_CONSTANT_FORCE:
-        effect.constant.length = params->duration;
+        effect.constant.length = (params->duration == 0xffff ? SDL_HAPTIC_INFINITY : params->duration);
         effect.constant.delay = params->start_delay;
         effect.constant.button = params->trigger_button;
         effect.constant.interval = params->trigger_repeat_interval;
@@ -655,6 +655,8 @@ static NTSTATUS sdl_device_physical_effect_update(struct unix_device *iface, BYT
         effect.constant.fade_level = params->envelope.fade_level;
         break;
 
+    /* According to the SDL documentation, ramp effect doesn't
+     * support SDL_HAPTIC_INFINITY. */
     case PID_USAGE_ET_RAMP:
         effect.ramp.length = params->duration;
         effect.ramp.delay = params->start_delay;




More information about the wine-cvs mailing list