Qt: Add integer upscaling option

This commit is contained in:
Connor McLaughlin 2020-05-01 01:00:29 +10:00
parent b4c31e55e2
commit 55fc3fffd9
3 changed files with 46 additions and 19 deletions

View File

@ -10,23 +10,32 @@ GPUSettingsWidget::GPUSettingsWidget(QtHostInterface* host_interface, QWidget* p
m_ui.setupUi(this); m_ui.setupUi(this);
setupAdditionalUi(); setupAdditionalUi();
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.renderer, "GPU/Renderer", SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.renderer, QStringLiteral("GPU/Renderer"),
&Settings::ParseRendererName, &Settings::GetRendererName); &Settings::ParseRendererName, &Settings::GetRendererName);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.useDebugDevice, "GPU/UseDebugDevice"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.useDebugDevice,
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.displayAspectRatio, "Display/AspectRatio", QStringLiteral("GPU/UseDebugDevice"));
&Settings::ParseDisplayAspectRatio, SettingWidgetBinder::BindWidgetToEnumSetting(
&Settings::GetDisplayAspectRatioName); m_host_interface, m_ui.displayAspectRatio, QStringLiteral("Display/AspectRatio"),
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.displayCropMode, "Display/CropMode", &Settings::ParseDisplayAspectRatio, &Settings::GetDisplayAspectRatioName);
&Settings::ParseDisplayCropMode, &Settings::GetDisplayCropModeName); SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.displayCropMode,
QStringLiteral("Display/CropMode"), &Settings::ParseDisplayCropMode,
&Settings::GetDisplayCropModeName);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.displayLinearFiltering, SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.displayLinearFiltering,
"Display/LinearFiltering"); QStringLiteral("Display/LinearFiltering"));
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.vsync, "Display/VSync"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.displayIntegerScaling,
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.resolutionScale, "GPU/ResolutionScale"); QStringLiteral("Display/IntegerScaling"));
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.trueColor, "GPU/TrueColor"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.vsync, QStringLiteral("Display/VSync"));
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.scaledDithering, "GPU/ScaledDithering"); SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.resolutionScale,
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.disableInterlacing, "GPU/DisableInterlacing"); QStringLiteral("GPU/ResolutionScale"));
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.forceNTSCTimings, "GPU/ForceNTSCTimings"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.trueColor, QStringLiteral("GPU/TrueColor"));
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.linearTextureFiltering, "GPU/TextureFiltering"); SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.scaledDithering,
QStringLiteral("GPU/ScaledDithering"));
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.disableInterlacing,
QStringLiteral("GPU/DisableInterlacing"));
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.forceNTSCTimings,
QStringLiteral("GPU/ForceNTSCTimings"));
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.linearTextureFiltering,
QStringLiteral("GPU/TextureFiltering"));
connect(m_ui.resolutionScale, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(m_ui.resolutionScale, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&GPUSettingsWidget::updateScaledDitheringEnabled); &GPUSettingsWidget::updateScaledDitheringEnabled);
@ -58,6 +67,10 @@ GPUSettingsWidget::GPUSettingsWidget(QtHostInterface* host_interface, QWidget* p
"Uses bilinear texture filtering when displaying the console's framebuffer to the screen. Disabling filtering will " "Uses bilinear texture filtering when displaying the console's framebuffer to the screen. Disabling filtering will "
"producer a sharper, blockier/pixelated image. Enabling will smooth out the image. The option will be less " "producer a sharper, blockier/pixelated image. Enabling will smooth out the image. The option will be less "
"noticable the higher the resolution scale."); "noticable the higher the resolution scale.");
dialog->registerWidgetHelp(
m_ui.displayIntegerScaling, "Integer Upscaling", "Unchecked",
"Adds padding to the display area to ensure that the ratio between pixels on the host to "
"pixels in the console is an integer number. May result in a sharper image in some 2D games.");
dialog->registerWidgetHelp(m_ui.vsync, "VSync", "Checked", dialog->registerWidgetHelp(m_ui.vsync, "VSync", "Checked",
"Enables synchronization with the host display when possible. Enabling this option will " "Enables synchronization with the host display when possible. Enabling this option will "
"provide better frame pacing and smoother motion with fewer duplicated frames. VSync is " "provide better frame pacing and smoother motion with fewer duplicated frames. VSync is "

View File

@ -86,6 +86,13 @@
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="displayIntegerScaling">
<property name="text">
<string>Integer Upscaling</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="vsync"> <widget class="QCheckBox" name="vsync">
<property name="text"> <property name="text">
<string>VSync</string> <string>VSync</string>

View File

@ -164,11 +164,18 @@ void QtHostInterface::applySettings()
CommonHostInterface::UpdateInputMap(si); CommonHostInterface::UpdateInputMap(si);
// detect when render-to-main flag changes // detect when render-to-main flag changes
const bool render_to_main = m_qsettings->value("Main/RenderToMainWindow", true).toBool(); if (m_system)
if (m_system && getHostDisplay() && !m_is_fullscreen && render_to_main != m_is_rendering_to_main)
{ {
m_is_rendering_to_main = render_to_main; const bool render_to_main = m_qsettings->value("Main/RenderToMainWindow", true).toBool();
updateDisplayState(); if (getHostDisplay() && !m_is_fullscreen && render_to_main != m_is_rendering_to_main)
{
m_is_rendering_to_main = render_to_main;
updateDisplayState();
}
else
{
renderDisplay();
}
} }
} }