Module: wine Branch: master Commit: 496f7c61348825d735e10878d04c190cc92b8729 URL: https://gitlab.winehq.org/wine/wine/-/commit/496f7c61348825d735e10878d04c190...
Author: Ivo Ivanov logos128@gmail.com Date: Sun Jul 17 18:02:41 2022 +0300
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.
---
dlls/windows.gaming.input/provider.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/windows.gaming.input/provider.c b/dlls/windows.gaming.input/provider.c index 39229a35c7d..6908d733a53 100644 --- a/dlls/windows.gaming.input/provider.c +++ b/dlls/windows.gaming.input/provider.c @@ -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;