Merge pull request #8308 from CookiePLMonster/cmdline-headless

Make --batch run Dolphin headless
This commit is contained in:
Connor McLaughlin
2019-08-20 12:22:50 +10:00
committed by GitHub
3 changed files with 15 additions and 9 deletions

View File

@ -138,7 +138,7 @@ int main(int argc, char* argv[])
UICommon::CreateDirectories(); UICommon::CreateDirectories();
UICommon::Init(); UICommon::Init();
Resources::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 // Hook up alerts from core
Common::RegisterMsgAlertHandler(QtMsgAlertHandler); Common::RegisterMsgAlertHandler(QtMsgAlertHandler);
@ -217,8 +217,11 @@ int main(int argc, char* argv[])
} }
#endif #endif
auto* updater = new Updater(&win); if (!Settings::Instance().IsBatchModeEnabled())
updater->start(); {
auto* updater = new Updater(&win);
updater->start();
}
retval = app.exec(); retval = app.exec();
} }

View File

@ -1714,7 +1714,8 @@ void MainWindow::OnUpdateProgressDialog(QString title, int progress, int total)
void MainWindow::Show() 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 the booting of a game was requested on start up, do that now
if (m_pending_boot != nullptr) if (m_pending_boot != nullptr)

View File

@ -26,11 +26,10 @@ public:
: ConfigLayerLoader(Config::LayerType::CommandLine) : ConfigLayerLoader(Config::LayerType::CommandLine)
{ {
if (!video_backend.empty()) 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()) if (!audio_backend.empty())
m_values.emplace_back( m_values.emplace_back(Config::MAIN_DSP_HLE.location, ValueToString(audio_backend == "HLE"));
std::make_tuple(Config::MAIN_DSP_HLE.location, ValueToString(audio_backend == "HLE")));
// Arguments are in the format of <System>.<Section>.<Key>=Value // Arguments are in the format of <System>.<Section>.<Key>=Value
for (const auto& arg : args) for (const auto& arg : args)
@ -45,7 +44,8 @@ public:
if (system) if (system)
{ {
m_values.emplace_back( 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));
} }
} }
} }
@ -96,7 +96,9 @@ std::unique_ptr<optparse::OptionParser> CreateParser(ParserOptions options)
.action("store_true") .action("store_true")
.help("Show the debugger pane and additional View menu options"); .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("-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"); parser->add_option("-c", "--confirm").action("store_true").help("Set Confirm on Stop");
} }