Lucas Fialho Zawacki : dinput: SetActionMap setting the axis range according to the action format.

Alexandre Julliard julliard at winehq.org
Fri Jul 22 10:15:58 CDT 2011


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

Author: Lucas Fialho Zawacki <lfzawacki at gmail.com>
Date:   Thu Jul 21 15:37:15 2011 -0300

dinput: SetActionMap setting the axis range according to the action format.

---

 dlls/dinput/device.c        |    8 ++++++++
 dlls/dinput8/tests/device.c |   15 +++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 2bd5d6c..58d4e14 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -1483,9 +1483,17 @@ HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap(LPDIRECTINPUTDEVICE8W iface
 						     DWORD dwFlags)
 {
     DIPROPDWORD dp;
+    DIPROPRANGE dpr;
 
     FIXME("(%p)->(%p,%s,%08x): semi-stub !\n", iface, lpdiaf, debugstr_w(lpszUserName), dwFlags);
 
+    dpr.diph.dwSize = sizeof(DIPROPRANGE);
+    dpr.lMin = lpdiaf->lAxisMin;
+    dpr.lMax = lpdiaf->lAxisMax;
+    dpr.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+    dpr.diph.dwHow = DIPH_DEVICE;
+    IDirectInputDevice8_SetProperty(iface, DIPROP_RANGE, &dpr.diph);
+
     if (lpdiaf->dwBufferSize > 0)
     {
         dp.diph.dwSize = sizeof(DIPROPDWORD);
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
index cedad80..31e2e3f 100644
--- a/dlls/dinput8/tests/device.c
+++ b/dlls/dinput8/tests/device.c
@@ -132,6 +132,7 @@ static BOOL CALLBACK enumeration_callback(
 {
     HRESULT hr;
     DIPROPDWORD dp;
+    DIPROPRANGE dpr;
     struct enum_data *data = pvRef;
     if (!data) return DIENUM_CONTINUE;
 
@@ -179,6 +180,20 @@ static BOOL CALLBACK enumeration_callback(
     ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
     ok (dp.dwData == data->lpdiaf->dwBufferSize, "SetActionMap must set the buffer, buffersize=%d\n", dp.dwData);
 
+    /* Test axis range */
+    memset(&dpr, 0, sizeof(dpr));
+    dpr.diph.dwSize = sizeof(dpr);
+    dpr.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+    dpr.diph.dwHow  = DIPH_DEVICE;
+
+    hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_RANGE, &dpr.diph);
+    /* Only test if device supports the range property */
+    if (SUCCEEDED(hr))
+    {
+        ok (dpr.lMin == data->lpdiaf->lAxisMin, "SetActionMap must set the min axis range expected=%d got=%d\n", data->lpdiaf->lAxisMin, dpr.lMin);
+        ok (dpr.lMax == data->lpdiaf->lAxisMax, "SetActionMap must set the max axis range expected=%d got=%d\n", data->lpdiaf->lAxisMax, dpr.lMax);
+    }
+
     /* SetActionMap has set the data format so now it should work */
     hr = IDirectInputDevice8_Acquire(lpdid);
     ok (SUCCEEDED(hr), "Acquire failed hr=%08x\n", hr);




More information about the wine-cvs mailing list