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)  if (MSVC)      target_link_libraries(citra getopt)  endif() -target_link_libraries(citra ${PLATFORM_LIBRARIES}) +target_link_libraries(citra ${PLATFORM_LIBRARIES} Threads::Threads)  if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD")      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 @@  #include "common/logging/log.h"  #include "common/logging/backend.h"  #include "common/logging/filter.h" +#include "common/scm_rev.h"  #include "common/scope_exit.h"  #include "core/settings.h" @@ -34,11 +35,17 @@  #include "video_core/video_core.h" -static void PrintHelp() +static void PrintHelp(const char *argv0)  { -    std::cout << "Usage: citra [options] <filename>" << std::endl; -    std::cout << "--help, -h            Display this information" << std::endl; -    std::cout << "--gdbport, -g number  Enable gdb stub on port number" << std::endl; +    std::cout << "Usage: " << argv0 << " [options] <filename>\n" +                 "-g, --gdbport=NUMBER  Enable gdb stub on port NUMBER\n" +                 "-h, --help            Display this help and exit\n" +                 "-v, --version         Output version information and exit\n"; +} + +static void PrintVersion() +{ +    std::cout << "Citra " << Common::g_scm_branch << " " << Common::g_scm_desc << std::endl;  }  /// Application entry point @@ -51,18 +58,16 @@ int main(int argc, char **argv) {      std::string boot_filename;      static struct option long_options[] = { -        { "help", no_argument, 0, 'h' },          { "gdbport", required_argument, 0, 'g' }, +        { "help", no_argument, 0, 'h' }, +        { "version", no_argument, 0, 'v' },          { 0, 0, 0, 0 }      };      while (optind < argc) { -        char arg = getopt_long(argc, argv, ":hg:", long_options, &option_index); +        char arg = getopt_long(argc, argv, "g:hv", long_options, &option_index);          if (arg != -1) {              switch (arg) { -            case 'h': -                PrintHelp(); -                return 0;              case 'g':                  errno = 0;                  gdb_port = strtoul(optarg, &endarg, 0); @@ -73,6 +78,12 @@ int main(int argc, char **argv) {                      exit(1);                  }                  break; +            case 'h': +                PrintHelp(argv[0]); +                return 0; +            case 'v': +                PrintVersion(); +                return 0;              }          } else {              boot_filename = argv[optind]; @@ -93,14 +104,13 @@ int main(int argc, char **argv) {      log_filter.ParseFilterString(Settings::values.log_filter); -    GDBStub::ToggleServer(use_gdbstub); -    GDBStub::SetServerPort(gdb_port); +    // Apply the command line arguments +    Settings::values.gdbstub_port = gdb_port; +    Settings::values.use_gdbstub = use_gdbstub; +    Settings::Apply();      std::unique_ptr<EmuWindow_SDL2> emu_window = std::make_unique<EmuWindow_SDL2>(); -    VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer; -    VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit; -      System::Init(emu_window.get());      SCOPE_EXIT({ System::Shutdown(); }); 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() {      // Renderer      Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", false);      Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true); +    Settings::values.use_scaled_resolution = sdl2_config->GetBoolean("Renderer", "use_scaled_resolution", false);      Settings::values.bg_red   = (float)sdl2_config->GetReal("Renderer", "bg_red",   1.0);      Settings::values.bg_green = (float)sdl2_config->GetReal("Renderer", "bg_green", 1.0);      Settings::values.bg_blue  = (float)sdl2_config->GetReal("Renderer", "bg_blue",  1.0); +    // Audio +    Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto"); +      // Data Storage      Settings::values.use_virtual_sd = sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); @@ -82,7 +86,7 @@ void Config::ReadValues() {      // Debugging      Settings::values.use_gdbstub = sdl2_config->GetBoolean("Debugging", "use_gdbstub", false); -    Settings::values.gdbstub_port = sdl2_config->GetInteger("Debugging", "gdbstub_port", 24689); +    Settings::values.gdbstub_port = static_cast<u16>(sdl2_config->GetInteger("Debugging", "gdbstub_port", 24689));  }  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 =  # 0 : Interpreter (slow), 1 (default): JIT (fast)  use_shader_jit = +# Whether to use native 3DS screen resolution or to scale rendering resolution to the displayed screen size. +# 0 (default): Native, 1: Scaled +use_scaled_resolution = +  # The clear color for the renderer. What shows up on the sides of the bottom screen.  # Must be in range of 0.0-1.0. Defaults to 1.0 for all.  bg_red =  bg_blue =  bg_green = +[Audio] +# Which audio output engine to use. +# auto (default): Auto-select, null: No audio output, sdl2: SDL2 (if available) +output_engine = +  [Data Storage]  # Whether to create a virtual SD card.  # 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 @@  #define SDL_MAIN_HANDLED  #include <SDL.h> +#include <glad/glad.h> +  #include "common/key_map.h"  #include "common/logging/log.h"  #include "common/scm_rev.h" @@ -98,6 +100,11 @@ EmuWindow_SDL2::EmuWindow_SDL2() {          exit(1);      } +    if (!gladLoadGLLoader(static_cast<GLADloadproc>(SDL_GL_GetProcAddress))) { +        LOG_CRITICAL(Frontend, "Failed to initialize GL functions! Exiting..."); +        exit(1); +    } +      OnResize();      OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);      SDL_PumpEvents();  | 
