summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-01-11 03:53:04 +0100
committerGitHub <noreply@github.com>2021-01-11 03:53:04 +0100
commit46cd71d1c773c29cce8b48e7e2b478bdf6d77085 (patch)
tree3a80c21c004c3f2b9eeb9180c52c810a9635fdbb
parentMerge pull request #5324 from Morph1984/docked-default (diff)
parentyuzu/main: Add basic command line arguments (diff)
downloadyuzu-46cd71d1c773c29cce8b48e7e2b478bdf6d77085.tar
yuzu-46cd71d1c773c29cce8b48e7e2b478bdf6d77085.tar.gz
yuzu-46cd71d1c773c29cce8b48e7e2b478bdf6d77085.tar.bz2
yuzu-46cd71d1c773c29cce8b48e7e2b478bdf6d77085.tar.lz
yuzu-46cd71d1c773c29cce8b48e7e2b478bdf6d77085.tar.xz
yuzu-46cd71d1c773c29cce8b48e7e2b478bdf6d77085.tar.zst
yuzu-46cd71d1c773c29cce8b48e7e2b478bdf6d77085.zip
-rw-r--r--src/yuzu/main.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 2c10160c8..2e74037d1 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -292,12 +292,48 @@ GMainWindow::GMainWindow()
connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor);
connect(ui.menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor);
+ MigrateConfigFiles();
+
+ ui.action_Fullscreen->setChecked(false);
+
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() {