tree 0c86a223596d
authorSam Lantinga <slouken@libsdl.org>
Mon, 11 Feb 2013 11:21:19 -0800
changeset 68426ea07537baa2
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
     1.1 --- a/src/joystick/SDL_gamecontroller.c	Mon Feb 11 11:20:49 2013 -0800
     1.2 +++ b/src/joystick/SDL_gamecontroller.c	Mon Feb 11 11:21:19 2013 -0800
     1.3 @@ -53,18 +53,20 @@
     1.4  
     1.5  	// mapping of axis/button id to controller version
     1.6  	int axes[SDL_CONTROLLER_AXIS_MAX];
     1.7 +	int buttonasaxis[SDL_CONTROLLER_AXIS_MAX];
     1.8 +
     1.9  	int buttons[SDL_CONTROLLER_BUTTON_MAX];
    1.10 -
    1.11  	int axesasbutton[SDL_CONTROLLER_BUTTON_MAX];
    1.12  	struct _SDL_HatAsButton hatasbutton[SDL_CONTROLLER_BUTTON_MAX];
    1.13 -	int buttonasaxis[SDL_CONTROLLER_AXIS_MAX];
    1.14  
    1.15  	// reverse mapping, joystick indices to buttons
    1.16  	SDL_CONTROLLER_AXIS raxes[k_nMaxReverseEntries];
    1.17 +	SDL_CONTROLLER_AXIS rbuttonasaxis[k_nMaxReverseEntries];
    1.18 +
    1.19  	SDL_CONTROLLER_BUTTON rbuttons[k_nMaxReverseEntries];
    1.20  	SDL_CONTROLLER_BUTTON raxesasbutton[k_nMaxReverseEntries];
    1.21 +
    1.22  	struct _SDL_HatAsButton rhatasbutton[k_nMaxReverseEntries];
    1.23 -	SDL_CONTROLLER_AXIS rbuttonasaxis[k_nMaxReverseEntries];
    1.24  };
    1.25  
    1.26  
    1.27 @@ -355,8 +357,8 @@
    1.28  		}
    1.29  		else if ( button != SDL_CONTROLLER_BUTTON_INVALID )
    1.30  		{
    1.31 -			pMapping->buttonasaxis[ button ] = iSDLButton;
    1.32 -			pMapping->rbuttonasaxis[ iSDLButton ] = button;
    1.33 +			pMapping->axesasbutton[ button ] = iSDLButton;
    1.34 +			pMapping->raxesasbutton[ iSDLButton ] = button;
    1.35  		}
    1.36  		else
    1.37  		{
    1.38 @@ -494,10 +496,10 @@
    1.39  	for ( j = 0; j < k_nMaxReverseEntries; j++ )
    1.40  	{
    1.41  		pMapping->raxes[j] = SDL_CONTROLLER_AXIS_INVALID;
    1.42 +		pMapping->rbuttonasaxis[j] = SDL_CONTROLLER_AXIS_INVALID;
    1.43  		pMapping->rbuttons[j] = SDL_CONTROLLER_BUTTON_INVALID;
    1.44  		pMapping->raxesasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID;
    1.45  		pMapping->rhatasbutton[j].hat = -1;
    1.46 -		pMapping->rbuttonasaxis[j] = SDL_CONTROLLER_AXIS_INVALID;
    1.47  	}
    1.48  
    1.49  	SDL_PrivateGameControllerParseControllerConfigString( pMapping, pchMapping );