Commit 3ad4f9f3 authored by Rémi Bernon's avatar Rémi Bernon 💬 Committed by Alexandre Julliard
Browse files

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's avatarRémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard's avatarAlexandre Julliard <julliard@winehq.org>
parent cb41e4b1
......@@ -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--)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment