From 2ea37c11427f607b8f2010681fbcb976042b8f87 Mon Sep 17 00:00:00 2001 From: lizzie Date: Fri, 6 Mar 2026 11:07:47 +0000 Subject: [PATCH] [frontend] allow to specify input profile name for first player on command line Signed-off-by: lizzie --- docs/user/CommandLine.md | 2 ++ src/yuzu/main_window.cpp | 3 +++ src/yuzu_cmd/yuzu.cpp | 15 +++++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/user/CommandLine.md b/docs/user/CommandLine.md index 4b3a5bdf58..cd98d88b19 100644 --- a/docs/user/CommandLine.md +++ b/docs/user/CommandLine.md @@ -7,6 +7,7 @@ There are two main applications, an SDL2 based app (`eden-cli`) and a Qt based a - `-g `: Alternate way to specify what to load, overrides. However let it be noted that arguments that use `-` will be treated as options/ignored, if your game, for some reason, starts with `-`, in order to safely handle it you may need to specify it as an argument. - `-f`: Use fullscreen. - `-u `: Select the index of the user to load as. +- `-input-profile `: Specifies input profile name to use (for player #0 only). - `-qlaunch`: Launch QLaunch. - `-setup`: Launch setup applet. @@ -20,3 +21,4 @@ There are two main applications, an SDL2 based app (`eden-cli`) and a Qt based a - `--program/-p`: Specify the program arguments to pass (optional). - `--user/-u`: Specify the user index. - `--version/-v`: Display version and quit. +- `--input-profile/-i`: Specifies input profile name to use (for player #0 only). diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index e02e02b413..06fa0a913b 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -665,6 +665,9 @@ MainWindow::MainWindow(bool has_broken_vulkan) // Launch game at path game_path = args[++i]; has_gamepath = true; + } else if (args[i] == QStringLiteral("-input-profile") && i < args.size() - 1) { + auto& players = Settings::values.players.GetValue(); + players[0].profile_name = args[++i].toStdString(); } else if (args[i] == QStringLiteral("-qlaunch")) { should_launch_qlaunch = true; } else if (args[i] == QStringLiteral("-setup")) { diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index b292b4886b..8124c91ea1 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: 2014 Citra Emulator Project @@ -208,6 +208,7 @@ int main(int argc, char** argv) { std::string nickname{}; std::string password{}; std::string address{}; + std::string input_profile{}; u16 port = Network::DefaultRoomPort; static struct option long_options[] = { @@ -221,12 +222,13 @@ int main(int argc, char** argv) { {"program", optional_argument, 0, 'p'}, {"user", required_argument, 0, 'u'}, {"version", no_argument, 0, 'v'}, + {"input-profile", no_argument, 0, 'i'}, {0, 0, 0, 0}, // clang-format on }; while (optind < argc) { - int arg = getopt_long(argc, argv, "g:fhvp::c:u:d:", long_options, &option_index); + int arg = getopt_long(argc, argv, "g:fhvcip::c:u:d:", long_options, &option_index); if (arg != -1) { switch (char(arg)) { case 'd': @@ -245,6 +247,10 @@ int main(int argc, char** argv) { case 'g': filepath = std::string(optarg); break; + case 'i': { + input_profile = std::string(optarg); + break; + } case 'm': { use_multiplayer = true; const std::string str_arg(optarg); @@ -311,6 +317,11 @@ int main(int argc, char** argv) { Settings::values.program_args = program_args; } + if (!input_profile.empty()) { + auto& players = Settings::values.players.GetValue(); + players[0].profile_name = input_profile; + } + if (selected_user.has_value()) { Settings::values.current_user = std::clamp(*selected_user, 0, 7); }