Move the ZTP hack to the game properties (reverted all changes from r6057 to the video plugins) due to some obvious reasons. Also some fixes to the coding style.

Remove a member variable which I introduced in r5907 although it never actually got used. Restores binary compatibility (at least in that regard) to pre-r5907 video plugins, but breaks any binaries after that :P

Update FIFO watermark tightness recommendations. 1000 is quite a high value I guess, but some people seem to need it.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6060 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX
2010-08-05 18:41:02 +00:00
parent 8dc01b685f
commit d5d7beb6c7
13 changed files with 118 additions and 84 deletions

View File

@ -71,8 +71,6 @@ struct SConfig
// framelimit choose
int m_Framelimit;
bool b_UseFPS;
// FIFO watermark tightness
int m_WatermarkTightness;
// other interface settings
bool m_InterfaceToolbar;
bool m_InterfaceStatusbar;

View File

@ -318,6 +318,8 @@ void CISOProperties::CreateGUIControls(bool IsWad)
SafeTextureCache = new wxCheckBox(m_GameConfig, ID_SAFETEXTURECACHE, _("Safe Texture Cache"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
DstAlphaPass = new wxCheckBox(m_GameConfig, ID_DSTALPHAPASS, _("Distance Alpha Pass"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
UseXFB = new wxCheckBox(m_GameConfig, ID_USEXFB, _("Use XFB"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
UseZTPSpeedupHack = new wxCheckBox(m_GameConfig, ID_USEXFB, _("ZTP hack"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
UseZTPSpeedupHack->SetToolTip(wxT("Enable this to speed up The Legend of Zelda: Twilight Princess. Disable for ANY other game."));
// Hack
Hacktext = new wxStaticText(m_GameConfig, ID_HACK_TEXT, _("Projection Hack for: "), wxDefaultPosition, wxDefaultSize);
arrayStringFor_Hack.Add(_("None"));
@ -329,7 +331,7 @@ void CISOProperties::CreateGUIControls(bool IsWad)
WMTightnessText = new wxStaticText(m_GameConfig, ID_WMTIGHTNESS_TEXT, wxT("Watermark tightness: "), wxDefaultPosition, wxDefaultSize);
WMTightness = new wxTextCtrl(m_GameConfig, ID_WMTIGHTNESS, wxT(""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator(wxFILTER_NUMERIC));
WMTightness->SetToolTip(wxT("Change this if you get lots of FIFO overflow errors. Reasonable values range from 0 to 200."));
WMTightness->SetToolTip(wxT("Change this if you get lots of FIFO overflow errors. Reasonable values range from 0 to 1000."));
// Emulation State
sEmuState = new wxBoxSizer(wxHORIZONTAL);
@ -359,6 +361,7 @@ void CISOProperties::CreateGUIControls(bool IsWad)
sbVideoOverrides->Add(SafeTextureCache, 0, wxEXPAND|wxLEFT, 5);
sbVideoOverrides->Add(DstAlphaPass, 0, wxEXPAND|wxLEFT, 5);
sbVideoOverrides->Add(UseXFB, 0, wxEXPAND|wxLEFT, 5);
sbVideoOverrides->Add(UseZTPSpeedupHack, 0, wxEXPAND|wxLEFT, 5);
wxFlexGridSizer* fifosizer = new wxFlexGridSizer(2, 2, 0, 0);
fifosizer->Add(Hacktext, 0, wxLEFT, 5);
@ -868,6 +871,11 @@ void CISOProperties::LoadGameConfig()
else
UseXFB->Set3StateValue(wxCHK_UNDETERMINED);
if (GameIni.Get("Video", "ZTPSpeedupHack", &bTemp))
UseZTPSpeedupHack->Set3StateValue((wxCheckBoxState)bTemp);
else
UseZTPSpeedupHack->Set3StateValue(wxCHK_UNDETERMINED);
if (GameIni.Get("Video", "FIFOWatermarkTightness", &sTemp))
WMTightness->SetValue(wxString(sTemp.c_str(), *wxConvCurrent));
else
@ -959,6 +967,11 @@ bool CISOProperties::SaveGameConfig()
else
GameIni.Set("Video", "UseXFB", UseXFB->Get3StateValue());
if (UseZTPSpeedupHack->Get3StateValue() == wxCHK_UNDETERMINED)
GameIni.DeleteKey("Video", "ZTPSpeedupHack");
else
GameIni.Set("Video", "ZTPSpeedupHack", UseZTPSpeedupHack->Get3StateValue());
if (Hack->GetSelection() == -1)
GameIni.DeleteKey("Video", "ProjectionHack");
else

View File

@ -90,7 +90,7 @@ class CISOProperties : public wxDialog
// Video
wxCheckBox *ForceFiltering,
*EFBCopyDisable, *EFBToTextureEnable,
*SafeTextureCache, *DstAlphaPass, *UseXFB;
*SafeTextureCache, *DstAlphaPass, *UseXFB, *UseZTPSpeedupHack;
wxStaticText *Hacktext;
wxArrayString arrayStringFor_Hack;
wxChoice *Hack;
@ -173,6 +173,7 @@ class CISOProperties : public wxDialog
ID_SAFETEXTURECACHE,
ID_DSTALPHAPASS,
ID_USEXFB,
ID_ZTP_SPEEDUP,
ID_HACK_TEXT,
ID_HACK,
ID_WMTIGHTNESS_TEXT,

View File

@ -43,9 +43,9 @@ void BPInit()
memset(&bpmem, 0, sizeof(bpmem));
bpmem.bpMask = 0xFFFFFF;
mapTexAddress = 0;
numWrites = 0;
mapTexFound = false;
mapTexAddress = 0;
numWrites = 0;
mapTexFound = false;
}
void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, float yScale, float xfbLines, u32 xfbAddr, const u32 dstWidth, const u32 dstHeight)
@ -91,39 +91,34 @@ void BPWritten(const BPCmd& bp)
// FIXME: Hangs load-state, but should fix graphic-heavy games state loading
//s_bpCritical.Enter();
//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 (!mapTexFound)
{
if (bp.address == BPMEM_TEV_COLOR_ENV || bp.address == BPMEM_TEV_ALPHA_ENV)
{
numWrites++;
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);
}
}
else
numWrites = 0;
FlushPipeline();
}
else
{
if ( ((bpmem.tex[0].texImage3[0].hex << 5) != mapTexAddress) || !(bpmem.tevorders[0].getEnable(0)) || bp.address == BPMEM_TREF )
FlushPipeline();
}
}
else
FlushPipeline();
//END ZTP SPEEDUP HACK CHANGES
// 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 (!mapTexFound)
{
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();
}
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 FlushPipeline();
((u32*)&bpmem)[bp.address] = bp.newvalue;

View File

@ -96,7 +96,6 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
iniFile.Get("Hacks", "FIFOWatermarkTightness", &iFIFOWatermarkTightness, 50);
iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0);
iniFile.Get("Hacks", "ZTPSpeedHack", &bZTPSpeedHack, false);
iniFile.Get("Hardware", "Adapter", &iAdapter, 0);
if (iAdapter == -1)
@ -202,7 +201,6 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture);
iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);
iniFile.Set("Hacks", "ProjectionHack", iPhackvalue);
iniFile.Set("Hacks", "ZTPSpeedHack", bZTPSpeedHack);
iniFile.Set("Hardware", "Adapter", iAdapter);

View File

@ -125,7 +125,7 @@ struct VideoConfig
float fhackvalue1, fhackvalue2;
bool bProjHack1;
float fAspectRatioHackW, fAspectRatioHackH;
bool bZTPSpeedHack;
bool bZTPSpeedHack; // The Legend of Zelda: Twilight Princess
int iLog; // CONF_ bits
int iSaveTargetId;