Commit d0070935 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

dinput: Fix infinite effect length handling.

Based on ideas by Elias Vanderstuyft. Signed-off-by: 's avatarBruno Jesus <00cpxxx@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 7d88a12d
...@@ -302,8 +302,12 @@ static HRESULT WINAPI LinuxInputEffectImpl_GetParameters( ...@@ -302,8 +302,12 @@ static HRESULT WINAPI LinuxInputEffectImpl_GetParameters(
} }
} }
if (dwFlags & DIEP_DURATION) { if (dwFlags & DIEP_DURATION)
peff->dwDuration = (DWORD)This->effect.replay.length * 1000; {
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) { if (dwFlags & DIEP_ENVELOPE) {
...@@ -535,7 +539,14 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters( ...@@ -535,7 +539,14 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
} }
if (dwFlags & DIEP_DURATION) 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) { if (dwFlags & DIEP_ENVELOPE) {
struct ff_envelope* env; struct ff_envelope* env;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment