dinput: Implement HID joystick DIPROP_AUTOCENTER property.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-09-28 09:30:14 +02:00 committed by Alexandre Julliard
parent 5eb65418eb
commit 5732347cbe
2 changed files with 15 additions and 3 deletions

View File

@ -628,6 +628,9 @@ static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, con
lstrcpynW( value->wszPath, impl->device_path, MAX_PATH );
return DI_OK;
}
case (DWORD_PTR)DIPROP_AUTOCENTER:
if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM;
return DIERR_UNSUPPORTED;
default:
return IDirectInputDevice2WImpl_GetProperty( iface, guid, header );
}
@ -684,6 +687,7 @@ static HRESULT WINAPI hid_joystick_SetProperty( IDirectInputDevice8W *iface, con
const DIPROPHEADER *header )
{
struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface );
HRESULT hr;
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
enum_objects( impl, header, DIDFT_AXIS, set_property_prop_saturation, (void *)header );
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_GRANULARITY:
case (DWORD_PTR)DIPROP_VIDPID:

View File

@ -3864,7 +3864,6 @@ static void test_simple_joystick(void)
hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATION, &prop_dword.diph );
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_GetProperty DIPROP_CALIBRATION returned %#x\n", hr );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
todo_wine
ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_GetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
ok( hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_GetProperty DIPROP_DEADZONE returned %#x\n", hr );
@ -4347,7 +4346,6 @@ static void test_simple_joystick(void)
hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );
ok( hr == DIERR_ACQUIRED, "IDirectInputDevice8_SetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
todo_wine
ok( hr == DIERR_ACQUIRED, "IDirectInputDevice8_SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
prop_pointer.diph.dwHow = DIPH_BYUSAGE;
prop_pointer.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
@ -4460,7 +4458,6 @@ static void test_simple_joystick(void)
ok( hr == DI_OK, "IDirectInputDevice8_SetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
prop_dword.dwData = 0xdeadbeef;
hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
todo_wine
ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
prop_dword.dwData = DIPROPAUTOCENTER_ON;
hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );