From 22947af8542460a47889ae24df6927d5a90e6579 Mon Sep 17 00:00:00 2001 From: Joshua L Date: Sun, 19 Sep 2021 02:07:07 +1000 Subject: [PATCH] Sdl gamecontrollerdb.txt fix (#356) sdl: load gamecontrollerdb.txt before calling SDL_InitSubSystem --- core/sdl/sdl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/sdl/sdl.cpp b/core/sdl/sdl.cpp index 7c2327a36..62467d080 100644 --- a/core/sdl/sdl.cpp +++ b/core/sdl/sdl.cpp @@ -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);