From: Ivo Ivanov logos128@gmail.com
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. --- dlls/windows.gaming.input/provider.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/windows.gaming.input/provider.c b/dlls/windows.gaming.input/provider.c index 39229a35c7d..d5703ec76d9 100644 --- a/dlls/windows.gaming.input/provider.c +++ b/dlls/windows.gaming.input/provider.c @@ -141,6 +141,14 @@ 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 ); @@ -153,9 +161,23 @@ static HRESULT WINAPI wine_provider_get_Type( IWineGameControllerProvider *iface
switch (GET_DIDEVICE_TYPE( instance.dwDevType )) { - case DI8DEVTYPE_DRIVING: *value = WineGameControllerType_RacingWheel; break; - case DI8DEVTYPE_GAMEPAD: *value = WineGameControllerType_Gamepad; break; - default: *value = WineGameControllerType_Joystick; break; + case DI8DEVTYPE_DRIVING: + *value = WineGameControllerType_RacingWheel; + break; + case DI8DEVTYPE_GAMEPAD: + *value = WineGameControllerType_Gamepad; + break; + default: + { + DWORD count = 0; + if (FAILED(IDirectInputDevice8_EnumObjects( impl->dinput_device, count_ffb_axes, &count, DIDFT_AXIS ))) + count = 0; + + if (count == 1) + *value = WineGameControllerType_RacingWheel; + else *value = WineGameControllerType_Joystick; + break; + } }
return S_OK;