diff --git a/src/duckstation-qt/gamepropertiesdialog.cpp b/src/duckstation-qt/gamepropertiesdialog.cpp index c41946b54..c62067b2e 100644 --- a/src/duckstation-qt/gamepropertiesdialog.cpp +++ b/src/duckstation-qt/gamepropertiesdialog.cpp @@ -132,6 +132,13 @@ void GamePropertiesDialog::setupAdditionalUi() qApp->translate("DisplayCropMode", Settings::GetDisplayCropModeDisplayName(static_cast(i)))); } + m_ui.userDownsampleMode->addItem(tr("(unchanged)")); + for (u32 i = 0; i < static_cast(GPUDownsampleMode::Count); i++) + { + m_ui.userDownsampleMode->addItem( + qApp->translate("GPUDownsampleMode", Settings::GetDownsampleModeDisplayName(static_cast(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(gs.display_aspect_ratio.value()) + 1); } + if (gs.gpu_downsample_mode.has_value()) + { + QSignalBlocker sb(m_ui.userDownsampleMode); + m_ui.userDownsampleMode->setCurrentIndex(static_cast(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::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(index - 1); + saveGameSettings(); + }); + connectBooleanUserSetting(m_ui.userLinearUpscaling, &m_game_settings.display_linear_upscaling); connectBooleanUserSetting(m_ui.userIntegerUpscaling, &m_game_settings.display_integer_upscaling); diff --git a/src/duckstation-qt/gamepropertiesdialog.ui b/src/duckstation-qt/gamepropertiesdialog.ui index 5fe8cb6f2..09118dd3b 100644 --- a/src/duckstation-qt/gamepropertiesdialog.ui +++ b/src/duckstation-qt/gamepropertiesdialog.ui @@ -281,7 +281,17 @@ - + + + + Downsampling: + + + + + + + diff --git a/src/frontend-common/game_list.h b/src/frontend-common/game_list.h index 04de7479e..2122c5c7f 100644 --- a/src/frontend-common/game_list.h +++ b/src/frontend-common/game_list.h @@ -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; diff --git a/src/frontend-common/game_settings.cpp b/src/frontend-common/game_settings.cpp index ec3764328..193fbf642 100644 --- a/src/frontend-common/game_settings.cpp +++ b/src/frontend-common/game_settings.cpp @@ -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(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()) diff --git a/src/frontend-common/game_settings.h b/src/frontend-common/game_settings.h index 9155adbc3..6b61cf43b 100644 --- a/src/frontend-common/game_settings.h +++ b/src/frontend-common/game_settings.h @@ -56,6 +56,7 @@ struct Entry std::optional cdrom_read_speedup; std::optional display_crop_mode; std::optional display_aspect_ratio; + std::optional gpu_downsample_mode; std::optional display_linear_upscaling; std::optional display_integer_upscaling; std::optional display_force_4_3_for_24bit;