From abc97bb0fa63e18971dbb4dfd7d02ae4184b9410 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 30 Aug 2019 08:08:15 +1000 Subject: [PATCH] DolphinQt: Don't overwrite >8x IR scale in ini, add maximum internal res option This adds an ini-only setting under GFX.ini -> [Settings] -> MaxInternalResolution. Setting this will allow the user to select resolutions beyond the default 8x max scale in graphics options. --- Source/Core/Core/Config/GraphicsSettings.cpp | 1 + Source/Core/Core/Config/GraphicsSettings.h | 1 + .../Config/Graphics/EnhancementsWidget.cpp | 31 ++++++++++++------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Source/Core/Core/Config/GraphicsSettings.cpp b/Source/Core/Core/Config/GraphicsSettings.cpp index 83baf5ae05..84b9a49244 100644 --- a/Source/Core/Core/Config/GraphicsSettings.cpp +++ b/Source/Core/Core/Config/GraphicsSettings.cpp @@ -61,6 +61,7 @@ const ConfigInfo GFX_FAST_DEPTH_CALC{{System::GFX, "Settings", "FastDepthC const ConfigInfo GFX_MSAA{{System::GFX, "Settings", "MSAA"}, 1}; const ConfigInfo GFX_SSAA{{System::GFX, "Settings", "SSAA"}, false}; const ConfigInfo GFX_EFB_SCALE{{System::GFX, "Settings", "InternalResolution"}, 1}; +const ConfigInfo GFX_MAX_EFB_SCALE{{System::GFX, "Settings", "MaxInternalResolution"}, 8}; const ConfigInfo GFX_TEXFMT_OVERLAY_ENABLE{{System::GFX, "Settings", "TexFmtOverlayEnable"}, false}; const ConfigInfo GFX_TEXFMT_OVERLAY_CENTER{{System::GFX, "Settings", "TexFmtOverlayCenter"}, diff --git a/Source/Core/Core/Config/GraphicsSettings.h b/Source/Core/Core/Config/GraphicsSettings.h index dc8d501fab..26f62382ca 100644 --- a/Source/Core/Core/Config/GraphicsSettings.h +++ b/Source/Core/Core/Config/GraphicsSettings.h @@ -54,6 +54,7 @@ extern const ConfigInfo GFX_FAST_DEPTH_CALC; extern const ConfigInfo GFX_MSAA; extern const ConfigInfo GFX_SSAA; extern const ConfigInfo GFX_EFB_SCALE; +extern const ConfigInfo GFX_MAX_EFB_SCALE; extern const ConfigInfo GFX_TEXFMT_OVERLAY_ENABLE; extern const ConfigInfo GFX_TEXFMT_OVERLAY_CENTER; extern const ConfigInfo GFX_ENABLE_WIREFRAME; diff --git a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp index 11d7befe58..0fcb0a6c53 100644 --- a/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/EnhancementsWidget.cpp @@ -26,6 +26,7 @@ #include "VideoCommon/PostProcessing.h" #include "VideoCommon/VideoBackendBase.h" +#include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" EnhancementsWidget::EnhancementsWidget(GraphicsWindow* parent) @@ -48,21 +49,29 @@ void EnhancementsWidget::CreateWidgets() auto* enhancements_layout = new QGridLayout(); enhancements_box->setLayout(enhancements_layout); - m_ir_combo = new GraphicsChoice({tr("Auto (Multiple of 640x528)"), tr("Native (640x528)"), - tr("2x Native (1280x1056) for 720p"), - tr("3x Native (1920x1584) for 1080p"), - tr("4x Native (2560x2112) for 1440p"), - tr("5x Native (3200x2640)"), tr("6x Native (3840x3168) for 4K"), - tr("7x Native (4480x3696)"), tr("8x Native (5120x4224) for 5K")}, - Config::GFX_EFB_SCALE); + // Only display the first 8 scales, which most users will not go beyond. + QStringList resolution_options{ + tr("Auto (Multiple of 640x528)"), tr("Native (640x528)"), + tr("2x Native (1280x1056) for 720p"), tr("3x Native (1920x1584) for 1080p"), + tr("4x Native (2560x2112) for 1440p"), tr("5x Native (3200x2640)"), + tr("6x Native (3840x3168) for 4K"), tr("7x Native (4480x3696)"), + tr("8x Native (5120x4224) for 5K")}; + const int visible_resolution_option_count = static_cast(resolution_options.size()); - if (g_Config.iEFBScale > 8) + // If the current scale is greater than the max scale in the ini, add sufficient options so that + // when the settings are saved we don't lose the user-modified value from the ini. + const int max_efb_scale = + std::max(Config::Get(Config::GFX_EFB_SCALE), Config::Get(Config::GFX_MAX_EFB_SCALE)); + for (int scale = static_cast(resolution_options.size()); scale <= max_efb_scale; scale++) { - m_ir_combo->addItem(tr("Custom")); - m_ir_combo->setCurrentIndex(m_ir_combo->count() - 1); + resolution_options.append(tr("%1x Native (%2x%3)") + .arg(QString::number(scale), + QString::number(static_cast(EFB_WIDTH) * scale), + QString::number(static_cast(EFB_HEIGHT) * scale))); } - m_ir_combo->setMaxVisibleItems(m_ir_combo->count()); + m_ir_combo = new GraphicsChoice(resolution_options, Config::GFX_EFB_SCALE); + m_ir_combo->setMaxVisibleItems(visible_resolution_option_count); m_aa_combo = new QComboBox(); m_af_combo = new GraphicsChoice({tr("1x"), tr("2x"), tr("4x"), tr("8x"), tr("16x")},