xinput: Fix rumble amount value rounding.

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 <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2019-05-28 16:41:20 +02:00 committed by Alexandre Julliard
parent e6ce281d30
commit d636cc18ba
1 changed files with 2 additions and 2 deletions

View File

@ -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);