diff options
Diffstat (limited to 'src/citra/citra.cpp')
| -rw-r--r-- | src/citra/citra.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
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; |