Remove the ZTP speedup hack. Also remove useless debugging code, and a presumably outdated workaround (which was commented out).

Fixes issue 6875.
This commit is contained in:
Tony Wasserka 2014-01-15 22:22:28 +01:00
parent 5e5db9fbc6
commit b49c09c36b
5 changed files with 16 additions and 76 deletions

View File

@ -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))) { \

View File

@ -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,

View File

@ -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<std::mutex> 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)

View File

@ -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);

View File

@ -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;