joy.cpl: Consistently use the 32 buttons limit from DIJOYSTATE.

Based on a patch from Ivo Ivanov <logos128@gmail.com>.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51873
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 2021-10-14 09:39:54 +02:00 committed by Alexandre Julliard
parent eb223bf58d
commit f101712510

View file

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