diff options
| author | 2021-03-30 15:01:33 -0700 | |
|---|---|---|
| committer | 2021-03-30 15:01:33 -0700 | |
| commit | eeea426c745e26f20f1cf6c6929c377897ef3e68 (patch) | |
| tree | 8949fd213838a30e3494ebfc4195d4afa9cffb02 /src | |
| parent | Merge pull request #6124 from jbeich/vulkan+opengl (diff) | |
| parent | yuzu/main: Add user command line argument (diff) | |
| download | yuzu-eeea426c745e26f20f1cf6c6929c377897ef3e68.tar.gz yuzu-eeea426c745e26f20f1cf6c6929c377897ef3e68.tar.xz yuzu-eeea426c745e26f20f1cf6c6929c377897ef3e68.zip | |
Merge pull request #6116 from german77/userArgument
yuzu/main: Add user command line argument
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 24bfa4d34..06445b993 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -320,6 +320,34 @@ GMainWindow::GMainWindow() | |||
| 320 | continue; | 320 | continue; |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | // Launch game with a specific user | ||
| 324 | if (args[i] == QStringLiteral("-u")) { | ||
| 325 | if (i >= args.size() - 1) { | ||
| 326 | continue; | ||
| 327 | } | ||
| 328 | |||
| 329 | if (args[i + 1].startsWith(QChar::fromLatin1('-'))) { | ||
| 330 | continue; | ||
| 331 | } | ||
| 332 | |||
| 333 | bool argument_ok; | ||
| 334 | const std::size_t selected_user = args[++i].toUInt(&argument_ok); | ||
| 335 | |||
| 336 | if (!argument_ok) { | ||
| 337 | LOG_ERROR(Frontend, "Invalid user argument"); | ||
| 338 | continue; | ||
| 339 | } | ||
| 340 | |||
| 341 | const Service::Account::ProfileManager manager; | ||
| 342 | if (!manager.UserExistsIndex(selected_user)) { | ||
| 343 | LOG_ERROR(Frontend, "Selected user doesn't exist"); | ||
| 344 | continue; | ||
| 345 | } | ||
| 346 | |||
| 347 | Settings::values.current_user = selected_user; | ||
| 348 | continue; | ||
| 349 | } | ||
| 350 | |||
| 323 | // Launch game at path | 351 | // Launch game at path |
| 324 | if (args[i] == QStringLiteral("-g")) { | 352 | if (args[i] == QStringLiteral("-g")) { |
| 325 | if (i >= args.size() - 1) { | 353 | if (i >= args.size() - 1) { |