CommonHostInterface: Fix -settings on cmdline not applying

This commit is contained in:
Connor McLaughlin 2021-03-12 03:02:57 +10:00
parent 14a98c3c9e
commit 7241876cc7
2 changed files with 10 additions and 14 deletions

View file

@ -56,6 +56,8 @@
Log_SetChannel(CommonHostInterface); Log_SetChannel(CommonHostInterface);
static std::string s_settings_filename;
CommonHostInterface::CommonHostInterface() = default; CommonHostInterface::CommonHostInterface() = default;
CommonHostInterface::~CommonHostInterface() = default; CommonHostInterface::~CommonHostInterface() = default;
@ -367,7 +369,7 @@ bool CommonHostInterface::ParseCommandLineParameters(int argc, char* argv[],
} }
else if (CHECK_ARG_PARAM("-settings")) else if (CHECK_ARG_PARAM("-settings"))
{ {
m_settings_filename = argv[++i]; s_settings_filename = argv[++i];
continue; continue;
} }
else if (CHECK_ARG("--")) else if (CHECK_ARG("--"))
@ -2367,18 +2369,13 @@ bool CommonHostInterface::SaveInputProfile(const char* profile_path)
std::string CommonHostInterface::GetSettingsFileName() const std::string CommonHostInterface::GetSettingsFileName() const
{ {
if (!m_settings_filename.empty()) std::string filename;
{ if (!s_settings_filename.empty())
if (!FileSystem::FileExists(m_settings_filename.c_str())) filename = s_settings_filename;
{ else
Log_ErrorPrintf("Could not find settings file %s, using default", m_settings_filename.c_str()); filename = GetUserDirectoryRelativePath("settings.ini");
}
else return filename;
{
return GetUserDirectoryRelativePath(m_settings_filename.c_str());
}
}
return GetUserDirectoryRelativePath("settings.ini");
} }
std::string CommonHostInterface::GetGameSaveStateFileName(const char* game_code, s32 slot) const std::string CommonHostInterface::GetGameSaveStateFileName(const char* game_code, s32 slot) const

View file

@ -418,7 +418,6 @@ protected:
void DoFrameStep(); void DoFrameStep();
void DoToggleCheats(); void DoToggleCheats();
std::string m_settings_filename;
std::unique_ptr<SettingsInterface> m_settings_interface; std::unique_ptr<SettingsInterface> m_settings_interface;
std::recursive_mutex m_settings_mutex; std::recursive_mutex m_settings_mutex;