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

dinput: Implement HID joystick DIPROP_AUTOCENTER property.

parent 5eb65418
...@@ -628,6 +628,9 @@ static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, con ...@@ -628,6 +628,9 @@ static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, con
lstrcpynW( value->wszPath, impl->device_path, MAX_PATH ); lstrcpynW( value->wszPath, impl->device_path, MAX_PATH );
return DI_OK; return DI_OK;
} }
case (DWORD_PTR)DIPROP_AUTOCENTER:
if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
return DIERR_UNSUPPORTED;
default: default:
return IDirectInputDevice2WImpl_GetProperty( iface, guid, header ); return IDirectInputDevice2WImpl_GetProperty( iface, guid, header );
} }
...@@ -684,6 +687,7 @@ static HRESULT WINAPI hid_joystick_SetProperty( IDirectInputDevice8W *iface, con ...@@ -684,6 +687,7 @@ static HRESULT WINAPI hid_joystick_SetProperty( IDirectInputDevice8W *iface, con
const DIPROPHEADER *header ) const DIPROPHEADER *header )
{ {
struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface );
HRESULT hr;
TRACE( "iface %p, guid %s, header %p\n", iface, debugstr_guid( guid ), header ); TRACE( "iface %p, guid %s, header %p\n", iface, debugstr_guid( guid ), header );
...@@ -717,6 +721,17 @@ static HRESULT WINAPI hid_joystick_SetProperty( IDirectInputDevice8W *iface, con ...@@ -717,6 +721,17 @@ static HRESULT WINAPI hid_joystick_SetProperty( IDirectInputDevice8W *iface, con
enum_objects( impl, header, DIDFT_AXIS, set_property_prop_saturation, (void *)header ); enum_objects( impl, header, DIDFT_AXIS, set_property_prop_saturation, (void *)header );
return DI_OK; return DI_OK;
} }
case (DWORD_PTR)DIPROP_AUTOCENTER:
{
DIPROPDWORD *value = (DIPROPDWORD *)header;
if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
EnterCriticalSection( &impl->base.crit );
if (impl->base.acquired) hr = DIERR_ACQUIRED;
else if (value->dwData > DIPROPAUTOCENTER_ON) hr = DIERR_INVALIDPARAM;
else hr = DIERR_UNSUPPORTED;
LeaveCriticalSection( &impl->base.crit );
return hr;
}
case (DWORD_PTR)DIPROP_FFLOAD: case (DWORD_PTR)DIPROP_FFLOAD:
case (DWORD_PTR)DIPROP_GRANULARITY: case (DWORD_PTR)DIPROP_GRANULARITY:
case (DWORD_PTR)DIPROP_VIDPID: case (DWORD_PTR)DIPROP_VIDPID:
......
...@@ -3864,7 +3864,6 @@ static void test_simple_joystick(void) ...@@ -3864,7 +3864,6 @@ static void test_simple_joystick(void)
hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATION, &prop_dword.diph ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATION, &prop_dword.diph );
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_GetProperty DIPROP_CALIBRATION returned %#x\n", hr ); ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_GetProperty DIPROP_CALIBRATION returned %#x\n", hr );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
todo_wine
ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_GetProperty DIPROP_AUTOCENTER returned %#x\n", hr ); ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_GetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_GetProperty DIPROP_DEADZONE returned %#x\n", hr ); ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_GetProperty DIPROP_DEADZONE returned %#x\n", hr );
...@@ -4347,7 +4346,6 @@ static void test_simple_joystick(void) ...@@ -4347,7 +4346,6 @@ static void test_simple_joystick(void)
hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );
ok( hr == DIERR_ACQUIRED, "IDirectInputDevice8_SetProperty DIPROP_BUFFERSIZE returned %#x\n", hr ); ok( hr == DIERR_ACQUIRED, "IDirectInputDevice8_SetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
todo_wine
ok( hr == DIERR_ACQUIRED, "IDirectInputDevice8_SetProperty DIPROP_AUTOCENTER returned %#x\n", hr ); ok( hr == DIERR_ACQUIRED, "IDirectInputDevice8_SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
prop_pointer.diph.dwHow = DIPH_BYUSAGE; prop_pointer.diph.dwHow = DIPH_BYUSAGE;
prop_pointer.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC ); prop_pointer.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
...@@ -4460,7 +4458,6 @@ static void test_simple_joystick(void) ...@@ -4460,7 +4458,6 @@ static void test_simple_joystick(void)
ok( hr == DI_OK, "IDirectInputDevice8_SetProperty DIPROP_BUFFERSIZE returned %#x\n", hr ); ok( hr == DI_OK, "IDirectInputDevice8_SetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
prop_dword.dwData = 0xdeadbeef; prop_dword.dwData = 0xdeadbeef;
hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
todo_wine
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SetProperty DIPROP_AUTOCENTER returned %#x\n", hr ); ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
prop_dword.dwData = DIPROPAUTOCENTER_ON; prop_dword.dwData = DIPROPAUTOCENTER_ON;
hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph ); hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
......
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