diff options
| -rw-r--r-- | src/citra/config.cpp | 3 | ||||
| -rw-r--r-- | src/citra/default_ini.h | 7 | ||||
| -rw-r--r-- | src/citra_qt/config.cpp | 5 | ||||
| -rw-r--r-- | src/citra_qt/configure_graphics.cpp | 76 | ||||
| -rw-r--r-- | src/citra_qt/configure_graphics.ui | 86 | ||||
| -rw-r--r-- | src/core/settings.cpp | 1 | ||||
| -rw-r--r-- | src/core/settings.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/video_core.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/video_core.h | 1 |
10 files changed, 170 insertions, 25 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 98f093258..bd8ac563b 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp | |||
| @@ -63,8 +63,7 @@ void Config::ReadValues() { | |||
| 63 | // Renderer | 63 | // Renderer |
| 64 | Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true); | 64 | Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true); |
| 65 | Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true); | 65 | Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true); |
| 66 | Settings::values.use_scaled_resolution = | 66 | Settings::values.resolution_factor = sdl2_config->GetReal("Renderer", "resolution_factor", 1.0); |
| 67 | sdl2_config->GetBoolean("Renderer", "use_scaled_resolution", false); | ||
| 68 | Settings::values.use_vsync = sdl2_config->GetBoolean("Renderer", "use_vsync", false); | 67 | Settings::values.use_vsync = sdl2_config->GetBoolean("Renderer", "use_vsync", false); |
| 69 | Settings::values.toggle_framelimit = | 68 | Settings::values.toggle_framelimit = |
| 70 | sdl2_config->GetBoolean("Renderer", "toggle_framelimit", true); | 69 | sdl2_config->GetBoolean("Renderer", "toggle_framelimit", true); |
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index bb4720d25..7996813b4 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h | |||
| @@ -51,9 +51,10 @@ use_hw_renderer = | |||
| 51 | # 0: Interpreter (slow), 1 (default): JIT (fast) | 51 | # 0: Interpreter (slow), 1 (default): JIT (fast) |
| 52 | use_shader_jit = | 52 | use_shader_jit = |
| 53 | 53 | ||
| 54 | # Whether to use native 3DS screen resolution or to scale rendering resolution to the displayed screen size. | 54 | # Resolution scale factor |
| 55 | # 0 (default): Native, 1: Scaled | 55 | # 0: Auto (scales resolution to window size), 1: Native 3DS screen resolution, Otherwise a scale |
| 56 | use_scaled_resolution = | 56 | # factor for the 3DS resolution |
| 57 | resolution_factor = | ||
| 57 | 58 | ||
| 58 | # Whether to enable V-Sync (caps the framerate at 60FPS) or not. | 59 | # Whether to enable V-Sync (caps the framerate at 60FPS) or not. |
| 59 | # 0 (default): Off, 1: On | 60 | # 0 (default): Off, 1: On |
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index c904c4b00..8021667d0 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp | |||
| @@ -44,8 +44,7 @@ void Config::ReadValues() { | |||
| 44 | qt_config->beginGroup("Renderer"); | 44 | qt_config->beginGroup("Renderer"); |
| 45 | Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool(); | 45 | Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool(); |
| 46 | Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool(); | 46 | Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool(); |
| 47 | Settings::values.use_scaled_resolution = | 47 | Settings::values.resolution_factor = qt_config->value("resolution_factor", 1.0).toFloat(); |
| 48 | qt_config->value("use_scaled_resolution", false).toBool(); | ||
| 49 | Settings::values.use_vsync = qt_config->value("use_vsync", false).toBool(); | 48 | Settings::values.use_vsync = qt_config->value("use_vsync", false).toBool(); |
| 50 | Settings::values.toggle_framelimit = qt_config->value("toggle_framelimit", true).toBool(); | 49 | Settings::values.toggle_framelimit = qt_config->value("toggle_framelimit", true).toBool(); |
| 51 | 50 | ||
| @@ -152,7 +151,7 @@ void Config::SaveValues() { | |||
| 152 | qt_config->beginGroup("Renderer"); | 151 | qt_config->beginGroup("Renderer"); |
| 153 | qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer); | 152 | qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer); |
| 154 | qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit); | 153 | qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit); |
| 155 | qt_config->setValue("use_scaled_resolution", Settings::values.use_scaled_resolution); | 154 | qt_config->setValue("resolution_factor", (double)Settings::values.resolution_factor); |
| 156 | qt_config->setValue("use_vsync", Settings::values.use_vsync); | 155 | qt_config->setValue("use_vsync", Settings::values.use_vsync); |
| 157 | qt_config->setValue("toggle_framelimit", Settings::values.toggle_framelimit); | 156 | qt_config->setValue("toggle_framelimit", Settings::values.toggle_framelimit); |
| 158 | 157 | ||
diff --git a/src/citra_qt/configure_graphics.cpp b/src/citra_qt/configure_graphics.cpp index cea7db388..54f799b47 100644 --- a/src/citra_qt/configure_graphics.cpp +++ b/src/citra_qt/configure_graphics.cpp | |||
| @@ -18,10 +18,81 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) | |||
| 18 | 18 | ||
| 19 | ConfigureGraphics::~ConfigureGraphics() {} | 19 | ConfigureGraphics::~ConfigureGraphics() {} |
| 20 | 20 | ||
| 21 | enum class Resolution : int { | ||
| 22 | Auto, | ||
| 23 | Scale1x, | ||
| 24 | Scale2x, | ||
| 25 | Scale3x, | ||
| 26 | Scale4x, | ||
| 27 | Scale5x, | ||
| 28 | Scale6x, | ||
| 29 | Scale7x, | ||
| 30 | Scale8x, | ||
| 31 | Scale9x, | ||
| 32 | Scale10x, | ||
| 33 | }; | ||
| 34 | |||
| 35 | float ToResolutionFactor(Resolution option) { | ||
| 36 | switch (option) { | ||
| 37 | case Resolution::Auto: | ||
| 38 | return 0.f; | ||
| 39 | case Resolution::Scale1x: | ||
| 40 | return 1.f; | ||
| 41 | case Resolution::Scale2x: | ||
| 42 | return 2.f; | ||
| 43 | case Resolution::Scale3x: | ||
| 44 | return 3.f; | ||
| 45 | case Resolution::Scale4x: | ||
| 46 | return 4.f; | ||
| 47 | case Resolution::Scale5x: | ||
| 48 | return 5.f; | ||
| 49 | case Resolution::Scale6x: | ||
| 50 | return 6.f; | ||
| 51 | case Resolution::Scale7x: | ||
| 52 | return 7.f; | ||
| 53 | case Resolution::Scale8x: | ||
| 54 | return 8.f; | ||
| 55 | case Resolution::Scale9x: | ||
| 56 | return 9.f; | ||
| 57 | case Resolution::Scale10x: | ||
| 58 | return 10.f; | ||
| 59 | } | ||
| 60 | return 0.f; | ||
| 61 | } | ||
| 62 | |||
| 63 | Resolution FromResolutionFactor(float factor) { | ||
| 64 | if (factor == 0.f) { | ||
| 65 | return Resolution::Auto; | ||
| 66 | } else if (factor == 1.f) { | ||
| 67 | return Resolution::Scale1x; | ||
| 68 | } else if (factor == 2.f) { | ||
| 69 | return Resolution::Scale2x; | ||
| 70 | } else if (factor == 3.f) { | ||
| 71 | return Resolution::Scale3x; | ||
| 72 | } else if (factor == 4.f) { | ||
| 73 | return Resolution::Scale4x; | ||
| 74 | } else if (factor == 5.f) { | ||
| 75 | return Resolution::Scale5x; | ||
| 76 | } else if (factor == 6.f) { | ||
| 77 | return Resolution::Scale6x; | ||
| 78 | } else if (factor == 7.f) { | ||
| 79 | return Resolution::Scale7x; | ||
| 80 | } else if (factor == 8.f) { | ||
| 81 | return Resolution::Scale8x; | ||
| 82 | } else if (factor == 9.f) { | ||
| 83 | return Resolution::Scale9x; | ||
| 84 | } else if (factor == 10.f) { | ||
| 85 | return Resolution::Scale10x; | ||
| 86 | } | ||
| 87 | return Resolution::Auto; | ||
| 88 | } | ||
| 89 | |||
| 21 | void ConfigureGraphics::setConfiguration() { | 90 | void ConfigureGraphics::setConfiguration() { |
| 22 | ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer); | 91 | ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer); |
| 92 | ui->resolution_factor_combobox->setEnabled(Settings::values.use_hw_renderer); | ||
| 23 | ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit); | 93 | ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit); |
| 24 | ui->toggle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution); | 94 | ui->resolution_factor_combobox->setCurrentIndex( |
| 95 | static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor))); | ||
| 25 | ui->toggle_vsync->setChecked(Settings::values.use_vsync); | 96 | ui->toggle_vsync->setChecked(Settings::values.use_vsync); |
| 26 | ui->toggle_framelimit->setChecked(Settings::values.toggle_framelimit); | 97 | ui->toggle_framelimit->setChecked(Settings::values.toggle_framelimit); |
| 27 | ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option)); | 98 | ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option)); |
| @@ -31,7 +102,8 @@ void ConfigureGraphics::setConfiguration() { | |||
| 31 | void ConfigureGraphics::applyConfiguration() { | 102 | void ConfigureGraphics::applyConfiguration() { |
| 32 | Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked(); | 103 | Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked(); |
| 33 | Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked(); | 104 | Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked(); |
| 34 | Settings::values.use_scaled_resolution = ui->toggle_scaled_resolution->isChecked(); | 105 | Settings::values.resolution_factor = |
| 106 | ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex())); | ||
| 35 | Settings::values.use_vsync = ui->toggle_vsync->isChecked(); | 107 | Settings::values.use_vsync = ui->toggle_vsync->isChecked(); |
| 36 | Settings::values.toggle_framelimit = ui->toggle_framelimit->isChecked(); | 108 | Settings::values.toggle_framelimit = ui->toggle_framelimit->isChecked(); |
| 37 | Settings::values.layout_option = | 109 | Settings::values.layout_option = |
diff --git a/src/citra_qt/configure_graphics.ui b/src/citra_qt/configure_graphics.ui index 964aa0bbd..62021fe22 100644 --- a/src/citra_qt/configure_graphics.ui +++ b/src/citra_qt/configure_graphics.ui | |||
| @@ -37,13 +37,6 @@ | |||
| 37 | </widget> | 37 | </widget> |
| 38 | </item> | 38 | </item> |
| 39 | <item> | 39 | <item> |
| 40 | <widget class="QCheckBox" name="toggle_scaled_resolution"> | ||
| 41 | <property name="text"> | ||
| 42 | <string>Enable scaled resolution</string> | ||
| 43 | </property> | ||
| 44 | </widget> | ||
| 45 | </item> | ||
| 46 | <item> | ||
| 47 | <widget class="QCheckBox" name="toggle_vsync"> | 40 | <widget class="QCheckBox" name="toggle_vsync"> |
| 48 | <property name="text"> | 41 | <property name="text"> |
| 49 | <string>Enable V-Sync</string> | 42 | <string>Enable V-Sync</string> |
| @@ -57,6 +50,76 @@ | |||
| 57 | </property> | 50 | </property> |
| 58 | </widget> | 51 | </widget> |
| 59 | </item> | 52 | </item> |
| 53 | <item> | ||
| 54 | <layout class="QHBoxLayout" name="horizontalLayout"> | ||
| 55 | <item> | ||
| 56 | <widget class="QLabel" name="label"> | ||
| 57 | <property name="text"> | ||
| 58 | <string>Internal Resolution:</string> | ||
| 59 | </property> | ||
| 60 | </widget> | ||
| 61 | </item> | ||
| 62 | <item> | ||
| 63 | <widget class="QComboBox" name="resolution_factor_combobox"> | ||
| 64 | <item> | ||
| 65 | <property name="text"> | ||
| 66 | <string notr="true">Auto (Window Size)</string> | ||
| 67 | </property> | ||
| 68 | </item> | ||
| 69 | <item> | ||
| 70 | <property name="text"> | ||
| 71 | <string notr="true">Native (400x240)</string> | ||
| 72 | </property> | ||
| 73 | </item> | ||
| 74 | <item> | ||
| 75 | <property name="text"> | ||
| 76 | <string notr="true">2x Native (800x480)</string> | ||
| 77 | </property> | ||
| 78 | </item> | ||
| 79 | <item> | ||
| 80 | <property name="text"> | ||
| 81 | <string notr="true">3x Native (1200x720)</string> | ||
| 82 | </property> | ||
| 83 | </item> | ||
| 84 | <item> | ||
| 85 | <property name="text"> | ||
| 86 | <string notr="true">4x Native (1600x960)</string> | ||
| 87 | </property> | ||
| 88 | </item> | ||
| 89 | <item> | ||
| 90 | <property name="text"> | ||
| 91 | <string notr="true">5x Native (2000x1200)</string> | ||
| 92 | </property> | ||
| 93 | </item> | ||
| 94 | <item> | ||
| 95 | <property name="text"> | ||
| 96 | <string notr="true">6x Native (2400x1440)</string> | ||
| 97 | </property> | ||
| 98 | </item> | ||
| 99 | <item> | ||
| 100 | <property name="text"> | ||
| 101 | <string notr="true">7x Native (2800x1680)</string> | ||
| 102 | </property> | ||
| 103 | </item> | ||
| 104 | <item> | ||
| 105 | <property name="text"> | ||
| 106 | <string notr="true">8x Native (3200x1920)</string> | ||
| 107 | </property> | ||
| 108 | </item> | ||
| 109 | <item> | ||
| 110 | <property name="text"> | ||
| 111 | <string notr="true">9x Native (3600x2160)</string> | ||
| 112 | </property> | ||
| 113 | </item> | ||
| 114 | <item> | ||
| 115 | <property name="text"> | ||
| 116 | <string notr="true">10x Native (4000x2400)</string> | ||
| 117 | </property> | ||
| 118 | </item> | ||
| 119 | </widget> | ||
| 120 | </item> | ||
| 121 | </layout> | ||
| 122 | </item> | ||
| 60 | </layout> | 123 | </layout> |
| 61 | </widget> | 124 | </widget> |
| 62 | </item> | 125 | </item> |
| @@ -128,5 +191,12 @@ | |||
| 128 | </layout> | 191 | </layout> |
| 129 | </widget> | 192 | </widget> |
| 130 | <resources/> | 193 | <resources/> |
| 131 | <connections/> | 194 | <connections> |
| 195 | <connection> | ||
| 196 | <sender>toggle_hw_renderer</sender> | ||
| 197 | <signal>toggled(bool)</signal> | ||
| 198 | <receiver>resolution_factor_combobox</receiver> | ||
| 199 | <slot>setEnabled(bool)</slot> | ||
| 200 | </connection> | ||
| 201 | </connections> | ||
| 132 | </ui> | 202 | </ui> |
diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 5d23c52f9..9afaf79ec 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp | |||
| @@ -20,7 +20,6 @@ void Apply() { | |||
| 20 | 20 | ||
| 21 | VideoCore::g_hw_renderer_enabled = values.use_hw_renderer; | 21 | VideoCore::g_hw_renderer_enabled = values.use_hw_renderer; |
| 22 | VideoCore::g_shader_jit_enabled = values.use_shader_jit; | 22 | VideoCore::g_shader_jit_enabled = values.use_shader_jit; |
| 23 | VideoCore::g_scaled_resolution_enabled = values.use_scaled_resolution; | ||
| 24 | VideoCore::g_toggle_framelimit_enabled = values.toggle_framelimit; | 23 | VideoCore::g_toggle_framelimit_enabled = values.toggle_framelimit; |
| 25 | 24 | ||
| 26 | if (VideoCore::g_emu_window) { | 25 | if (VideoCore::g_emu_window) { |
diff --git a/src/core/settings.h b/src/core/settings.h index 4e7a4b1be..8dbda653a 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -88,7 +88,7 @@ struct Values { | |||
| 88 | // Renderer | 88 | // Renderer |
| 89 | bool use_hw_renderer; | 89 | bool use_hw_renderer; |
| 90 | bool use_shader_jit; | 90 | bool use_shader_jit; |
| 91 | bool use_scaled_resolution; | 91 | float resolution_factor; |
| 92 | bool use_vsync; | 92 | bool use_vsync; |
| 93 | bool toggle_framelimit; | 93 | bool toggle_framelimit; |
| 94 | 94 | ||
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 85aa06cd5..ef3b06a7b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -556,14 +556,21 @@ RasterizerCacheOpenGL::GetFramebufferSurfaces(const Pica::Regs::FramebufferConfi | |||
| 556 | color_params.width = depth_params.width = config.GetWidth(); | 556 | color_params.width = depth_params.width = config.GetWidth(); |
| 557 | color_params.height = depth_params.height = config.GetHeight(); | 557 | color_params.height = depth_params.height = config.GetHeight(); |
| 558 | color_params.is_tiled = depth_params.is_tiled = true; | 558 | color_params.is_tiled = depth_params.is_tiled = true; |
| 559 | if (VideoCore::g_scaled_resolution_enabled) { | ||
| 560 | auto layout = VideoCore::g_emu_window->GetFramebufferLayout(); | ||
| 561 | 559 | ||
| 562 | // Assume same scaling factor for top and bottom screens | 560 | // Set the internal resolution, assume the same scaling factor for top and bottom screens |
| 561 | const Layout::FramebufferLayout& layout = VideoCore::g_emu_window->GetFramebufferLayout(); | ||
| 562 | if (Settings::values.resolution_factor == 0.0f) { | ||
| 563 | // Auto - scale resolution to the window size | ||
| 563 | color_params.res_scale_width = depth_params.res_scale_width = | 564 | color_params.res_scale_width = depth_params.res_scale_width = |
| 564 | (float)layout.top_screen.GetWidth() / VideoCore::kScreenTopWidth; | 565 | (float)layout.top_screen.GetWidth() / VideoCore::kScreenTopWidth; |
| 565 | color_params.res_scale_height = depth_params.res_scale_height = | 566 | color_params.res_scale_height = depth_params.res_scale_height = |
| 566 | (float)layout.top_screen.GetHeight() / VideoCore::kScreenTopHeight; | 567 | (float)layout.top_screen.GetHeight() / VideoCore::kScreenTopHeight; |
| 568 | } else { | ||
| 569 | // Otherwise, scale the resolution by the specified factor | ||
| 570 | color_params.res_scale_width = Settings::values.resolution_factor; | ||
| 571 | depth_params.res_scale_width = Settings::values.resolution_factor; | ||
| 572 | color_params.res_scale_height = Settings::values.resolution_factor; | ||
| 573 | depth_params.res_scale_height = Settings::values.resolution_factor; | ||
| 567 | } | 574 | } |
| 568 | 575 | ||
| 569 | color_params.addr = config.GetColorBufferPhysicalAddress(); | 576 | color_params.addr = config.GetColorBufferPhysicalAddress(); |
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 8db882f59..7186a7652 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp | |||
| @@ -19,7 +19,6 @@ std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin | |||
| 19 | 19 | ||
| 20 | std::atomic<bool> g_hw_renderer_enabled; | 20 | std::atomic<bool> g_hw_renderer_enabled; |
| 21 | std::atomic<bool> g_shader_jit_enabled; | 21 | std::atomic<bool> g_shader_jit_enabled; |
| 22 | std::atomic<bool> g_scaled_resolution_enabled; | ||
| 23 | std::atomic<bool> g_vsync_enabled; | 22 | std::atomic<bool> g_vsync_enabled; |
| 24 | std::atomic<bool> g_toggle_framelimit_enabled; | 23 | std::atomic<bool> g_toggle_framelimit_enabled; |
| 25 | 24 | ||
diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h index c397c1974..4aba19ca0 100644 --- a/src/video_core/video_core.h +++ b/src/video_core/video_core.h | |||
| @@ -37,7 +37,6 @@ extern EmuWindow* g_emu_window; ///< Emu window | |||
| 37 | // qt ui) | 37 | // qt ui) |
| 38 | extern std::atomic<bool> g_hw_renderer_enabled; | 38 | extern std::atomic<bool> g_hw_renderer_enabled; |
| 39 | extern std::atomic<bool> g_shader_jit_enabled; | 39 | extern std::atomic<bool> g_shader_jit_enabled; |
| 40 | extern std::atomic<bool> g_scaled_resolution_enabled; | ||
| 41 | extern std::atomic<bool> g_toggle_framelimit_enabled; | 40 | extern std::atomic<bool> g_toggle_framelimit_enabled; |
| 42 | 41 | ||
| 43 | /// Start the video core | 42 | /// Start the video core |