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.cpp36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index 40e40f192..d6ad13f69 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -5,6 +5,7 @@
5#include <string> 5#include <string>
6#include <thread> 6#include <thread>
7#include <iostream> 7#include <iostream>
8#include <memory>
8 9
9// This needs to be included before getopt.h because the latter #defines symbols used by it 10// This needs to be included before getopt.h because the latter #defines symbols used by it
10#include "common/microprofile.h" 11#include "common/microprofile.h"
@@ -19,7 +20,6 @@
19#include "common/logging/log.h" 20#include "common/logging/log.h"
20#include "common/logging/backend.h" 21#include "common/logging/backend.h"
21#include "common/logging/filter.h" 22#include "common/logging/filter.h"
22#include "common/make_unique.h"
23#include "common/scope_exit.h" 23#include "common/scope_exit.h"
24 24
25#include "core/settings.h" 25#include "core/settings.h"
@@ -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,16 +91,14 @@ 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 // Apply the command line arguments
80 GDBStub::SetServerPort(static_cast<u32>(Settings::values.gdbstub_port)); 97 Settings::values.gdbstub_port = gdb_port;
81 98 Settings::values.use_gdbstub = use_gdbstub;
82 std::unique_ptr<EmuWindow_SDL2> emu_window = Common::make_unique<EmuWindow_SDL2>(); 99 Settings::Apply();
83 100
84 VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer; 101 std::unique_ptr<EmuWindow_SDL2> emu_window = std::make_unique<EmuWindow_SDL2>();
85 VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit;
86 102
87 System::Init(emu_window.get()); 103 System::Init(emu_window.get());
88 SCOPE_EXIT({ System::Shutdown(); }); 104 SCOPE_EXIT({ System::Shutdown(); });