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.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index 128b9a16d..7b387e258 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -2,10 +2,10 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <string>
6#include <thread>
7#include <iostream> 5#include <iostream>
8#include <memory> 6#include <memory>
7#include <string>
8#include <thread>
9 9
10// 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
11#include "common/microprofile.h" 11#include "common/microprofile.h"
@@ -13,53 +13,51 @@
13#ifdef _MSC_VER 13#ifdef _MSC_VER
14#include <getopt.h> 14#include <getopt.h>
15#else 15#else
16#include <unistd.h>
17#include <getopt.h> 16#include <getopt.h>
17#include <unistd.h>
18#endif 18#endif
19 19
20#ifdef _WIN32 20#ifdef _WIN32
21#include <Windows.h> 21#include <Windows.h>
22#endif 22#endif
23 23
24#include "common/logging/log.h"
25#include "common/logging/backend.h" 24#include "common/logging/backend.h"
26#include "common/logging/filter.h" 25#include "common/logging/filter.h"
26#include "common/logging/log.h"
27#include "common/scm_rev.h" 27#include "common/scm_rev.h"
28#include "common/scope_exit.h" 28#include "common/scope_exit.h"
29#include "common/string_util.h" 29#include "common/string_util.h"
30 30
31#include "core/settings.h"
32#include "core/system.h"
33#include "core/core.h" 31#include "core/core.h"
34#include "core/gdbstub/gdbstub.h" 32#include "core/gdbstub/gdbstub.h"
35#include "core/loader/loader.h" 33#include "core/loader/loader.h"
34#include "core/settings.h"
35#include "core/system.h"
36 36
37#include "citra/config.h" 37#include "citra/config.h"
38#include "citra/emu_window/emu_window_sdl2.h" 38#include "citra/emu_window/emu_window_sdl2.h"
39 39
40#include "video_core/video_core.h" 40#include "video_core/video_core.h"
41 41
42 42static void PrintHelp(const char* argv0) {
43static void PrintHelp(const char *argv0) 43 std::cout << "Usage: " << argv0
44{ 44 << " [options] <filename>\n"
45 std::cout << "Usage: " << argv0 << " [options] <filename>\n"
46 "-g, --gdbport=NUMBER Enable gdb stub on port NUMBER\n" 45 "-g, --gdbport=NUMBER Enable gdb stub on port NUMBER\n"
47 "-h, --help Display this help and exit\n" 46 "-h, --help Display this help and exit\n"
48 "-v, --version Output version information and exit\n"; 47 "-v, --version Output version information and exit\n";
49} 48}
50 49
51static void PrintVersion() 50static void PrintVersion() {
52{
53 std::cout << "Citra " << Common::g_scm_branch << " " << Common::g_scm_desc << std::endl; 51 std::cout << "Citra " << Common::g_scm_branch << " " << Common::g_scm_desc << std::endl;
54} 52}
55 53
56/// Application entry point 54/// Application entry point
57int main(int argc, char **argv) { 55int main(int argc, char** argv) {
58 Config config; 56 Config config;
59 int option_index = 0; 57 int option_index = 0;
60 bool use_gdbstub = Settings::values.use_gdbstub; 58 bool use_gdbstub = Settings::values.use_gdbstub;
61 u32 gdb_port = static_cast<u32>(Settings::values.gdbstub_port); 59 u32 gdb_port = static_cast<u32>(Settings::values.gdbstub_port);
62 char *endarg; 60 char* endarg;
63#ifdef _WIN32 61#ifdef _WIN32
64 int argc_w; 62 int argc_w;
65 auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w); 63 auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w);
@@ -71,12 +69,10 @@ int main(int argc, char **argv) {
71#endif 69#endif
72 std::string boot_filename; 70 std::string boot_filename;
73 71
74 static struct option long_options[] = { 72 static struct option long_options[] = {{"gdbport", required_argument, 0, 'g'},
75 { "gdbport", required_argument, 0, 'g' }, 73 {"help", no_argument, 0, 'h'},
76 { "help", no_argument, 0, 'h' }, 74 {"version", no_argument, 0, 'v'},
77 { "version", no_argument, 0, 'v' }, 75 {0, 0, 0, 0}};
78 { 0, 0, 0, 0 }
79 };
80 76
81 while (optind < argc) { 77 while (optind < argc) {
82 char arg = getopt_long(argc, argv, "g:hv", long_options, &option_index); 78 char arg = getopt_long(argc, argv, "g:hv", long_options, &option_index);
@@ -86,7 +82,8 @@ int main(int argc, char **argv) {
86 errno = 0; 82 errno = 0;
87 gdb_port = strtoul(optarg, &endarg, 0); 83 gdb_port = strtoul(optarg, &endarg, 0);
88 use_gdbstub = true; 84 use_gdbstub = true;
89 if (endarg == optarg) errno = EINVAL; 85 if (endarg == optarg)
86 errno = EINVAL;
90 if (errno != 0) { 87 if (errno != 0) {
91 perror("--gdbport"); 88 perror("--gdbport");
92 exit(1); 89 exit(1);