GameSettings: Add downsampling mode

This commit is contained in:
Connor McLaughlin 2020-12-30 17:53:51 +10:00
parent 3cb2cd8235
commit 78282d1508
5 changed files with 44 additions and 3 deletions

View File

@ -132,6 +132,13 @@ void GamePropertiesDialog::setupAdditionalUi()
qApp->translate("DisplayCropMode", Settings::GetDisplayCropModeDisplayName(static_cast<DisplayCropMode>(i))));
}
m_ui.userDownsampleMode->addItem(tr("(unchanged)"));
for (u32 i = 0; i < static_cast<u32>(GPUDownsampleMode::Count); i++)
{
m_ui.userDownsampleMode->addItem(
qApp->translate("GPUDownsampleMode", Settings::GetDownsampleModeDisplayName(static_cast<GPUDownsampleMode>(i))));
}
m_ui.userResolutionScale->addItem(tr("(unchanged)"));
QtUtils::FillComboBoxWithResolutionScales(m_ui.userResolutionScale);
@ -341,6 +348,11 @@ void GamePropertiesDialog::populateGameSettings()
QSignalBlocker sb(m_ui.userAspectRatio);
m_ui.userAspectRatio->setCurrentIndex(static_cast<int>(gs.display_aspect_ratio.value()) + 1);
}
if (gs.gpu_downsample_mode.has_value())
{
QSignalBlocker sb(m_ui.userDownsampleMode);
m_ui.userDownsampleMode->setCurrentIndex(static_cast<int>(gs.gpu_downsample_mode.value()) + 1);
}
populateBooleanUserSetting(m_ui.userLinearUpscaling, gs.display_linear_upscaling);
populateBooleanUserSetting(m_ui.userIntegerUpscaling, gs.display_integer_upscaling);
@ -525,6 +537,14 @@ void GamePropertiesDialog::connectUi()
saveGameSettings();
});
connect(m_ui.userDownsampleMode, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int index) {
if (index <= 0)
m_game_settings.gpu_downsample_mode.reset();
else
m_game_settings.gpu_downsample_mode = static_cast<GPUDownsampleMode>(index - 1);
saveGameSettings();
});
connectBooleanUserSetting(m_ui.userLinearUpscaling, &m_game_settings.display_linear_upscaling);
connectBooleanUserSetting(m_ui.userIntegerUpscaling, &m_game_settings.display_integer_upscaling);

View File

@ -281,7 +281,17 @@
<item row="1" column="1">
<widget class="QComboBox" name="userCropMode"/>
</item>
<item row="2" column="0" colspan="2">
<item row="2" column="0">
<widget class="QLabel" name="label_31">
<property name="text">
<string>Downsampling:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="userDownsampleMode"/>
</item>
<item row="3" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="userLinearUpscaling">

View File

@ -108,7 +108,7 @@ private:
enum : u32
{
GAME_LIST_CACHE_SIGNATURE = 0x45434C47,
GAME_LIST_CACHE_VERSION = 19
GAME_LIST_CACHE_VERSION = 20
};
using DatabaseMap = std::unordered_map<std::string, GameListDatabaseEntry>;

View File

@ -119,6 +119,7 @@ bool Entry::LoadFromStream(ByteStream* stream)
!ReadOptionalFromStream(stream, &gpu_pgxp_tolerance) ||
!ReadOptionalFromStream(stream, &gpu_pgxp_depth_threshold) ||
!ReadOptionalFromStream(stream, &display_crop_mode) || !ReadOptionalFromStream(stream, &display_aspect_ratio) ||
!ReadOptionalFromStream(stream, &gpu_downsample_mode) ||
!ReadOptionalFromStream(stream, &display_linear_upscaling) ||
!ReadOptionalFromStream(stream, &display_integer_upscaling) ||
!ReadOptionalFromStream(stream, &display_force_4_3_for_24bit) ||
@ -167,7 +168,7 @@ bool Entry::SaveToStream(ByteStream* stream) const
WriteOptionalToStream(stream, dma_halt_ticks) && WriteOptionalToStream(stream, gpu_fifo_size) &&
WriteOptionalToStream(stream, gpu_max_run_ahead) && WriteOptionalToStream(stream, gpu_pgxp_tolerance) &&
WriteOptionalToStream(stream, gpu_pgxp_depth_threshold) && WriteOptionalToStream(stream, display_crop_mode) &&
WriteOptionalToStream(stream, display_aspect_ratio) &&
WriteOptionalToStream(stream, display_aspect_ratio) && WriteOptionalToStream(stream, gpu_downsample_mode) &&
WriteOptionalToStream(stream, display_linear_upscaling) &&
WriteOptionalToStream(stream, display_integer_upscaling) &&
WriteOptionalToStream(stream, display_force_4_3_for_24bit) &&
@ -243,6 +244,9 @@ static void ParseIniSection(Entry* entry, const char* section, const CSimpleIniA
cvalue = ini.GetValue(section, "DisplayAspectRatio", nullptr);
if (cvalue)
entry->display_aspect_ratio = Settings::ParseDisplayAspectRatio(cvalue);
cvalue = ini.GetValue(section, "GPUDownsampleMode", nullptr);
if (cvalue)
entry->gpu_downsample_mode = Settings::ParseDownsampleModeName(cvalue);
cvalue = ini.GetValue(section, "DisplayLinearUpscaling", nullptr);
if (cvalue)
entry->display_linear_upscaling = StringUtil::FromChars<bool>(cvalue);
@ -354,6 +358,10 @@ static void StoreIniSection(const Entry& entry, const char* section, CSimpleIniA
ini.SetValue(section, "DisplayAspectRatio",
Settings::GetDisplayAspectRatioName(entry.display_aspect_ratio.value()));
}
if (entry.gpu_downsample_mode.has_value())
{
ini.SetValue(section, "GPUDownsampleMode", Settings::GetDownsampleModeName(entry.gpu_downsample_mode.value()));
}
if (entry.display_linear_upscaling.has_value())
ini.SetValue(section, "DisplayLinearUpscaling", entry.display_linear_upscaling.value() ? "true" : "false");
if (entry.display_integer_upscaling.has_value())
@ -536,6 +544,8 @@ void Entry::ApplySettings(bool display_osd_messages) const
g_settings.display_crop_mode = display_crop_mode.value();
if (display_aspect_ratio.has_value())
g_settings.display_aspect_ratio = display_aspect_ratio.value();
if (gpu_downsample_mode.has_value())
g_settings.gpu_downsample_mode = gpu_downsample_mode.value();
if (display_linear_upscaling.has_value())
g_settings.display_linear_filtering = display_linear_upscaling.value();
if (display_integer_upscaling.has_value())

View File

@ -56,6 +56,7 @@ struct Entry
std::optional<u32> cdrom_read_speedup;
std::optional<DisplayCropMode> display_crop_mode;
std::optional<DisplayAspectRatio> display_aspect_ratio;
std::optional<GPUDownsampleMode> gpu_downsample_mode;
std::optional<bool> display_linear_upscaling;
std::optional<bool> display_integer_upscaling;
std::optional<bool> display_force_4_3_for_24bit;