Commit 496f7c61 authored by Ivo Ivanov's avatar Ivo Ivanov Committed by Alexandre Julliard

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.
parent a1ce348c
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment