From d636cc18ba53ed7ca798c919dd56b0d5dabee9fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 28 May 2019 16:41:20 +0200 Subject: [PATCH] xinput: Fix rumble amount value rounding. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit XINPUT_VIBRATION structure documentation says that wLeftMotorSpeed and wRightMotorSpeed can range from 0 to 65535. The values were incorrectly divided by 255 in HID_set_state, which made the value range overflow one byte. Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/xinput1_3/hid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/xinput1_3/hid.c b/dlls/xinput1_3/hid.c index 34e4e51285c..dc5601cb6a1 100644 --- a/dlls/xinput1_3/hid.c +++ b/dlls/xinput1_3/hid.c @@ -469,8 +469,8 @@ DWORD HID_set_state(xinput_controller* device, XINPUT_VIBRATION* state) report.report = 0; report.pad1[0] = 0x8; report.pad1[1] = 0x0; - report.left = (BYTE)(state->wLeftMotorSpeed / 255); - report.right = (BYTE)(state->wRightMotorSpeed / 255); + report.left = (BYTE)(state->wLeftMotorSpeed / 256); + report.right = (BYTE)(state->wRightMotorSpeed / 256); memset(&report.pad2, 0, sizeof(report.pad2)); EnterCriticalSection(&private->crit);