diff options
Diffstat (limited to '')
-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() { // Renderer Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true); 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.resolution_factor = sdl2_config->GetReal("Renderer", "resolution_factor", 1.0); Settings::values.use_vsync = sdl2_config->GetBoolean("Renderer", "use_vsync", false); Settings::values.toggle_framelimit = 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 = # 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 = +# Resolution scale factor +# 0: Auto (scales resolution to window size), 1: Native 3DS screen resolution, Otherwise a scale +# factor for the 3DS resolution +resolution_factor = # Whether to enable V-Sync (caps the framerate at 60FPS) or not. # 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() { qt_config->beginGroup("Renderer"); Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool(); Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool(); - Settings::values.use_scaled_resolution = - qt_config->value("use_scaled_resolution", false).toBool(); + Settings::values.resolution_factor = qt_config->value("resolution_factor", 1.0).toFloat(); Settings::values.use_vsync = qt_config->value("use_vsync", false).toBool(); Settings::values.toggle_framelimit = qt_config->value("toggle_framelimit", true).toBool(); @@ -152,7 +151,7 @@ void Config::SaveValues() { qt_config->beginGroup("Renderer"); qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer); qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit); - qt_config->setValue("use_scaled_resolution", Settings::values.use_scaled_resolution); + qt_config->setValue("resolution_factor", (double)Settings::values.resolution_factor); qt_config->setValue("use_vsync", Settings::values.use_vsync); qt_config->setValue("toggle_framelimit", Settings::values.toggle_framelimit); 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) ConfigureGraphics::~ConfigureGraphics() {} +enum class Resolution : int { + Auto, + Scale1x, + Scale2x, + Scale3x, + Scale4x, + Scale5x, + Scale6x, + Scale7x, + Scale8x, + Scale9x, + Scale10x, +}; + +float ToResolutionFactor(Resolution option) { + switch (option) { + case Resolution::Auto: + return 0.f; + case Resolution::Scale1x: + return 1.f; + case Resolution::Scale2x: + return 2.f; + case Resolution::Scale3x: + return 3.f; + case Resolution::Scale4x: + return 4.f; + case Resolution::Scale5x: + return 5.f; + case Resolution::Scale6x: + return 6.f; + case Resolution::Scale7x: + return 7.f; + case Resolution::Scale8x: + return 8.f; + case Resolution::Scale9x: + return 9.f; + case Resolution::Scale10x: + return 10.f; + } + return 0.f; +} + +Resolution FromResolutionFactor(float factor) { + if (factor == 0.f) { + return Resolution::Auto; + } else if (factor == 1.f) { + return Resolution::Scale1x; + } else if (factor == 2.f) { + return Resolution::Scale2x; + } else if (factor == 3.f) { + return Resolution::Scale3x; + } else if (factor == 4.f) { + return Resolution::Scale4x; + } else if (factor == 5.f) { + return Resolution::Scale5x; + } else if (factor == 6.f) { + return Resolution::Scale6x; + } else if (factor == 7.f) { + return Resolution::Scale7x; + } else if (factor == 8.f) { + return Resolution::Scale8x; + } else if (factor == 9.f) { + return Resolution::Scale9x; + } else if (factor == 10.f) { + return Resolution::Scale10x; + } + return Resolution::Auto; +} + void ConfigureGraphics::setConfiguration() { ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer); + ui->resolution_factor_combobox->setEnabled(Settings::values.use_hw_renderer); ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit); - ui->toggle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution); + ui->resolution_factor_combobox->setCurrentIndex( + static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor))); ui->toggle_vsync->setChecked(Settings::values.use_vsync); ui->toggle_framelimit->setChecked(Settings::values.toggle_framelimit); ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option)); @@ -31,7 +102,8 @@ void ConfigureGraphics::setConfiguration() { void ConfigureGraphics::applyConfiguration() { Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked(); Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked(); - Settings::values.use_scaled_resolution = ui->toggle_scaled_resolution->isChecked(); + Settings::values.resolution_factor = + ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex())); Settings::values.use_vsync = ui->toggle_vsync->isChecked(); Settings::values.toggle_framelimit = ui->toggle_framelimit->isChecked(); 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 @@ </widget> </item> <item> - <widget class="QCheckBox" name="toggle_scaled_resolution"> - <property name="text"> - <string>Enable scaled resolution</string> - </property> - </widget> - </item> - <item> <widget class="QCheckBox" name="toggle_vsync"> <property name="text"> <string>Enable V-Sync</string> @@ -57,6 +50,76 @@ </property> </widget> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Internal Resolution:</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="resolution_factor_combobox"> + <item> + <property name="text"> + <string notr="true">Auto (Window Size)</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">Native (400x240)</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">2x Native (800x480)</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">3x Native (1200x720)</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">4x Native (1600x960)</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">5x Native (2000x1200)</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">6x Native (2400x1440)</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">7x Native (2800x1680)</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">8x Native (3200x1920)</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">9x Native (3600x2160)</string> + </property> + </item> + <item> + <property name="text"> + <string notr="true">10x Native (4000x2400)</string> + </property> + </item> + </widget> + </item> + </layout> + </item> </layout> </widget> </item> @@ -128,5 +191,12 @@ </layout> </widget> <resources/> - <connections/> + <connections> + <connection> + <sender>toggle_hw_renderer</sender> + <signal>toggled(bool)</signal> + <receiver>resolution_factor_combobox</receiver> + <slot>setEnabled(bool)</slot> + </connection> + </connections> </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() { VideoCore::g_hw_renderer_enabled = values.use_hw_renderer; VideoCore::g_shader_jit_enabled = values.use_shader_jit; - VideoCore::g_scaled_resolution_enabled = values.use_scaled_resolution; VideoCore::g_toggle_framelimit_enabled = values.toggle_framelimit; 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 { // Renderer bool use_hw_renderer; bool use_shader_jit; - bool use_scaled_resolution; + float resolution_factor; bool use_vsync; bool toggle_framelimit; 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 color_params.width = depth_params.width = config.GetWidth(); color_params.height = depth_params.height = config.GetHeight(); color_params.is_tiled = depth_params.is_tiled = true; - if (VideoCore::g_scaled_resolution_enabled) { - auto layout = VideoCore::g_emu_window->GetFramebufferLayout(); - // Assume same scaling factor for top and bottom screens + // Set the internal resolution, assume the same scaling factor for top and bottom screens + const Layout::FramebufferLayout& layout = VideoCore::g_emu_window->GetFramebufferLayout(); + if (Settings::values.resolution_factor == 0.0f) { + // Auto - scale resolution to the window size color_params.res_scale_width = depth_params.res_scale_width = (float)layout.top_screen.GetWidth() / VideoCore::kScreenTopWidth; color_params.res_scale_height = depth_params.res_scale_height = (float)layout.top_screen.GetHeight() / VideoCore::kScreenTopHeight; + } else { + // Otherwise, scale the resolution by the specified factor + color_params.res_scale_width = Settings::values.resolution_factor; + depth_params.res_scale_width = Settings::values.resolution_factor; + color_params.res_scale_height = Settings::values.resolution_factor; + depth_params.res_scale_height = Settings::values.resolution_factor; } 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 std::atomic<bool> g_hw_renderer_enabled; std::atomic<bool> g_shader_jit_enabled; -std::atomic<bool> g_scaled_resolution_enabled; std::atomic<bool> g_vsync_enabled; std::atomic<bool> g_toggle_framelimit_enabled; 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 // qt ui) extern std::atomic<bool> g_hw_renderer_enabled; extern std::atomic<bool> g_shader_jit_enabled; -extern std::atomic<bool> g_scaled_resolution_enabled; extern std::atomic<bool> g_toggle_framelimit_enabled; /// Start the video core |