summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Greg Wicks2015-06-22 20:59:00 -0400
committerGravatar Greg Wicks2015-07-12 15:49:23 -0400
commit9930ef72ddaf8930a9bf3e574b7de69f73ecbf87 (patch)
tree30af5b4937f81d1ea7bb9148ec27e71d5501d345 /src
parentMerge pull request #823 from Subv/applets_drawing (diff)
downloadyuzu-9930ef72ddaf8930a9bf3e574b7de69f73ecbf87.tar.gz
yuzu-9930ef72ddaf8930a9bf3e574b7de69f73ecbf87.tar.xz
yuzu-9930ef72ddaf8930a9bf3e574b7de69f73ecbf87.zip
Implement new argument parsing using getopt and add the corresponding library to externals
Diffstat (limited to 'src')
-rw-r--r--src/citra/CMakeLists.txt5
-rw-r--r--src/citra/citra.cpp40
2 files changed, 42 insertions, 3 deletions
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt
index 5e8cbfa35..918687312 100644
--- a/src/citra/CMakeLists.txt
+++ b/src/citra/CMakeLists.txt
@@ -16,8 +16,11 @@ create_directory_groups(${SRCS} ${HEADERS})
16add_executable(citra ${SRCS} ${HEADERS}) 16add_executable(citra ${SRCS} ${HEADERS})
17target_link_libraries(citra core common video_core) 17target_link_libraries(citra core common video_core)
18target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih) 18target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih)
19if (MSVC)
20 target_link_libraries(citra getopt)
21endif()
19target_link_libraries(citra ${PLATFORM_LIBRARIES}) 22target_link_libraries(citra ${PLATFORM_LIBRARIES})
20 23
21if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") 24if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD")
22 install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") 25 install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
23endif() 26endif() \ No newline at end of file
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index a59726c78..182646f4c 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -3,6 +3,15 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <string> 5#include <string>
6#include <thread>
7#include <iostream>
8
9#ifdef _MSC_VER
10#include <getopt.h>
11#else
12#include <unistd.h>
13#include <getopt.h>
14#endif
6 15
7#include "common/logging/log.h" 16#include "common/logging/log.h"
8#include "common/logging/backend.h" 17#include "common/logging/backend.h"
@@ -18,12 +27,39 @@
18 27
19#include "video_core/video_core.h" 28#include "video_core/video_core.h"
20 29
30
31static void PrintHelp()
32{
33 std::cout << "Usage: citra <filename>" << std::endl;
34}
35
21/// Application entry point 36/// Application entry point
22int main(int argc, char **argv) { 37int main(int argc, char **argv) {
38 int option_index = 0;
39 std::string boot_filename;
40 static struct option long_options[] = {
41 { "help", no_argument, 0, 'h' },
42 { 0, 0, 0, 0 }
43 };
44
45 while (optind < argc) {
46 char arg = getopt_long(argc, argv, ":h", long_options, &option_index);
47 if (arg != -1) {
48 switch (arg) {
49 case 'h':
50 PrintHelp();
51 return 0;
52 }
53 } else {
54 boot_filename = argv[optind];
55 optind++;
56 }
57 }
58
23 Log::Filter log_filter(Log::Level::Debug); 59 Log::Filter log_filter(Log::Level::Debug);
24 Log::SetFilter(&log_filter); 60 Log::SetFilter(&log_filter);
25 61
26 if (argc < 2) { 62 if (boot_filename.empty()) {
27 LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified"); 63 LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
28 return -1; 64 return -1;
29 } 65 }
@@ -31,7 +67,7 @@ int main(int argc, char **argv) {
31 Config config; 67 Config config;
32 log_filter.ParseFilterString(Settings::values.log_filter); 68 log_filter.ParseFilterString(Settings::values.log_filter);
33 69
34 std::string boot_filename = argv[1]; 70
35 EmuWindow_GLFW* emu_window = new EmuWindow_GLFW; 71 EmuWindow_GLFW* emu_window = new EmuWindow_GLFW;
36 72
37 VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer; 73 VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer;