From 0014bb1ea3e2bd3331c9d825114e3decefdfe255 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 11 Feb 2013 11:21:19 -0800 Subject: [PATCH] tree 0c86a223596d parent 44e12dd8ee8e author Edward Rudd 1358030047 18000 committer Edward Rudd 1358030047 18000 revision 6821 branch default Fix a bad mapping from "axis" to "button" --- src/joystick/SDL_gamecontroller.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index 7a87d0370..91da1157a 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -53,18 +53,20 @@ struct _SDL_ControllerMapping // mapping of axis/button id to controller version int axes[SDL_CONTROLLER_AXIS_MAX]; - int buttons[SDL_CONTROLLER_BUTTON_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 @@ void SDL_PrivateGameControllerParseButton( const char *szGameButton, const char } 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 @@ void SDL_PrivateLoadButtonMapping( struct _SDL_ControllerMapping *pMapping, SDL_ 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 );