dinput: Support INFINITE as number of effect iterations (try 3)

Marcel Hasler mahasler at gmail.com
Wed Feb 1 12:12:17 CST 2012


According to the DirectX reference, IDirectInputEffect::Start accepts
INFINITE (aka -1) for the number of iterations. However, passing -1 to
Linux via input_event results in no effect being played at all. This
patch sets the number of iterations to the maximum signed value
allowed if INFINITE is passed.

This fixes bug 29712.

This patch supersedes patches 83233 and 83301.
-------------- next part --------------
From 5e975219c78d616591afe771034c207e91a9cce6 Mon Sep 17 00:00:00 2001
From: Marcel Hasler <mahasler at gmail.com>
Date: Tue, 31 Jan 2012 00:36:56 +0100
Subject: dinput: Support INFINITE as number of effect iterations

---
 dlls/dinput/effect_linuxinput.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c
index c224bd8..1ca9df8 100644
--- a/dlls/dinput/effect_linuxinput.c
+++ b/dlls/dinput/effect_linuxinput.c
@@ -518,7 +518,10 @@ static HRESULT WINAPI LinuxInputEffectImpl_Start(
 
     event.type = EV_FF;
     event.code = This->effect.id;
-    event.value = dwIterations;
+
+    /* Linux doesn't accept INFINITE, use the maximum __s32 value instead */
+    event.value = (dwIterations == INFINITE) ? 0x7fffffff : dwIterations;
+
     if (write(*(This->fd), &event, sizeof(event)) == -1) {
 	FIXME("Unable to write event.  Assuming device disconnected.\n");
 	return DIERR_INPUTLOST;
-- 
1.7.8.4


More information about the wine-patches mailing list