diff options
Diffstat (limited to 'src/yuzu_cmd/yuzu.cpp')
| -rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 91133569d..d1f7b1d49 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp | |||
| @@ -62,13 +62,15 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; | |||
| 62 | static void PrintHelp(const char* argv0) { | 62 | static void PrintHelp(const char* argv0) { |
| 63 | std::cout << "Usage: " << argv0 | 63 | std::cout << "Usage: " << argv0 |
| 64 | << " [options] <filename>\n" | 64 | << " [options] <filename>\n" |
| 65 | "-m, --multiplayer=nick:password@address:port" | 65 | "-c, --config Load the specified configuration file\n" |
| 66 | " Nickname, password, address and port for multiplayer\n" | ||
| 67 | "-f, --fullscreen Start in fullscreen mode\n" | 66 | "-f, --fullscreen Start in fullscreen mode\n" |
| 67 | "-g, --game File path of the game to load\n" | ||
| 68 | "-h, --help Display this help and exit\n" | 68 | "-h, --help Display this help and exit\n" |
| 69 | "-v, --version Output version information and exit\n" | 69 | "-m, --multiplayer=nick:password@address:port" |
| 70 | " Nickname, password, address and port for multiplayer\n" | ||
| 70 | "-p, --program Pass following string as arguments to executable\n" | 71 | "-p, --program Pass following string as arguments to executable\n" |
| 71 | "-c, --config Load the specified configuration file\n"; | 72 | "-u, --user Select a specific user profile from 0 to 7\n" |
| 73 | "-v, --version Output version information and exit\n"; | ||
| 72 | } | 74 | } |
| 73 | 75 | ||
| 74 | static void PrintVersion() { | 76 | static void PrintVersion() { |
| @@ -199,6 +201,7 @@ int main(int argc, char** argv) { | |||
| 199 | std::string filepath; | 201 | std::string filepath; |
| 200 | std::optional<std::string> config_path; | 202 | std::optional<std::string> config_path; |
| 201 | std::string program_args; | 203 | std::string program_args; |
| 204 | std::optional<int> selected_user; | ||
| 202 | 205 | ||
| 203 | bool use_multiplayer = false; | 206 | bool use_multiplayer = false; |
| 204 | bool fullscreen = false; | 207 | bool fullscreen = false; |
| @@ -209,12 +212,14 @@ int main(int argc, char** argv) { | |||
| 209 | 212 | ||
| 210 | static struct option long_options[] = { | 213 | static struct option long_options[] = { |
| 211 | // clang-format off | 214 | // clang-format off |
| 212 | {"multiplayer", required_argument, 0, 'm'}, | 215 | {"config", required_argument, 0, 'c'}, |
| 213 | {"fullscreen", no_argument, 0, 'f'}, | 216 | {"fullscreen", no_argument, 0, 'f'}, |
| 214 | {"help", no_argument, 0, 'h'}, | 217 | {"help", no_argument, 0, 'h'}, |
| 215 | {"version", no_argument, 0, 'v'}, | 218 | {"game", required_argument, 0, 'g'}, |
| 219 | {"multiplayer", required_argument, 0, 'm'}, | ||
| 216 | {"program", optional_argument, 0, 'p'}, | 220 | {"program", optional_argument, 0, 'p'}, |
| 217 | {"config", required_argument, 0, 'c'}, | 221 | {"user", required_argument, 0, 'u'}, |
| 222 | {"version", no_argument, 0, 'v'}, | ||
| 218 | {0, 0, 0, 0}, | 223 | {0, 0, 0, 0}, |
| 219 | // clang-format on | 224 | // clang-format on |
| 220 | }; | 225 | }; |
| @@ -223,6 +228,21 @@ int main(int argc, char** argv) { | |||
| 223 | int arg = getopt_long(argc, argv, "g:fhvp::c:", long_options, &option_index); | 228 | int arg = getopt_long(argc, argv, "g:fhvp::c:", long_options, &option_index); |
| 224 | if (arg != -1) { | 229 | if (arg != -1) { |
| 225 | switch (static_cast<char>(arg)) { | 230 | switch (static_cast<char>(arg)) { |
| 231 | case 'c': | ||
| 232 | config_path = optarg; | ||
| 233 | break; | ||
| 234 | case 'f': | ||
| 235 | fullscreen = true; | ||
| 236 | LOG_INFO(Frontend, "Starting in fullscreen mode..."); | ||
| 237 | break; | ||
| 238 | case 'h': | ||
| 239 | PrintHelp(argv[0]); | ||
| 240 | return 0; | ||
| 241 | case 'g': { | ||
| 242 | const std::string str_arg(optarg); | ||
| 243 | filepath = str_arg; | ||
| 244 | break; | ||
| 245 | } | ||
| 226 | case 'm': { | 246 | case 'm': { |
| 227 | use_multiplayer = true; | 247 | use_multiplayer = true; |
| 228 | const std::string str_arg(optarg); | 248 | const std::string str_arg(optarg); |
| @@ -255,23 +275,16 @@ int main(int argc, char** argv) { | |||
| 255 | } | 275 | } |
| 256 | break; | 276 | break; |
| 257 | } | 277 | } |
| 258 | case 'f': | 278 | case 'p': |
| 259 | fullscreen = true; | 279 | program_args = argv[optind]; |
| 260 | LOG_INFO(Frontend, "Starting in fullscreen mode..."); | 280 | ++optind; |
| 261 | break; | 281 | break; |
| 262 | case 'h': | 282 | case 'u': |
| 263 | PrintHelp(argv[0]); | 283 | selected_user = atoi(optarg); |
| 264 | return 0; | 284 | return 0; |
| 265 | case 'v': | 285 | case 'v': |
| 266 | PrintVersion(); | 286 | PrintVersion(); |
| 267 | return 0; | 287 | return 0; |
| 268 | case 'p': | ||
| 269 | program_args = argv[optind]; | ||
| 270 | ++optind; | ||
| 271 | break; | ||
| 272 | case 'c': | ||
| 273 | config_path = optarg; | ||
| 274 | break; | ||
| 275 | } | 288 | } |
| 276 | } else { | 289 | } else { |
| 277 | #ifdef _WIN32 | 290 | #ifdef _WIN32 |
| @@ -295,6 +308,10 @@ int main(int argc, char** argv) { | |||
| 295 | Settings::values.program_args = program_args; | 308 | Settings::values.program_args = program_args; |
| 296 | } | 309 | } |
| 297 | 310 | ||
| 311 | if (selected_user.has_value()) { | ||
| 312 | Settings::values.current_user = std::clamp(*selected_user, 0, 7); | ||
| 313 | } | ||
| 314 | |||
| 298 | #ifdef _WIN32 | 315 | #ifdef _WIN32 |
| 299 | LocalFree(argv_w); | 316 | LocalFree(argv_w); |
| 300 | #endif | 317 | #endif |