diff --git a/src/gui-sdl/gui-sdl.c b/src/gui-sdl/gui-sdl.c index 8bc4734..afa8167 100644 --- a/src/gui-sdl/gui-sdl.c +++ b/src/gui-sdl/gui-sdl.c @@ -375,13 +375,11 @@ static void insert_keyboard_map(const char *key, const char *fmt, ...) read_inputdevice_config (&currprefs, buf, key); } -static void setup_joystick(int joy, const char *key, int sdl_key) +static void setup_joystick_defaults(int joy) { int fire_buttons[] = {3,7,9,10}; int i; - insert_keyboard_map(key, "input.1.joystick.%d.button.%d", joy, sdl_key); - /* For some reason, the user uaerc removes these. The following * lines should be removed when this is properly figured out */ for (i = 0; i < 8; i++) @@ -415,6 +413,11 @@ static void setup_joystick(int joy, const char *key, int sdl_key) } } +static void setup_joystick(int joy, const char *key, int sdl_key) +{ + insert_keyboard_map(key, "input.1.joystick.%d.button.%d", joy, sdl_key); +} + static void keyboard_options(void) { const int wiimote_to_sdl[] = {2, 4, 5}; @@ -734,6 +737,7 @@ void gui_display(int shortcut) if (prefs_has_changed) { char user_options[255] = ""; + int i; #ifdef OPTIONS_IN_HOME char *home = getenv ("HOME"); @@ -746,6 +750,9 @@ void gui_display(int shortcut) strcat(user_options, OPTIONSFILENAME); strcat(user_options, ".user"); + for (i = 0; i < 2; i++) + setup_joystick_defaults(i); + cfgfile_save(&changed_prefs, user_options, 0); } }