mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
Add cli parameter to override default settings file (#1375)
* Add cli parameter to specify alternate settings file * fix issue with error message string parameter
This commit is contained in:
parent
35fdae0d95
commit
f7b0c0f493
|
@ -225,6 +225,8 @@ static void PrintCommandLineHelp(const char* progname, const char* frontend_name
|
|||
std::fprintf(stderr, " -nocontroller: Prevents the emulator from polling for controllers.\n"
|
||||
" Try this option if you're having difficulties starting\n"
|
||||
" the emulator.\n");
|
||||
std::fprintf(stderr, " -settings <filename>: Loads a custom settings configuration from the\n"
|
||||
" specified filename. Default settings applied if file not found.\n");
|
||||
std::fprintf(stderr, " --: Signals that no more arguments will follow and the remaining\n"
|
||||
" parameters make up the filename. Use when the filename contains\n"
|
||||
" spaces or starts with a dash.\n");
|
||||
|
@ -323,6 +325,11 @@ bool CommonHostInterface::ParseCommandLineParameters(int argc, char* argv[],
|
|||
state_index = -1;
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG_PARAM("-settings"))
|
||||
{
|
||||
m_settings_filename = argv[++i];
|
||||
continue;
|
||||
}
|
||||
else if (CHECK_ARG("--"))
|
||||
{
|
||||
no_more_args = true;
|
||||
|
@ -1956,6 +1963,17 @@ bool CommonHostInterface::SaveInputProfile(const char* profile_path, SettingsInt
|
|||
|
||||
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");
|
||||
}
|
||||
|
||||
|
|
|
@ -345,6 +345,8 @@ protected:
|
|||
std::deque<OSDMessage> m_osd_messages;
|
||||
std::mutex m_osd_messages_lock;
|
||||
|
||||
std::string m_settings_filename;
|
||||
|
||||
bool m_frame_step_request = false;
|
||||
bool m_fast_forward_enabled = false;
|
||||
bool m_timer_resolution_increased = false;
|
||||
|
|
Loading…
Reference in a new issue