Signed-off-by: Ivo Ivanov logos128@gmail.com Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 16 +++++++++++++--- dlls/dinput/device_private.h | 2 ++ dlls/dinput8/tests/hid.c | 6 +++++- 3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index c58ffc7ac73..8d65d051a3b 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -974,9 +974,13 @@ static HRESULT WINAPI dinput_device_GetProperty( IDirectInputDevice8W *iface, co return impl->vtbl->get_property( iface, LOWORD( guid ), header, &instance );
case (DWORD_PTR)DIPROP_AUTOCENTER: + { + DIPROPDWORD *value = (DIPROPDWORD *)header; if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; - return DIERR_UNSUPPORTED; - + if (!(impl->caps.dwFlags & DIDC_FORCEFEEDBACK)) return DIERR_UNSUPPORTED; + value->dwData = impl->autocenter; + return DI_OK; + } case (DWORD_PTR)DIPROP_BUFFERSIZE: { DIPROPDWORD *value = (DIPROPDWORD *)header; @@ -1076,11 +1080,17 @@ static HRESULT WINAPI dinput_device_SetProperty( IDirectInputDevice8W *iface, co { const DIPROPDWORD *value = (const DIPROPDWORD *)header; if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; + if (header->dwHow != DIPH_DEVICE) return DIERR_UNSUPPORTED; EnterCriticalSection( &impl->crit ); if (impl->acquired) hr = DIERR_ACQUIRED; else if (value->dwData > DIPROPAUTOCENTER_ON) hr = DIERR_INVALIDPARAM; else if (!(impl->caps.dwFlags & DIDC_FORCEFEEDBACK)) hr = DIERR_UNSUPPORTED; - else hr = DI_OK; + else + { + FIXME( "DIPROP_AUTOCENTER stub!\n" ); + impl->autocenter = value->dwData; + hr = DI_OK; + } LeaveCriticalSection( &impl->crit ); return hr; } diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index e77d0190a48..02befc6e869 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -96,6 +96,8 @@ struct dinput_device
BYTE device_state_report_id; BYTE device_state[DEVICE_STATE_MAX_SIZE]; + + BOOL autocenter; };
extern HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, const GUID *guid, diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index a460357af0c..d553fa92ef7 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -7616,9 +7616,13 @@ static void test_force_feedback_joystick( DWORD version ) hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE ); ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr );
+ prop_dword.diph.dwHow = DIPH_BYUSAGE; + prop_dword.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC ); + prop_dword.dwData = DIPROPAUTOCENTER_ON; + hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph ); + ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_AUTOCENTER returned %#x\n", hr ); prop_dword.diph.dwHow = DIPH_DEVICE; prop_dword.diph.dwObj = 0; - prop_dword.dwData = DIPROPAUTOCENTER_ON; hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph ); ok( hr == DI_OK, "SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );