dinput: Stub support for the DIPROP_CALIBRATIONMODE 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-11-18 09:53:18 +01:00 committed by Alexandre Julliard
parent 0c9cac9547
commit e8d961b5c7
2 changed files with 26 additions and 11 deletions

View File

@ -920,6 +920,7 @@ static HRESULT check_property( struct dinput_device *impl, const GUID *guid, con
case (DWORD_PTR)DIPROP_AUTOCENTER:
case (DWORD_PTR)DIPROP_AXISMODE:
case (DWORD_PTR)DIPROP_BUFFERSIZE:
case (DWORD_PTR)DIPROP_CALIBRATIONMODE:
case (DWORD_PTR)DIPROP_DEADZONE:
case (DWORD_PTR)DIPROP_FFGAIN:
case (DWORD_PTR)DIPROP_FFLOAD:
@ -966,6 +967,7 @@ 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_GRANULARITY:
case (DWORD_PTR)DIPROP_CALIBRATIONMODE:
if (header->dwHow == DIPH_DEVICE && !set) return DIERR_UNSUPPORTED;
break;
@ -1015,6 +1017,7 @@ static HRESULT check_property( struct dinput_device *impl, const GUID *guid, con
}
case (DWORD_PTR)DIPROP_AUTOCENTER:
case (DWORD_PTR)DIPROP_AXISMODE:
case (DWORD_PTR)DIPROP_CALIBRATIONMODE:
{
const DIPROPDWORD *value = (const DIPROPDWORD *)header;
if (value->dwData > 1) return DIERR_INVALIDPARAM;
@ -1038,6 +1041,7 @@ 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;
break;
@ -1102,6 +1106,12 @@ static BOOL CALLBACK get_object_property( const DIDEVICEOBJECTINSTANCEW *instanc
value->dwData = properties->saturation;
return DIENUM_STOP;
}
case (DWORD_PTR)DIPROP_CALIBRATIONMODE:
{
DIPROPDWORD *value = (DIPROPDWORD *)params->header;
value->dwData = properties->calibration_mode;
return DI_OK;
}
case (DWORD_PTR)DIPROP_GRANULARITY:
{
DIPROPDWORD *value = (DIPROPDWORD *)params->header;
@ -1145,6 +1155,7 @@ static HRESULT dinput_device_get_property( IDirectInputDevice8W *iface, const GU
case (DWORD_PTR)DIPROP_SATURATION:
case (DWORD_PTR)DIPROP_GRANULARITY:
case (DWORD_PTR)DIPROP_KEYNAME:
case (DWORD_PTR)DIPROP_CALIBRATIONMODE:
hr = impl->vtbl->enum_objects( iface, &filter, object_mask, get_object_property, &params );
if (FAILED(hr)) return hr;
if (hr == DIENUM_CONTINUE) return DIERR_NOTFOUND;
@ -1249,6 +1260,12 @@ static BOOL CALLBACK set_object_property( const DIDEVICEOBJECTINSTANCEW *instanc
properties->saturation = value->dwData;
return DIENUM_CONTINUE;
}
case (DWORD_PTR)DIPROP_CALIBRATIONMODE:
{
const DIPROPDWORD *value = (const DIPROPDWORD *)params->header;
properties->calibration_mode = value->dwData;
return DIENUM_CONTINUE;
}
}
return DIENUM_STOP;
@ -1312,6 +1329,15 @@ static HRESULT WINAPI dinput_device_set_property( IDirectInputDevice8W *iface, c
reset_device_state( iface );
return DI_OK;
}
case (DWORD_PTR)DIPROP_CALIBRATIONMODE:
{
const DIPROPDWORD *value = (const DIPROPDWORD *)header;
if (value->dwData > DIPROPCALIBRATIONMODE_RAW) return DIERR_INVALIDPARAM;
hr = impl->vtbl->enum_objects( iface, &filter, DIDFT_AXIS, set_object_property, &params );
if (FAILED(hr)) return hr;
reset_device_state( iface );
return DI_OK;
}
case (DWORD_PTR)DIPROP_AUTOCENTER:
{
const DIPROPDWORD *value = (const DIPROPDWORD *)header;

View File

@ -4215,9 +4215,7 @@ static void test_simple_joystick(void)
ok( prop_dword.dwData == 10000, "got %u expected %u\n", prop_dword.dwData, 10000 );
prop_dword.dwData = 0xdeadbeef;
hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
todo_wine
ok( hr == DI_OK, "GetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
todo_wine
ok( prop_dword.dwData == DIPROPCALIBRATIONMODE_COOKED, "got %u expected %u\n", prop_dword.dwData, DIPROPCALIBRATIONMODE_COOKED );
prop_string.diph.dwHow = DIPH_BYUSAGE;
@ -4927,7 +4925,6 @@ static void test_simple_joystick(void)
hr = IDirectInputDevice8_SetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_SATURATION returned %#x\n", hr );
hr = IDirectInputDevice8_SetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
todo_wine
ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
prop_dword.dwData = 1000;
hr = IDirectInputDevice8_SetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
@ -4937,7 +4934,6 @@ static void test_simple_joystick(void)
ok( hr == DI_OK, "SetProperty DIPROP_SATURATION returned %#x\n", hr );
prop_dword.dwData = DIPROPCALIBRATIONMODE_COOKED;
hr = IDirectInputDevice8_SetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
todo_wine
ok( hr == DI_OK, "SetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
@ -5025,13 +5021,10 @@ static void test_simple_joystick(void)
prop_dword.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
prop_dword.dwData = DIPROPCALIBRATIONMODE_RAW;
hr = IDirectInputDevice8_SetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
todo_wine
ok( hr == DI_OK, "SetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
prop_dword.dwData = 0xdeadbeef;
hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
todo_wine
ok( hr == DI_OK, "GetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
todo_wine
ok( prop_dword.dwData == DIPROPCALIBRATIONMODE_RAW, "got %u expected %u\n", prop_dword.dwData, DIPROPCALIBRATIONMODE_RAW );
hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
@ -5039,23 +5032,19 @@ static void test_simple_joystick(void)
winetest_push_context( "state[%d]", i );
todo_wine
ok( state.lX == 15, "got lX %d, expected %d\n" , state.lX, 15 );
todo_wine
check_member( state, expect_state_abs[0], "%d", lY );
check_member( state, expect_state_abs[0], "%d", lZ );
check_member( state, expect_state_abs[0], "%d", lRx );
todo_wine
check_member( state, expect_state_abs[0], "%d", rgdwPOV[0] );
check_member( state, expect_state_abs[0], "%d", rgdwPOV[1] );
winetest_pop_context();
prop_dword.dwData = DIPROPCALIBRATIONMODE_COOKED;
hr = IDirectInputDevice8_SetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
todo_wine
ok( hr == DI_OK, "SetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
send_hid_input( file, &injected_input[ARRAY_SIZE(injected_input) - 1], sizeof(*injected_input) );
res = WaitForSingleObject( event, 100 );
todo_wine
ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" );
hr = IDirectInputDevice8_Unacquire( device );