diff options
| author | 2020-12-25 15:17:49 -0500 | |
|---|---|---|
| committer | 2020-12-25 15:41:00 -0500 | |
| commit | ff3aa5d3804db4deef3c4a1996a5bbc7d8bf202c (patch) | |
| tree | b38c8e07c64056927eda314929cf4d572db5d025 /src | |
| parent | Merge pull request #5226 from ReinUsesLisp/c4715-vc (diff) | |
| download | yuzu-ff3aa5d3804db4deef3c4a1996a5bbc7d8bf202c.tar.gz yuzu-ff3aa5d3804db4deef3c4a1996a5bbc7d8bf202c.tar.xz yuzu-ff3aa5d3804db4deef3c4a1996a5bbc7d8bf202c.zip | |
yuzu/main: Add basic command line arguments
The following command line arguments are supported:
yuzu.exe "path_to_game" - Launches a game at "path_to_game"
yuzu.exe -f - Launches the next game in fullscreen
yuzu.exe -g "path_to_game" - Launches a game at "path_to_game"
yuzu.exe -f -g "path_to_game" - Launches a game at "path_to_game" in fullscreen
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 7aa515226..ebaccd2ef 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -292,12 +292,48 @@ GMainWindow::GMainWindow() | |||
| 292 | connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor); | 292 | connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor); |
| 293 | connect(ui.menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor); | 293 | connect(ui.menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor); |
| 294 | 294 | ||
| 295 | MigrateConfigFiles(); | ||
| 296 | |||
| 297 | ui.action_Fullscreen->setChecked(false); | ||
| 298 | |||
| 295 | QStringList args = QApplication::arguments(); | 299 | QStringList args = QApplication::arguments(); |
| 296 | if (args.length() >= 2) { | 300 | |
| 297 | BootGame(args[1]); | 301 | if (args.size() < 2) { |
| 302 | return; | ||
| 298 | } | 303 | } |
| 299 | 304 | ||
| 300 | MigrateConfigFiles(); | 305 | QString game_path; |
| 306 | |||
| 307 | for (int i = 1; i < args.size(); ++i) { | ||
| 308 | // Preserves drag/drop functionality | ||
| 309 | if (args.size() == 2 && !args[1].startsWith(QChar::fromLatin1('-'))) { | ||
| 310 | game_path = args[1]; | ||
| 311 | break; | ||
| 312 | } | ||
| 313 | |||
| 314 | // Launch game in fullscreen mode | ||
| 315 | if (args[i] == QStringLiteral("-f")) { | ||
| 316 | ui.action_Fullscreen->setChecked(true); | ||
| 317 | continue; | ||
| 318 | } | ||
| 319 | |||
| 320 | // Launch game at path | ||
| 321 | if (args[i] == QStringLiteral("-g")) { | ||
| 322 | if (i >= args.size() - 1) { | ||
| 323 | continue; | ||
| 324 | } | ||
| 325 | |||
| 326 | if (args[i + 1].startsWith(QChar::fromLatin1('-'))) { | ||
| 327 | continue; | ||
| 328 | } | ||
| 329 | |||
| 330 | game_path = args[++i]; | ||
| 331 | } | ||
| 332 | } | ||
| 333 | |||
| 334 | if (!game_path.isEmpty()) { | ||
| 335 | BootGame(game_path); | ||
| 336 | } | ||
| 301 | } | 337 | } |
| 302 | 338 | ||
| 303 | GMainWindow::~GMainWindow() { | 339 | GMainWindow::~GMainWindow() { |