diff options
Diffstat (limited to 'src/yuzu_cmd/yuzu.cpp')
-rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 8198cde16..14bf82f39 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -62,7 +62,8 @@ static void PrintHelp(const char* argv0) { "-f, --fullscreen Start in fullscreen mode\n" "-h, --help Display this help and exit\n" "-v, --version Output version information and exit\n" - "-p, --program Pass following string as arguments to executable\n"; + "-p, --program Pass following string as arguments to executable\n" + "-c, --config Load the specified configuration file\n"; } static void PrintVersion() { @@ -74,7 +75,6 @@ int main(int argc, char** argv) { Common::Log::Initialize(); Common::Log::SetColorConsoleBackendEnabled(true); Common::DetachedTasks detached_tasks; - Config config; int option_index = 0; #ifdef _WIN32 @@ -87,19 +87,24 @@ int main(int argc, char** argv) { } #endif std::string filepath; + std::optional<std::string> config_path; + std::string program_args; bool fullscreen = false; static struct option long_options[] = { + // clang-format off {"fullscreen", no_argument, 0, 'f'}, {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, {"program", optional_argument, 0, 'p'}, + {"config", required_argument, 0, 'c'}, {0, 0, 0, 0}, + // clang-format on }; while (optind < argc) { - int arg = getopt_long(argc, argv, "g:fhvp::", long_options, &option_index); + int arg = getopt_long(argc, argv, "g:fhvp::c:", long_options, &option_index); if (arg != -1) { switch (static_cast<char>(arg)) { case 'f': @@ -113,9 +118,12 @@ int main(int argc, char** argv) { PrintVersion(); return 0; case 'p': - Settings::values.program_args = argv[optind]; + program_args = argv[optind]; ++optind; break; + case 'c': + config_path = optarg; + break; } } else { #ifdef _WIN32 @@ -127,6 +135,12 @@ int main(int argc, char** argv) { } } + Config config{config_path}; + + if (!program_args.empty()) { + Settings::values.program_args = program_args; + } + #ifdef _WIN32 LocalFree(argv_w); #endif |