From 379f264aa8b7dce66f68cf38bfafa57616f3804e Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 27 Oct 2019 19:03:10 +0100 Subject: Disable render to main when using batch mode https://bugs.dolphin-emu.org/issues/11888 This also includes another change: DolphinQt will now exit with an error if you use --batch without specifying a game using any method (unlike in the past where --batch would be ignored if you didn't specify a game using --exec, even if you had used --nand-title). The main reason why I did this was because coding the alternative (ignoring --batch) would be annoying with render to main involved. --- Source/Core/UICommon/CommandLineParse.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Source/Core/UICommon/CommandLineParse.cpp') diff --git a/Source/Core/UICommon/CommandLineParse.cpp b/Source/Core/UICommon/CommandLineParse.cpp index 0794546db5..bf3a556a29 100644 --- a/Source/Core/UICommon/CommandLineParse.cpp +++ b/Source/Core/UICommon/CommandLineParse.cpp @@ -22,7 +22,7 @@ class CommandLineConfigLayerLoader final : public Config::ConfigLayerLoader { public: CommandLineConfigLayerLoader(const std::list& args, const std::string& video_backend, - const std::string& audio_backend) + const std::string& audio_backend, bool batch) : ConfigLayerLoader(Config::LayerType::CommandLine) { if (!video_backend.empty()) @@ -31,6 +31,11 @@ public: if (!audio_backend.empty()) m_values.emplace_back(Config::MAIN_DSP_HLE.location, ValueToString(audio_backend == "HLE")); + // Batch mode hides the main window, and render to main hides the render window. To avoid a + // situation where we would have no window at all, disable render to main when using batch mode. + if (batch) + m_values.emplace_back(Config::MAIN_RENDER_TO_MAIN.location, ValueToString(false)); + // Arguments are in the format of .
.=Value for (const auto& arg : args) { @@ -98,7 +103,7 @@ std::unique_ptr CreateParser(ParserOptions options) parser->add_option("-l", "--logger").action("store_true").help("Open the logger"); parser->add_option("-b", "--batch") .action("store_true") - .help("Run Dolphin without the user interface (Requires --exec)"); + .help("Run Dolphin without the user interface (Requires --exec or --nand-title)"); parser->add_option("-c", "--confirm").action("store_true").help("Set Confirm on Stop"); } @@ -120,7 +125,8 @@ static void AddConfigLayer(const optparse::Values& options) Config::AddLayer(std::make_unique( std::move(config_args), static_cast(options.get("video_backend")), - static_cast(options.get("audio_emulation")))); + static_cast(options.get("audio_emulation")), + static_cast(options.get("batch")))); } optparse::Values& ParseArguments(optparse::OptionParser* parser, int argc, char** argv) -- cgit v1.2.3