tree 0c86a223596d
authorSam Lantinga <slouken@libsdl.org>
Mon, 11 Feb 2013 11:21:19 -0800
changeset 6842 6ea07537baa2
parent 6841 90bba8d8e42a
child 6843 a52016007a7e
tree 0c86a223596d parent 44e12dd8ee8e author Edward Rudd <urkle@outoforder.cc> 1358030047 18000 committer Edward Rudd <urkle@outoforder.cc> 1358030047 18000 revision 6821 branch default Fix a bad mapping from "axis" to "button"
src/joystick/SDL_gamecontroller.c
--- a/src/joystick/SDL_gamecontroller.c	Mon Feb 11 11:20:49 2013 -0800
+++ b/src/joystick/SDL_gamecontroller.c	Mon Feb 11 11:21:19 2013 -0800
@@ -53,18 +53,20 @@
 
 	// mapping of axis/button id to controller version
 	int axes[SDL_CONTROLLER_AXIS_MAX];
+	int buttonasaxis[SDL_CONTROLLER_AXIS_MAX];
+
 	int buttons[SDL_CONTROLLER_BUTTON_MAX];
-
 	int axesasbutton[SDL_CONTROLLER_BUTTON_MAX];
 	struct _SDL_HatAsButton hatasbutton[SDL_CONTROLLER_BUTTON_MAX];
-	int buttonasaxis[SDL_CONTROLLER_AXIS_MAX];
 
 	// reverse mapping, joystick indices to buttons
 	SDL_CONTROLLER_AXIS raxes[k_nMaxReverseEntries];
+	SDL_CONTROLLER_AXIS rbuttonasaxis[k_nMaxReverseEntries];
+
 	SDL_CONTROLLER_BUTTON rbuttons[k_nMaxReverseEntries];
 	SDL_CONTROLLER_BUTTON raxesasbutton[k_nMaxReverseEntries];
+
 	struct _SDL_HatAsButton rhatasbutton[k_nMaxReverseEntries];
-	SDL_CONTROLLER_AXIS rbuttonasaxis[k_nMaxReverseEntries];
 };
 
 
@@ -355,8 +357,8 @@
 		}
 		else if ( button != SDL_CONTROLLER_BUTTON_INVALID )
 		{
-			pMapping->buttonasaxis[ button ] = iSDLButton;
-			pMapping->rbuttonasaxis[ iSDLButton ] = button;
+			pMapping->axesasbutton[ button ] = iSDLButton;
+			pMapping->raxesasbutton[ iSDLButton ] = button;
 		}
 		else
 		{
@@ -494,10 +496,10 @@
 	for ( j = 0; j < k_nMaxReverseEntries; j++ )
 	{
 		pMapping->raxes[j] = SDL_CONTROLLER_AXIS_INVALID;
+		pMapping->rbuttonasaxis[j] = SDL_CONTROLLER_AXIS_INVALID;
 		pMapping->rbuttons[j] = SDL_CONTROLLER_BUTTON_INVALID;
 		pMapping->raxesasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID;
 		pMapping->rhatasbutton[j].hat = -1;
-		pMapping->rbuttonasaxis[j] = SDL_CONTROLLER_AXIS_INVALID;
 	}
 
 	SDL_PrivateGameControllerParseControllerConfigString( pMapping, pchMapping );