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

Marcel Hasler mahasler at gmail.com
Sat Jan 28 18:56:02 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 patch 83233. It does the same thing but adds a
comment and should be easier to understand.
-------------- next part --------------
From 8af912ffeef59afcec734a611c18c06df1f94b42 Mon Sep 17 00:00:00 2001
From: Marcel Hasler <mahasler at gmail.com>
Date: Sun, 29 Jan 2012 01:04:54 +0100
Subject: dinput: Support INFINITE as number of effect iterations

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

diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c
index c224bd8..1576cf9 100644
--- a/dlls/dinput/effect_linuxinput.c
+++ b/dlls/dinput/effect_linuxinput.c
@@ -518,7 +518,14 @@ static HRESULT WINAPI LinuxInputEffectImpl_Start(
 
     event.type = EV_FF;
     event.code = This->effect.id;
-    event.value = dwIterations;
+
+    /* Linux doesn't accept INFINITE, use the largest signed value instead */
+    if (dwIterations == INFINITE) {
+        event.value = 0x7fff;
+    } else {
+        event.value = 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