From 7241876cc70a4d7c2170524515959689273c3f2b Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 12 Mar 2021 03:02:57 +1000 Subject: [PATCH] CommonHostInterface: Fix -settings on cmdline not applying --- src/frontend-common/common_host_interface.cpp | 23 ++++++++----------- src/frontend-common/common_host_interface.h | 1 - 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp index a81745c04..365b6b0ed 100644 --- a/src/frontend-common/common_host_interface.cpp +++ b/src/frontend-common/common_host_interface.cpp @@ -56,6 +56,8 @@ Log_SetChannel(CommonHostInterface); +static std::string s_settings_filename; + CommonHostInterface::CommonHostInterface() = default; CommonHostInterface::~CommonHostInterface() = default; @@ -367,7 +369,7 @@ bool CommonHostInterface::ParseCommandLineParameters(int argc, char* argv[], } else if (CHECK_ARG_PARAM("-settings")) { - m_settings_filename = argv[++i]; + s_settings_filename = argv[++i]; continue; } else if (CHECK_ARG("--")) @@ -2367,18 +2369,13 @@ bool CommonHostInterface::SaveInputProfile(const char* profile_path) std::string CommonHostInterface::GetSettingsFileName() const { - if (!m_settings_filename.empty()) - { - if (!FileSystem::FileExists(m_settings_filename.c_str())) - { - Log_ErrorPrintf("Could not find settings file %s, using default", m_settings_filename.c_str()); - } - else - { - return GetUserDirectoryRelativePath(m_settings_filename.c_str()); - } - } - return GetUserDirectoryRelativePath("settings.ini"); + std::string filename; + if (!s_settings_filename.empty()) + filename = s_settings_filename; + else + filename = GetUserDirectoryRelativePath("settings.ini"); + + return filename; } std::string CommonHostInterface::GetGameSaveStateFileName(const char* game_code, s32 slot) const diff --git a/src/frontend-common/common_host_interface.h b/src/frontend-common/common_host_interface.h index 6fb1dcc82..cd835188a 100644 --- a/src/frontend-common/common_host_interface.h +++ b/src/frontend-common/common_host_interface.h @@ -418,7 +418,6 @@ protected: void DoFrameStep(); void DoToggleCheats(); - std::string m_settings_filename; std::unique_ptr m_settings_interface; std::recursive_mutex m_settings_mutex;