From b49c09c36b67efc95abe29894620b36547b69d3b Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Wed, 15 Jan 2014 22:22:28 +0100 Subject: [PATCH] Remove the ZTP speedup hack. Also remove useless debugging code, and a presumably outdated workaround (which was commented out). Fixes issue 6875. --- Source/Core/DolphinWX/ISOProperties.cpp | 6 -- Source/Core/DolphinWX/ISOProperties.h | 3 +- Source/Core/VideoCommon/BPStructs.cpp | 81 +++++-------------------- Source/Core/VideoCommon/VideoConfig.cpp | 1 - Source/Core/VideoCommon/VideoConfig.h | 1 - 5 files changed, 16 insertions(+), 76 deletions(-) diff --git a/Source/Core/DolphinWX/ISOProperties.cpp b/Source/Core/DolphinWX/ISOProperties.cpp index 4efbca283c..d2bf7ca329 100644 --- a/Source/Core/DolphinWX/ISOProperties.cpp +++ b/Source/Core/DolphinWX/ISOProperties.cpp @@ -364,9 +364,6 @@ void CISOProperties::CreateGUIControls(bool IsWad) UseBBox = new wxCheckBox(m_GameConfig, ID_USE_BBOX, _("Enable Bounding Box Calculation"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Video", "UseBBox")); UseBBox->SetToolTip(_("If checked, the bounding box registers will be updated. Used by the Paper Mario games.")); - UseZTPSpeedupHack = new wxCheckBox(m_GameConfig, ID_ZTP_SPEEDUP, _("ZTP hack"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Video", "ZTPSpeedupHack")); - UseZTPSpeedupHack->SetToolTip(_("Enable this to speed up The Legend of Zelda: Twilight Princess. Disable for ANY other game.")); - // Hack wxFlexGridSizer * const szrPHackSettings = new wxFlexGridSizer(0); PHackEnable = new wxCheckBox(m_GameConfig, ID_PHACKENABLE, _("Custom Projection Hack"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE); @@ -413,7 +410,6 @@ void CISOProperties::CreateGUIControls(bool IsWad) wxStaticBoxSizer * const sbVideoOverrides = new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Video")); sbVideoOverrides->Add(UseBBox, 0, wxLEFT, 5); - sbVideoOverrides->Add(UseZTPSpeedupHack, 0, wxLEFT, 5); szrPHackSettings->Add(PHackEnable, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5); szrPHackSettings->Add(PHSettings, 0, wxLEFT, 5); @@ -1010,7 +1006,6 @@ void CISOProperties::LoadGameConfig() SetCheckboxValueFromGameini("Core", "DSPHLE", DSPHLE); SetCheckboxValueFromGameini("Wii", "Widescreen", EnableWideScreen); SetCheckboxValueFromGameini("Video", "UseBBox", UseBBox); - SetCheckboxValueFromGameini("Video", "ZTPSpeedupHack", UseZTPSpeedupHack); // First set values from default gameini, then apply values from local gameini int iTemp; @@ -1091,7 +1086,6 @@ bool CISOProperties::SaveGameConfig() SaveGameIniValueFrom3StateCheckbox("Core", "DSPHLE", DSPHLE); SaveGameIniValueFrom3StateCheckbox("Wii", "Widescreen", EnableWideScreen); SaveGameIniValueFrom3StateCheckbox("Video", "UseBBox", UseBBox); - SaveGameIniValueFrom3StateCheckbox("Video", "ZTPSpeedupHack", UseZTPSpeedupHack); #define SAVE_IF_NOT_DEFAULT(section, key, val, def) do { \ if (GameIniDefault.Exists((section), (key))) { \ diff --git a/Source/Core/DolphinWX/ISOProperties.h b/Source/Core/DolphinWX/ISOProperties.h index d19e2f9dc4..6e73ea119a 100644 --- a/Source/Core/DolphinWX/ISOProperties.h +++ b/Source/Core/DolphinWX/ISOProperties.h @@ -61,7 +61,7 @@ private: // Wii wxCheckBox *EnableWideScreen; // Video - wxCheckBox *UseZTPSpeedupHack, *PHackEnable, *UseBBox; + wxCheckBox *PHackEnable, *UseBBox; wxButton *PHSettings; wxArrayString arrayStringFor_EmuState; @@ -123,7 +123,6 @@ private: ID_MERGEBLOCKS, ID_AUDIO_DSP_HLE, ID_USE_BBOX, - ID_ZTP_SPEEDUP, ID_PHACKENABLE, ID_PHSETTINGS, ID_ENABLEPROGRESSIVESCAN, diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 296be7c548..51d4008768 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -71,77 +71,26 @@ void BPWritten(const BPCmd& bp) // check for invalid state, else unneeded configuration are built g_video_backend->CheckInvalidState(); - // Debugging only, this lets you skip a bp update - //static int times = 0; - //static bool enable = false; - - //switch (bp.address) - //{ - //case BPMEM_CONSTANTALPHA: - // { - // if (times-- == 0 && enable) - // return; - // else - // break; - // } - //default: break; - //} - - // FIXME: Hangs load-state, but should fix graphic-heavy games state loading - //std::lock_guard lk(s_bpCritical); - - // BEGIN ZTP SPEEDUP HACK CHANGES - // This hunk of code disables the usual pipeline flush for certain BP Writes - // that occur while the minimap is being drawn in Zelda: Twilight Princess. - // This significantly increases speed while in hyrule field. In depth discussion - // on how this Hack came to be can be found at: http://forums.dolphin-emu.com/thread-10638.html - // -fircrestsk8 - if (g_ActiveConfig.bZTPSpeedHack) + if (((s32*)&bpmem)[bp.address] == bp.newvalue) { - if (!mapTexFound) + if (!(bp.address == BPMEM_TRIGGER_EFB_COPY + || bp.address == BPMEM_CLEARBBOX1 + || bp.address == BPMEM_CLEARBBOX2 + || bp.address == BPMEM_SETDRAWDONE + || bp.address == BPMEM_PE_TOKEN_ID + || bp.address == BPMEM_PE_TOKEN_INT_ID + || bp.address == BPMEM_LOADTLUT0 + || bp.address == BPMEM_LOADTLUT1 + || bp.address == BPMEM_TEXINVALIDATE + || bp.address == BPMEM_PRELOAD_MODE + || bp.address == BPMEM_CLEAR_PIXEL_PERF)) { - if (bp.address != BPMEM_TEV_COLOR_ENV && bp.address != BPMEM_TEV_ALPHA_ENV) - { - numWrites = 0; - } - else if (++numWrites >= 100) // seem that if 100 consecutive BP writes are called to either of these addresses in ZTP, - { // then it is safe to assume the map texture address is currently loaded into the BP memory - mapTexAddress = bpmem.tex[0].texImage3[0].hex << 5; - mapTexFound = true; - WARN_LOG(VIDEO, "\nZTP map texture found at address %08x\n", mapTexAddress); - } - FlushPipeline(); + return; } - else if ( (bpmem.tex[0].texImage3[0].hex << 5) != mapTexAddress || - bpmem.tevorders[0].getEnable(0) == 0 || - bp.address == BPMEM_TREF) - { - FlushPipeline(); - } - } // END ZTP SPEEDUP HACK - else - { - if (((s32*)&bpmem)[bp.address] == bp.newvalue) - { - if (!(bp.address == BPMEM_TRIGGER_EFB_COPY - || bp.address == BPMEM_CLEARBBOX1 - || bp.address == BPMEM_CLEARBBOX2 - || bp.address == BPMEM_SETDRAWDONE - || bp.address == BPMEM_PE_TOKEN_ID - || bp.address == BPMEM_PE_TOKEN_INT_ID - || bp.address == BPMEM_LOADTLUT0 - || bp.address == BPMEM_LOADTLUT1 - || bp.address == BPMEM_TEXINVALIDATE - || bp.address == BPMEM_PRELOAD_MODE - || bp.address == BPMEM_CLEAR_PIXEL_PERF)) - { - return; - } - } - - FlushPipeline(); } + FlushPipeline(); + ((u32*)&bpmem)[bp.address] = bp.newvalue; switch (bp.address) diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index bd9fc015ac..c5828d24ea 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -204,7 +204,6 @@ void VideoConfig::GameIniLoad() CHECK_SETTING("Video", "PH_ExtraParam", iPhackvalue[3]); CHECK_SETTING("Video", "PH_ZNear", sPhackvalue[0]); CHECK_SETTING("Video", "PH_ZFar", sPhackvalue[1]); - CHECK_SETTING("Video", "ZTPSpeedupHack", bZTPSpeedHack); CHECK_SETTING("Video", "UseBBox", bUseBBox); CHECK_SETTING("Video", "PerfQueriesEnable", bPerfQueriesEnable); diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index 71d0b7f22c..4e9e528155 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -117,7 +117,6 @@ struct VideoConfig int iPhackvalue[4]; std::string sPhackvalue[2]; float fAspectRatioHackW, fAspectRatioHackH; - bool bZTPSpeedHack; // The Legend of Zelda: Twilight Princess bool bUseBBox; bool bEnablePixelLighting; bool bHackedBufferUpload;