diff options
Diffstat (limited to 'src/yuzu_cmd/yuzu.cpp')
| -rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 63 |
1 files changed, 42 insertions, 21 deletions
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 91133569d..7b6d49c63 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp | |||
| @@ -42,6 +42,8 @@ | |||
| 42 | #include <windows.h> | 42 | #include <windows.h> |
| 43 | 43 | ||
| 44 | #include <shellapi.h> | 44 | #include <shellapi.h> |
| 45 | |||
| 46 | #include "common/windows/timer_resolution.h" | ||
| 45 | #endif | 47 | #endif |
| 46 | 48 | ||
| 47 | #undef _UNICODE | 49 | #undef _UNICODE |
| @@ -62,13 +64,15 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; | |||
| 62 | static void PrintHelp(const char* argv0) { | 64 | static void PrintHelp(const char* argv0) { |
| 63 | std::cout << "Usage: " << argv0 | 65 | std::cout << "Usage: " << argv0 |
| 64 | << " [options] <filename>\n" | 66 | << " [options] <filename>\n" |
| 65 | "-m, --multiplayer=nick:password@address:port" | 67 | "-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" | 68 | "-f, --fullscreen Start in fullscreen mode\n" |
| 69 | "-g, --game File path of the game to load\n" | ||
| 68 | "-h, --help Display this help and exit\n" | 70 | "-h, --help Display this help and exit\n" |
| 69 | "-v, --version Output version information and exit\n" | 71 | "-m, --multiplayer=nick:password@address:port" |
| 72 | " Nickname, password, address and port for multiplayer\n" | ||
| 70 | "-p, --program Pass following string as arguments to executable\n" | 73 | "-p, --program Pass following string as arguments to executable\n" |
| 71 | "-c, --config Load the specified configuration file\n"; | 74 | "-u, --user Select a specific user profile from 0 to 7\n" |
| 75 | "-v, --version Output version information and exit\n"; | ||
| 72 | } | 76 | } |
| 73 | 77 | ||
| 74 | static void PrintVersion() { | 78 | static void PrintVersion() { |
| @@ -199,6 +203,7 @@ int main(int argc, char** argv) { | |||
| 199 | std::string filepath; | 203 | std::string filepath; |
| 200 | std::optional<std::string> config_path; | 204 | std::optional<std::string> config_path; |
| 201 | std::string program_args; | 205 | std::string program_args; |
| 206 | std::optional<int> selected_user; | ||
| 202 | 207 | ||
| 203 | bool use_multiplayer = false; | 208 | bool use_multiplayer = false; |
| 204 | bool fullscreen = false; | 209 | bool fullscreen = false; |
| @@ -209,20 +214,37 @@ int main(int argc, char** argv) { | |||
| 209 | 214 | ||
| 210 | static struct option long_options[] = { | 215 | static struct option long_options[] = { |
| 211 | // clang-format off | 216 | // clang-format off |
| 212 | {"multiplayer", required_argument, 0, 'm'}, | 217 | {"config", required_argument, 0, 'c'}, |
| 213 | {"fullscreen", no_argument, 0, 'f'}, | 218 | {"fullscreen", no_argument, 0, 'f'}, |
| 214 | {"help", no_argument, 0, 'h'}, | 219 | {"help", no_argument, 0, 'h'}, |
| 215 | {"version", no_argument, 0, 'v'}, | 220 | {"game", required_argument, 0, 'g'}, |
| 221 | {"multiplayer", required_argument, 0, 'm'}, | ||
| 216 | {"program", optional_argument, 0, 'p'}, | 222 | {"program", optional_argument, 0, 'p'}, |
| 217 | {"config", required_argument, 0, 'c'}, | 223 | {"user", required_argument, 0, 'u'}, |
| 224 | {"version", no_argument, 0, 'v'}, | ||
| 218 | {0, 0, 0, 0}, | 225 | {0, 0, 0, 0}, |
| 219 | // clang-format on | 226 | // clang-format on |
| 220 | }; | 227 | }; |
| 221 | 228 | ||
| 222 | while (optind < argc) { | 229 | while (optind < argc) { |
| 223 | int arg = getopt_long(argc, argv, "g:fhvp::c:", long_options, &option_index); | 230 | int arg = getopt_long(argc, argv, "g:fhvp::c:u:", long_options, &option_index); |
| 224 | if (arg != -1) { | 231 | if (arg != -1) { |
| 225 | switch (static_cast<char>(arg)) { | 232 | switch (static_cast<char>(arg)) { |
| 233 | case 'c': | ||
| 234 | config_path = optarg; | ||
| 235 | break; | ||
| 236 | case 'f': | ||
| 237 | fullscreen = true; | ||
| 238 | LOG_INFO(Frontend, "Starting in fullscreen mode..."); | ||
| 239 | break; | ||
| 240 | case 'h': | ||
| 241 | PrintHelp(argv[0]); | ||
| 242 | return 0; | ||
| 243 | case 'g': { | ||
| 244 | const std::string str_arg(optarg); | ||
| 245 | filepath = str_arg; | ||
| 246 | break; | ||
| 247 | } | ||
| 226 | case 'm': { | 248 | case 'm': { |
| 227 | use_multiplayer = true; | 249 | use_multiplayer = true; |
| 228 | const std::string str_arg(optarg); | 250 | const std::string str_arg(optarg); |
| @@ -255,23 +277,16 @@ int main(int argc, char** argv) { | |||
| 255 | } | 277 | } |
| 256 | break; | 278 | break; |
| 257 | } | 279 | } |
| 258 | case 'f': | ||
| 259 | fullscreen = true; | ||
| 260 | LOG_INFO(Frontend, "Starting in fullscreen mode..."); | ||
| 261 | break; | ||
| 262 | case 'h': | ||
| 263 | PrintHelp(argv[0]); | ||
| 264 | return 0; | ||
| 265 | case 'v': | ||
| 266 | PrintVersion(); | ||
| 267 | return 0; | ||
| 268 | case 'p': | 280 | case 'p': |
| 269 | program_args = argv[optind]; | 281 | program_args = argv[optind]; |
| 270 | ++optind; | 282 | ++optind; |
| 271 | break; | 283 | break; |
| 272 | case 'c': | 284 | case 'u': |
| 273 | config_path = optarg; | 285 | selected_user = atoi(optarg); |
| 274 | break; | 286 | break; |
| 287 | case 'v': | ||
| 288 | PrintVersion(); | ||
| 289 | return 0; | ||
| 275 | } | 290 | } |
| 276 | } else { | 291 | } else { |
| 277 | #ifdef _WIN32 | 292 | #ifdef _WIN32 |
| @@ -295,8 +310,14 @@ int main(int argc, char** argv) { | |||
| 295 | Settings::values.program_args = program_args; | 310 | Settings::values.program_args = program_args; |
| 296 | } | 311 | } |
| 297 | 312 | ||
| 313 | if (selected_user.has_value()) { | ||
| 314 | Settings::values.current_user = std::clamp(*selected_user, 0, 7); | ||
| 315 | } | ||
| 316 | |||
| 298 | #ifdef _WIN32 | 317 | #ifdef _WIN32 |
| 299 | LocalFree(argv_w); | 318 | LocalFree(argv_w); |
| 319 | |||
| 320 | Common::Windows::SetCurrentTimerResolutionToMaximum(); | ||
| 300 | #endif | 321 | #endif |
| 301 | 322 | ||
| 302 | MicroProfileOnThreadCreate("EmuThread"); | 323 | MicroProfileOnThreadCreate("EmuThread"); |
| @@ -388,7 +409,7 @@ int main(int argc, char** argv) { | |||
| 388 | 409 | ||
| 389 | if (Settings::values.use_disk_shader_cache.GetValue()) { | 410 | if (Settings::values.use_disk_shader_cache.GetValue()) { |
| 390 | system.Renderer().ReadRasterizer()->LoadDiskResources( | 411 | system.Renderer().ReadRasterizer()->LoadDiskResources( |
| 391 | system.GetCurrentProcessProgramID(), std::stop_token{}, | 412 | system.GetApplicationProcessProgramID(), std::stop_token{}, |
| 392 | [](VideoCore::LoadCallbackStage, size_t value, size_t total) {}); | 413 | [](VideoCore::LoadCallbackStage, size_t value, size_t total) {}); |
| 393 | } | 414 | } |
| 394 | 415 | ||