From f10171251024d779946b6d62ebbf59b26b938c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 14 Oct 2021 09:39:54 +0200 Subject: [PATCH] joy.cpl: Consistently use the 32 buttons limit from DIJOYSTATE. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on a patch from Ivo Ivanov . Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51873 Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/joy.cpl/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c index 1498021db66..4431669eee8 100644 --- a/dlls/joy.cpl/main.c +++ b/dlls/joy.cpl/main.c @@ -414,7 +414,7 @@ static INT_PTR CALLBACK list_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM * Joystick testing functions * */ -static void dump_joy_state(DIJOYSTATE* st, int num_buttons) +static void dump_joy_state(DIJOYSTATE* st) { int i; TRACE("Ax (% 5d,% 5d,% 5d)\n", st->lX,st->lY, st->lZ); @@ -423,7 +423,7 @@ static void dump_joy_state(DIJOYSTATE* st, int num_buttons) TRACE("Pov (% 5d,% 5d,% 5d,% 5d)\n", st->rgdwPOV[0], st->rgdwPOV[1], st->rgdwPOV[2], st->rgdwPOV[3]); TRACE("Buttons "); - for(i=0; i < num_buttons; i++) + for(i=0; i < TEST_MAX_BUTTONS; i++) TRACE(" %c",st->rgbButtons[i] ? 'x' : 'o'); TRACE("\n"); } @@ -474,10 +474,10 @@ static DWORD WINAPI input_thread(void *param) poll_input(&data->joysticks[data->chosen_joystick], &state); - dump_joy_state(&state, data->joysticks[data->chosen_joystick].num_buttons); + dump_joy_state(&state); /* Indicate pressed buttons */ - for (i = 0; i < data->joysticks[data->chosen_joystick].num_buttons; i++) + for (i = 0; i < TEST_MAX_BUTTONS; i++) SendMessageW(data->graphics.buttons[i], BM_SETSTATE, !!state.rgbButtons[i], 0); /* Indicate axis positions, axes showing are hardcoded for now */ @@ -766,7 +766,7 @@ static DWORD WINAPI ff_input_thread(void *param) SetWindowPos(data->graphics.ff_axis, 0, r.left, r.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - for (i=0; i < joy->num_buttons; i++) + for (i=0; i < TEST_MAX_BUTTONS; i++) if (state.rgbButtons[i]) { IDirectInputEffect_SetParameters(joy->effects[chosen_effect].effect, dieffect, flags);