From eebb4bd91ead34606c85237730d3514b09a3ab2a Mon Sep 17 00:00:00 2001 From: lizzie Date: Sat, 25 Jul 2026 22:20:31 +0200 Subject: [PATCH] [eden-cli] add extra CLI options -n/-x/-s (#4173) from wasm PR: - `--null-render/-n`: Forces the usage of the "Null" render backend irrespective of settings. - `--filter/-x`: Sets the debug log filter irrespective of settings. - `--singlecore/-s`: Forces single-core regardless of settings. Signed-off-by: lizzie Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4173 Reviewed-by: MaranBr Reviewed-by: Maufeat --- docs/user/CommandLine.md | 3 +++ src/yuzu_cmd/yuzu.cpp | 42 ++++++++++++++++++++++++++++++---------- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/docs/user/CommandLine.md b/docs/user/CommandLine.md index 6e1f0f237c..51542115e3 100644 --- a/docs/user/CommandLine.md +++ b/docs/user/CommandLine.md @@ -27,3 +27,6 @@ There are two main applications, an SDL-based app (`eden-cli`) and a Qt based ap - `--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). +- `--null-render/-n`: Forces the usage of the "Null" render backend irrespective of settings. +- `--filter/-x`: Sets the debug log filter irrespective of settings. +- `--singlecore/-s`: Forces single-core regardless of settings. diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 6b33ca1b67..d0dcae1561 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -191,7 +191,6 @@ int main(int argc, char** argv) { #ifdef _WIN32 int argc_w; auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w); - if (argv_w == nullptr) { LOG_CRITICAL(Frontend, "Failed to get command line arguments"); return -1; @@ -204,10 +203,13 @@ int main(int argc, char** argv) { std::optional override_gdb_port{}; bool use_multiplayer = false; bool fullscreen = false; + bool force_null_render = false; + bool force_single_core = false; std::string nickname{}; std::string password{}; std::string address{}; std::string input_profile{}; + std::optional log_filter{}; u16 port = Network::DefaultRoomPort; static struct option long_options[] = { @@ -222,6 +224,9 @@ int main(int argc, char** argv) { {"user", required_argument, 0, 'u'}, {"version", no_argument, 0, 'v'}, {"input-profile", no_argument, 0, 'i'}, + {"null-render", no_argument, 0, 'n'}, + {"singlecore", no_argument, 0, 's'}, + {"filter", no_argument, 0, 'x'}, {0, 0, 0, 0}, // clang-format on }; @@ -259,7 +264,7 @@ int main(int argc, char** argv) { if (!std::regex_match(str_arg, re)) { std::cout << "Wrong format for option --multiplayer\n"; PrintHelp(argv[0]); - return 0; + return -1; } std::smatch match; @@ -269,17 +274,16 @@ int main(int argc, char** argv) { password = match[2]; address = match[3]; if (!match[4].str().empty()) { - port = static_cast(std::strtoul(match[4].str().c_str(), nullptr, 0)); + port = u16(std::strtoul(match[4].str().c_str(), nullptr, 0)); } std::regex nickname_re("^[a-zA-Z0-9._\\- ]+$"); if (!std::regex_match(nickname, nickname_re)) { - std::cout - << "Nickname is not valid. Must be 4 to 20 alphanumeric characters.\n"; - return 0; + LOG_ERROR(Frontend, "Nickname is not valid. Must be 4 to 20 alphanumeric characters"); + return -1; } if (address.empty()) { - std::cout << "Address to room must not be empty.\n"; - return 0; + LOG_ERROR(Frontend, "Address to room must not be empty"); + return -1; } break; } @@ -292,7 +296,17 @@ int main(int argc, char** argv) { break; case 'v': PrintVersion(); - return 0; + return -1; + case 'n': + force_null_render = true; + break; + case 's': + force_single_core = true; + break; + case 'x': + log_filter = argv[optind]; + ++optind; + break; } } else { #ifdef _WIN32 @@ -309,7 +323,7 @@ int main(int argc, char** argv) { // apply the log_filter setting // the logger was initialized before and doesn't pick up the filter on its own Common::Log::Filter filter; - filter.ParseFilterString(Settings::values.log_filter.GetValue()); + filter.ParseFilterString(log_filter.value_or(Settings::values.log_filter.GetValue())); Common::Log::SetGlobalFilter(filter); if (!program_args.empty()) { @@ -330,6 +344,14 @@ int main(int argc, char** argv) { Settings::values.gdbstub_port = *override_gdb_port; } + if (force_single_core) { + Settings::values.use_multi_core = false; + } + + if (force_null_render) { + Settings::values.renderer_backend = Settings::RendererBackend::Null; + } + #ifdef _WIN32 LocalFree(argv_w); #endif