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);
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);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.useDebugDevice, "GPU/UseDebugDevice");
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.displayAspectRatio, "Display/AspectRatio",
&Settings::ParseDisplayAspectRatio,
&Settings::GetDisplayAspectRatioName);
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.displayCropMode, "Display/CropMode",
&Settings::ParseDisplayCropMode, &Settings::GetDisplayCropModeName);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.useDebugDevice,
QStringLiteral("GPU/UseDebugDevice"));
SettingWidgetBinder::BindWidgetToEnumSetting(
m_host_interface, m_ui.displayAspectRatio, QStringLiteral("Display/AspectRatio"),
&Settings::ParseDisplayAspectRatio, &Settings::GetDisplayAspectRatioName);
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.displayCropMode,
QStringLiteral("Display/CropMode"), &Settings::ParseDisplayCropMode,
&Settings::GetDisplayCropModeName);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.displayLinearFiltering,
"Display/LinearFiltering");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.vsync, "Display/VSync");
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.resolutionScale, "GPU/ResolutionScale");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.trueColor, "GPU/TrueColor");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.scaledDithering, "GPU/ScaledDithering");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.disableInterlacing, "GPU/DisableInterlacing");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.forceNTSCTimings, "GPU/ForceNTSCTimings");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.linearTextureFiltering, "GPU/TextureFiltering");
QStringLiteral("Display/LinearFiltering"));
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.displayIntegerScaling,
QStringLiteral("Display/IntegerScaling"));
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.vsync, QStringLiteral("Display/VSync"));
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.resolutionScale,
QStringLiteral("GPU/ResolutionScale"));
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.trueColor, QStringLiteral("GPU/TrueColor"));
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,
&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 "
"producer a sharper, blockier/pixelated image. Enabling will smooth out the image. The option will be less "
"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",
"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 "

View file

@ -86,6 +86,13 @@
</widget>
</item>
<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">
<property name="text">
<string>VSync</string>

View file

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