1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 03:45:57 +00:00

windows.gaming.input: Assume that joysticks with single FFB axis are racing wheels.

The HID PID steering wheels always declare one force feedback axis,
while the joysticks always have two or more. So it is safe to
assume that joysticks with single FFB axis are racing wheels.

Fixes FH5 not having force feedback with a Simucube 2 steering
wheel, when using the hidraw backend.
This commit is contained in:
Ivo Ivanov 2022-07-17 18:02:41 +03:00 committed by Alexandre Julliard
parent a1ce348c95
commit 496f7c6134

View File

@ -141,6 +141,13 @@ static HRESULT WINAPI wine_provider_GetTrustLevel( IWineGameControllerProvider *
return E_NOTIMPL;
}
static BOOL CALLBACK count_ffb_axes( const DIDEVICEOBJECTINSTANCEW *obj, void *args )
{
DWORD *count = args;
if (obj->dwType & DIDFT_FFACTUATOR) (*count)++;
return DIENUM_CONTINUE;
}
static HRESULT WINAPI wine_provider_get_Type( IWineGameControllerProvider *iface, WineGameControllerType *value )
{
struct provider *impl = impl_from_IWineGameControllerProvider( iface );
@ -155,7 +162,14 @@ static HRESULT WINAPI wine_provider_get_Type( IWineGameControllerProvider *iface
{
case DI8DEVTYPE_DRIVING: *value = WineGameControllerType_RacingWheel; break;
case DI8DEVTYPE_GAMEPAD: *value = WineGameControllerType_Gamepad; break;
default: *value = WineGameControllerType_Joystick; break;
default:
{
DWORD count = 0;
hr = IDirectInputDevice8_EnumObjects( impl->dinput_device, count_ffb_axes, &count, DIDFT_AXIS );
if (SUCCEEDED(hr) && count == 1) *value = WineGameControllerType_RacingWheel;
else *value = WineGameControllerType_Joystick;
break;
}
}
return S_OK;