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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2022-01-13 14:14:55 +01:00 committed by Alexandre Julliard
parent cb41e4b175
commit 3ad4f9f356
1 changed files with 2 additions and 1 deletions

View File

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