diff --git a/src/Common/Settings.cpp b/src/Common/Settings.cpp index 01ce14a18..1eb5f0eb6 100644 --- a/src/Common/Settings.cpp +++ b/src/Common/Settings.cpp @@ -38,8 +38,7 @@ #include "Settings.hpp" #include "CxbxKrnl/Emu.h" #include "CxbxKrnl/EmuShared.h" -#include -#include +#include // TODO: Implement Qt support when real CPU emulation is available. #ifndef QT_VERSION // NOTE: Non-Qt will be using current directory for data @@ -198,16 +197,8 @@ bool Settings::Init() #endif saveFile.append(szSettings_settings_file); - // If the config file does not exists, create a blank one - // We can't call Save here because that overrides default values with false! - if (!std::experimental::filesystem::exists(saveFile)) { - std::ofstream ofs(saveFile, std::ofstream::out); - ofs << "\n"; - ofs.close(); - } - - // Call LoadUserConfig, this will load the config, applying defaults for any missing fields - bRet = LoadUserConfig(); + // Call LoadConfig, this will load the config, applying defaults for any missing fields + bRet = LoadConfig(); if (!bRet) { MessageBox(nullptr, szSettings_setup_error, "Cxbx-Reloaded", MB_OK); @@ -245,9 +236,6 @@ bool Settings::LoadUserConfig() bool Settings::LoadFile(std::string file_path) { - bool bRet; - const char* si_data; - int iStatus; std::list si_list; std::list::iterator si_list_iterator; @@ -258,6 +246,17 @@ bool Settings::LoadFile(std::string file_path) } m_file_path = file_path; + return LoadConfig(); +} + +bool Settings::LoadConfig() +{ + bool bRet; + const char* si_data; + int iStatus; + std::list si_list; + std::list::iterator si_list_iterator; + // ==== GUI Begin =========== m_gui.CxbxDebugMode = (DebugMode)m_si.GetLongValue(section_gui, sect_gui_keys.CxbxDebugMode, /*Default=*/DM_NONE); diff --git a/src/Common/Settings.hpp b/src/Common/Settings.hpp index 20b22327d..43190bf9d 100644 --- a/src/Common/Settings.hpp +++ b/src/Common/Settings.hpp @@ -123,6 +123,7 @@ public: bool Init(); bool LoadUserConfig(); bool LoadFile(std::string file_path); + bool LoadConfig(); bool Save(std::string file_path = ""); void Delete(); void SyncToEmulator();