summaryrefslogtreecommitdiff
path: root/src/citra/citra.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra/citra.cpp')
-rw-r--r--src/citra/citra.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index b12369136..3a1fbe3f7 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -36,25 +36,43 @@
36 36
37static void PrintHelp() 37static 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
43int main(int argc, char **argv) { 45int main(int argc, char **argv) {
46 Config config;
44 int option_index = 0; 47 int option_index = 0;
48 bool use_gdbstub = Settings::values.use_gdbstub;
49 u32 gdb_port = static_cast<u32>(Settings::values.gdbstub_port);
50 char *endarg;
45 std::string boot_filename; 51 std::string boot_filename;
52
46 static struct option long_options[] = { 53 static struct option long_options[] = {
47 { "help", no_argument, 0, 'h' }, 54 { "help", no_argument, 0, 'h' },
55 { "gdbport", required_argument, 0, 'g' },
48 { 0, 0, 0, 0 } 56 { 0, 0, 0, 0 }
49 }; 57 };
50 58
51 while (optind < argc) { 59 while (optind < argc) {
52 char arg = getopt_long(argc, argv, ":h", long_options, &option_index); 60 char arg = getopt_long(argc, argv, ":hg:", long_options, &option_index);
53 if (arg != -1) { 61 if (arg != -1) {
54 switch (arg) { 62 switch (arg) {
55 case 'h': 63 case 'h':
56 PrintHelp(); 64 PrintHelp();
57 return 0; 65 return 0;
66 case 'g':
67 errno = 0;
68 gdb_port = strtoul(optarg, &endarg, 0);
69 use_gdbstub = true;
70 if (endarg == optarg) errno = EINVAL;
71 if (errno != 0) {
72 perror("--gdbport");
73 exit(1);
74 }
75 break;
58 } 76 }
59 } else { 77 } else {
60 boot_filename = argv[optind]; 78 boot_filename = argv[optind];
@@ -73,11 +91,10 @@ int main(int argc, char **argv) {
73 return -1; 91 return -1;
74 } 92 }
75 93
76 Config config;
77 log_filter.ParseFilterString(Settings::values.log_filter); 94 log_filter.ParseFilterString(Settings::values.log_filter);
78 95
79 GDBStub::ToggleServer(Settings::values.use_gdbstub); 96 GDBStub::ToggleServer(use_gdbstub);
80 GDBStub::SetServerPort(static_cast<u32>(Settings::values.gdbstub_port)); 97 GDBStub::SetServerPort(gdb_port);
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