From 80e8037e0b5e1894140cf4d7f8a1881df0428fe9 Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 11 Aug 2019 20:43:18 +0200 Subject: [PATCH 1/2] Truly use emplace_back in CommandLineConfigLayerLoader constructor --- Source/Core/UICommon/CommandLineParse.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/UICommon/CommandLineParse.cpp b/Source/Core/UICommon/CommandLineParse.cpp index 1a7f2bb82d..6eb94844d6 100644 --- a/Source/Core/UICommon/CommandLineParse.cpp +++ b/Source/Core/UICommon/CommandLineParse.cpp @@ -26,11 +26,10 @@ public: : ConfigLayerLoader(Config::LayerType::CommandLine) { if (!video_backend.empty()) - m_values.emplace_back(std::make_tuple(Config::MAIN_GFX_BACKEND.location, video_backend)); + m_values.emplace_back(Config::MAIN_GFX_BACKEND.location, video_backend); if (!audio_backend.empty()) - m_values.emplace_back( - std::make_tuple(Config::MAIN_DSP_HLE.location, ValueToString(audio_backend == "HLE"))); + m_values.emplace_back(Config::MAIN_DSP_HLE.location, ValueToString(audio_backend == "HLE")); // Arguments are in the format of .
.=Value for (const auto& arg : args) @@ -45,7 +44,8 @@ public: if (system) { m_values.emplace_back( - std::make_tuple(Config::ConfigLocation{*system, section, key}, value)); + Config::ConfigLocation{std::move(*system), std::move(section), std::move(key)}, + std::move(value)); } } } From b6df0bff939670ee209abb8817d1aa3bd7ded709 Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 11 Aug 2019 20:58:04 +0200 Subject: [PATCH 2/2] Make --batch run Dolphin in headless mode, provided --exec is also passed --- Source/Core/DolphinQt/Main.cpp | 9 ++++++--- Source/Core/DolphinQt/MainWindow.cpp | 3 ++- Source/Core/UICommon/CommandLineParse.cpp | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Source/Core/DolphinQt/Main.cpp b/Source/Core/DolphinQt/Main.cpp index ebbf53dd9e..411bc357e3 100644 --- a/Source/Core/DolphinQt/Main.cpp +++ b/Source/Core/DolphinQt/Main.cpp @@ -138,7 +138,7 @@ int main(int argc, char* argv[]) UICommon::CreateDirectories(); UICommon::Init(); Resources::Init(); - Settings::Instance().SetBatchModeEnabled(options.is_set("batch")); + Settings::Instance().SetBatchModeEnabled(options.is_set("batch") && options.is_set("exec")); // Hook up alerts from core Common::RegisterMsgAlertHandler(QtMsgAlertHandler); @@ -217,8 +217,11 @@ int main(int argc, char* argv[]) } #endif - auto* updater = new Updater(&win); - updater->start(); + if (!Settings::Instance().IsBatchModeEnabled()) + { + auto* updater = new Updater(&win); + updater->start(); + } retval = app.exec(); } diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index e8caad4791..745ecf0fd5 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -1714,7 +1714,8 @@ void MainWindow::OnUpdateProgressDialog(QString title, int progress, int total) void MainWindow::Show() { - QWidget::show(); + if (!Settings::Instance().IsBatchModeEnabled()) + QWidget::show(); // If the booting of a game was requested on start up, do that now if (m_pending_boot != nullptr) diff --git a/Source/Core/UICommon/CommandLineParse.cpp b/Source/Core/UICommon/CommandLineParse.cpp index 6eb94844d6..5a12d62997 100644 --- a/Source/Core/UICommon/CommandLineParse.cpp +++ b/Source/Core/UICommon/CommandLineParse.cpp @@ -96,7 +96,9 @@ std::unique_ptr CreateParser(ParserOptions options) .action("store_true") .help("Show the debugger pane and additional View menu options"); parser->add_option("-l", "--logger").action("store_true").help("Open the logger"); - parser->add_option("-b", "--batch").action("store_true").help("Exit Dolphin with emulation"); + parser->add_option("-b", "--batch") + .action("store_true") + .help("Run Dolphin without the user interface (Requires --exec)"); parser->add_option("-c", "--confirm").action("store_true").help("Set Confirm on Stop"); }