Module: wine Branch: master Commit: 8e069f0bf2d9784b66ae863a9894d765e182787f URL: https://gitlab.winehq.org/wine/wine/-/commit/8e069f0bf2d9784b66ae863a9894d76...
Author: Rémi Bernon rbernon@codeweavers.com Date: Mon Mar 20 16:18:58 2023 +0100
dinput: Only set DIPROP_RANGE in SetActionMap if range isn't empty.
---
dlls/dinput/device.c | 9 ++++++--- dlls/dinput/tests/joystick8.c | 4 ---- 2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index a17df9aa69d..9dd7a3f478f 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -2084,9 +2084,12 @@ static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, D
free( obj_df );
- prop_range.lMin = format->lAxisMin; - prop_range.lMax = format->lAxisMax; - IDirectInputDevice8_SetProperty( iface, DIPROP_RANGE, &prop_range.diph ); + if (format->lAxisMin != format->lAxisMax) + { + prop_range.lMin = format->lAxisMin; + prop_range.lMax = format->lAxisMax; + IDirectInputDevice8_SetProperty( iface, DIPROP_RANGE, &prop_range.diph ); + }
prop_buffer.dwData = format->dwBufferSize; IDirectInputDevice8_SetProperty( iface, DIPROP_BUFFERSIZE, &prop_buffer.diph ); diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index 48e097dcafa..22a83f911bc 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -925,18 +925,14 @@ static void test_action_map( IDirectInputDevice8W *device, HANDLE file, HANDLE e prop_range.diph.dwObj = DIDFT_ABSAXIS | DIDFT_MAKEINSTANCE( 2 ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); - todo_wine ok( prop_range.lMin == +1000, "got lMin %+ld\n", prop_range.lMin ); - todo_wine ok( prop_range.lMax == +51000, "got lMax %+ld\n", prop_range.lMax );
prop_range.diph.dwHow = DIPH_BYUSAGE; prop_range.diph.dwObj = MAKELONG(HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC); hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); ok( hr == DI_OK, "GetProperty returned %#lx\n", hr ); - todo_wine ok( prop_range.lMin == -14000, "got lMin %+ld\n", prop_range.lMin ); - todo_wine ok( prop_range.lMax == -4000, "got lMax %+ld\n", prop_range.lMax );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );