From 3ad4f9f356b9f59731bf7e5c8abbdcee145994ba Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Bernon?= Date: Thu, 13 Jan 2022 14:14:55 +0100 Subject: [PATCH] dinput: Reset button state for each report read. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit As we loop on ReadFile success we may read multiple reports at once, but we never reset buttons in the enumeration params. The pressed buttons are returned by HidP_GetUsagesEx and any other button must be cleared. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52387 Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/dinput/joystick_hid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 2e3efd2ee8a..29d1de8b98e 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -1208,8 +1208,8 @@ static HRESULT hid_joystick_read( IDirectInputDevice8W *iface ) struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); ULONG i, index, count, report_len = impl->caps.InputReportByteLength; DIDATAFORMAT *format = impl->base.device_format; - struct parse_device_state_params params = {{0}}; char *report_buf = impl->input_report_buf; + struct parse_device_state_params params; struct hid_joystick_effect *effect; DWORD device_state, effect_state; USAGE_AND_PAGE *usages; @@ -1247,6 +1247,7 @@ static HRESULT hid_joystick_read( IDirectInputDevice8W *iface ) params.time = GetCurrentTime(); params.seq = impl->base.dinput->evsequence++; memcpy( params.old_state, impl->base.device_state, format->dwDataSize ); + memset( params.buttons, 0, sizeof(params.buttons) ); memset( impl->base.device_state, 0, format->dwDataSize ); while (count--) -- 2.11.4.GIT