From 5370670b10ad573ecc45a26c4540dddce4c7e5e4 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sun, 16 Sep 2018 19:53:39 +0200 Subject: [PATCH] Use different .cfg files depending on GUI API used SDL1 => gfx2.cfg SDL2 => gfx2-sdl2.cfg Win32 => gfx2-win32.cfg X11 => gfx2-x11.cfg defaults to gfx2.cfg --- src/init.c | 5 +++-- src/setup.h | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/init.c b/src/init.c index d2b912da..24a2f5d4 100644 --- a/src/init.c +++ b/src/init.c @@ -2136,8 +2136,9 @@ int Load_CFG(int reload_all) T_Config_video_mode cfg_video_mode; int key_conversion = 0; - strcpy(filename,Config_directory); - strcat(filename,"gfx2.cfg"); + snprintf(filename, sizeof(filename), "%s%s", Config_directory, CONFIG_FILENAME); + + GFX2_Log(GFX2_DEBUG, "Load_CFG() trying to load %s\n", filename); file_size=File_length(filename); diff --git a/src/setup.h b/src/setup.h index cad4e931..2b75e235 100644 --- a/src/setup.h +++ b/src/setup.h @@ -89,6 +89,14 @@ void Set_config_directory(const char * program_dir, char * config_dir); /// Name of the binary file containing some configuration settings. #if defined (__MINT__) #define CONFIG_FILENAME "GFX2.CFG" +#elif defined(USE_SDL) + #define CONFIG_FILENAME "gfx2.cfg" +#elif defined(USE_SDL2) + #define CONFIG_FILENAME "gfx2-sdl2.cfg" +#elif defined(USE_X11) + #define CONFIG_FILENAME "gfx2-x11.cfg" +#elif defined(WIN32) + #define CONFIG_FILENAME "gfx2-win32.cfg" #else #define CONFIG_FILENAME "gfx2.cfg" #endif