Module: wine Branch: master Commit: 9855fbe252ff3664d879e8cd9f5d1ea879af47dd URL: https://source.winehq.org/git/wine.git/?a=commit;h=9855fbe252ff3664d879e8cd9...
Author: Alexey Prokhin alexey@prokhin.ru Date: Wed Aug 7 19:51:35 2019 +0300
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: Alexey Prokhin alexey@prokhin.ru Signed-off-by: Andrew Eikum aeikum@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/xinput1_3/hid.c | 10 +++++++--- dlls/xinput1_3/xinput_private.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/xinput1_3/hid.c b/dlls/xinput1_3/hid.c index aa46f35..38c93be 100644 --- a/dlls/xinput1_3/hid.c +++ b/dlls/xinput1_3/hid.c @@ -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); } diff --git a/dlls/xinput1_3/xinput_private.h b/dlls/xinput1_3/xinput_private.h index 00888f4..d6e0e96 100644 --- a/dlls/xinput1_3/xinput_private.h +++ b/dlls/xinput1_3/xinput_private.h @@ -23,6 +23,7 @@ typedef struct _xinput_controller XINPUT_CAPABILITIES caps; void *platform_private; XINPUT_STATE state; + XINPUT_VIBRATION vibration; } xinput_controller;