diff options
author | bunnei <bunneidev@gmail.com> | 2021-03-31 00:01:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-31 00:01:33 +0200 |
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 yuzu-eeea426c745e26f20f1cf6c6929c377897ef3e68.tar.gz yuzu-eeea426c745e26f20f1cf6c6929c377897ef3e68.tar.bz2 yuzu-eeea426c745e26f20f1cf6c6929c377897ef3e68.tar.lz yuzu-eeea426c745e26f20f1cf6c6929c377897ef3e68.tar.xz yuzu-eeea426c745e26f20f1cf6c6929c377897ef3e68.tar.zst yuzu-eeea426c745e26f20f1cf6c6929c377897ef3e68.zip |
Diffstat (limited to '')
-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() continue; } + // Launch game with a specific user + if (args[i] == QStringLiteral("-u")) { + if (i >= args.size() - 1) { + continue; + } + + if (args[i + 1].startsWith(QChar::fromLatin1('-'))) { + continue; + } + + bool argument_ok; + const std::size_t selected_user = args[++i].toUInt(&argument_ok); + + if (!argument_ok) { + LOG_ERROR(Frontend, "Invalid user argument"); + continue; + } + + const Service::Account::ProfileManager manager; + if (!manager.UserExistsIndex(selected_user)) { + LOG_ERROR(Frontend, "Selected user doesn't exist"); + continue; + } + + Settings::values.current_user = selected_user; + continue; + } + // Launch game at path if (args[i] == QStringLiteral("-g")) { if (i >= args.size() - 1) { |