Rémi Bernon : joy.cpl: Consistently use the 32 buttons limit from DIJOYSTATE.

Alexandre Julliard julliard at winehq.org
Thu Oct 14 15:09:33 CDT 2021


Module: wine
Branch: master
Commit: f10171251024d779946b6d62ebbf59b26b938c9c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f10171251024d779946b6d62ebbf59b26b938c9c

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Thu Oct 14 09:39:54 2021 +0200

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

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

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51873
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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




More information about the wine-cvs mailing list