diff options
Diffstat (limited to 'src/citra/citra.cpp')
| -rw-r--r-- | src/citra/citra.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index b12369136..045c5fe8c 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp | |||
| @@ -36,25 +36,40 @@ | |||
| 36 | 36 | ||
| 37 | static void PrintHelp() | 37 | static void PrintHelp() |
| 38 | { | 38 | { |
| 39 | std::cout << "Usage: citra <filename>" << std::endl; | 39 | std::cout << "Usage: citra [options] <filename>" << std::endl; |
| 40 | std::cout << "--help, -h Display this information" << std::endl; | ||
| 41 | std::cout << "--gdbport, -g number Enable gdb stub on port number" << std::endl; | ||
| 40 | } | 42 | } |
| 41 | 43 | ||
| 42 | /// Application entry point | 44 | /// Application entry point |
| 43 | int main(int argc, char **argv) { | 45 | int main(int argc, char **argv) { |
| 44 | int option_index = 0; | 46 | int option_index = 0; |
| 47 | u32 gdb_port = 0; | ||
| 48 | char *endarg; | ||
| 45 | std::string boot_filename; | 49 | std::string boot_filename; |
| 50 | |||
| 46 | static struct option long_options[] = { | 51 | static struct option long_options[] = { |
| 47 | { "help", no_argument, 0, 'h' }, | 52 | { "help", no_argument, 0, 'h' }, |
| 53 | { "gdbport", required_argument, 0, 'g' }, | ||
| 48 | { 0, 0, 0, 0 } | 54 | { 0, 0, 0, 0 } |
| 49 | }; | 55 | }; |
| 50 | 56 | ||
| 51 | while (optind < argc) { | 57 | while (optind < argc) { |
| 52 | char arg = getopt_long(argc, argv, ":h", long_options, &option_index); | 58 | char arg = getopt_long(argc, argv, ":hg:", long_options, &option_index); |
| 53 | if (arg != -1) { | 59 | if (arg != -1) { |
| 54 | switch (arg) { | 60 | switch (arg) { |
| 55 | case 'h': | 61 | case 'h': |
| 56 | PrintHelp(); | 62 | PrintHelp(); |
| 57 | return 0; | 63 | return 0; |
| 64 | case 'g': | ||
| 65 | errno = 0; | ||
| 66 | gdb_port = strtoul(optarg, &endarg, 0); | ||
| 67 | if (endarg == optarg) errno = EINVAL; | ||
| 68 | if (errno != 0) { | ||
| 69 | perror("--gdbport"); | ||
| 70 | exit(1); | ||
| 71 | } | ||
| 72 | break; | ||
| 58 | } | 73 | } |
| 59 | } else { | 74 | } else { |
| 60 | boot_filename = argv[optind]; | 75 | boot_filename = argv[optind]; |
| @@ -76,8 +91,10 @@ int main(int argc, char **argv) { | |||
| 76 | Config config; | 91 | Config config; |
| 77 | log_filter.ParseFilterString(Settings::values.log_filter); | 92 | log_filter.ParseFilterString(Settings::values.log_filter); |
| 78 | 93 | ||
| 79 | GDBStub::ToggleServer(Settings::values.use_gdbstub); | 94 | if (gdb_port != 0) { |
| 80 | GDBStub::SetServerPort(static_cast<u32>(Settings::values.gdbstub_port)); | 95 | GDBStub::ToggleServer(true); |
| 96 | GDBStub::SetServerPort(gdb_port); | ||
| 97 | } | ||
| 81 | 98 | ||
| 82 | std::unique_ptr<EmuWindow_SDL2> emu_window = std::make_unique<EmuWindow_SDL2>(); | 99 | std::unique_ptr<EmuWindow_SDL2> emu_window = std::make_unique<EmuWindow_SDL2>(); |
| 83 | 100 | ||