From daf108039778544bfe4672f17287b7b53833eafe Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 11 Jan 2023 19:30:07 +1000 Subject: [PATCH] Qt: Fix -portable CLI parameter --- src/duckstation-nogui/nogui_host.cpp | 17 +++++------------ src/duckstation-qt/qthost.cpp | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/duckstation-nogui/nogui_host.cpp b/src/duckstation-nogui/nogui_host.cpp index 820eebe4b..1921d117a 100644 --- a/src/duckstation-nogui/nogui_host.cpp +++ b/src/duckstation-nogui/nogui_host.cpp @@ -164,6 +164,10 @@ void NoGUIHost::SetResourcesDirectory() void NoGUIHost::SetDataDirectory() { + // Already set, e.g. by -portable. + if (!EmuFolders::DataRoot.empty()) + return; + if (ShouldUsePortableMode()) { EmuFolders::DataRoot = EmuFolders::AppRoot; @@ -1078,9 +1082,6 @@ void NoGUIHost::PrintCommandLineHelp(const char* progname) std::fprintf(stderr, " -fullscreen: Enters fullscreen mode immediately after starting.\n"); std::fprintf(stderr, " -nofullscreen: Prevents fullscreen mode from triggering if enabled.\n"); std::fprintf(stderr, " -portable: Forces \"portable mode\", data in same directory.\n"); - 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 : Loads a custom settings configuration from the\n" " specified filename. Default settings applied if file not found.\n"); std::fprintf(stderr, " -earlyconsole: Creates console as early as possible, for logging.\n"); @@ -1149,13 +1150,6 @@ bool NoGUIHost::ParseCommandLineParametersAndInitializeConfig(int argc, char* ar AutoBoot(autoboot)->override_fast_boot = false; continue; } - else if (CHECK_ARG("-nocontroller")) - { - Log_InfoPrintf("Command Line: Disabling controller support."); - // m_flags.disable_controller_interface = true; - Panic("Fixme"); - continue; - } else if (CHECK_ARG("-resume")) { state_index = -1; @@ -1196,8 +1190,7 @@ bool NoGUIHost::ParseCommandLineParametersAndInitializeConfig(int argc, char* ar else if (CHECK_ARG("-portable")) { Log_InfoPrintf("Command Line: Using portable mode."); - // SetUserDirectoryToProgramDirectory(); - Panic("Fixme"); + EmuFolders::DataRoot = EmuFolders::AppRoot; continue; } else if (CHECK_ARG_PARAM("-settings")) diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index 9b7d2e0f9..5346bc2d6 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -250,6 +250,10 @@ void QtHost::SetResourcesDirectory() void QtHost::SetDataDirectory() { + // Already set, e.g. by -portable. + if (!EmuFolders::DataRoot.empty()) + return; + if (ShouldUsePortableMode()) { EmuFolders::DataRoot = EmuFolders::AppRoot; @@ -1884,9 +1888,6 @@ void QtHost::PrintCommandLineHelp(const char* progname) std::fprintf(stderr, " -nogui: Disables main window from being shown, exits on shutdown.\n"); std::fprintf(stderr, " -bigpicture: Automatically starts big picture UI.\n"); std::fprintf(stderr, " -portable: Forces \"portable mode\", data in same directory.\n"); - 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 : Loads a custom settings configuration from the\n" " specified filename. Default settings applied if file not found.\n"); std::fprintf(stderr, " -earlyconsole: Creates console as early as possible, for logging.\n"); @@ -1966,13 +1967,6 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app, AutoBoot(autoboot)->override_fast_boot = false; continue; } - else if (CHECK_ARG("-nocontroller")) - { - Log_InfoPrintf("Command Line: Disabling controller support."); - // m_flags.disable_controller_interface = true; - Panic("Fixme"); - continue; - } else if (CHECK_ARG("-resume")) { state_index = -1; @@ -2007,8 +2001,7 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app, else if (CHECK_ARG("-portable")) { Log_InfoPrintf("Command Line: Using portable mode."); - // SetUserDirectoryToProgramDirectory(); - Panic("Fixme"); + EmuFolders::DataRoot = EmuFolders::AppRoot; continue; } else if (CHECK_ARG_PARAM("-settings"))