forked from ShuriZma/suyu
1
0
Fork 0

Merge pull request #5229 from Morph1984/fullscreen-opt

yuzu/main: Add basic command line arguments
This commit is contained in:
bunnei 2021-01-10 18:53:04 -08:00 committed by GitHub
commit 46cd71d1c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 39 additions and 3 deletions

View File

@ -292,12 +292,48 @@ GMainWindow::GMainWindow()
connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor); connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor);
connect(ui.menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor); connect(ui.menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor);
MigrateConfigFiles();
ui.action_Fullscreen->setChecked(false);
QStringList args = QApplication::arguments(); QStringList args = QApplication::arguments();
if (args.length() >= 2) {
BootGame(args[1]); if (args.size() < 2) {
return;
} }
MigrateConfigFiles(); QString game_path;
for (int i = 1; i < args.size(); ++i) {
// Preserves drag/drop functionality
if (args.size() == 2 && !args[1].startsWith(QChar::fromLatin1('-'))) {
game_path = args[1];
break;
}
// Launch game in fullscreen mode
if (args[i] == QStringLiteral("-f")) {
ui.action_Fullscreen->setChecked(true);
continue;
}
// Launch game at path
if (args[i] == QStringLiteral("-g")) {
if (i >= args.size() - 1) {
continue;
}
if (args[i + 1].startsWith(QChar::fromLatin1('-'))) {
continue;
}
game_path = args[++i];
}
}
if (!game_path.isEmpty()) {
BootGame(game_path);
}
} }
GMainWindow::~GMainWindow() { GMainWindow::~GMainWindow() {