diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-09-30 14:28:17 -0400 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-10-07 14:32:32 -0400 |
commit | 081f5c1dbf8f7a40c801832f56adb5293e2bac1a (patch) | |
tree | 08f5e56dc68f2e4cc91b1ceb25237ecaa56de6ad /src/yuzu_cmd | |
parent | 8bbc12b9c24b67a08afd2df884da8fb664eb00be (diff) |
cmd: Support passing game arguments from command line
Uses -p (--program) and following string as args.
Diffstat (limited to 'src/yuzu_cmd')
-rw-r--r-- | src/yuzu_cmd/config.cpp | 1 | ||||
-rw-r--r-- | src/yuzu_cmd/yuzu.cpp | 19 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 9d934e220..2470f4640 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -138,6 +138,7 @@ void Config::ReadValues() { Settings::values.use_gdbstub = sdl2_config->GetBoolean("Debugging", "use_gdbstub", false); Settings::values.gdbstub_port = static_cast<u16>(sdl2_config->GetInteger("Debugging", "gdbstub_port", 24689)); + Settings::values.program_args = sdl2_config->Get("Debugging", "program_args", ""); // Web Service Settings::values.enable_telemetry = diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index 1d951ca3f..27aba95f6 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -56,9 +56,10 @@ static void PrintHelp(const char* argv0) { std::cout << "Usage: " << argv0 << " [options] <filename>\n" "-g, --gdbport=NUMBER Enable gdb stub on port NUMBER\n" - "-f, --fullscreen Start in fullscreen mode\n" + "-f, --fullscreen Start in fullscreen mode\n" "-h, --help Display this help and exit\n" - "-v, --version Output version information and exit\n"; + "-v, --version Output version information and exit\n" + "-p, --program Pass following string as arguments to executable\n"; } static void PrintVersion() { @@ -103,15 +104,13 @@ int main(int argc, char** argv) { bool fullscreen = false; static struct option long_options[] = { - {"gdbport", required_argument, 0, 'g'}, - {"fullscreen", no_argument, 0, 'f'}, - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'v'}, - {0, 0, 0, 0}, + {"gdbport", required_argument, 0, 'g'}, {"fullscreen", no_argument, 0, 'f'}, + {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, + {"program", optional_argument, 0, 'p'}, {0, 0, 0, 0}, }; while (optind < argc) { - char arg = getopt_long(argc, argv, "g:fhv", long_options, &option_index); + char arg = getopt_long(argc, argv, "g:fhvp::", long_options, &option_index); if (arg != -1) { switch (arg) { case 'g': @@ -135,6 +134,10 @@ int main(int argc, char** argv) { case 'v': PrintVersion(); return 0; + case 'p': + Settings::values.program_args = argv[optind]; + ++optind; + break; } } else { #ifdef _WIN32 |