in_sdl.c: IN_StartupJoystick: do SDL_INIT_GAMECONTROLLER before SDL_GameControllerAddMappingsFromFile, to match the sdl testgamecontroller tool

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1296 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
ewasylishen 2016-03-03 23:01:44 +00:00
parent 7665caeb85
commit 198d27b6fb

View file

@ -283,6 +283,12 @@ void IN_StartupJoystick (void)
if (COM_CheckParm("-nojoy")) if (COM_CheckParm("-nojoy"))
return; return;
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1 )
{
Con_Warning("could not initialize SDL Game Controller\n");
return;
}
// Load additional SDL2 controller definitions from gamecontrollerdb.txt // Load additional SDL2 controller definitions from gamecontrollerdb.txt
q_snprintf (controllerdb, sizeof(controllerdb), "%s/gamecontrollerdb.txt", com_basedir); q_snprintf (controllerdb, sizeof(controllerdb), "%s/gamecontrollerdb.txt", com_basedir);
nummappings = SDL_GameControllerAddMappingsFromFile(controllerdb); nummappings = SDL_GameControllerAddMappingsFromFile(controllerdb);
@ -297,12 +303,6 @@ void IN_StartupJoystick (void)
if (nummappings > 0) if (nummappings > 0)
Con_Printf("%d mappings loaded from gamecontrollerdb.txt\n", nummappings); Con_Printf("%d mappings loaded from gamecontrollerdb.txt\n", nummappings);
} }
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1 )
{
Con_Warning("could not initialize SDL Game Controller\n");
return;
}
for (i = 0; i < SDL_NumJoysticks(); i++) for (i = 0; i < SDL_NumJoysticks(); i++)
{ {