1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-04 21:28:54 +03:00

Make sure the joystick subsystem is inited before InputManager starts

This commit is contained in:
Paul Cercueil 2013-07-29 16:54:12 -04:00
parent fcb2618286
commit de9b3cd27d
2 changed files with 8 additions and 1 deletions

View File

@ -221,7 +221,7 @@ GMenu2X::GMenu2X()
setenv("SDL_FBCON_DONT_CLEAR", "1", 0);
//Screen
if( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_TIMER) < 0) {
if( SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) {
ERROR("Could not initialize SDL: %s\n", SDL_GetError());
quit();
}

View File

@ -42,8 +42,15 @@ InputManager::InputManager()
{
#ifndef SDL_JOYSTICK_DISABLED
int i;
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0) {
ERROR("Unable to init joystick subsystem\n");
return;
}
for (i = 0; i < SDL_NumJoysticks(); i++)
joysticks.push_back(SDL_JoystickOpen(i));
DEBUG("Opening %i joysticks\n", i);
#endif
}