diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/citra/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/citra/citra.cpp | 40 |
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}) | |||
| 16 | add_executable(citra ${SRCS} ${HEADERS}) | 16 | add_executable(citra ${SRCS} ${HEADERS}) |
| 17 | target_link_libraries(citra core common video_core) | 17 | target_link_libraries(citra core common video_core) |
| 18 | target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih) | 18 | target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih) |
| 19 | if (MSVC) | ||
| 20 | target_link_libraries(citra getopt) | ||
| 21 | endif() | ||
| 19 | target_link_libraries(citra ${PLATFORM_LIBRARIES}) | 22 | target_link_libraries(citra ${PLATFORM_LIBRARIES}) |
| 20 | 23 | ||
| 21 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") | 24 | if(${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") |
| 23 | endif() | 26 | endif() \ 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 | |||
| 31 | static void PrintHelp() | ||
| 32 | { | ||
| 33 | std::cout << "Usage: citra <filename>" << std::endl; | ||
| 34 | } | ||
| 35 | |||
| 21 | /// Application entry point | 36 | /// Application entry point |
| 22 | int main(int argc, char **argv) { | 37 | int 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; |