From 2fbdf2a3ce9db50cb69c7c671fe1916ed8b20507 Mon Sep 17 00:00:00 2001 From: booto Date: Thu, 26 Jan 2017 04:57:03 -0500 Subject: [PATCH] Hack to stop dcbz/dcbi over low MEM1 trashing memory. --- Data/Sys/GameSettings/SCY.ini | 4 ++++ Data/Sys/GameSettings/SQI.ini | 23 +++++++++++++++++++ Source/Core/Core/BootManager.cpp | 3 +++ Source/Core/Core/ConfigManager.cpp | 2 ++ Source/Core/Core/ConfigManager.h | 1 + .../Interpreter/Interpreter_LoadStore.cpp | 13 ++++++++--- .../Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp | 1 + 7 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 Data/Sys/GameSettings/SQI.ini diff --git a/Data/Sys/GameSettings/SCY.ini b/Data/Sys/GameSettings/SCY.ini index 0cbe81fb54..ab46802b05 100644 --- a/Data/Sys/GameSettings/SCY.ini +++ b/Data/Sys/GameSettings/SCY.ini @@ -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 diff --git a/Data/Sys/GameSettings/SQI.ini b/Data/Sys/GameSettings/SQI.ini new file mode 100644 index 0000000000..fea88a7bfa --- /dev/null +++ b/Data/Sys/GameSettings/SQI.ini @@ -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 diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index 2452eddf1c..0a028e90f3 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -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); diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 6365cd3386..edb2386bd4 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -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; diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index 89206742c5..e91bb9b1ff 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -106,6 +106,7 @@ struct SConfig : NonCopyable bool bMMU = false; bool bDCBZOFF = false; + bool bLowDCBZHack = false; int iBBDumpPort = 0; bool bFastDiscSpeed = false; diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp index 09ce857b3a..7d16ff2ec4 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -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 diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp index f730ca76dc..0ab42bcd47 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp @@ -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;