distribution/packages/emulators/standalone/flycast-sa/patches/03-fix-sdl-controller.patch
2023-03-17 16:40:00 +00:00

16 lines
605 B
Diff

diff --git a/core/sdl/sdl.cpp b/core/sdl/sdl.cpp
index 62467d08..cb167b4f 100644
--- a/core/sdl/sdl.cpp
+++ b/core/sdl/sdl.cpp
@@ -160,6 +160,11 @@ void input_sdl_init()
#endif
std::string db = get_readonly_data_path("gamecontrollerdb.txt");
int rv = SDL_GameControllerAddMappingsFromFile(db.c_str());
+ if (rv < 0 && (nowide::getenv("SDL_GAMECONTROLLERCONFIG_FILE") != NULL))
+ {
+ db = (std::string) nowide::getenv("SDL_GAMECONTROLLERCONFIG_FILE");
+ rv = SDL_GameControllerAddMappingsFromFile(db.c_str());
+ }
if (rv < 0)
{
db = get_readonly_config_path("gamecontrollerdb.txt");