commit e5fb4a9effa4c42960ebec31cb05a15265a1de45
Author: Simon Howard <fraggle@soulsphere.org>
AuthorDate: Sun Jun 26 18:01:14 2016 -0400
Commit: Simon Howard <fraggle@soulsphere.org>
CommitDate: Sun Jun 26 18:01:14 2016 -0400
setup: Reset button map when loading configs.
When loading a config for a known joystick, reset joystick button
mappings back to defaults, otherwise the button configs we are
setting might just map to arbitrary buttons.
---
src/setup/joystick.c | 42 ++++++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 16 deletions(-)
diff --git a/src/setup/joystick.c b/src/setup/joystick.c
index 1b47669f..9554a429 100644
--- a/src/setup/joystick.c
+++ b/src/setup/joystick.c
@@ -125,22 +125,32 @@ static SDL_Joystick **all_joysticks = NULL;
// Always loaded before others, to get a known starting configuration.
static const joystick_config_t empty_defaults[] =
{
- {"joystick_x_axis", -1},
- {"joystick_x_invert", 0},
- {"joystick_y_axis", -1},
- {"joystick_y_invert", 0},
- {"joystick_strafe_axis", -1},
- {"joystick_strafe_invert", 0},
- {"joyb_fire", -1},
- {"joyb_use", -1},
- {"joyb_strafe", -1},
- {"joyb_speed", -1},
- {"joyb_strafeleft", -1},
- {"joyb_straferight", -1},
- {"joyb_prevweapon", -1},
- {"joyb_nextweapon", -1},
- {"joyb_jump", -1},
- {"joyb_menu_activate", -1},
+ {"joystick_x_axis", -1},
+ {"joystick_x_invert", 0},
+ {"joystick_y_axis", -1},
+ {"joystick_y_invert", 0},
+ {"joystick_strafe_axis", -1},
+ {"joystick_strafe_invert", 0},
+ {"joyb_fire", -1},
+ {"joyb_use", -1},
+ {"joyb_strafe", -1},
+ {"joyb_speed", -1},
+ {"joyb_strafeleft", -1},
+ {"joyb_straferight", -1},
+ {"joyb_prevweapon", -1},
+ {"joyb_nextweapon", -1},
+ {"joyb_jump", -1},
+ {"joyb_menu_activate", -1},
+ {"joystick_physical_button0", 0},
+ {"joystick_physical_button1", 1},
+ {"joystick_physical_button2", 2},
+ {"joystick_physical_button3", 3},
+ {"joystick_physical_button4", 4},
+ {"joystick_physical_button5", 5},
+ {"joystick_physical_button6", 6},
+ {"joystick_physical_button7", 7},
+ {"joystick_physical_button8", 8},
+ {"joystick_physical_button9", 9},
{NULL, 0},
};