From 74763d2156ca8d1e8dbf2f31ddc5f39693dae373 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 12 Mar 2023 23:44:53 +1000 Subject: [PATCH] Qt: Hide manual hardware fixes from global settings --- pcsx2-qt/Settings/GraphicsSettingsWidget.cpp | 81 +++++++++++++++++--- pcsx2-qt/Settings/GraphicsSettingsWidget.h | 1 + pcsx2-qt/Settings/GraphicsSettingsWidget.ui | 2 +- 3 files changed, 73 insertions(+), 11 deletions(-) diff --git a/pcsx2-qt/Settings/GraphicsSettingsWidget.cpp b/pcsx2-qt/Settings/GraphicsSettingsWidget.cpp index 6184680bae..75eec08db0 100644 --- a/pcsx2-qt/Settings/GraphicsSettingsWidget.cpp +++ b/pcsx2-qt/Settings/GraphicsSettingsWidget.cpp @@ -80,6 +80,15 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget* m_ui.setupUi(this); +#ifndef PCSX2_DEVBUILD + if (!m_dialog->isPerGameSettings()) + { + // We removed hardware fixes from global settings, but people in the past did set this stuff globally. + // So, just reset it all. We can remove this code at some point in the future. + resetManualHardwareFixes(); + } +#endif + ////////////////////////////////////////////////////////////////////////// // Global Settings ////////////////////////////////////////////////////////////////////////// @@ -166,11 +175,8 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget* SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.dithering, "EmuCore/GS", "dithering_ps2", 2); SettingWidgetBinder::BindWidgetToIntSetting( sif, m_ui.mipmapping, "EmuCore/GS", "mipmap_hw", static_cast(HWMipmapLevel::Automatic), -1); - SettingWidgetBinder::BindWidgetToIntSetting( - sif, m_ui.crcFixLevel, "EmuCore/GS", "crc_hack_level", static_cast(CRCHackLevel::Automatic), -1); SettingWidgetBinder::BindWidgetToIntSetting( sif, m_ui.blending, "EmuCore/GS", "accurate_blending_unit", static_cast(AccBlendLevel::Basic)); - SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.gpuPaletteConversion, "EmuCore/GS", "paltex", false); SettingWidgetBinder::BindWidgetToIntSetting( sif, m_ui.texturePreloading, "EmuCore/GS", "texture_preloading", static_cast(TexturePreloadingLevel::Off)); @@ -187,6 +193,7 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget* ////////////////////////////////////////////////////////////////////////// // HW Renderer Fixes ////////////////////////////////////////////////////////////////////////// + SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.crcFixLevel, "EmuCore/GS", "crc_hack_level", static_cast(CRCHackLevel::Automatic), -1); SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.halfScreenFix, "EmuCore/GS", "UserHacks_Half_Bottom_Override", -1, -1); SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.cpuSpriteRenderBW, "EmuCore/GS", "UserHacks_CPUSpriteRenderBW", 0); SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.cpuCLUTRender, "EmuCore/GS", "UserHacks_CPUCLUTRender", 0); @@ -205,6 +212,7 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget* SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.readTCOnClose, "EmuCore/GS", "UserHacks_ReadTCOnClose", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.targetPartialInvalidation, "EmuCore/GS", "UserHacks_TargetPartialInvalidation", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.estimateTextureRegion, "EmuCore/GS", "UserHacks_EstimateTextureRegion", false); + SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.gpuPaletteConversion, "EmuCore/GS", "paltex", false); ////////////////////////////////////////////////////////////////////////// // HW Upscaling Fixes @@ -296,13 +304,11 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget* m_ui.advancedOptionsFormLayout->removeRow(0); m_ui.gsDownloadMode = nullptr; - // Remove texture offset and skipdraw range for global settings. - m_ui.upscalingFixesLayout->removeRow(2); - m_ui.hardwareFixesLayout->removeRow(5); - m_ui.skipDrawStart = nullptr; - m_ui.skipDrawEnd = nullptr; - m_ui.textureOffsetX = nullptr; - m_ui.textureOffsetY = nullptr; + // Don't allow setting hardware fixes globally. + // Too many stupid youtube "best settings" guides, that break other games. + m_ui.hardwareRenderingOptionsLayout->removeWidget(m_ui.enableHWFixes); + delete m_ui.enableHWFixes; + m_ui.enableHWFixes = nullptr; } #endif @@ -1019,3 +1025,58 @@ void GraphicsSettingsWidget::updateRendererDependentOptions() } } } + +void GraphicsSettingsWidget::resetManualHardwareFixes() +{ + bool changed = false; + { + auto lock = Host::GetSettingsLock(); + SettingsInterface* const si = Host::Internal::GetBaseSettingsLayer(); + + auto check_bool = [&](const char* section, const char* key, bool expected) { + if (si->GetBoolValue(section, key, expected) != expected) + { + si->SetBoolValue(section, key, expected); + changed = true; + } + }; + auto check_int = [&](const char* section, const char* key, s32 expected) { + if (si->GetIntValue(section, key, expected) != expected) + { + si->SetIntValue(section, key, expected); + changed = true; + } + }; + + check_bool("EmuCore/GS", "UserHacks", false); + + check_int("EmuCore/GS", "crc_hack_level", static_cast(CRCHackLevel::Automatic)); + check_int("EmuCore/GS", "UserHacks_Half_Bottom_Override", -1); + check_int("EmuCore/GS", "UserHacks_CPUSpriteRenderBW", 0); + check_int("EmuCore/GS", "UserHacks_CPUCLUTRender", 0); + check_int("EmuCore/GS", "UserHacks_GPUTargetCLUTMode", 0); + check_int("EmuCore/GS", "UserHacks_SkipDraw_Start", 0); + check_int("EmuCore/GS", "UserHacks_SkipDraw_End", 0); + check_bool("EmuCore/GS", "UserHacks_AutoFlush", false); + check_bool("EmuCore/GS", "UserHacks_CPU_FB_Conversion", false); + check_bool("EmuCore/GS", "UserHacks_DisableDepthSupport", false); + check_bool("EmuCore/GS", "UserHacks_Disable_Safe_Features", false); + check_bool("EmuCore/GS", "preload_frame_with_gs_data", false); + check_bool("EmuCore/GS", "UserHacks_DisablePartialInvalidation", false); + check_int("EmuCore/GS", "UserHacks_TextureInsideRt", static_cast(GSTextureInRtMode::Disabled)); + check_bool("EmuCore/GS", "UserHacks_ReadTCOnClose", false); + check_bool("EmuCore/GS", "UserHacks_TargetPartialInvalidation", false); + check_bool("EmuCore/GS", "UserHacks_EstimateTextureRegion", false); + check_bool("EmuCore/GS", "paltex", false); + check_int("EmuCore/GS", "UserHacks_HalfPixelOffset", 0); + check_int("EmuCore/GS", "UserHacks_round_sprite_offset", 0); + check_int("EmuCore/GS", "UserHacks_TCOffsetX", 0); + check_int("EmuCore/GS", "UserHacks_TCOffsetY", 0); + check_bool("EmuCore/GS", "UserHacks_align_sprite_X", false); + check_bool("EmuCore/GS", "UserHacks_merge_pp_sprite", false); + check_bool("EmuCore/GS", "UserHacks_WildHack", false); + } + + if (changed) + Host::CommitBaseSettingChanges(); +} diff --git a/pcsx2-qt/Settings/GraphicsSettingsWidget.h b/pcsx2-qt/Settings/GraphicsSettingsWidget.h index f0993c975b..c3de1794b6 100644 --- a/pcsx2-qt/Settings/GraphicsSettingsWidget.h +++ b/pcsx2-qt/Settings/GraphicsSettingsWidget.h @@ -54,6 +54,7 @@ private Q_SLOTS: private: GSRendererType getEffectiveRenderer() const; void updateRendererDependentOptions(); + void resetManualHardwareFixes(); SettingsDialog* m_dialog; diff --git a/pcsx2-qt/Settings/GraphicsSettingsWidget.ui b/pcsx2-qt/Settings/GraphicsSettingsWidget.ui index 343a323dee..e6bdc9f44d 100644 --- a/pcsx2-qt/Settings/GraphicsSettingsWidget.ui +++ b/pcsx2-qt/Settings/GraphicsSettingsWidget.ui @@ -667,7 +667,7 @@ - +