[3/4] dinput: On Unacquire, stop all effects and unload them

Vincent Pelletier plr.vincent at gmail.com
Wed Jan 21 16:30:10 CST 2009


The purpose of this patch is the same as
http://www.winehq.org/pipermail/wine-patches/2009-January/067875.html

Patch [4/4] adds a test to show that it's how it happens in Windows.

-- 
Vincent Pelletier
-------------- next part --------------
From 6eeeb3916ef14d42a432c489ba6bfa4a0b67afba Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <plr.vincent at gmail.com>
Date: Wed, 21 Jan 2009 23:01:42 +0100
Subject: On Unacquire, stop all effects and unload them.
 Remove todo_wine from corresponding test.

---
 dlls/dinput/joystick_linuxinput.c |   12 ++++++++++++
 dlls/dinput/tests/joystick.c      |    2 +-
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index be5dccf..da2d0bc 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -678,6 +678,18 @@ static HRESULT WINAPI JoystickAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
     TRACE("(this=%p)\n",This);
     res = IDirectInputDevice2AImpl_Unacquire(iface);
     if (res==DI_OK && This->joyfd!=-1) {
+      effect_list_item *itr;
+
+      /* For each known effect:
+       * - stop it
+       * - unload it
+       * But, unlike DISFFC_RESET, do not release the effect.
+       */
+      LIST_FOR_EACH_ENTRY(itr, &This->ff_effects, effect_list_item, entry) {
+          IDirectInputEffect_Stop(itr->ref);
+          IDirectInputEffect_Unload(itr->ref);
+      }
+
       close(This->joyfd);
       This->joyfd = -1;
     }
diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c
index 0d5a34b..286c168 100644
--- a/dlls/dinput/tests/joystick.c
+++ b/dlls/dinput/tests/joystick.c
@@ -387,7 +387,7 @@ static BOOL CALLBACK EnumJoysticks(
                 hr = IDirectInputDevice_Acquire(pJoystick);
                 ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr);
                 hr = IDirectInputEffect_SetParameters(effect, &eff, DIEP_GAIN);
-                todo_wine ok(hr==DI_OK,"IDirectInputEffect_SetParameters failed: %08x\n", hr);
+                ok(hr==DI_OK,"IDirectInputEffect_SetParameters failed: %08x\n", hr);
             }
             ref = IUnknown_Release(effect);
             ok(ref == 0, "IDirectInputDevice_Release() reference count = %d\n", ref);
-- 
1.5.6.5



More information about the wine-patches mailing list