diff options
Diffstat (limited to 'src/citra')
| -rw-r--r-- | src/citra/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/citra/citra.cpp | 38 | ||||
| -rw-r--r-- | src/citra/config.cpp | 6 | ||||
| -rw-r--r-- | src/citra/default_ini.h | 9 | ||||
| -rw-r--r-- | src/citra/emu_window/emu_window_sdl2.cpp | 7 |
5 files changed, 46 insertions, 16 deletions
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index fa615deb9..43fa06b4e 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt | |||
| @@ -21,7 +21,7 @@ target_link_libraries(citra ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad) | |||
| 21 | if (MSVC) | 21 | if (MSVC) |
| 22 | target_link_libraries(citra getopt) | 22 | target_link_libraries(citra getopt) |
| 23 | endif() | 23 | endif() |
| 24 | target_link_libraries(citra ${PLATFORM_LIBRARIES}) | 24 | target_link_libraries(citra ${PLATFORM_LIBRARIES} Threads::Threads) |
| 25 | 25 | ||
| 26 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") | 26 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") |
| 27 | install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") | 27 | install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") |
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index 3a1fbe3f7..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 | ||
| 37 | static void PrintHelp() | 38 | static 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 | |||
| 46 | static 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]; |
| @@ -93,14 +104,13 @@ int main(int argc, char **argv) { | |||
| 93 | 104 | ||
| 94 | log_filter.ParseFilterString(Settings::values.log_filter); | 105 | log_filter.ParseFilterString(Settings::values.log_filter); |
| 95 | 106 | ||
| 96 | GDBStub::ToggleServer(use_gdbstub); | 107 | // Apply the command line arguments |
| 97 | GDBStub::SetServerPort(gdb_port); | 108 | Settings::values.gdbstub_port = gdb_port; |
| 109 | Settings::values.use_gdbstub = use_gdbstub; | ||
| 110 | Settings::Apply(); | ||
| 98 | 111 | ||
| 99 | std::unique_ptr<EmuWindow_SDL2> emu_window = std::make_unique<EmuWindow_SDL2>(); | 112 | std::unique_ptr<EmuWindow_SDL2> emu_window = std::make_unique<EmuWindow_SDL2>(); |
| 100 | 113 | ||
| 101 | VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer; | ||
| 102 | VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit; | ||
| 103 | |||
| 104 | System::Init(emu_window.get()); | 114 | System::Init(emu_window.get()); |
| 105 | SCOPE_EXIT({ System::Shutdown(); }); | 115 | SCOPE_EXIT({ System::Shutdown(); }); |
| 106 | 116 | ||
diff --git a/src/citra/config.cpp b/src/citra/config.cpp index ebea5f840..4d170dec8 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp | |||
| @@ -65,11 +65,15 @@ void Config::ReadValues() { | |||
| 65 | // Renderer | 65 | // Renderer |
| 66 | Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", false); | 66 | Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", false); |
| 67 | Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true); | 67 | Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true); |
| 68 | Settings::values.use_scaled_resolution = sdl2_config->GetBoolean("Renderer", "use_scaled_resolution", false); | ||
| 68 | 69 | ||
| 69 | Settings::values.bg_red = (float)sdl2_config->GetReal("Renderer", "bg_red", 1.0); | 70 | Settings::values.bg_red = (float)sdl2_config->GetReal("Renderer", "bg_red", 1.0); |
| 70 | Settings::values.bg_green = (float)sdl2_config->GetReal("Renderer", "bg_green", 1.0); | 71 | Settings::values.bg_green = (float)sdl2_config->GetReal("Renderer", "bg_green", 1.0); |
| 71 | Settings::values.bg_blue = (float)sdl2_config->GetReal("Renderer", "bg_blue", 1.0); | 72 | Settings::values.bg_blue = (float)sdl2_config->GetReal("Renderer", "bg_blue", 1.0); |
| 72 | 73 | ||
| 74 | // Audio | ||
| 75 | Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto"); | ||
| 76 | |||
| 73 | // Data Storage | 77 | // Data Storage |
| 74 | Settings::values.use_virtual_sd = sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); | 78 | Settings::values.use_virtual_sd = sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); |
| 75 | 79 | ||
| @@ -82,7 +86,7 @@ void Config::ReadValues() { | |||
| 82 | 86 | ||
| 83 | // Debugging | 87 | // Debugging |
| 84 | Settings::values.use_gdbstub = sdl2_config->GetBoolean("Debugging", "use_gdbstub", false); | 88 | Settings::values.use_gdbstub = sdl2_config->GetBoolean("Debugging", "use_gdbstub", false); |
| 85 | Settings::values.gdbstub_port = sdl2_config->GetInteger("Debugging", "gdbstub_port", 24689); | 89 | Settings::values.gdbstub_port = static_cast<u16>(sdl2_config->GetInteger("Debugging", "gdbstub_port", 24689)); |
| 86 | } | 90 | } |
| 87 | 91 | ||
| 88 | void Config::Reload() { | 92 | void Config::Reload() { |
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index c9b490a00..49126356f 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h | |||
| @@ -46,12 +46,21 @@ use_hw_renderer = | |||
| 46 | # 0 : Interpreter (slow), 1 (default): JIT (fast) | 46 | # 0 : Interpreter (slow), 1 (default): JIT (fast) |
| 47 | use_shader_jit = | 47 | use_shader_jit = |
| 48 | 48 | ||
| 49 | # Whether to use native 3DS screen resolution or to scale rendering resolution to the displayed screen size. | ||
| 50 | # 0 (default): Native, 1: Scaled | ||
| 51 | use_scaled_resolution = | ||
| 52 | |||
| 49 | # The clear color for the renderer. What shows up on the sides of the bottom screen. | 53 | # The clear color for the renderer. What shows up on the sides of the bottom screen. |
| 50 | # Must be in range of 0.0-1.0. Defaults to 1.0 for all. | 54 | # Must be in range of 0.0-1.0. Defaults to 1.0 for all. |
| 51 | bg_red = | 55 | bg_red = |
| 52 | bg_blue = | 56 | bg_blue = |
| 53 | bg_green = | 57 | bg_green = |
| 54 | 58 | ||
| 59 | [Audio] | ||
| 60 | # Which audio output engine to use. | ||
| 61 | # auto (default): Auto-select, null: No audio output, sdl2: SDL2 (if available) | ||
| 62 | output_engine = | ||
| 63 | |||
| 55 | [Data Storage] | 64 | [Data Storage] |
| 56 | # Whether to create a virtual SD card. | 65 | # Whether to create a virtual SD card. |
| 57 | # 1 (default): Yes, 0: No | 66 | # 1 (default): Yes, 0: No |
diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp index 924189f4c..12cdd9d95 100644 --- a/src/citra/emu_window/emu_window_sdl2.cpp +++ b/src/citra/emu_window/emu_window_sdl2.cpp | |||
| @@ -9,6 +9,8 @@ | |||
| 9 | #define SDL_MAIN_HANDLED | 9 | #define SDL_MAIN_HANDLED |
| 10 | #include <SDL.h> | 10 | #include <SDL.h> |
| 11 | 11 | ||
| 12 | #include <glad/glad.h> | ||
| 13 | |||
| 12 | #include "common/key_map.h" | 14 | #include "common/key_map.h" |
| 13 | #include "common/logging/log.h" | 15 | #include "common/logging/log.h" |
| 14 | #include "common/scm_rev.h" | 16 | #include "common/scm_rev.h" |
| @@ -98,6 +100,11 @@ EmuWindow_SDL2::EmuWindow_SDL2() { | |||
| 98 | exit(1); | 100 | exit(1); |
| 99 | } | 101 | } |
| 100 | 102 | ||
| 103 | if (!gladLoadGLLoader(static_cast<GLADloadproc>(SDL_GL_GetProcAddress))) { | ||
| 104 | LOG_CRITICAL(Frontend, "Failed to initialize GL functions! Exiting..."); | ||
| 105 | exit(1); | ||
| 106 | } | ||
| 107 | |||
| 101 | OnResize(); | 108 | OnResize(); |
| 102 | OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); | 109 | OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); |
| 103 | SDL_PumpEvents(); | 110 | SDL_PumpEvents(); |