From ac460970ab2063f7770cee5c8dc9c601fc69541d Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Thu, 21 May 2009 17:43:07 +0000 Subject: [PATCH] Hard-code ENTERGUI and FIRE button setting. I hope this is possible to get rid of... --- src/gui-sdl/gui-sdl.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/gui-sdl/gui-sdl.c b/src/gui-sdl/gui-sdl.c index 4963e77..4bc0dfb 100644 --- a/src/gui-sdl/gui-sdl.c +++ b/src/gui-sdl/gui-sdl.c @@ -317,16 +317,27 @@ static void keyboard_options(void) break; } - for (i = 0; i < 4; i++) + for (i = 0; i < 2; i++) { + int fire_buttons[] = {3,7,9,10}; char buf[80]; - if (snprintf(buf, 80, "input.1.joystick.%d.button.%d", - i, sdl_key) >= 255) - { - fprintf(stderr, "Buffer overflow. Something is wrong\n"); - return; - } + int j; + + snprintf(buf, 80, "input.1.joystick.%d.button.%d", i, sdl_key); read_inputdevice_config (&changed_prefs, buf, key); + + snprintf(buf, 80, "input.1.joystick.%d.button.6", i); + read_inputdevice_config (&changed_prefs, buf, "SPC_ENTERGUI"); + snprintf(buf, 80, "input.1.joystick.%d.button.19", i); + read_inputdevice_config (&changed_prefs, buf, "SPC_ENTERGUI"); + + for (j = 0; j < sizeof(fire_buttons) / sizeof(fire_buttons[0]); j++) + { + snprintf(buf, 80, "input.1.joystick.%d.button.%d", + i, fire_buttons[j]); + read_inputdevice_config (&changed_prefs, buf, + i == 0 ? "JOY2_FIRE_BUTTON" : "JOY1_FIRE_BUTTON"); + } } prefs_has_changed = 1;