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/DolphinQt/Main.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'Source/Core/DolphinQt/Main.cpp') diff --git a/Source/Core/DolphinQt/Main.cpp b/Source/Core/DolphinQt/Main.cpp index 65cbd0360d..b54caae0b8 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") && options.is_set("exec")); + Settings::Instance().SetBatchModeEnabled(options.is_set("batch")); // Hook up alerts from core Common::RegisterMsgAlertHandler(QtMsgAlertHandler); @@ -152,12 +152,14 @@ int main(int argc, char* argv[]) &app, &Core::HostDispatchJobs); std::unique_ptr boot; + bool game_specified = false; if (options.is_set("exec")) { const std::list paths_list = options.all("exec"); const std::vector paths{std::make_move_iterator(std::begin(paths_list)), std::make_move_iterator(std::end(paths_list))}; boot = BootParameters::GenerateFromFile(paths); + game_specified = true; } else if (options.is_set("nand_title")) { @@ -171,14 +173,30 @@ int main(int argc, char* argv[]) { ModalMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Invalid title ID.")); } + game_specified = true; } else if (!args.empty()) { boot = BootParameters::GenerateFromFile(args.front()); + game_specified = true; } int retval; + if (Settings::Instance().IsBatchModeEnabled() && !game_specified) + { + ModalMessageBox::critical( + nullptr, QObject::tr("Error"), + QObject::tr("Batch mode cannot be used without specifying a game to launch.")); + retval = 1; + } + else if (Settings::Instance().IsBatchModeEnabled() && !boot) + { + // A game to launch was specified, but it was invalid. + // An error has already been shown by code above, so exit without showing another error. + retval = 1; + } + else { DolphinAnalytics::Instance().ReportDolphinStart("qt"); -- cgit v1.2.3