From 91732e2baff00bf5642d51b2618499aecc65107c Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 1 Apr 2018 21:27:06 +0200 Subject: [PATCH] Remove support for projection hacks This isn't really useful for anything anymore as far as I know. --- Data/Sys/GameSettings/GJ3.ini | 22 ----- Data/Sys/GameSettings/GNO.ini | 8 -- Data/Sys/GameSettings/R2K.ini | 22 ----- Data/Sys/GameSettings/R3T.ini | 22 ----- Source/Core/Core/Config/GraphicsSettings.cpp | 7 -- .../Core/ConfigLoaders/IsSettingSaveable.cpp | 4 +- .../DolphinWX/ISOProperties/ISOProperties.cpp | 25 +----- .../DolphinWX/ISOProperties/ISOProperties.h | 9 -- Source/Core/VideoBackends/OGL/Render.cpp | 5 -- .../Core/VideoCommon/VertexShaderManager.cpp | 89 +------------------ Source/Core/VideoCommon/VertexShaderManager.h | 2 - Source/Core/VideoCommon/VideoBackendBase.cpp | 1 - Source/Core/VideoCommon/VideoConfig.cpp | 5 -- Source/Core/VideoCommon/VideoConfig.h | 11 --- 14 files changed, 4 insertions(+), 228 deletions(-) delete mode 100644 Data/Sys/GameSettings/GJ3.ini delete mode 100644 Data/Sys/GameSettings/R2K.ini delete mode 100644 Data/Sys/GameSettings/R3T.ini diff --git a/Data/Sys/GameSettings/GJ3.ini b/Data/Sys/GameSettings/GJ3.ini deleted file mode 100644 index 8dc09031d7..0000000000 --- a/Data/Sys/GameSettings/GJ3.ini +++ /dev/null @@ -1,22 +0,0 @@ -# GJ3PA4 - International Superstar Soccer 3 - -[Core] -# Values set here will override the main Dolphin settings. - -[OnLoad] -# Add memory patches to be loaded once on boot here. - -[OnFrame] -# Add memory patches to be applied every frame here. - -[ActionReplay] -# Add action replay cheats here. - -[Video] -ProjectionHack = 1 -PH_SZNear = 1 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = 0.1 - diff --git a/Data/Sys/GameSettings/GNO.ini b/Data/Sys/GameSettings/GNO.ini index 58fbed3527..3548aa2619 100644 --- a/Data/Sys/GameSettings/GNO.ini +++ b/Data/Sys/GameSettings/GNO.ini @@ -12,14 +12,6 @@ [ActionReplay] # Add action replay cheats here. -[Video] -ProjectionHack = 1 -PH_SZNear = 0 -PH_SZFar = 1 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = 0.000153 - [Video_Settings] SafeTextureCacheColorSamples = 0 diff --git a/Data/Sys/GameSettings/R2K.ini b/Data/Sys/GameSettings/R2K.ini deleted file mode 100644 index c8cc2ed068..0000000000 --- a/Data/Sys/GameSettings/R2K.ini +++ /dev/null @@ -1,22 +0,0 @@ -# R2KP54 - DON KING BOXING - -[Core] -# Values set here will override the main Dolphin settings. - -[OnLoad] -# Add memory patches to be loaded once on boot here. - -[OnFrame] -# Add memory patches to be applied every frame here. - -[ActionReplay] -# Add action replay cheats here. - -[Video] -ProjectionHack = 1 -PH_SZNear = 1 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = 0.1 - diff --git a/Data/Sys/GameSettings/R3T.ini b/Data/Sys/GameSettings/R3T.ini deleted file mode 100644 index 7b9a17a140..0000000000 --- a/Data/Sys/GameSettings/R3T.ini +++ /dev/null @@ -1,22 +0,0 @@ -# R3TP54 - TOPSPIN 3 - -[Core] -# Values set here will override the main Dolphin settings. - -[OnLoad] -# Add memory patches to be loaded once on boot here. - -[OnFrame] -# Add memory patches to be applied every frame here. - -[ActionReplay] -# Add action replay cheats here. - -[Video] -ProjectionHack = 1 -PH_SZNear = 1 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = 0.1 - diff --git a/Source/Core/Core/Config/GraphicsSettings.cpp b/Source/Core/Core/Config/GraphicsSettings.cpp index 7412c81740..f46c7a585a 100644 --- a/Source/Core/Core/Config/GraphicsSettings.cpp +++ b/Source/Core/Core/Config/GraphicsSettings.cpp @@ -141,13 +141,6 @@ const ConfigInfo GFX_HACK_VERTEX_ROUDING{{System::GFX, "Hacks", "VertexRou // Graphics.GameSpecific -const ConfigInfo GFX_PROJECTION_HACK{{System::GFX, "GameSpecific", "ProjectionHack"}, 0}; -const ConfigInfo GFX_PROJECTION_HACK_SZNEAR{{System::GFX, "GameSpecific", "PH_SZNear"}, 0}; -const ConfigInfo GFX_PROJECTION_HACK_SZFAR{{System::GFX, "GameSpecific", "PH_SZFar"}, 0}; -const ConfigInfo GFX_PROJECTION_HACK_ZNEAR{{System::GFX, "GameSpecific", "PH_ZNear"}, - ""}; -const ConfigInfo GFX_PROJECTION_HACK_ZFAR{{System::GFX, "GameSpecific", "PH_ZFar"}, - ""}; const ConfigInfo GFX_PERF_QUERIES_ENABLE{{System::GFX, "GameSpecific", "PerfQueriesEnable"}, false}; } // namespace Config diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp index d9e210deaa..a4bf157df9 100644 --- a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp +++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp @@ -80,9 +80,7 @@ bool IsSettingSaveable(const Config::ConfigLocation& config_location) // Graphics.GameSpecific - Config::GFX_PROJECTION_HACK.location, Config::GFX_PROJECTION_HACK_SZNEAR.location, - Config::GFX_PROJECTION_HACK_SZFAR.location, Config::GFX_PROJECTION_HACK_ZNEAR.location, - Config::GFX_PROJECTION_HACK_ZFAR.location, Config::GFX_PERF_QUERIES_ENABLE.location, + Config::GFX_PERF_QUERIES_ENABLE.location, }; diff --git a/Source/Core/DolphinWX/ISOProperties/ISOProperties.cpp b/Source/Core/DolphinWX/ISOProperties/ISOProperties.cpp index e4aaf0a59d..622246f5c4 100644 --- a/Source/Core/DolphinWX/ISOProperties/ISOProperties.cpp +++ b/Source/Core/DolphinWX/ISOProperties/ISOProperties.cpp @@ -495,26 +495,7 @@ void CISOProperties::LoadGameConfig() SetCheckboxValueFromGameini("Wii", "Widescreen", m_enable_widescreen); SetCheckboxValueFromGameini("Video_Stereoscopy", "StereoEFBMonoDepth", m_mono_depth); - IniFile::Section* default_video = m_gameini_default.GetOrCreateSection("Video"); - - int iTemp; - default_video->Get("ProjectionHack", &iTemp); - default_video->Get("PH_SZNear", &m_phack_data.PHackSZNear); - if (m_gameini_local.GetIfExists("Video", "PH_SZNear", &iTemp)) - m_phack_data.PHackSZNear = !!iTemp; - default_video->Get("PH_SZFar", &m_phack_data.PHackSZFar); - if (m_gameini_local.GetIfExists("Video", "PH_SZFar", &iTemp)) - m_phack_data.PHackSZFar = !!iTemp; - std::string sTemp; - default_video->Get("PH_ZNear", &m_phack_data.PHZNear); - if (m_gameini_local.GetIfExists("Video", "PH_ZNear", &sTemp)) - m_phack_data.PHZNear = sTemp; - default_video->Get("PH_ZFar", &m_phack_data.PHZFar); - if (m_gameini_local.GetIfExists("Video", "PH_ZFar", &sTemp)) - m_phack_data.PHZFar = sTemp; - - sTemp = ""; if (!m_gameini_local.GetIfExists("Core", "GPUDeterminismMode", &sTemp)) m_gameini_default.GetIfExists("Core", "GPUDeterminismMode", &sTemp); @@ -527,6 +508,7 @@ void CISOProperties::LoadGameConfig() else if (sTemp == "fake-completion") m_gpu_determinism->SetSelection(3); + int iTemp; IniFile::Section* default_stereoscopy = m_gameini_default.GetOrCreateSection("Video_Stereoscopy"); default_stereoscopy->Get("StereoDepthPercentage", &iTemp, 100); m_gameini_local.GetIfExists("Video_Stereoscopy", "StereoDepthPercentage", &iTemp); @@ -595,11 +577,6 @@ bool CISOProperties::SaveGameConfig() m_gameini_local.DeleteKey((section), (key)); \ } while (0) - SAVE_IF_NOT_DEFAULT("Video", "PH_SZNear", (m_phack_data.PHackSZNear ? 1 : 0), 0); - SAVE_IF_NOT_DEFAULT("Video", "PH_SZFar", (m_phack_data.PHackSZFar ? 1 : 0), 0); - SAVE_IF_NOT_DEFAULT("Video", "PH_ZNear", m_phack_data.PHZNear, ""); - SAVE_IF_NOT_DEFAULT("Video", "PH_ZFar", m_phack_data.PHZFar, ""); - std::string tmp; if (m_gpu_determinism->GetSelection() == 0) tmp = "Not Set"; diff --git a/Source/Core/DolphinWX/ISOProperties/ISOProperties.h b/Source/Core/DolphinWX/ISOProperties/ISOProperties.h index 55465b3f7c..713fe3d364 100644 --- a/Source/Core/DolphinWX/ISOProperties/ISOProperties.h +++ b/Source/Core/DolphinWX/ISOProperties/ISOProperties.h @@ -39,14 +39,6 @@ namespace Gecko class CodeConfigPanel; } -struct PHackData -{ - bool PHackSZNear; - bool PHackSZFar; - std::string PHZNear; - std::string PHZFar; -}; - wxDECLARE_EVENT(DOLPHIN_EVT_CHANGE_ISO_PROPERTIES_TITLE, wxCommandEvent); class CISOProperties : public wxDialog @@ -64,7 +56,6 @@ private: std::unique_ptr m_open_iso; std::vector m_on_frame; - PHackData m_phack_data; // Core wxCheckBox *m_cpu_thread, *m_mmu, *m_dcbz_off, *m_fprf; diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index ab30fe288a..e7557deed6 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -51,11 +51,6 @@ #include "VideoCommon/VideoConfig.h" #include "VideoCommon/XFMemory.h" -void VideoConfig::UpdateProjectionHack() -{ - ::UpdateProjectionHack(g_Config.phack); -} - namespace OGL { VideoConfig g_ogl_config; diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 9d3c25ca13..e01b9aa666 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -47,88 +47,6 @@ static float s_fViewRotation[2]; VertexShaderConstants VertexShaderManager::constants; bool VertexShaderManager::dirty; -struct ProjectionHack -{ - float sign; - float value; - ProjectionHack() {} - ProjectionHack(float new_sign, float new_value) : sign(new_sign), value(new_value) {} -}; - -namespace -{ -// Control Variables -static ProjectionHack g_proj_hack_near; -static ProjectionHack g_proj_hack_far; -} // Namespace - -static float PHackValue(std::string sValue) -{ - float f = 0; - bool fp = false; - const char* cStr = sValue.c_str(); - char* c = new char[strlen(cStr) + 1]; - std::istringstream sTof(""); - - for (unsigned int i = 0; i <= strlen(cStr); ++i) - { - if (i == 20) - { - c[i] = '\0'; - break; - } - - c[i] = (cStr[i] == ',') ? '.' : *(cStr + i); - if (c[i] == '.') - fp = true; - } - - cStr = c; - sTof.str(cStr); - sTof >> f; - - if (!fp) - f /= 0xF4240; - - delete[] c; - return f; -} - -void UpdateProjectionHack(const ProjectionHackConfig& config) -{ - float near_value = 0, far_value = 0; - float near_sign = 1.0, far_sign = 1.0; - - if (config.m_enable) - { - const char* near_sign_str = ""; - const char* far_sign_str = ""; - - NOTICE_LOG(VIDEO, "\t\t--- Orthographic Projection Hack ON ---"); - - if (config.m_sznear) - { - near_sign *= -1.0f; - near_sign_str = " * (-1)"; - } - if (config.m_szfar) - { - far_sign *= -1.0f; - far_sign_str = " * (-1)"; - } - - near_value = PHackValue(config.m_znear); - NOTICE_LOG(VIDEO, "- zNear Correction = (%f + zNear)%s", near_value, near_sign_str); - - far_value = PHackValue(config.m_zfar); - NOTICE_LOG(VIDEO, "- zFar Correction = (%f + zFar)%s", far_value, far_sign_str); - } - - // Set the projections hacks - g_proj_hack_near = ProjectionHack(near_sign, near_value); - g_proj_hack_far = ProjectionHack(far_sign, far_value); -} - // Viewport correction: // In D3D, the viewport rectangle must fit within the render target. // Say you want a viewport at (ix, iy) with size (iw, ih), @@ -454,7 +372,6 @@ void VertexShaderManager::SetConstants() g_fProjectionMatrix[8] = 0.0f; g_fProjectionMatrix[9] = 0.0f; g_fProjectionMatrix[10] = rawProjection[4]; - g_fProjectionMatrix[11] = rawProjection[5]; g_fProjectionMatrix[12] = 0.0f; @@ -495,10 +412,8 @@ void VertexShaderManager::SetConstants() g_fProjectionMatrix[8] = 0.0f; g_fProjectionMatrix[9] = 0.0f; - g_fProjectionMatrix[10] = (g_proj_hack_near.value + rawProjection[4]) * - ((g_proj_hack_near.sign == 0) ? 1.0f : g_proj_hack_near.sign); - g_fProjectionMatrix[11] = (g_proj_hack_far.value + rawProjection[5]) * - ((g_proj_hack_far.sign == 0) ? 1.0f : g_proj_hack_far.sign); + g_fProjectionMatrix[10] = rawProjection[4]; + g_fProjectionMatrix[11] = rawProjection[5]; g_fProjectionMatrix[12] = 0.0f; g_fProjectionMatrix[13] = 0.0f; diff --git a/Source/Core/VideoCommon/VertexShaderManager.h b/Source/Core/VideoCommon/VertexShaderManager.h index b2c707db1f..71bb5cbdb7 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.h +++ b/Source/Core/VideoCommon/VertexShaderManager.h @@ -12,8 +12,6 @@ class PointerWrap; struct ProjectionHackConfig; -void UpdateProjectionHack(const ProjectionHackConfig& config); - // The non-API dependent parts. class VertexShaderManager { diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index d8415c46f0..9315d1d7b3 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -295,7 +295,6 @@ void VideoBackendBase::InitializeShared() PixelShaderManager::Init(); g_Config.Refresh(); - g_Config.UpdateProjectionHack(); UpdateActiveConfig(); } diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 9c90c009a0..d08d5b793a 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -142,11 +142,6 @@ void VideoConfig::Refresh() bEFBEmulateFormatChanges = Config::Get(Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES); bVertexRounding = Config::Get(Config::GFX_HACK_VERTEX_ROUDING); - phack.m_enable = Config::Get(Config::GFX_PROJECTION_HACK) == 1; - phack.m_sznear = Config::Get(Config::GFX_PROJECTION_HACK_SZNEAR) == 1; - phack.m_szfar = Config::Get(Config::GFX_PROJECTION_HACK_SZFAR) == 1; - phack.m_znear = Config::Get(Config::GFX_PROJECTION_HACK_ZNEAR); - phack.m_zfar = Config::Get(Config::GFX_PROJECTION_HACK_ZFAR); bPerfQueriesEnable = Config::Get(Config::GFX_PERF_QUERIES_ENABLE); VerifyValidity(); diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index 8e22765695..cc8e4cde88 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -50,22 +50,12 @@ enum class ShaderCompilationMode : int AsynchronousSkipRendering }; -struct ProjectionHackConfig final -{ - bool m_enable; - bool m_sznear; - bool m_szfar; - std::string m_znear; - std::string m_zfar; -}; - // NEVER inherit from this class. struct VideoConfig final { VideoConfig(); void Refresh(); void VerifyValidity(); - void UpdateProjectionHack(); bool IsVSync() const; // General @@ -130,7 +120,6 @@ struct VideoConfig final bool bImmediateXFB; bool bCopyEFBScaled; int iSafeTextureCache_ColorSamples; - ProjectionHackConfig phack; float fAspectRatioHackW, fAspectRatioHackH; bool bEnablePixelLighting; bool bFastDepthCalc;