summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2016-04-20 09:58:46 -0400
committerGravatar bunnei2016-04-20 09:58:46 -0400
commit24bd57b6bf75bc853e4211c2023abc52ea651cd3 (patch)
treefa4639a97ef4447b5a6f41272a2f9888b302e07c /src
parentMerge pull request #1672 from wwylele/win-driver-fix (diff)
parentSDL2 Frontend: Use argv[0], add a --version, and reorder options. (diff)
downloadyuzu-24bd57b6bf75bc853e4211c2023abc52ea651cd3.tar.gz
yuzu-24bd57b6bf75bc853e4211c2023abc52ea651cd3.tar.xz
yuzu-24bd57b6bf75bc853e4211c2023abc52ea651cd3.zip
Merge pull request #1691 from linkmauve/improve-sdl-options
SDL2 Frontend: Use argv[0], add a --version, and reorder options
Diffstat (limited to 'src')
-rw-r--r--src/citra/citra.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index d6ad13f69..b4501eb2e 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -20,6 +20,7 @@
20#include "common/logging/log.h" 20#include "common/logging/log.h"
21#include "common/logging/backend.h" 21#include "common/logging/backend.h"
22#include "common/logging/filter.h" 22#include "common/logging/filter.h"
23#include "common/scm_rev.h"
23#include "common/scope_exit.h" 24#include "common/scope_exit.h"
24 25
25#include "core/settings.h" 26#include "core/settings.h"
@@ -34,11 +35,17 @@
34#include "video_core/video_core.h" 35#include "video_core/video_core.h"
35 36
36 37
37static void PrintHelp() 38static void PrintHelp(const char *argv0)
38{ 39{
39 std::cout << "Usage: citra [options] <filename>" << std::endl; 40 std::cout << "Usage: " << argv0 << " [options] <filename>\n"
40 std::cout << "--help, -h Display this information" << std::endl; 41 "-g, --gdbport=NUMBER Enable gdb stub on port NUMBER\n"
41 std::cout << "--gdbport, -g number Enable gdb stub on port number" << std::endl; 42 "-h, --help Display this help and exit\n"
43 "-v, --version Output version information and exit\n";
44}
45
46static void PrintVersion()
47{
48 std::cout << "Citra " << Common::g_scm_branch << " " << Common::g_scm_desc << std::endl;
42} 49}
43 50
44/// Application entry point 51/// Application entry point
@@ -51,18 +58,16 @@ int main(int argc, char **argv) {
51 std::string boot_filename; 58 std::string boot_filename;
52 59
53 static struct option long_options[] = { 60 static struct option long_options[] = {
54 { "help", no_argument, 0, 'h' },
55 { "gdbport", required_argument, 0, 'g' }, 61 { "gdbport", required_argument, 0, 'g' },
62 { "help", no_argument, 0, 'h' },
63 { "version", no_argument, 0, 'v' },
56 { 0, 0, 0, 0 } 64 { 0, 0, 0, 0 }
57 }; 65 };
58 66
59 while (optind < argc) { 67 while (optind < argc) {
60 char arg = getopt_long(argc, argv, ":hg:", long_options, &option_index); 68 char arg = getopt_long(argc, argv, "g:hv", long_options, &option_index);
61 if (arg != -1) { 69 if (arg != -1) {
62 switch (arg) { 70 switch (arg) {
63 case 'h':
64 PrintHelp();
65 return 0;
66 case 'g': 71 case 'g':
67 errno = 0; 72 errno = 0;
68 gdb_port = strtoul(optarg, &endarg, 0); 73 gdb_port = strtoul(optarg, &endarg, 0);
@@ -73,6 +78,12 @@ int main(int argc, char **argv) {
73 exit(1); 78 exit(1);
74 } 79 }
75 break; 80 break;
81 case 'h':
82 PrintHelp(argv[0]);
83 return 0;
84 case 'v':
85 PrintVersion();
86 return 0;
76 } 87 }
77 } else { 88 } else {
78 boot_filename = argv[optind]; 89 boot_filename = argv[optind];