Module: wine Branch: master Commit: b8b03b54b79fcc45fb0662aea30033cfb4d04cde URL: http://source.winehq.org/git/wine.git/?a=commit;h=b8b03b54b79fcc45fb0662aea3...
Author: Vitaliy Margolen wine-patches@kievinfo.com Date: Fri Feb 2 00:47:19 2007 -0700
dinput: Initialize user limits with the default 0..65535 range. Add tests.
---
dlls/dinput/joystick_linuxinput.c | 6 ++++-- dlls/dinput/tests/joystick.c | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 0011398..12fcf6d 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -387,8 +387,10 @@ static JoystickImpl *alloc_device(REFGUI
memcpy(&df->rgodf[idx], &c_dfDIJoystick2.rgodf[i], df->dwObjSize); newDevice->axes[i] = idx; - newDevice->props[idx].wantmin = newDevice->props[idx].havemin = newDevice->joydev->axes[i][AXIS_ABSMIN]; - newDevice->props[idx].wantmax = newDevice->props[idx].havemax = newDevice->joydev->axes[i][AXIS_ABSMAX]; + newDevice->props[idx].havemin = newDevice->joydev->axes[i][AXIS_ABSMIN]; + newDevice->props[idx].havemax = newDevice->joydev->axes[i][AXIS_ABSMAX]; + newDevice->props[idx].wantmin = 0; + newDevice->props[idx].wantmax = 0xffff; newDevice->props[idx].deadzone = 0; df->rgodf[idx++].dwType = DIDFT_MAKEINSTANCE(newDevice->numAxes++) | DIDFT_ABSAXIS; } diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c index df12529..05be5d6 100644 --- a/dlls/dinput/tests/joystick.c +++ b/dlls/dinput/tests/joystick.c @@ -81,6 +81,7 @@ typedef struct tagJoystickInfo DWORD axis; DWORD pov; DWORD button; + LONG lMin, lMax; } JoystickInfo;
static BOOL CALLBACK EnumAxes( @@ -102,8 +103,14 @@ static BOOL CALLBACK EnumAxes( diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER); diprg.diph.dwHow = DIPH_BYID; diprg.diph.dwObj = pdidoi->dwType; - diprg.lMin = -1000; - diprg.lMax = +1000; + + hr = IDirectInputDevice_GetProperty(info->pJoystick, DIPROP_RANGE, &diprg.diph); + ok(SUCCEEDED(hr), "IDirectInputDevice_GetProperty() failed: %s\n", DXGetErrorString8(hr)); + ok(info->lMin == diprg.lMin && info->lMax == diprg.lMax, "Min/Max range invalid: " + "expected %d..%d got %d..%d\n", info->lMin, info->lMax, diprg.lMin, diprg.lMax); + + diprg.lMin = -2000; + diprg.lMax = +2000;
hr = IDirectInputDevice_SetProperty(info->pJoystick, DIPROP_RANGE, NULL); ok(hr==E_INVALIDARG,"IDirectInputDevice_SetProperty() should have returned " @@ -239,6 +246,9 @@ static BOOL CALLBACK EnumJoysticks( ZeroMemory(&info, sizeof(info)); info.pJoystick = pJoystick;
+ /* default min/max limits */ + info.lMin = 0; + info.lMax = 0xffff; /* enumerate objects */ hr = IDirectInputDevice_EnumObjects(pJoystick, EnumAxes, (VOID*)&info, DIDFT_ALL); ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %s\n",