Bruno Jesus : dinput: Fix infinite effect length handling.

Alexandre Julliard julliard at winehq.org
Thu Aug 25 10:39:36 CDT 2016


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

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Wed Aug 24 22:55:57 2016 -0300

dinput: Fix infinite effect length handling.

Based on ideas by Elias Vanderstuyft.

Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput/effect_linuxinput.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c
index 0d2fdf5..1b60d47 100644
--- a/dlls/dinput/effect_linuxinput.c
+++ b/dlls/dinput/effect_linuxinput.c
@@ -302,8 +302,12 @@ static HRESULT WINAPI LinuxInputEffectImpl_GetParameters(
 	}
     }
 
-    if (dwFlags & DIEP_DURATION) {
-	peff->dwDuration = (DWORD)This->effect.replay.length * 1000;
+    if (dwFlags & DIEP_DURATION)
+    {
+        if (!This->effect.replay.length) /* infinite for the linux driver */
+            peff->dwDuration = INFINITE;
+        else
+            peff->dwDuration = (DWORD)This->effect.replay.length * 1000;
     }
 
     if (dwFlags & DIEP_ENVELOPE) {
@@ -535,7 +539,14 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
     }
 
     if (dwFlags & DIEP_DURATION)
-	This->effect.replay.length = peff->dwDuration / 1000;
+    {
+        if (peff->dwDuration == INFINITE)
+            This->effect.replay.length = 0; /* infinite for the linux driver */
+        else if(peff->dwDuration > 1000)
+            This->effect.replay.length = peff->dwDuration / 1000;
+        else
+            This->effect.replay.length = 1;
+    }
 
     if (dwFlags & DIEP_ENVELOPE) {
         struct ff_envelope* env;




More information about the wine-cvs mailing list