Commit c0f7325b859e940e4beb21b850a50ae86dd45062

Ozkan Sezer 2020-11-15T17:10:15

SDL_PrivateJoystickForceRecentering: fix wrong loop counter usage. The typo seems to have been added by commit c7782fd6142b

diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index ee54930..465a38d 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -469,24 +469,17 @@ SDL_JoystickOpen(int device_index)
     return joystick;
 }
 
-
 int
 SDL_JoystickAttachVirtual(SDL_JoystickType type,
-                          int naxes,
-                          int nbuttons,
-                          int nhats)
+                          int naxes, int nbuttons, int nhats)
 {
 #if SDL_JOYSTICK_VIRTUAL
-    return SDL_JoystickAttachVirtualInner(type,
-                                          naxes,
-                                          nbuttons,
-                                          nhats);
+    return SDL_JoystickAttachVirtualInner(type, naxes, nbuttons, nhats);
 #else
     return SDL_SetError("SDL not built with virtual-joystick support");
 #endif
 }
 
-
 int
 SDL_JoystickDetachVirtual(int device_index)
 {
@@ -509,7 +502,6 @@ SDL_JoystickDetachVirtual(int device_index)
 #endif
 }
 
-
 SDL_bool
 SDL_JoystickIsVirtual(int device_index)
 {
@@ -532,7 +524,6 @@ SDL_JoystickIsVirtual(int device_index)
 #endif
 }
 
-
 int
 SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value)
 {
@@ -543,7 +534,6 @@ SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value)
 #endif
 }
 
-
 int
 SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value)
 {
@@ -554,7 +544,6 @@ SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value)
 #endif
 }
 
-
 int
 SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value)
 {
@@ -565,7 +554,6 @@ SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value)
 #endif
 }
 
-
 /*
  * Checks to make sure the joystick is valid.
  */
@@ -1226,7 +1214,7 @@ SDL_PrivateJoystickForceRecentering(SDL_Joystick *joystick)
     }
 
     for (i = 0; i < joystick->ntouchpads; i++) {
-        SDL_JoystickTouchpadInfo *touchpad = &joystick->touchpads[j];
+        SDL_JoystickTouchpadInfo *touchpad = &joystick->touchpads[i];
 
         for (j = 0; j < touchpad->nfingers; ++j) {
             SDL_PrivateJoystickTouchpad(joystick, i, j, SDL_RELEASED, 0.0f, 0.0f, 0.0f);