Merge pull request #4780 from booto/dcbz_hack

Hack to stop dcbz/dcbi over low MEM1 trashing memory.
This commit is contained in:
Matthew Parlane 2017-01-29 21:51:15 +13:00 committed by GitHub
commit a8c51d99f1
7 changed files with 44 additions and 3 deletions

View File

@ -2,6 +2,8 @@
[Core]
# Values set here will override the main Dolphin settings.
MMU = 1
LowDCBZHack = 1
[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
@ -17,3 +19,5 @@ EmulationIssues =
[ActionReplay]
# Add action replay cheats here.
[Video_Settings]
SafeTextureCacheColorSamples = 2048

View File

@ -0,0 +1,23 @@
# SQIE4Q, SQIP4Q - Disney Infinity
[Core]
# Values set here will override the main Dolphin settings.
MMU = 1
LowDCBZHack = 1
[EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 3
EmulationIssues =
[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_Settings]
SafeTextureCacheColorSamples = 2048

View File

@ -73,6 +73,7 @@ private:
bool bAccurateNaNs;
bool bMMU;
bool bDCBZOFF;
bool bLowDCBZHack;
bool m_EnableJIT;
bool bSyncGPU;
bool bFastDiscSpeed;
@ -145,6 +146,7 @@ void ConfigCache::RestoreConfig(SConfig* config)
config->bAccurateNaNs = bAccurateNaNs;
config->bMMU = bMMU;
config->bDCBZOFF = bDCBZOFF;
config->bLowDCBZHack = bLowDCBZHack;
config->m_DSPEnableJIT = m_EnableJIT;
config->bSyncGPU = bSyncGPU;
config->bFastDiscSpeed = bFastDiscSpeed;
@ -248,6 +250,7 @@ bool BootCore(const std::string& _rFilename)
core_section->Get("AccurateNaNs", &StartUp.bAccurateNaNs, StartUp.bAccurateNaNs);
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
core_section->Get("DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF);
core_section->Get("LowDCBZHack", &StartUp.bLowDCBZHack, StartUp.bLowDCBZHack);
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
core_section->Get("FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
core_section->Get("DSPHLE", &StartUp.bDSPHLE, StartUp.bDSPHLE);

View File

@ -578,6 +578,7 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("SyncGpuOverclock", &fSyncGpuOverclock, 1.0f);
core->Get("FastDiscSpeed", &bFastDiscSpeed, false);
core->Get("DCBZ", &bDCBZOFF, false);
core->Get("LowDCBZHack", &bLowDCBZHack, false);
core->Get("FPRF", &bFPRF, false);
core->Get("AccurateNaNs", &bAccurateNaNs, false);
core->Get("EmulationSpeed", &m_EmulationSpeed, 1.0f);
@ -725,6 +726,7 @@ void SConfig::LoadDefaults()
bAccurateNaNs = false;
bMMU = false;
bDCBZOFF = false;
bLowDCBZHack = false;
iBBDumpPort = -1;
bSyncGPU = false;
bFastDiscSpeed = false;

View File

@ -106,6 +106,7 @@ struct SConfig : NonCopyable
bool bMMU = false;
bool bDCBZOFF = false;
bool bLowDCBZHack = false;
int iBBDumpPort = 0;
bool bFastDiscSpeed = false;

View File

@ -362,11 +362,18 @@ void Interpreter::dcbtst(UGeckoInstruction inst)
void Interpreter::dcbz(UGeckoInstruction inst)
{
// TODO: Implement some sort of L2 emulation.
// DCBZOFF is a hack to fix certain games which would otherwise require
// accurate L2 emulation.
if (!SConfig::GetInstance().bDCBZOFF)
PowerPC::ClearCacheLine(Helper_Get_EA_X(inst) & (~31));
if (SConfig::GetInstance().bDCBZOFF)
return;
u32 dcbz_addr = Helper_Get_EA_X(inst);
// Hack to stop dcbz/dcbi over low MEM1 trashing memory.
if (SConfig::GetInstance().bLowDCBZHack && (dcbz_addr < 0x80008000) && (dcbz_addr >= 0x80000000))
return;
// TODO: Implement some sort of L2 emulation.
PowerPC::ClearCacheLine(dcbz_addr & (~31));
}
// eciwx/ecowx technically should access the specified device

View File

@ -330,6 +330,7 @@ void Jit64::dcbz(UGeckoInstruction inst)
JITDISABLE(bJITLoadStoreOff);
if (SConfig::GetInstance().bDCBZOFF)
return;
FALLBACK_IF(SConfig::GetInstance().bLowDCBZHack);
int a = inst.RA;
int b = inst.RB;