Commit e6eb909d authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Stub support for DIPROP_AUTOCENTER property.

parent 23194bb0
...@@ -974,9 +974,13 @@ static HRESULT WINAPI dinput_device_GetProperty( IDirectInputDevice8W *iface, co ...@@ -974,9 +974,13 @@ static HRESULT WINAPI dinput_device_GetProperty( IDirectInputDevice8W *iface, co
return impl->vtbl->get_property( iface, LOWORD( guid ), header, &instance ); return impl->vtbl->get_property( iface, LOWORD( guid ), header, &instance );
case (DWORD_PTR)DIPROP_AUTOCENTER: case (DWORD_PTR)DIPROP_AUTOCENTER:
{
DIPROPDWORD *value = (DIPROPDWORD *)header;
if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; 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: case (DWORD_PTR)DIPROP_BUFFERSIZE:
{ {
DIPROPDWORD *value = (DIPROPDWORD *)header; DIPROPDWORD *value = (DIPROPDWORD *)header;
...@@ -1076,11 +1080,17 @@ static HRESULT WINAPI dinput_device_SetProperty( IDirectInputDevice8W *iface, co ...@@ -1076,11 +1080,17 @@ static HRESULT WINAPI dinput_device_SetProperty( IDirectInputDevice8W *iface, co
{ {
const DIPROPDWORD *value = (const DIPROPDWORD *)header; const DIPROPDWORD *value = (const DIPROPDWORD *)header;
if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
if (header->dwHow != DIPH_DEVICE) return DIERR_UNSUPPORTED;
EnterCriticalSection( &impl->crit ); EnterCriticalSection( &impl->crit );
if (impl->acquired) hr = DIERR_ACQUIRED; if (impl->acquired) hr = DIERR_ACQUIRED;
else if (value->dwData > DIPROPAUTOCENTER_ON) hr = DIERR_INVALIDPARAM; else if (value->dwData > DIPROPAUTOCENTER_ON) hr = DIERR_INVALIDPARAM;
else if (!(impl->caps.dwFlags & DIDC_FORCEFEEDBACK)) hr = DIERR_UNSUPPORTED; 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 ); LeaveCriticalSection( &impl->crit );
return hr; return hr;
} }
......
...@@ -96,6 +96,8 @@ struct dinput_device ...@@ -96,6 +96,8 @@ struct dinput_device
BYTE device_state_report_id; BYTE device_state_report_id;
BYTE device_state[DEVICE_STATE_MAX_SIZE]; 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, extern HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, const GUID *guid,
......
...@@ -7616,9 +7616,13 @@ static void test_force_feedback_joystick( DWORD version ) ...@@ -7616,9 +7616,13 @@ static void test_force_feedback_joystick( DWORD version )
hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE ); hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE );
ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr ); 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.dwHow = DIPH_DEVICE;
prop_dword.diph.dwObj = 0; prop_dword.diph.dwObj = 0;
prop_dword.dwData = DIPROPAUTOCENTER_ON;
hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
ok( hr == DI_OK, "SetProperty DIPROP_AUTOCENTER returned %#x\n", hr ); ok( hr == DI_OK, "SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment