Commit 9855fbe2 authored by Alexey Prokhin's avatar Alexey Prokhin Committed by Alexandre Julliard

xinput: Fix vibration capabilities.

wLeftMotorSpeed and wRightMotorSpeed returned by XInputGetCapabilities are supposed to be resolutions rather than current motor speeds. This fixes rumble in Far Cry 5. Signed-off-by: 's avatarAlexey Prokhin <alexey@prokhin.ru> Signed-off-by: 's avatarAndrew Eikum <aeikum@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 433c14b0
......@@ -173,7 +173,11 @@ static BOOL VerifyGamepad(PHIDP_PREPARSED_DATA ppd, XINPUT_CAPABILITIES *xinput_
value_caps_count = caps->NumberOutputValueCaps;
if (value_caps_count > 0)
{
xinput_caps->Flags |= XINPUT_CAPS_FFB_SUPPORTED;
xinput_caps->Vibration.wLeftMotorSpeed = 255;
xinput_caps->Vibration.wRightMotorSpeed = 255;
}
return TRUE;
}
......@@ -456,8 +460,8 @@ DWORD HID_set_state(xinput_controller* device, XINPUT_VIBRATION* state)
if (device->caps.Flags & XINPUT_CAPS_FFB_SUPPORTED)
{
device->caps.Vibration.wLeftMotorSpeed = state->wLeftMotorSpeed;
device->caps.Vibration.wRightMotorSpeed = state->wRightMotorSpeed;
device->vibration.wLeftMotorSpeed = state->wLeftMotorSpeed;
device->vibration.wRightMotorSpeed = state->wRightMotorSpeed;
if (private->enabled)
{
......@@ -498,7 +502,7 @@ void HID_enable(xinput_controller* device, BOOL enable)
}
else if (!private->enabled && enable)
{
HID_set_state(device, &device->caps.Vibration);
HID_set_state(device, &device->vibration);
}
LeaveCriticalSection(&private->crit);
}
......
......@@ -23,6 +23,7 @@ typedef struct _xinput_controller
XINPUT_CAPABILITIES caps;
void *platform_private;
XINPUT_STATE state;
XINPUT_VIBRATION vibration;
} xinput_controller;
......
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