dinput: Implement HID wheel type detection.
Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com> Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
389ecae089
commit
feea75c64b
|
@ -1400,6 +1400,7 @@ static BOOL hid_joystick_device_try_open( UINT32 handle, const WCHAR *path, HAND
|
|||
PHIDP_PREPARSED_DATA *preparsed, HIDD_ATTRIBUTES *attrs,
|
||||
HIDP_CAPS *caps, DIDEVICEINSTANCEW *instance, DWORD version )
|
||||
{
|
||||
BOOL has_accelerator, has_brake, has_clutch;
|
||||
PHIDP_PREPARSED_DATA preparsed_data = NULL;
|
||||
DWORD type = 0, button_count = 0;
|
||||
HIDP_BUTTON_CAPS buttons[10];
|
||||
|
@ -1486,6 +1487,36 @@ static BOOL hid_joystick_device_try_open( UINT32 handle, const WCHAR *path, HAND
|
|||
if (status != HIDP_STATUS_SUCCESS || !count)
|
||||
type = DI8DEVTYPE_SUPPLEMENTAL | (DI8DEVTYPESUPPLEMENTAL_UNKNOWN << 8) | DIDEVTYPE_HID;
|
||||
|
||||
count = 1;
|
||||
status = HidP_GetSpecificValueCaps( HidP_Input, HID_USAGE_PAGE_SIMULATION, 0, HID_USAGE_SIMULATION_STEERING,
|
||||
&value, &count, preparsed_data );
|
||||
if (status == HIDP_STATUS_SUCCESS && count)
|
||||
{
|
||||
type = DI8DEVTYPE_DRIVING | DIDEVTYPE_HID;
|
||||
|
||||
count = 1;
|
||||
status = HidP_GetSpecificValueCaps( HidP_Input, HID_USAGE_PAGE_SIMULATION, 0, HID_USAGE_SIMULATION_ACCELERATOR,
|
||||
&value, &count, preparsed_data );
|
||||
has_accelerator = (status == HIDP_STATUS_SUCCESS && count);
|
||||
|
||||
count = 1;
|
||||
status = HidP_GetSpecificValueCaps( HidP_Input, HID_USAGE_PAGE_SIMULATION, 0, HID_USAGE_SIMULATION_BRAKE,
|
||||
&value, &count, preparsed_data );
|
||||
has_brake = (status == HIDP_STATUS_SUCCESS && count);
|
||||
|
||||
count = 1;
|
||||
status = HidP_GetSpecificValueCaps( HidP_Input, HID_USAGE_PAGE_SIMULATION, 0, HID_USAGE_SIMULATION_CLUTCH,
|
||||
&value, &count, preparsed_data );
|
||||
has_clutch = (status == HIDP_STATUS_SUCCESS && count);
|
||||
|
||||
if (has_accelerator && has_brake && has_clutch)
|
||||
type |= (DI8DEVTYPEDRIVING_THREEPEDALS << 8);
|
||||
else if (has_accelerator && has_brake)
|
||||
type |= (DI8DEVTYPEDRIVING_DUALPEDALS << 8);
|
||||
else
|
||||
type |= (DI8DEVTYPEDRIVING_LIMITED << 8);
|
||||
}
|
||||
|
||||
instance->dwDevType = device_type_for_version( type, version );
|
||||
|
||||
*device = device_file;
|
||||
|
|
|
@ -2557,7 +2557,7 @@ static BOOL test_device_types( DWORD version )
|
|||
ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr );
|
||||
check_member( devinst, expect_devinst[i], "%d", dwSize );
|
||||
check_member_guid( devinst, expect_devinst[i], guidProduct );
|
||||
todo_wine_if( (version <= 0x700 && i == 3) || i > 3 )
|
||||
todo_wine_if( version <= 0x700 && i == 3 )
|
||||
check_member( devinst, expect_devinst[i], "%#x", dwDevType );
|
||||
check_member_guid( devinst, expect_devinst[i], guidFFDriver );
|
||||
check_member( devinst, expect_devinst[i], "%04x", wUsagePage );
|
||||
|
@ -2567,7 +2567,7 @@ static BOOL test_device_types( DWORD version )
|
|||
ok( hr == DI_OK, "GetCapabilities returned %#x\n", hr );
|
||||
check_member( caps, expect_caps[i], "%d", dwSize );
|
||||
check_member( caps, expect_caps[i], "%#x", dwFlags );
|
||||
todo_wine_if( (version <= 0x700 && i == 3) || i > 3 )
|
||||
todo_wine_if( version <= 0x700 && i == 3 )
|
||||
check_member( caps, expect_caps[i], "%#x", dwDevType );
|
||||
check_member( caps, expect_caps[i], "%d", dwAxes );
|
||||
check_member( caps, expect_caps[i], "%d", dwButtons );
|
||||
|
|
Loading…
Reference in New Issue