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

This commit is contained in:
Lucas Fialho Zawacki 2011-07-21 15:37:15 -03:00 committed by Alexandre Julliard
parent 79bd7249e4
commit 8cc44cb8c3
2 changed files with 23 additions and 0 deletions

View File

@ -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);

View File

@ -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);