Vitaliy Margolen : dinput: Default value for unassigned POVs should be -1.

Alexandre Julliard julliard at winehq.org
Fri May 9 06:26:53 CDT 2008


Module: wine
Branch: master
Commit: 382ed33b7a770d532bcf4b7dc392ee929c987c7a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=382ed33b7a770d532bcf4b7dc392ee929c987c7a

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Thu May  8 08:11:19 2008 -0600

dinput: Default value for unassigned POVs should be -1.

---

 dlls/dinput/device.c         |    7 +++++--
 dlls/dinput/tests/joystick.c |    7 +++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 1a5e25f..2c4cc6d 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -452,9 +452,12 @@ HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *format)
 		dt[index].size = sizeof(DWORD);
 	    dt[index].offset_in  = -1;
 	    dt[index].offset_out = asked_format->rgodf[j].dwOfs;
-	    dt[index].value = 0;
+            if (asked_format->rgodf[j].dwType & DIDFT_POV)
+                dt[index].value = -1;
+            else
+                dt[index].value = 0;
 	    index++;
-	    
+
 	    same = 0;
 	}
     }
diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c
index d8c05f0..4727a5a 100644
--- a/dlls/dinput/tests/joystick.c
+++ b/dlls/dinput/tests/joystick.c
@@ -324,6 +324,13 @@ static BOOL CALLBACK EnumJoysticks(
     ok(hr == S_FALSE, "IDirectInputDevice_Acquire() should have returned S_FALSE, got: %s\n",
        DXGetErrorString8(hr));
 
+    if (info.pov < 4)
+    {
+        hr = IDirectInputDevice_GetDeviceState(pJoystick, sizeof(DIJOYSTATE2), &js);
+        ok(hr == DI_OK, "IDirectInputDevice_GetDeviceState() failed: %s\n", DXGetErrorString8(hr));
+        ok(js.rgdwPOV[3] == -1, "Default for unassigned POV should be -1 not: %d\n", js.rgdwPOV[3]);
+    }
+
     if (winetest_interactive) {
         trace("You have 30 seconds to test all axes, sliders, POVs and buttons\n");
         count = 300;




More information about the wine-cvs mailing list