[PATCH] dinput: Reset button state for each report read.
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 <rbernon(a)codeweavers.com> --- 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 29cf3afcdd4..3e47ec9e23c 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -1213,8 +1213,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; @@ -1252,6 +1252,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.34.1
participants (1)
-
Rémi Bernon