diff options
| author | 2020-02-13 22:17:28 -0500 | |
|---|---|---|
| committer | 2020-02-13 22:17:28 -0500 | |
| commit | 27e19f87c63437db641b736429ac3503160f21ae (patch) | |
| tree | 42a00db2d3ef5e0878c486e5e09eafdba3347edb /src | |
| parent | Merge pull request #3405 from lioncash/thread (diff) | |
| download | yuzu-27e19f87c63437db641b736429ac3503160f21ae.tar.gz yuzu-27e19f87c63437db641b736429ac3503160f21ae.tar.xz yuzu-27e19f87c63437db641b736429ac3503160f21ae.zip | |
Add following aspect ratios: 16:9, 21:9, Stretch to Window
Available as a drop down within the configure graphics tab.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/frontend/framebuffer_layout.cpp | 17 | ||||
| -rw-r--r-- | src/core/settings.h | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.ui | 30 | ||||
| -rw-r--r-- | src/yuzu_cmd/config.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu_cmd/default_ini.h | 4 | ||||
| -rw-r--r-- | src/yuzu_tester/config.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu_tester/default_ini.h | 4 |
9 files changed, 62 insertions, 2 deletions
diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index d6d2cf3f0..f94fa0041 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp | |||
| @@ -27,9 +27,22 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height) { | |||
| 27 | // so just calculate them both even if the other isn't showing. | 27 | // so just calculate them both even if the other isn't showing. |
| 28 | FramebufferLayout res{width, height}; | 28 | FramebufferLayout res{width, height}; |
| 29 | 29 | ||
| 30 | const float emulation_aspect_ratio{static_cast<float>(ScreenUndocked::Height) / | ||
| 31 | ScreenUndocked::Width}; | ||
| 32 | const auto window_aspect_ratio = static_cast<float>(height) / width; | 30 | const auto window_aspect_ratio = static_cast<float>(height) / width; |
| 31 | float emulation_aspect_ratio; | ||
| 32 | |||
| 33 | switch (Settings::values.aspect_ratio) { | ||
| 34 | case 0: // 16:9 (Default) | ||
| 35 | emulation_aspect_ratio = static_cast<float>(ScreenUndocked::Height) / ScreenUndocked::Width; | ||
| 36 | break; | ||
| 37 | case 1: // 21:9 | ||
| 38 | emulation_aspect_ratio = 9.f / 21; | ||
| 39 | break; | ||
| 40 | case 2: // Stretch to Window | ||
| 41 | emulation_aspect_ratio = window_aspect_ratio; | ||
| 42 | break; | ||
| 43 | default: // 16:9 | ||
| 44 | emulation_aspect_ratio = static_cast<float>(ScreenUndocked::Height) / ScreenUndocked::Width; | ||
| 45 | } | ||
| 33 | 46 | ||
| 34 | const Common::Rectangle<u32> screen_window_area{0, 0, width, height}; | 47 | const Common::Rectangle<u32> screen_window_area{0, 0, width, height}; |
| 35 | Common::Rectangle<u32> screen = MaxRectangle(screen_window_area, emulation_aspect_ratio); | 48 | Common::Rectangle<u32> screen = MaxRectangle(screen_window_area, emulation_aspect_ratio); |
diff --git a/src/core/settings.h b/src/core/settings.h index e1a9a0ffa..f837d3fbc 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -429,6 +429,7 @@ struct Values { | |||
| 429 | int vulkan_device; | 429 | int vulkan_device; |
| 430 | 430 | ||
| 431 | float resolution_factor; | 431 | float resolution_factor; |
| 432 | int aspect_ratio; | ||
| 432 | bool use_frame_limit; | 433 | bool use_frame_limit; |
| 433 | u16 frame_limit; | 434 | u16 frame_limit; |
| 434 | bool use_disk_shader_cache; | 435 | bool use_disk_shader_cache; |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index cd94693c1..6209fff75 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -630,6 +630,7 @@ void Config::ReadRendererValues() { | |||
| 630 | Settings::values.vulkan_device = ReadSetting(QStringLiteral("vulkan_device"), 0).toInt(); | 630 | Settings::values.vulkan_device = ReadSetting(QStringLiteral("vulkan_device"), 0).toInt(); |
| 631 | Settings::values.resolution_factor = | 631 | Settings::values.resolution_factor = |
| 632 | ReadSetting(QStringLiteral("resolution_factor"), 1.0).toFloat(); | 632 | ReadSetting(QStringLiteral("resolution_factor"), 1.0).toFloat(); |
| 633 | Settings::values.aspect_ratio = ReadSetting(QStringLiteral("aspect_ratio"), 0).toInt(); | ||
| 633 | Settings::values.use_frame_limit = | 634 | Settings::values.use_frame_limit = |
| 634 | ReadSetting(QStringLiteral("use_frame_limit"), true).toBool(); | 635 | ReadSetting(QStringLiteral("use_frame_limit"), true).toBool(); |
| 635 | Settings::values.frame_limit = ReadSetting(QStringLiteral("frame_limit"), 100).toInt(); | 636 | Settings::values.frame_limit = ReadSetting(QStringLiteral("frame_limit"), 100).toInt(); |
| @@ -1064,6 +1065,7 @@ void Config::SaveRendererValues() { | |||
| 1064 | WriteSetting(QStringLiteral("vulkan_device"), Settings::values.vulkan_device, 0); | 1065 | WriteSetting(QStringLiteral("vulkan_device"), Settings::values.vulkan_device, 0); |
| 1065 | WriteSetting(QStringLiteral("resolution_factor"), | 1066 | WriteSetting(QStringLiteral("resolution_factor"), |
| 1066 | static_cast<double>(Settings::values.resolution_factor), 1.0); | 1067 | static_cast<double>(Settings::values.resolution_factor), 1.0); |
| 1068 | WriteSetting(QStringLiteral("aspect_ratio"), Settings::values.aspect_ratio, 0); | ||
| 1067 | WriteSetting(QStringLiteral("use_frame_limit"), Settings::values.use_frame_limit, true); | 1069 | WriteSetting(QStringLiteral("use_frame_limit"), Settings::values.use_frame_limit, true); |
| 1068 | WriteSetting(QStringLiteral("frame_limit"), Settings::values.frame_limit, 100); | 1070 | WriteSetting(QStringLiteral("frame_limit"), Settings::values.frame_limit, 100); |
| 1069 | WriteSetting(QStringLiteral("use_disk_shader_cache"), Settings::values.use_disk_shader_cache, | 1071 | WriteSetting(QStringLiteral("use_disk_shader_cache"), Settings::values.use_disk_shader_cache, |
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index f57a24e36..ea899c080 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -97,6 +97,7 @@ void ConfigureGraphics::SetConfiguration() { | |||
| 97 | ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend)); | 97 | ui->api->setCurrentIndex(static_cast<int>(Settings::values.renderer_backend)); |
| 98 | ui->resolution_factor_combobox->setCurrentIndex( | 98 | ui->resolution_factor_combobox->setCurrentIndex( |
| 99 | static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor))); | 99 | static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor))); |
| 100 | ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio); | ||
| 100 | ui->use_disk_shader_cache->setEnabled(runtime_lock); | 101 | ui->use_disk_shader_cache->setEnabled(runtime_lock); |
| 101 | ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache); | 102 | ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache); |
| 102 | ui->use_accurate_gpu_emulation->setChecked(Settings::values.use_accurate_gpu_emulation); | 103 | ui->use_accurate_gpu_emulation->setChecked(Settings::values.use_accurate_gpu_emulation); |
| @@ -114,6 +115,7 @@ void ConfigureGraphics::ApplyConfiguration() { | |||
| 114 | Settings::values.vulkan_device = vulkan_device; | 115 | Settings::values.vulkan_device = vulkan_device; |
| 115 | Settings::values.resolution_factor = | 116 | Settings::values.resolution_factor = |
| 116 | ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex())); | 117 | ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex())); |
| 118 | Settings::values.aspect_ratio = ui->aspect_ratio_combobox->currentIndex(); | ||
| 117 | Settings::values.use_disk_shader_cache = ui->use_disk_shader_cache->isChecked(); | 119 | Settings::values.use_disk_shader_cache = ui->use_disk_shader_cache->isChecked(); |
| 118 | Settings::values.use_accurate_gpu_emulation = ui->use_accurate_gpu_emulation->isChecked(); | 120 | Settings::values.use_accurate_gpu_emulation = ui->use_accurate_gpu_emulation->isChecked(); |
| 119 | Settings::values.use_asynchronous_gpu_emulation = | 121 | Settings::values.use_asynchronous_gpu_emulation = |
diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index e24372204..ca79909d0 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui | |||
| @@ -139,6 +139,36 @@ | |||
| 139 | </layout> | 139 | </layout> |
| 140 | </item> | 140 | </item> |
| 141 | <item> | 141 | <item> |
| 142 | <layout class="QHBoxLayout" name="horizontalLayout_6"> | ||
| 143 | <item> | ||
| 144 | <widget class="QLabel" name="ar_label"> | ||
| 145 | <property name="text"> | ||
| 146 | <string>Aspect Ratio:</string> | ||
| 147 | </property> | ||
| 148 | </widget> | ||
| 149 | </item> | ||
| 150 | <item> | ||
| 151 | <widget class="QComboBox" name="aspect_ratio_combobox"> | ||
| 152 | <item> | ||
| 153 | <property name="text"> | ||
| 154 | <string>Default (16:9)</string> | ||
| 155 | </property> | ||
| 156 | </item> | ||
| 157 | <item> | ||
| 158 | <property name="text"> | ||
| 159 | <string>Force 21:9</string> | ||
| 160 | </property> | ||
| 161 | </item> | ||
| 162 | <item> | ||
| 163 | <property name="text"> | ||
| 164 | <string>Stretch to Window</string> | ||
| 165 | </property> | ||
| 166 | </item> | ||
| 167 | </widget> | ||
| 168 | </item> | ||
| 169 | </layout> | ||
| 170 | </item> | ||
| 171 | <item> | ||
| 142 | <layout class="QHBoxLayout" name="horizontalLayout_3"> | 172 | <layout class="QHBoxLayout" name="horizontalLayout_3"> |
| 143 | <item> | 173 | <item> |
| 144 | <widget class="QLabel" name="bg_label"> | 174 | <widget class="QLabel" name="bg_label"> |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index b01a36023..96f1ce3af 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -379,6 +379,8 @@ void Config::ReadValues() { | |||
| 379 | 379 | ||
| 380 | Settings::values.resolution_factor = | 380 | Settings::values.resolution_factor = |
| 381 | static_cast<float>(sdl2_config->GetReal("Renderer", "resolution_factor", 1.0)); | 381 | static_cast<float>(sdl2_config->GetReal("Renderer", "resolution_factor", 1.0)); |
| 382 | Settings::values.aspect_ratio = | ||
| 383 | static_cast<int>(sdl2_config->GetInteger("Renderer", "aspect_ratio", 0)); | ||
| 382 | Settings::values.use_frame_limit = sdl2_config->GetBoolean("Renderer", "use_frame_limit", true); | 384 | Settings::values.use_frame_limit = sdl2_config->GetBoolean("Renderer", "use_frame_limit", true); |
| 383 | Settings::values.frame_limit = | 385 | Settings::values.frame_limit = |
| 384 | static_cast<u16>(sdl2_config->GetInteger("Renderer", "frame_limit", 100)); | 386 | static_cast<u16>(sdl2_config->GetInteger("Renderer", "frame_limit", 100)); |
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index 00fd88279..6522c9652 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h | |||
| @@ -122,6 +122,10 @@ use_shader_jit = | |||
| 122 | # factor for the Switch resolution | 122 | # factor for the Switch resolution |
| 123 | resolution_factor = | 123 | resolution_factor = |
| 124 | 124 | ||
| 125 | # Aspect ratio | ||
| 126 | # 0: Default (16:9), 1: Force 21:9, 2: Stretch to Window | ||
| 127 | aspect_ratio = | ||
| 128 | |||
| 125 | # Whether to enable V-Sync (caps the framerate at 60FPS) or not. | 129 | # Whether to enable V-Sync (caps the framerate at 60FPS) or not. |
| 126 | # 0 (default): Off, 1: On | 130 | # 0 (default): Off, 1: On |
| 127 | use_vsync = | 131 | use_vsync = |
diff --git a/src/yuzu_tester/config.cpp b/src/yuzu_tester/config.cpp index 84ab4d687..0ac93b62a 100644 --- a/src/yuzu_tester/config.cpp +++ b/src/yuzu_tester/config.cpp | |||
| @@ -118,6 +118,8 @@ void Config::ReadValues() { | |||
| 118 | // Renderer | 118 | // Renderer |
| 119 | Settings::values.resolution_factor = | 119 | Settings::values.resolution_factor = |
| 120 | static_cast<float>(sdl2_config->GetReal("Renderer", "resolution_factor", 1.0)); | 120 | static_cast<float>(sdl2_config->GetReal("Renderer", "resolution_factor", 1.0)); |
| 121 | Settings::values.aspect_ratio = | ||
| 122 | static_cast<int>(sdl2_config->GetInteger("Renderer", "aspect_ratio", 0)); | ||
| 121 | Settings::values.use_frame_limit = false; | 123 | Settings::values.use_frame_limit = false; |
| 122 | Settings::values.frame_limit = 100; | 124 | Settings::values.frame_limit = 100; |
| 123 | Settings::values.use_disk_shader_cache = | 125 | Settings::values.use_disk_shader_cache = |
diff --git a/src/yuzu_tester/default_ini.h b/src/yuzu_tester/default_ini.h index 9a3e86d68..676592db0 100644 --- a/src/yuzu_tester/default_ini.h +++ b/src/yuzu_tester/default_ini.h | |||
| @@ -26,6 +26,10 @@ use_shader_jit = | |||
| 26 | # factor for the Switch resolution | 26 | # factor for the Switch resolution |
| 27 | resolution_factor = | 27 | resolution_factor = |
| 28 | 28 | ||
| 29 | # Aspect ratio | ||
| 30 | # 0: Default (16:9), 1: Force 21:9, 2: Stretch to Window | ||
| 31 | aspect_ratio = | ||
| 32 | |||
| 29 | # Whether to enable V-Sync (caps the framerate at 60FPS) or not. | 33 | # Whether to enable V-Sync (caps the framerate at 60FPS) or not. |
| 30 | # 0 (default): Off, 1: On | 34 | # 0 (default): Off, 1: On |
| 31 | use_vsync = | 35 | use_vsync = |