From: Tim Clem tclem@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53627 --- dlls/dinput/device.c | 3 ++- dlls/dinput/mouse.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index b85d97d1b95..d0a5fd0ea1c 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1063,7 +1063,8 @@ static HRESULT check_property( struct dinput_device *impl, const GUID *guid, con case (DWORD_PTR)DIPROP_DEADZONE: case (DWORD_PTR)DIPROP_SATURATION: case (DWORD_PTR)DIPROP_CALIBRATIONMODE: - if (!impl->object_properties) return DIERR_UNSUPPORTED; + /* not supported on the mouse or keyboard */ + if (!(impl->caps.dwDevType & DIDEVTYPE_HID)) return DIERR_UNSUPPORTED; break;
case (DWORD_PTR)DIPROP_FFLOAD: diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 1572e73bac2..d855172d3b0 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -91,6 +91,17 @@ HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, return DI_OK; }
+static BOOL init_object_properties( const DIDEVICEOBJECTINSTANCEW *instance, void *data ) +{ + struct mouse *impl = (struct mouse *)data; + struct object_properties *properties = impl->base.object_properties + instance->dwOfs / sizeof(LONG); + + properties->range_min = DIPROPRANGE_NOMIN; + properties->range_max = DIPROPRANGE_NOMAX; + + return DIENUM_CONTINUE; +} + HRESULT mouse_create_device( struct dinput *dinput, const GUID *guid, IDirectInputDevice8W **out ) { struct mouse *impl; @@ -112,6 +123,15 @@ HRESULT mouse_create_device( struct dinput *dinput, const GUID *guid, IDirectInp impl->base.caps.dwHardwareRevision = 100; impl->base.dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
+ /* One object_properties per axis */ + impl->base.object_properties = calloc( 3, sizeof(struct object_properties) ); + if (!impl->base.object_properties) + { + IDirectInputDevice_Release( &impl->base.IDirectInputDevice8W_iface ); + return E_OUTOFMEMORY; + } + IDirectInputDevice8_EnumObjects( &impl->base.IDirectInputDevice8W_iface, init_object_properties, impl, DIDFT_RELAXIS ); + get_app_key(&hkey, &appkey); if (!get_config_key( hkey, appkey, L"MouseWarpOverride", buffer, sizeof(buffer) )) {