Sdl gamecontrollerdb.txt fix (#356)

sdl: load gamecontrollerdb.txt before calling SDL_InitSubSystem
This commit is contained in:
Joshua L 2021-09-19 02:07:07 +10:00 committed by GitHub
parent 17348dae8a
commit 22947af854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -158,9 +158,6 @@ void input_sdl_init()
SDL_SetHint(SDL_HINT_XINPUT_ENABLED, "0");
}
#endif
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0)
die("SDL: error initializing Joystick subsystem");
std::string db = get_readonly_data_path("gamecontrollerdb.txt");
int rv = SDL_GameControllerAddMappingsFromFile(db.c_str());
if (rv < 0)
@ -170,6 +167,10 @@ void input_sdl_init()
}
if (rv > 0)
DEBUG_LOG(INPUT ,"%d mappings loaded from %s", rv, db.c_str());
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0)
die("SDL: error initializing Joystick subsystem");
}
if (SDL_WasInit(SDL_INIT_HAPTIC) == 0)
SDL_InitSubSystem(SDL_INIT_HAPTIC);