[PATCH 2/4] dinput: Fix infinite effect length handling
Bruno Jesus
00cpxxx at gmail.com
Wed Aug 24 20:55:57 CDT 2016
Based on ideas by Elias Vanderstuyft.
Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
---
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;
--
2.9.3
More information about the wine-patches
mailing list