mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-06 10:17:14 +00:00
SDL: Warn if the selected joystick does not exist
This commit is contained in:
parent
76b71cabb9
commit
ee9b60676a
@ -55,16 +55,18 @@ SdlEventSource::SdlEventSource()
|
||||
memset(&_km, 0, sizeof(_km));
|
||||
|
||||
int joystick_num = ConfMan.getInt("joystick_num");
|
||||
if (joystick_num > -1) {
|
||||
if (joystick_num >= 0) {
|
||||
// Initialize SDL joystick subsystem
|
||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) {
|
||||
error("Could not initialize SDL: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
// Enable joystick
|
||||
if (SDL_NumJoysticks() > 0) {
|
||||
debug("Using joystick: %s", SDL_JoystickName(0));
|
||||
if (SDL_NumJoysticks() > joystick_num) {
|
||||
debug("Using joystick: %s", SDL_JoystickName(joystick_num));
|
||||
_joystick = SDL_JoystickOpen(joystick_num);
|
||||
} else {
|
||||
warning("Invalid joystick: %d", joystick_num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user