diff --git a/src/duckstation-qt/gamepropertiesdialog.cpp b/src/duckstation-qt/gamepropertiesdialog.cpp index a68e87ed5..b5c096022 100644 --- a/src/duckstation-qt/gamepropertiesdialog.cpp +++ b/src/duckstation-qt/gamepropertiesdialog.cpp @@ -135,6 +135,9 @@ void GamePropertiesDialog::setupAdditionalUi() m_ui.userResolutionScale->addItem(tr("(unchanged)")); QtUtils::FillComboBoxWithResolutionScales(m_ui.userResolutionScale); + m_ui.userMSAAMode->addItem(tr("(unchanged)")); + QtUtils::FillComboBoxWithMSAAModes(m_ui.userMSAAMode); + m_ui.userTextureFiltering->addItem(tr("(unchanged)")); for (u32 i = 0; i < static_cast(GPUTextureFilter::Count); i++) { @@ -307,6 +310,11 @@ void GamePropertiesDialog::populateGameSettings() QSignalBlocker sb(m_ui.gpuMaxRunAhead); m_ui.gpuMaxRunAhead->setValue(static_cast(gs.gpu_max_run_ahead.value())); } + if (gs.gpu_pgxp_tolerance.has_value()) + { + QSignalBlocker sb(m_ui.gpuPGXPTolerance); + m_ui.gpuPGXPTolerance->setValue(static_cast(gs.gpu_pgxp_tolerance.value())); + } if (gs.display_crop_mode.has_value()) { @@ -333,6 +341,21 @@ void GamePropertiesDialog::populateGameSettings() m_ui.userResolutionScale->setCurrentIndex(0); } + if (gs.gpu_multisamples.has_value() && gs.gpu_per_sample_shading.has_value()) + { + QSignalBlocker sb(m_ui.userMSAAMode); + const QVariant current_msaa_mode( + QtUtils::GetMSAAModeValue(static_cast(gs.gpu_multisamples.value()), gs.gpu_per_sample_shading.has_value())); + const int current_msaa_index = m_ui.userMSAAMode->findData(current_msaa_mode); + if (current_msaa_index >= 0) + m_ui.userMSAAMode->setCurrentIndex((current_msaa_index >= 0) ? current_msaa_index : 0); + } + else + { + QSignalBlocker sb(m_ui.userMSAAMode); + m_ui.userMSAAMode->setCurrentIndex(0); + } + if (gs.gpu_texture_filter.has_value()) { QSignalBlocker sb(m_ui.userTextureFiltering); @@ -497,6 +520,23 @@ void GamePropertiesDialog::connectUi() saveGameSettings(); }); + connect(m_ui.userMSAAMode, QOverload::of(&QComboBox::currentIndexChanged), [this](int index) { + if (index == 0) + { + m_game_settings.gpu_multisamples.reset(); + m_game_settings.gpu_per_sample_shading.reset(); + } + else + { + uint multisamples; + bool ssaa; + QtUtils::DecodeMSAAModeValue(m_ui.userMSAAMode->itemData(index), &multisamples, &ssaa); + m_game_settings.gpu_multisamples = static_cast(multisamples); + m_game_settings.gpu_per_sample_shading = ssaa; + } + saveGameSettings(); + }); + connect(m_ui.userTextureFiltering, QOverload::of(&QComboBox::currentIndexChanged), [this](int index) { if (index <= 0) m_game_settings.gpu_texture_filter.reset(); @@ -633,6 +673,13 @@ void GamePropertiesDialog::connectUi() m_game_settings.gpu_max_run_ahead = static_cast(value); saveGameSettings(); }); + connect(m_ui.gpuPGXPTolerance, QOverload::of(&QDoubleSpinBox::valueChanged), [this](double value) { + if (value < 0.0) + m_game_settings.gpu_pgxp_tolerance.reset(); + else + m_game_settings.gpu_pgxp_tolerance = static_cast(value); + saveGameSettings(); + }); } void GamePropertiesDialog::updateCPUClockSpeedLabel() diff --git a/src/duckstation-qt/gamepropertiesdialog.ui b/src/duckstation-qt/gamepropertiesdialog.ui index 9709c859e..00cafef5e 100644 --- a/src/duckstation-qt/gamepropertiesdialog.ui +++ b/src/duckstation-qt/gamepropertiesdialog.ui @@ -325,16 +325,26 @@ + + + Multisample Antialiasing: + + + + + + + Texture Filtering: - + - + @@ -741,6 +751,29 @@ + + + + PGXP Geometry Tolerance: + + + + + + + -1 + + + 10 + + + 0.5 + + + -1 + + + diff --git a/src/frontend-common/game_list.h b/src/frontend-common/game_list.h index 39c268737..428aa27f5 100644 --- a/src/frontend-common/game_list.h +++ b/src/frontend-common/game_list.h @@ -115,7 +115,7 @@ private: enum : u32 { GAME_LIST_CACHE_SIGNATURE = 0x45434C47, - GAME_LIST_CACHE_VERSION = 14 + GAME_LIST_CACHE_VERSION = 15 }; using DatabaseMap = std::unordered_map; diff --git a/src/frontend-common/game_settings.cpp b/src/frontend-common/game_settings.cpp index 0d824e42b..533f6b47e 100644 --- a/src/frontend-common/game_settings.cpp +++ b/src/frontend-common/game_settings.cpp @@ -111,11 +111,13 @@ bool Entry::LoadFromStream(ByteStream* stream) !ReadOptionalFromStream(stream, &display_active_end_offset) || !ReadOptionalFromStream(stream, &dma_max_slice_ticks) || !ReadOptionalFromStream(stream, &dma_halt_ticks) || !ReadOptionalFromStream(stream, &gpu_fifo_size) || !ReadOptionalFromStream(stream, &gpu_max_run_ahead) || - !ReadOptionalFromStream(stream, &display_crop_mode) || !ReadOptionalFromStream(stream, &display_aspect_ratio) || + !ReadOptionalFromStream(stream, &gpu_pgxp_tolerance) || !ReadOptionalFromStream(stream, &display_crop_mode) || + !ReadOptionalFromStream(stream, &display_aspect_ratio) || !ReadOptionalFromStream(stream, &display_linear_upscaling) || !ReadOptionalFromStream(stream, &display_integer_upscaling) || !ReadOptionalFromStream(stream, &display_force_4_3_for_24bit) || - !ReadOptionalFromStream(stream, &gpu_resolution_scale) || !ReadOptionalFromStream(stream, &gpu_true_color) || + !ReadOptionalFromStream(stream, &gpu_resolution_scale) || !ReadOptionalFromStream(stream, &gpu_multisamples) || + !ReadOptionalFromStream(stream, &gpu_per_sample_shading) || !ReadOptionalFromStream(stream, &gpu_true_color) || !ReadOptionalFromStream(stream, &gpu_scaled_dithering) || !ReadOptionalFromStream(stream, &gpu_force_ntsc_timings) || !ReadOptionalFromStream(stream, &gpu_texture_filter) || !ReadOptionalFromStream(stream, &gpu_widescreen_hack) || @@ -156,11 +158,13 @@ bool Entry::SaveToStream(ByteStream* stream) const WriteOptionalToStream(stream, display_active_end_offset) && WriteOptionalToStream(stream, dma_max_slice_ticks) && WriteOptionalToStream(stream, dma_halt_ticks) && WriteOptionalToStream(stream, gpu_fifo_size) && WriteOptionalToStream(stream, gpu_max_run_ahead) && - WriteOptionalToStream(stream, display_crop_mode) && WriteOptionalToStream(stream, display_aspect_ratio) && + WriteOptionalToStream(stream, gpu_pgxp_tolerance) && WriteOptionalToStream(stream, display_crop_mode) && + WriteOptionalToStream(stream, display_aspect_ratio) && WriteOptionalToStream(stream, display_linear_upscaling) && WriteOptionalToStream(stream, display_integer_upscaling) && WriteOptionalToStream(stream, display_force_4_3_for_24bit) && - WriteOptionalToStream(stream, gpu_resolution_scale) && WriteOptionalToStream(stream, gpu_true_color) && + WriteOptionalToStream(stream, gpu_resolution_scale) && WriteOptionalToStream(stream, gpu_multisamples) && + WriteOptionalToStream(stream, gpu_per_sample_shading) && WriteOptionalToStream(stream, gpu_true_color) && WriteOptionalToStream(stream, gpu_scaled_dithering) && WriteOptionalToStream(stream, gpu_force_ntsc_timings) && WriteOptionalToStream(stream, gpu_texture_filter) && WriteOptionalToStream(stream, gpu_widescreen_hack) && WriteOptionalToStream(stream, gpu_pgxp) && WriteOptionalToStream(stream, controller_1_type) && @@ -209,6 +213,9 @@ static void ParseIniSection(Entry* entry, const char* section, const CSimpleIniA lvalue = ini.GetLongValue(section, "GPUMaxRunAhead", 0); if (lvalue > 0) entry->gpu_max_run_ahead = static_cast(lvalue); + float fvalue = static_cast(ini.GetDoubleValue(section, "GPUPGXPTolerance", -1.0f)); + if (fvalue >= 0.0f) + entry->gpu_pgxp_tolerance = fvalue; cvalue = ini.GetValue(section, "DisplayCropMode", nullptr); if (cvalue) @@ -229,6 +236,12 @@ static void ParseIniSection(Entry* entry, const char* section, const CSimpleIniA cvalue = ini.GetValue(section, "GPUResolutionScale", nullptr); if (cvalue) entry->gpu_resolution_scale = StringUtil::FromChars(cvalue); + cvalue = ini.GetValue(section, "GPUMultisamples", nullptr); + if (cvalue) + entry->gpu_multisamples = StringUtil::FromChars(cvalue); + cvalue = ini.GetValue(section, "GPUPerSampleShading", nullptr); + if (cvalue) + entry->gpu_per_sample_shading = StringUtil::FromChars(cvalue); cvalue = ini.GetValue(section, "GPUTrueColor", nullptr); if (cvalue) entry->gpu_true_color = StringUtil::FromChars(cvalue); @@ -302,6 +315,8 @@ static void StoreIniSection(const Entry& entry, const char* section, CSimpleIniA ini.SetLongValue(section, "GPUFIFOSize", static_cast(entry.gpu_fifo_size.value())); if (entry.gpu_max_run_ahead.has_value()) ini.SetLongValue(section, "GPUMaxRunAhead", static_cast(entry.gpu_max_run_ahead.value())); + if (entry.gpu_pgxp_tolerance.has_value()) + ini.SetDoubleValue(section, "GPUPGXPTolerance", static_cast(entry.gpu_pgxp_tolerance.value())); if (entry.display_crop_mode.has_value()) ini.SetValue(section, "DisplayCropMode", Settings::GetDisplayCropModeName(entry.display_crop_mode.value())); @@ -319,6 +334,10 @@ static void StoreIniSection(const Entry& entry, const char* section, CSimpleIniA if (entry.gpu_resolution_scale.has_value()) ini.SetLongValue(section, "GPUResolutionScale", static_cast(entry.gpu_resolution_scale.value())); + if (entry.gpu_multisamples.has_value()) + ini.SetLongValue(section, "GPUMultisamples", static_cast(entry.gpu_multisamples.value())); + if (entry.gpu_per_sample_shading.has_value()) + ini.SetValue(section, "GPUPerSampleShading", entry.gpu_per_sample_shading.value() ? "true" : "false"); if (entry.gpu_true_color.has_value()) ini.SetValue(section, "GPUTrueColor", entry.gpu_true_color.value() ? "true" : "false"); if (entry.gpu_scaled_dithering.has_value()) @@ -475,6 +494,8 @@ void Entry::ApplySettings(bool display_osd_messages) const g_settings.gpu_fifo_size = gpu_fifo_size.value(); if (gpu_max_run_ahead.has_value()) g_settings.gpu_max_run_ahead = gpu_max_run_ahead.value(); + if (gpu_pgxp_tolerance.has_value()) + g_settings.gpu_pgxp_tolerance = gpu_pgxp_tolerance.value(); if (display_crop_mode.has_value()) g_settings.display_crop_mode = display_crop_mode.value(); @@ -489,6 +510,10 @@ void Entry::ApplySettings(bool display_osd_messages) const if (gpu_resolution_scale.has_value()) g_settings.gpu_resolution_scale = gpu_resolution_scale.value(); + if (gpu_multisamples.has_value()) + g_settings.gpu_multisamples = gpu_multisamples.value(); + if (gpu_per_sample_shading.has_value()) + g_settings.gpu_per_sample_shading = gpu_per_sample_shading.value(); if (gpu_true_color.has_value()) g_settings.gpu_true_color = gpu_true_color.value(); if (gpu_scaled_dithering.has_value()) diff --git a/src/frontend-common/game_settings.h b/src/frontend-common/game_settings.h index 70e518313..590118341 100644 --- a/src/frontend-common/game_settings.h +++ b/src/frontend-common/game_settings.h @@ -42,6 +42,7 @@ struct Entry std::optional dma_halt_ticks; std::optional gpu_fifo_size; std::optional gpu_max_run_ahead; + std::optional gpu_pgxp_tolerance; // user settings std::optional cpu_overclock_numerator; @@ -54,6 +55,8 @@ struct Entry std::optional display_integer_upscaling; std::optional display_force_4_3_for_24bit; std::optional gpu_resolution_scale; + std::optional gpu_multisamples; + std::optional gpu_per_sample_shading; std::optional gpu_true_color; std::optional gpu_scaled_dithering; std::optional gpu_force_ntsc_timings;