From 0a5f479250a3f596dd8757b6d28bdc29de92c32c Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 20 Jan 2013 13:09:38 +1100 Subject: [PATCH] Added a game property to disable the clearing of the data cache. This is needed by one known game, "Rubik's Puzzle Galaxy: Rush". Fixes Violin Paradise. --- Data/User/GameConfig/WZIPTW.ini | 1 + Source/Core/Core/Src/BootManager.cpp | 8 +++--- Source/Core/Core/Src/ConfigManager.cpp | 2 +- Source/Core/Core/Src/CoreParameter.cpp | 4 +-- Source/Core/Core/Src/CoreParameter.h | 2 +- Source/Core/Core/Src/HW/MemmapFunctions.cpp | 2 +- .../Interpreter/Interpreter_LoadStore.cpp | 2 +- Source/Core/DolphinWX/Src/ISOProperties.cpp | 26 +++++++++---------- Source/Core/DolphinWX/Src/ISOProperties.h | 4 +-- 9 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Data/User/GameConfig/WZIPTW.ini b/Data/User/GameConfig/WZIPTW.ini index 5fb4a23c18..6e7cce2648 100644 --- a/Data/User/GameConfig/WZIPTW.ini +++ b/Data/User/GameConfig/WZIPTW.ini @@ -1,5 +1,6 @@ # WZIPTW - Rubik's: Rush [Core] Values set here will override the main dolphin settings. +DCBZ = 1 [EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 1 EmulationIssues = Requires data cache emulation diff --git a/Source/Core/Core/Src/BootManager.cpp b/Source/Core/Core/Src/BootManager.cpp index 50c5756178..b867052381 100644 --- a/Source/Core/Core/Src/BootManager.cpp +++ b/Source/Core/Core/Src/BootManager.cpp @@ -54,7 +54,7 @@ namespace BootManager // Apply fire liberally struct ConfigCache { - bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bMMUBAT, + bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF, bVBeam, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bDisableWiimoteSpeaker, bHLE_BS2; int iTLBHack, iCPUCore; std::string strBackend; @@ -92,7 +92,7 @@ bool BootCore(const std::string& _rFilename) config_cache.iCPUCore = StartUp.iCPUCore; config_cache.bEnableFPRF = StartUp.bEnableFPRF; config_cache.bMMU = StartUp.bMMU; - config_cache.bMMUBAT = StartUp.bMMUBAT; + config_cache.bDCBZOFF = StartUp.bDCBZOFF; config_cache.iTLBHack = StartUp.iTLBHack; config_cache.bVBeam = StartUp.bVBeam; config_cache.bFastDiscSpeed = StartUp.bFastDiscSpeed; @@ -107,8 +107,8 @@ bool BootCore(const std::string& _rFilename) game_ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle); game_ini.Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF); game_ini.Get("Core", "MMU", &StartUp.bMMU, StartUp.bMMU); - game_ini.Get("Core", "BAT", &StartUp.bMMUBAT, StartUp.bMMUBAT); game_ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack); + game_ini.Get("Core", "DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF); game_ini.Get("Core", "VBeam", &StartUp.bVBeam, StartUp.bVBeam); game_ini.Get("Core", "FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed); game_ini.Get("Core", "BlockMerging", &StartUp.bMergeBlocks, StartUp.bMergeBlocks); @@ -167,7 +167,7 @@ void Stop() StartUp.iCPUCore = config_cache.iCPUCore; StartUp.bEnableFPRF = config_cache.bEnableFPRF; StartUp.bMMU = config_cache.bMMU; - StartUp.bMMUBAT = config_cache.bMMUBAT; + StartUp.bDCBZOFF = config_cache.bDCBZOFF; StartUp.iTLBHack = config_cache.iTLBHack; StartUp.bVBeam = config_cache.bVBeam; StartUp.bFastDiscSpeed = config_cache.bFastDiscSpeed; diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 317e770868..f6194c1bb7 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -400,7 +400,7 @@ void SConfig::LoadSettings() ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0); ini.Get("Core", "VBeam", &m_LocalCoreStartupParameter.bVBeam, false); ini.Get("Core", "FastDiscSpeed", &m_LocalCoreStartupParameter.bFastDiscSpeed, false); - ini.Get("Core", "BAT", &m_LocalCoreStartupParameter.bMMUBAT, false); + ini.Get("Core", "DCBZ", &m_LocalCoreStartupParameter.bDCBZOFF, false); ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default ini.Get("Core", "UseFPS", &b_UseFPS, false); // use vps as default diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 16615f5805..9fc451c807 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -49,7 +49,7 @@ SCoreStartupParameter::SCoreStartupParameter() bMergeBlocks(false), bDPL2Decoder(false), iLatency(14), bRunCompareServer(false), bRunCompareClient(false), - bMMU(false), bMMUBAT(false), iTLBHack(0), bVBeam(false), + bMMU(false), bDCBZOFF(false), iTLBHack(0), bVBeam(false), bFastDiscSpeed(false), SelectedLanguage(0), bWii(false), bDisableWiimoteSpeaker(false), bConfirmStop(false), bHideCursor(false), @@ -75,7 +75,7 @@ void SCoreStartupParameter::LoadDefaults() bDSPThread = true; bEnableFPRF = false; bMMU = false; - bMMUBAT = false; + bDCBZOFF = false; iTLBHack = 0; bVBeam = false; bFastDiscSpeed = false; diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 4c7c33cdfb..e2e5eb6f1b 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -113,7 +113,7 @@ struct SCoreStartupParameter bool bRunCompareClient; bool bMMU; - bool bMMUBAT; + bool bDCBZOFF; int iTLBHack; bool bVBeam; bool bFastDiscSpeed; diff --git a/Source/Core/Core/Src/HW/MemmapFunctions.cpp b/Source/Core/Core/Src/HW/MemmapFunctions.cpp index b391eea975..e01eedaaab 100644 --- a/Source/Core/Core/Src/HW/MemmapFunctions.cpp +++ b/Source/Core/Core/Src/HW/MemmapFunctions.cpp @@ -956,7 +956,7 @@ u32 TranslateAddress(const u32 _Address, const XCheckTLBFlag _Flag) // Check MSR[DR] bit before translating data addresses //if (((_Flag == FLAG_READ) || (_Flag == FLAG_WRITE)) && !(MSR & (1 << (31 - 27)))) return _Address; - u32 tlb_addr = Core::g_CoreStartupParameter.bMMUBAT?TranslateBlockAddress(_Address, _Flag):0; + u32 tlb_addr = TranslateBlockAddress(_Address, _Flag); if (tlb_addr == 0) { tlb_addr = TranslatePageAddress(_Address, _Flag); diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp index bc5cfc10e6..5e665eb38e 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -407,7 +407,7 @@ void Interpreter::dcbtst(UGeckoInstruction _inst) void Interpreter::dcbz(UGeckoInstruction _inst) { // HACK but works... we think - if (HID2.WPE || !HID0.DCFA) + if (!Core::g_CoreStartupParameter.bDCBZOFF) Memory::Memset(Helper_Get_EA_X(_inst) & (~31), 0, 32); if (!jit) PowerPC::CheckExceptions(); diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp index f06b3daa8a..2083c39201 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.cpp +++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp @@ -315,10 +315,10 @@ void CISOProperties::CreateGUIControls(bool IsWad) SkipIdle = new wxCheckBox(m_GameConfig, ID_IDLESKIP, _("Enable Idle Skipping"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); MMU = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable MMU"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); MMU->SetToolTip(_("Enables the Memory Management Unit, needed for some games. (ON = Compatible, OFF = Fast)")); - MMUBAT = new wxCheckBox(m_GameConfig, ID_MMUBAT, _("Enable BAT"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); - MMUBAT->SetToolTip(_("Enables Block Address Translation (BAT); a function of the Memory Management Unit. Accurate to the hardware, but slow to emulate. (ON = Compatible, OFF = Fast)")); TLBHack = new wxCheckBox(m_GameConfig, ID_TLBHACK, _("MMU Speed Hack"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); TLBHack->SetToolTip(_("Fast version of the MMU. Does not work for every game.")); + DCBZOFF = new wxCheckBox(m_GameConfig, ID_DCBZOFF, _("Skip DCBZ clearing"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); + DCBZOFF->SetToolTip(_("Bypass the clearing of the data cache by the DCBZ instruction. Usually leave this option disabled.")); VBeam = new wxCheckBox(m_GameConfig, ID_VBEAM, _("Accurate VBeam emulation"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); VBeam->SetToolTip(_("If the FPS is erratic, this option may help. (ON = Compatible, OFF = Fast)")); FastDiscSpeed = new wxCheckBox(m_GameConfig, ID_DISCSPEED, _("Speed up Disc Transfer Rate"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); @@ -364,7 +364,7 @@ void CISOProperties::CreateGUIControls(bool IsWad) sbCoreOverrides->Add(CPUThread, 0, wxLEFT, 5); sbCoreOverrides->Add(SkipIdle, 0, wxLEFT, 5); sbCoreOverrides->Add(MMU, 0, wxLEFT, 5); - sbCoreOverrides->Add(MMUBAT, 0, wxLEFT, 5); + sbCoreOverrides->Add(DCBZOFF, 0, wxLEFT, 5); sbCoreOverrides->Add(TLBHack, 0, wxLEFT, 5); sbCoreOverrides->Add(VBeam, 0, wxLEFT, 5); sbCoreOverrides->Add(FastDiscSpeed, 0, wxLEFT, 5); @@ -930,16 +930,16 @@ void CISOProperties::LoadGameConfig() else MMU->Set3StateValue(wxCHK_UNDETERMINED); - if (GameIni.Get("Core", "BAT", &bTemp)) - MMUBAT->Set3StateValue((wxCheckBoxState)bTemp); - else - MMUBAT->Set3StateValue(wxCHK_UNDETERMINED); - if (GameIni.Get("Core", "TLBHack", &bTemp)) TLBHack->Set3StateValue((wxCheckBoxState)bTemp); else TLBHack->Set3StateValue(wxCHK_UNDETERMINED); + if (GameIni.Get("Core", "DCBZ", &bTemp)) + DCBZOFF->Set3StateValue((wxCheckBoxState)bTemp); + else + DCBZOFF->Set3StateValue(wxCHK_UNDETERMINED); + if (GameIni.Get("Core", "VBeam", &bTemp)) VBeam->Set3StateValue((wxCheckBoxState)bTemp); else @@ -1025,16 +1025,16 @@ bool CISOProperties::SaveGameConfig() else GameIni.Set("Core", "MMU", MMU->Get3StateValue()); - if (MMUBAT->Get3StateValue() == wxCHK_UNDETERMINED) - GameIni.DeleteKey("Core", "BAT"); - else - GameIni.Set("Core", "BAT", MMUBAT->Get3StateValue()); - if (TLBHack->Get3StateValue() == wxCHK_UNDETERMINED) GameIni.DeleteKey("Core", "TLBHack"); else GameIni.Set("Core", "TLBHack", TLBHack->Get3StateValue()); + if (DCBZOFF->Get3StateValue() == wxCHK_UNDETERMINED) + GameIni.DeleteKey("Core", "DCBZ"); + else + GameIni.Set("Core", "DCBZ", DCBZOFF->Get3StateValue()); + if (VBeam->Get3StateValue() == wxCHK_UNDETERMINED) GameIni.DeleteKey("Core", "VBeam"); else diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h index 9d71e675e2..4f03130ba7 100644 --- a/Source/Core/DolphinWX/Src/ISOProperties.h +++ b/Source/Core/DolphinWX/Src/ISOProperties.h @@ -69,7 +69,7 @@ private: DECLARE_EVENT_TABLE(); // Core - wxCheckBox *CPUThread, *SkipIdle, *MMU, *MMUBAT, *TLBHack; + wxCheckBox *CPUThread, *SkipIdle, *MMU, *DCBZOFF, *TLBHack; wxCheckBox *VBeam, *FastDiscSpeed, *BlockMerging, *DSPHLE; // Wii wxCheckBox *EnableWideScreen, *DisableWiimoteSpeaker; @@ -127,7 +127,7 @@ private: ID_USEDUALCORE, ID_IDLESKIP, ID_MMU, - ID_MMUBAT, + ID_DCBZOFF, ID_TLBHACK, ID_VBEAM, ID_DISCSPEED,