From 82cf20aac9d758e32f90283f38141fd5174bcc52 Mon Sep 17 00:00:00 2001 From: "milkdropper.com" Date: Sat, 2 May 2020 19:42:50 +0400 Subject: [PATCH 1/7] ConfigPreset header --- src/libprojectM/projectM.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libprojectM/projectM.hpp b/src/libprojectM/projectM.hpp index 3e8e8955a3..03ab24af20 100644 --- a/src/libprojectM/projectM.hpp +++ b/src/libprojectM/projectM.hpp @@ -156,8 +156,15 @@ class DLLEXPORT projectM softCutRatingsEnabled(false) {} }; + struct ConfigPreset + { + std::string config_file; + Settings settings; + }; + projectM(std::string config_file, int flags = FLAG_NONE); projectM(Settings settings, int flags = FLAG_NONE); + projectM(ConfigPreset configPreset, int flags = FLAG_NONE); void projectM_resetGL( int width, int height ); void projectM_resetTextures(); From 727fdf89d21e72dce3dbb0703c0977a4da9b03d4 Mon Sep 17 00:00:00 2001 From: "milkdropper.com" Date: Sat, 2 May 2020 19:57:30 +0400 Subject: [PATCH 2/7] libProjectM support to read a config file and settings at the same time. --- src/libprojectM/projectM.cpp | 144 +++++++++++++++++++++++------------ src/libprojectM/projectM.hpp | 1 + 2 files changed, 95 insertions(+), 50 deletions(-) diff --git a/src/libprojectM/projectM.cpp b/src/libprojectM/projectM.cpp index 7c66890aa5..1a15326b09 100755 --- a/src/libprojectM/projectM.cpp +++ b/src/libprojectM/projectM.cpp @@ -128,6 +128,30 @@ projectM::projectM(Settings settings, int flags): projectM_resetGL(_settings.windowWidth, _settings.windowHeight); } +projectM::projectM(ConfigPreset configPreset, int flags) + : _pcm(0), + beatDetect(0), + renderer(0), + _pipelineContext(new PipelineContext()), + _pipelineContext2(new PipelineContext()), + m_presetPos(0), + timeKeeper(NULL), + m_flags(flags), + _matcher(NULL), + _merger(NULL) +{ + struct stat sb; + if (!configPreset.config_file.empty() && stat(configPreset.config_file.c_str(), &sb) == 0) + { + readConfig(configPreset.config_file, configPreset.settings); + } + else + { + readSettings(configPreset.settings); + } + projectM_reset(); + projectM_resetGL(_settings.windowWidth, _settings.windowHeight); +} bool projectM::writeConfig(const std::string & configFile, const Settings & settings) { @@ -157,82 +181,102 @@ bool projectM::writeConfig(const std::string & configFile, const Settings & sett return false; } - +void projectM::readConfig(const std::string &configFile, const Settings &settings) +{ + std::cout << "[projectM] config file: " << configFile << std::endl; + + ConfigFile config(configFile); + _settings.meshX = config.read("Mesh X", settings.meshX); + _settings.meshY = config.read("Mesh Y", settings.meshY); + _settings.textureSize = config.read("Texture Size", settings.textureSize); + _settings.fps = config.read("FPS", settings.fps); + _settings.windowWidth = config.read("Window Width", settings.windowWidth); + _settings.windowHeight = config.read("Window Height", settings.windowHeight); + _settings.smoothPresetDuration = config.read("Smooth Preset Duration", + config.read("Smooth Transition Duration", settings.smoothPresetDuration)); + _settings.presetDuration = config.read("Preset Duration", settings.presetDuration); + + _settings.presetURL = config.read("Preset Path", settings.presetURL); + + _settings.titleFontURL = config.read("Title Font", settings.titleFontURL); + _settings.menuFontURL = config.read("Menu Font", settings.menuFontURL); + + _settings.shuffleEnabled = config.read("Shuffle Enabled", settings.shuffleEnabled); + + _settings.easterEgg = config.read("Easter Egg Parameter", settings.easterEgg); + _settings.softCutRatingsEnabled = + config.read("Soft Cut Ratings Enabled", settings.softCutRatingsEnabled); + + projectM_init(_settings.meshX, _settings.meshY, _settings.fps, _settings.textureSize, + _settings.windowWidth, _settings.windowHeight); + + _settings.beatSensitivity = beatDetect->beat_sensitivity = + config.read("Hard Cut Sensitivity", 10.0); + + if (config.read("Aspect Correction", settings.aspectCorrection)) + { + _settings.aspectCorrection = true; + renderer->correction = true; + } + else + { + _settings.aspectCorrection = false; + renderer->correction = false; + } +} void projectM::readConfig (const std::string & configFile ) { - std::cout << "[projectM] config file: " << configFile << std::endl; - - ConfigFile config ( configFile ); - _settings.meshX = config.read ( "Mesh X", 32 ); - _settings.meshY = config.read ( "Mesh Y", 24 ); - _settings.textureSize = config.read ( "Texture Size", 512 ); - _settings.fps = config.read ( "FPS", 35 ); - _settings.windowWidth = config.read ( "Window Width", 512 ); - _settings.windowHeight = config.read ( "Window Height", 512 ); - _settings.smoothPresetDuration = config.read - ( "Smooth Preset Duration", config.read("Smooth Transition Duration", 10)); - _settings.presetDuration = config.read ( "Preset Duration", 15 ); + // if you read a config file with no default settings supplied, we will set them here before loading them with defaults. + projectM::Settings settings; + settings.meshX = 32; + settings.meshY = 24; + settings.textureSize = 512; + settings.fps = 35; + settings.windowWidth = 512; + settings.windowHeight = 512; + settings.smoothPresetDuration = 10; + settings.presetDuration = 15; #ifdef __unix__ - _settings.presetURL = config.read ( "Preset Path", "/usr/local/share/projectM/presets" ); + settings.presetURL = "/usr/local/share/projectM/presets"; #endif #ifdef __APPLE__ /// @bug awful hardcoded hack- need to add intelligence to cmake wrt bundling - carm - _settings.presetURL = config.read ( "Preset Path", "../Resources/presets" ); + settings.presetURL = "../Resources/presets"; #endif #ifdef WIN32 - _settings.presetURL = config.read ( "Preset Path", "/usr/local/share/projectM/presets" ); + settings.presetURL = "/usr/local/share/projectM/presets"; #endif #ifdef __APPLE__ - _settings.titleFontURL = config.read - ( "Title Font", "../Resources/fonts/Vera.tff"); - _settings.menuFontURL = config.read - ( "Menu Font", "../Resources/fonts/VeraMono.ttf"); + settings.titleFontURL = "../Resources/fonts/Vera.tff"; + settings.menuFontURL = "../Resources/fonts/VeraMono.ttf"; #endif #ifdef __unix__ - _settings.titleFontURL = config.read - ( "Title Font", "/usr/local/share/projectM/fonts/Vera.tff" ); - _settings.menuFontURL = config.read - ( "Menu Font", "/usr/local/share/projectM/fonts/VeraMono.tff" ); + settings.titleFontURL = "/usr/local/share/projectM/fonts/Vera.tff"; + settings.menuFontURL = "/usr/local/share/projectM/fonts/VeraMono.tff"; #endif #ifdef WIN32 - _settings.titleFontURL = config.read - ( "Title Font", projectM_FONT_TITLE ); - _settings.menuFontURL = config.read - ( "Menu Font", projectM_FONT_MENU ); + settings.titleFontURL = projectM_FONT_TITLE; + settings.menuFontURL = projectM_FONT_MENU; #endif + settings.shuffleEnabled = 1; - _settings.shuffleEnabled = config.read ( "Shuffle Enabled", true); - - _settings.easterEgg = config.read ( "Easter Egg Parameter", 0.0); - _settings.softCutRatingsEnabled = - config.read ( "Soft Cut Ratings Enabled", false); - - projectM_init ( _settings.meshX, _settings.meshY, _settings.fps, - _settings.textureSize, _settings.windowWidth,_settings.windowHeight); - - _settings.beatSensitivity = beatDetect->beat_sensitivity = config.read ( "Hard Cut Sensitivity", 10.0 ); - - - if ( config.read ( "Aspect Correction", true ) ) - { - _settings.aspectCorrection = true; - renderer->correction = true; - } - else - { - _settings.aspectCorrection = false; - renderer->correction = false; - } + settings.easterEgg = 0.0; + settings.softCutRatingsEnabled = 0; + settings.beatSensitivity = beatDetect->beat_sensitivity = 10.0; + settings.aspectCorrection = 1; + + // now load the config with default settings. + readConfig(configFile, settings); } diff --git a/src/libprojectM/projectM.hpp b/src/libprojectM/projectM.hpp index 03ab24af20..f6d95688ec 100644 --- a/src/libprojectM/projectM.hpp +++ b/src/libprojectM/projectM.hpp @@ -317,6 +317,7 @@ class DLLEXPORT projectM float fpsstart; void readConfig(const std::string &configFile); + void readConfig(const std::string &configFile, const Settings &settings); void readSettings(const Settings &settings); void projectM_init(int gx, int gy, int fps, int texsize, int width, int height); void projectM_reset(); From 3816615d574acc051d79d00afe405b5bc3f6ebec Mon Sep 17 00:00:00 2001 From: "milkdropper.com" Date: Sat, 2 May 2020 20:22:00 +0400 Subject: [PATCH 3/7] SDL config load changes --- src/projectM-sdl/pmSDL.cpp | 8 ++ src/projectM-sdl/pmSDL.hpp | 1 + src/projectM-sdl/projectM_SDL_main.cpp | 151 +++++++++++++++---------- 3 files changed, 99 insertions(+), 61 deletions(-) diff --git a/src/projectM-sdl/pmSDL.cpp b/src/projectM-sdl/pmSDL.cpp index 11a9daa017..600039a83f 100644 --- a/src/projectM-sdl/pmSDL.cpp +++ b/src/projectM-sdl/pmSDL.cpp @@ -453,6 +453,14 @@ projectMSDL::projectMSDL(std::string config_file, int flags) : projectM(config_f isFullScreen = false; } +projectMSDL::projectMSDL(ConfigPreset configPreset, int flags) : projectM(configPreset, flags) +{ + width = getWindowWidth(); + height = getWindowHeight(); + done = 0; + isFullScreen = false; +} + void projectMSDL::init(SDL_Window *window, SDL_GLContext *_glCtx, const bool _renderToTexture) { win = window; glCtx = _glCtx; diff --git a/src/projectM-sdl/pmSDL.hpp b/src/projectM-sdl/pmSDL.hpp index bd55ac0a2c..946eb90f60 100644 --- a/src/projectM-sdl/pmSDL.hpp +++ b/src/projectM-sdl/pmSDL.hpp @@ -90,6 +90,7 @@ class projectMSDL : public projectM { bool done; projectMSDL(Settings settings, int flags); projectMSDL(std::string config_file, int flags); + projectMSDL(ConfigPreset configPreset, int flags); void init(SDL_Window *window, SDL_GLContext *glCtx, const bool renderToTexture = false); int openAudioInput(); int toggleAudioInput(); diff --git a/src/projectM-sdl/projectM_SDL_main.cpp b/src/projectM-sdl/projectM_SDL_main.cpp index f9c0eb0bec..af094ec6c6 100644 --- a/src/projectM-sdl/projectM_SDL_main.cpp +++ b/src/projectM-sdl/projectM_SDL_main.cpp @@ -53,28 +53,59 @@ void DebugLog(GLenum source, #endif // return path to config file to use -std::string getConfigFilePath(std::string datadir_path) { - struct stat sb; - const char *path = datadir_path.c_str(); - - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Looking for configuration file in data dir: %s.\n", path); - - // check if datadir exists. - // it should exist if this application was installed. if not, assume we're developing it and use currect directory - if (stat(path, &sb) != 0) { - SDL_LogWarn(SDL_LOG_CATEGORY_ERROR, "Could not open datadir path %s\n", path); - } - - std::string configFilePath = path; - configFilePath += "/config.inp"; - - // check if config file exists - if (stat(configFilePath.c_str(), &sb) != 0) { - SDL_LogWarn(SDL_LOG_CATEGORY_ERROR, "No config file %s found. Using development settings.\n", configFilePath.c_str()); - return ""; - } - - return configFilePath; +std::string getConfigFilePath(std::string datadir_path) +{ + struct stat sb; + const char *path = datadir_path.c_str(); + + SDL_LogInfo( + SDL_LOG_CATEGORY_APPLICATION, "Looking for configuration file in data directory: %s\n", path); + + std::string configFilePath = ""; + + // check if datadir exists. + // it should exist if this application was installed. if not, try the settings directory. + if (stat(path, &sb) != 0) + { +#ifdef WIN32 + configFilePath += getenv("APPDATA"); + configFilePath += "\\projectM\\config.inp"; +#else + configFilePath += getenv("home"); + configFilePath += "/.projectM/config.inp"; +#endif + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, + "Looking for configuration file in settings directory: %s\n", configFilePath.c_str()); + } + else + { + configFilePath = path; + configFilePath += "config.inp"; + } + + // check if settings config file exists. + // if not, assume we're developing it and use the current working directory. + if (stat(configFilePath.c_str(), &sb) != 0) + { + configFilePath = ""; +#ifdef WIN32 + configFilePath += ".\\config.inp"; +#else + configFilePath += "./config.inp"; +#endif + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, + "Looking for configuration file in current working directory: %s\n", configFilePath.c_str()); + } + + // check if config file exists + if (stat(configFilePath.c_str(), &sb) != 0) + { + SDL_LogWarn(SDL_LOG_CATEGORY_ERROR, "No config file %s found. Using development settings.\n", + configFilePath.c_str()); + return ""; + } + + return configFilePath; } @@ -320,48 +351,46 @@ srand((int)(time(NULL))); // load configuration file std::string configFilePath = getConfigFilePath(base_path); - if (! configFilePath.empty()) { - // found config file, use it - app = new projectMSDL(configFilePath, 0); - SDL_Log("Using config from %s", configFilePath.c_str()); - } else { - base_path = SDL_GetBasePath(); - SDL_Log("Config file not found, using built-in settings. Data directory=%s\n", base_path.c_str()); - - // Get max refresh rate from attached displays to use as built-in max FPS. - int i = 0; - int maxRefreshRate = 0; - SDL_DisplayMode current; - for (i = 0; i < SDL_GetNumVideoDisplays(); ++i) + if (configFilePath.empty()) base_path = SDL_GetBasePath(); + + // Get max refresh rate from attached displays to use as built-in max FPS. + int i = 0; + int maxRefreshRate = 0; + SDL_DisplayMode current; + for (i = 0; i < SDL_GetNumVideoDisplays(); ++i) + { + if (SDL_GetCurrentDisplayMode(i, ¤t) == 0) { - if (SDL_GetCurrentDisplayMode(i, ¤t) == 0) - { - if (current.refresh_rate > maxRefreshRate) maxRefreshRate = current.refresh_rate; - } + if (current.refresh_rate > maxRefreshRate) maxRefreshRate = current.refresh_rate; } - if (maxRefreshRate <= 60) maxRefreshRate = 60; - - float heightWidthRatio = (float)height / (float)width; - projectM::Settings settings; - settings.windowWidth = width; - settings.windowHeight = height; - settings.meshX = 128; - settings.meshY = settings.meshX * heightWidthRatio; - settings.fps = maxRefreshRate; - settings.smoothPresetDuration = 3; // seconds - settings.presetDuration = 22; // seconds - settings.beatSensitivity = 0.8; - settings.aspectCorrection = 1; - settings.shuffleEnabled = 1; - settings.softCutRatingsEnabled = 1; // ??? - // get path to our app, use CWD or resource dir for presets/fonts/etc - settings.presetURL = base_path + "presets"; + } + if (maxRefreshRate <= 60) maxRefreshRate = 60; + + float heightWidthRatio = (float)height / (float)width; + projectM::Settings settings; + settings.windowWidth = width; + settings.windowHeight = height; + settings.meshX = 128; + settings.meshY = settings.meshX * heightWidthRatio; + settings.fps = maxRefreshRate; + settings.smoothPresetDuration = 3; // seconds + settings.presetDuration = 22; // seconds + settings.beatSensitivity = 0.8; + settings.aspectCorrection = 1; + settings.shuffleEnabled = 1; + settings.softCutRatingsEnabled = 1; // ??? + // get path to our app, use CWD or resource dir for presets/fonts/etc + settings.presetURL = base_path + "presets"; // settings.presetURL = base_path + "presets/presets_shader_test"; - settings.menuFontURL = base_path + "fonts/Vera.ttf"; - settings.titleFontURL = base_path + "fonts/Vera.ttf"; - // init with settings - app = new projectMSDL(settings, 0); - } + settings.menuFontURL = base_path + "fonts/Vera.ttf"; + settings.titleFontURL = base_path + "fonts/Vera.ttf"; + + // init with settings & config (if config was found) + projectM::ConfigPreset configPreset; + configPreset.config_file = configFilePath; + configPreset.settings = settings; + + app = new projectMSDL(settings, 0); app->init(win, &glCtx); #if STEREOSCOPIC_SBS From a9fe3ef52a8792d99c4b80941f8e7d017be3f563 Mon Sep 17 00:00:00 2001 From: "milkdropper.com" Date: Sat, 2 May 2020 20:53:27 +0400 Subject: [PATCH 4/7] SDL config is considered base directory for default presets and fonts. --- src/projectM-sdl/pmSDL.hpp | 2 +- src/projectM-sdl/projectM_SDL_main.cpp | 78 +++++++++++++------------- 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/projectM-sdl/pmSDL.hpp b/src/projectM-sdl/pmSDL.hpp index 946eb90f60..863d1b4bcc 100644 --- a/src/projectM-sdl/pmSDL.hpp +++ b/src/projectM-sdl/pmSDL.hpp @@ -76,7 +76,7 @@ #define DATADIR_PATH "." #warning "DATADIR_PATH is not defined - falling back to ./" #else - #define DATADIR_PATH "/usr/local/share/projectM" + #define DATADIR_PATH "/usr/local/share/projectM/" #ifndef WIN32 #warning "DATADIR_PATH is not defined - falling back to /usr/local/share/projectM" #endif /** WIN32 */ diff --git a/src/projectM-sdl/projectM_SDL_main.cpp b/src/projectM-sdl/projectM_SDL_main.cpp index af094ec6c6..cc435ff374 100644 --- a/src/projectM-sdl/projectM_SDL_main.cpp +++ b/src/projectM-sdl/projectM_SDL_main.cpp @@ -58,54 +58,50 @@ std::string getConfigFilePath(std::string datadir_path) struct stat sb; const char *path = datadir_path.c_str(); - SDL_LogInfo( - SDL_LOG_CATEGORY_APPLICATION, "Looking for configuration file in data directory: %s\n", path); + // first check if settings file is in DATA_DIR + std::string configFilePath = path; + std::string configFullPath = configFilePath; + configFullPath += "config.inp"; - std::string configFilePath = ""; - - // check if datadir exists. - // it should exist if this application was installed. if not, try the settings directory. - if (stat(path, &sb) != 0) + if (stat(configFullPath.c_str(), &sb) == 0) { + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Config: %s was found!\n", configFullPath.c_str()); + return configFilePath; + } + + // now check settings directories (windows / other) + configFilePath = ""; #ifdef WIN32 - configFilePath += getenv("APPDATA"); - configFilePath += "\\projectM\\config.inp"; + configFilePath += getenv("APPDATA"); + configFilePath += "\\projectM\\"; #else - configFilePath += getenv("home"); - configFilePath += "/.projectM/config.inp"; + configFilePath += getenv("home"); + configFilePath += "/.projectM/"; #endif - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, - "Looking for configuration file in settings directory: %s\n", configFilePath.c_str()); - } - else + + configFullPath = configFilePath + "config.inp"; + if (stat(configFullPath.c_str(), &sb) == 0) { - configFilePath = path; - configFilePath += "config.inp"; + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Config: %s was found!\n", configFullPath.c_str()); + return configFilePath; } - // check if settings config file exists. - // if not, assume we're developing it and use the current working directory. - if (stat(configFilePath.c_str(), &sb) != 0) - { - configFilePath = ""; + // finally try current working directory. + configFilePath = ""; #ifdef WIN32 - configFilePath += ".\\config.inp"; + configFilePath += ".\\"; #else - configFilePath += "./config.inp"; + configFilePath += "./"; #endif - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, - "Looking for configuration file in current working directory: %s\n", configFilePath.c_str()); - } - - // check if config file exists - if (stat(configFilePath.c_str(), &sb) != 0) + + configFullPath = configFilePath + "config.inp"; + if (stat(configFullPath.c_str(), &sb) == 0) { - SDL_LogWarn(SDL_LOG_CATEGORY_ERROR, "No config file %s found. Using development settings.\n", - configFilePath.c_str()); - return ""; + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Config: %s was found!\n", configFullPath.c_str()); + return configFilePath; } - - return configFilePath; + + return ""; } @@ -346,12 +342,14 @@ srand((int)(time(NULL))); projectMSDL *app; std::string base_path = DATADIR_PATH; - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Using data directory: %s\n", base_path.c_str()); - // load configuration file + // load configuration file folder (t might be different than DATADIR_PATH) std::string configFilePath = getConfigFilePath(base_path); - if (configFilePath.empty()) base_path = SDL_GetBasePath(); + if (configFilePath.empty()) base_path = SDL_GetBasePath(); // if no configfile was found, use SDL base path. + if (configFilePath != base_path) base_path = configFilePath; // if config file was found in a different directory than DATADIR_PATH, change base path to it. + + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Using data directory: %s\n", base_path.c_str()); // Get max refresh rate from attached displays to use as built-in max FPS. int i = 0; @@ -387,10 +385,10 @@ srand((int)(time(NULL))); // init with settings & config (if config was found) projectM::ConfigPreset configPreset; - configPreset.config_file = configFilePath; + configPreset.config_file = configFilePath + "config.inp"; configPreset.settings = settings; - app = new projectMSDL(settings, 0); + app = new projectMSDL(configPreset, 0); app->init(win, &glCtx); #if STEREOSCOPIC_SBS From db60b70712f277d7eecd40bee9c4a37f6cbe1016 Mon Sep 17 00:00:00 2001 From: "milkdropper.com" Date: Sat, 2 May 2020 20:54:27 +0400 Subject: [PATCH 5/7] remove directory stat check because program should do this check ahead of time (sdl does). empty check is good enough. --- src/libprojectM/projectM.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libprojectM/projectM.cpp b/src/libprojectM/projectM.cpp index 1a15326b09..a6ae7d27c1 100755 --- a/src/libprojectM/projectM.cpp +++ b/src/libprojectM/projectM.cpp @@ -140,8 +140,7 @@ projectM::projectM(ConfigPreset configPreset, int flags) _matcher(NULL), _merger(NULL) { - struct stat sb; - if (!configPreset.config_file.empty() && stat(configPreset.config_file.c_str(), &sb) == 0) + if (!configPreset.config_file.empty()) { readConfig(configPreset.config_file, configPreset.settings); } @@ -271,7 +270,7 @@ void projectM::readConfig (const std::string & configFile ) settings.easterEgg = 0.0; settings.softCutRatingsEnabled = 0; - settings.beatSensitivity = beatDetect->beat_sensitivity = 10.0; + settings.beatSensitivity = 10.0; settings.aspectCorrection = 1; From efe1643e992c8d11bb9978fe308b2e635e1aee5a Mon Sep 17 00:00:00 2001 From: "milkdropper.com" Date: Sat, 2 May 2020 20:58:04 +0400 Subject: [PATCH 6/7] Typo --- src/projectM-sdl/projectM_SDL_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/projectM-sdl/projectM_SDL_main.cpp b/src/projectM-sdl/projectM_SDL_main.cpp index cc435ff374..60bf1995c2 100644 --- a/src/projectM-sdl/projectM_SDL_main.cpp +++ b/src/projectM-sdl/projectM_SDL_main.cpp @@ -343,7 +343,7 @@ srand((int)(time(NULL))); std::string base_path = DATADIR_PATH; - // load configuration file folder (t might be different than DATADIR_PATH) + // load configuration file folder (it might be different than DATADIR_PATH) std::string configFilePath = getConfigFilePath(base_path); if (configFilePath.empty()) base_path = SDL_GetBasePath(); // if no configfile was found, use SDL base path. From 2c214c3af55c41b3771b114f1e77930b1d83b6d7 Mon Sep 17 00:00:00 2001 From: "milkdropper.com" Date: Sat, 2 May 2020 21:05:37 +0400 Subject: [PATCH 7/7] One bug fix based on changes to base_path handling. --- src/projectM-sdl/projectM_SDL_main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/projectM-sdl/projectM_SDL_main.cpp b/src/projectM-sdl/projectM_SDL_main.cpp index 60bf1995c2..ca651710d3 100644 --- a/src/projectM-sdl/projectM_SDL_main.cpp +++ b/src/projectM-sdl/projectM_SDL_main.cpp @@ -385,7 +385,12 @@ srand((int)(time(NULL))); // init with settings & config (if config was found) projectM::ConfigPreset configPreset; - configPreset.config_file = configFilePath + "config.inp"; + if (!configFilePath.empty()) { + configPreset.config_file = configFilePath + "config.inp"; + } + else { + configPreset.config_file = ""; + } configPreset.settings = settings; app = new projectMSDL(configPreset, 0);