use_joystick = false;
else
use_joystick = true;
+
+ reader.read_int ("joystick-x", &joystick_keymap.x_axis);
+ reader.read_int ("joystick-y", &joystick_keymap.y_axis);
+ reader.read_int ("joystick-a", &joystick_keymap.a_button);
+ reader.read_int ("joystick-b", &joystick_keymap.b_button);
+ reader.read_int ("joystick-start", &joystick_keymap.start_button);
+ reader.read_int ("joystick-deadzone", &joystick_keymap.dead_zone);
}
void saveconfig (void)
fprintf(config, "\n\t;; joystick number (-1 means no joystick):\n");
fprintf(config, "\t(joystick %d)\n", use_joystick ? joystick_num : -1);
+
+ fprintf(config, "\t(joystick-x %d)\n", joystick_keymap.x_axis);
+ fprintf(config, "\t(joystick-y %d)\n", joystick_keymap.y_axis);
+ fprintf(config, "\t(joystick-a %d)\n", joystick_keymap.a_button);
+ fprintf(config, "\t(joystick-b %d)\n", joystick_keymap.b_button);
+ fprintf(config, "\t(joystick-start %d)\n", joystick_keymap.start_button);
+ fprintf(config, "\t(joystick-deadzone %d)\n", joystick_keymap.dead_zone);
+
fprintf(config, ")\n");
}
}
}
else
{
- /* Check for proper joystick configuration: */
-
if (SDL_JoystickNumAxes(js) < 2)
{
fprintf(stderr,
assert(i+1 < argc);
joystick_num = atoi(argv[++i]);
}
+ else if (strcmp(argv[i], "--joymap") == 0)
+ {
+ assert(i+1 < argc);
+ if (sscanf(argv[++i],
+ "%d:%d:%d:%d:%d",
+ &joystick_keymap.x_axis,
+ &joystick_keymap.y_axis,
+ &joystick_keymap.a_button,
+ &joystick_keymap.b_button,
+ &joystick_keymap.start_button) != 5)
+ {
+ puts("Warning: Invalid or incomplete joymap, should be: 'XAXIS:YAXIS:A:B:START'");
+ }
+ else
+ {
+ std::cout << "Using new joymap:\n"
+ << " X-Axis: " << joystick_keymap.x_axis << "\n"
+ << " Y-Axis: " << joystick_keymap.y_axis << "\n"
+ << " A-Button: " << joystick_keymap.a_button << "\n"
+ << " B-Button: " << joystick_keymap.b_button << "\n"
+ << " Start-Button: " << joystick_keymap.start_button << std::endl;
+ }
+ }
else if (strcmp(argv[i], "--worldmap") == 0)
{
launch_worldmap_mode = true;
"\n"
"Misc Options:\n"
" -j, --joystick NUM Use joystick NUM (default: 0)\n"
+ " --joymap XAXIS:YAXIS:A:B:START\n"
+ " Define how joystick buttons and axis should be mapped\n"
" --worldmap Start in worldmap-mode (EXPERIMENTAL)\n"
" -d, --datadir DIR Load Game data from DIR (default: automatic)\n"
" --debug-mode Enables the debug-mode, which is useful for developers.\n"