From 8738b1879c993658181d90bbf2dc2f4622e304bf Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 11 Oct 2014 11:31:16 +1100 Subject: [PATCH] Removed the MMU Speed Hack option. The TLBHack is now enabled if the MMU option is disabled. This will help catch cases where a game requires the TLBHack but the option has not been set in the game ini. It also removes the possibility to mistakenly enable both the MMU and TLBHack. --- Source/Core/Core/BootManager.cpp | 5 +-- Source/Core/Core/ConfigManager.cpp | 1 - Source/Core/Core/CoreParameter.cpp | 3 +- Source/Core/Core/CoreParameter.h | 1 - Source/Core/Core/HW/Memmap.cpp | 5 +-- Source/Core/Core/HW/MemmapFunctions.cpp | 1 - Source/Core/Core/PowerPC/Jit64/JitAsm.cpp | 39 +++++++------------ .../Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp | 5 ++- .../Core/Core/PowerPC/JitCommon/Jit_Util.cpp | 13 +++---- Source/Core/Core/PowerPC/JitInterface.cpp | 2 +- .../Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- Source/Core/DolphinWX/ISOProperties.cpp | 5 --- Source/Core/DolphinWX/ISOProperties.h | 3 +- 13 files changed, 29 insertions(+), 56 deletions(-) diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index bfea949301..e6d14c28f7 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -48,7 +48,7 @@ namespace BootManager struct ConfigCache { bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF, m_EnableJIT, bDSPThread, - bVBeamSpeedHack, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2, bTLBHack, bProgressive; + bVBeamSpeedHack, bSyncGPU, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bHLE_BS2, bProgressive; int iCPUCore, Volume; int iWiimoteSource[MAX_BBMOTES]; SIDevices Pads[MAX_SI_CHANNELS]; @@ -116,7 +116,6 @@ bool BootCore(const std::string& _rFilename) config_cache.bEnableFPRF = StartUp.bEnableFPRF; config_cache.bMMU = StartUp.bMMU; config_cache.bDCBZOFF = StartUp.bDCBZOFF; - config_cache.bTLBHack = StartUp.bTLBHack; config_cache.bVBeamSpeedHack = StartUp.bVBeamSpeedHack; config_cache.bSyncGPU = StartUp.bSyncGPU; config_cache.bFastDiscSpeed = StartUp.bFastDiscSpeed; @@ -158,7 +157,6 @@ bool BootCore(const std::string& _rFilename) core_section->Get("SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle); core_section->Get("EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF); core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU); - core_section->Get("TLBHack", &StartUp.bTLBHack, StartUp.bTLBHack); core_section->Get("DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF); core_section->Get("VBeam", &StartUp.bVBeamSpeedHack, StartUp.bVBeamSpeedHack); core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU); @@ -286,7 +284,6 @@ void Stop() StartUp.bEnableFPRF = config_cache.bEnableFPRF; StartUp.bMMU = config_cache.bMMU; StartUp.bDCBZOFF = config_cache.bDCBZOFF; - StartUp.bTLBHack = config_cache.bTLBHack; StartUp.bVBeamSpeedHack = config_cache.bVBeamSpeedHack; StartUp.bSyncGPU = config_cache.bSyncGPU; StartUp.bFastDiscSpeed = config_cache.bFastDiscSpeed; diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 8d0f8d2cb0..7b433909db 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -536,7 +536,6 @@ void SConfig::LoadCoreSettings(IniFile& ini) core->Get("RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false); core->Get("RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false); core->Get("MMU", &m_LocalCoreStartupParameter.bMMU, false); - core->Get("TLBHack", &m_LocalCoreStartupParameter.bTLBHack, false); core->Get("BBDumpPort", &m_LocalCoreStartupParameter.iBBDumpPort, -1); core->Get("VBeam", &m_LocalCoreStartupParameter.bVBeamSpeedHack, false); core->Get("SyncGPU", &m_LocalCoreStartupParameter.bSyncGPU, false); diff --git a/Source/Core/Core/CoreParameter.cpp b/Source/Core/Core/CoreParameter.cpp index 92055d9eff..763a899ce2 100644 --- a/Source/Core/Core/CoreParameter.cpp +++ b/Source/Core/Core/CoreParameter.cpp @@ -39,7 +39,7 @@ SCoreStartupParameter::SCoreStartupParameter() bMergeBlocks(false), bEnableMemcardSaving(true), bDPL2Decoder(false), iLatency(14), bRunCompareServer(false), bRunCompareClient(false), - bMMU(false), bDCBZOFF(false), bTLBHack(false), iBBDumpPort(0), bVBeamSpeedHack(false), + bMMU(false), bDCBZOFF(false), iBBDumpPort(0), bVBeamSpeedHack(false), bSyncGPU(false), bFastDiscSpeed(false), SelectedLanguage(0), bWii(false), bConfirmStop(false), bHideCursor(false), @@ -75,7 +75,6 @@ void SCoreStartupParameter::LoadDefaults() bEnableFPRF = false; bMMU = false; bDCBZOFF = false; - bTLBHack = false; iBBDumpPort = -1; bVBeamSpeedHack = false; bSyncGPU = false; diff --git a/Source/Core/Core/CoreParameter.h b/Source/Core/Core/CoreParameter.h index 77d6a43c32..0920475261 100644 --- a/Source/Core/Core/CoreParameter.h +++ b/Source/Core/Core/CoreParameter.h @@ -158,7 +158,6 @@ struct SCoreStartupParameter bool bMMU; bool bDCBZOFF; - bool bTLBHack; int iBBDumpPort; bool bVBeamSpeedHack; bool bSyncGPU; diff --git a/Source/Core/Core/HW/Memmap.cpp b/Source/Core/Core/HW/Memmap.cpp index e1b1548c40..5d7b96d60d 100644 --- a/Source/Core/Core/HW/Memmap.cpp +++ b/Source/Core/Core/HW/Memmap.cpp @@ -43,8 +43,7 @@ namespace Memory // LOCAL SETTINGS // ---------------- -/* Enable the Translation Lookaside Buffer functions. TLBHack = 1 in Dolphin.ini or a - .ini file will set this to true */ +// Enable the Translation Lookaside Buffer functions. bool bFakeVMEM = false; static bool bMMU = false; // ============== @@ -143,8 +142,8 @@ static const int num_views = sizeof(views) / sizeof(MemoryView); void Init() { bool wii = SConfig::GetInstance().m_LocalCoreStartupParameter.bWii; - bFakeVMEM = SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack == true; bMMU = SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU; + bFakeVMEM = !bMMU; u32 flags = 0; if (wii) flags |= MV_WII_ONLY; diff --git a/Source/Core/Core/HW/MemmapFunctions.cpp b/Source/Core/Core/HW/MemmapFunctions.cpp index b2005670f7..2bc24586b9 100644 --- a/Source/Core/Core/HW/MemmapFunctions.cpp +++ b/Source/Core/Core/HW/MemmapFunctions.cpp @@ -305,7 +305,6 @@ u32 Read_Opcode(u32 _Address) } if (SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU && - !SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack && (_Address & ADDR_MASK_MEM1)) { // TODO: Check for MSR instruction address translation flag before translating diff --git a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp index bc764db668..544f1d3319 100644 --- a/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp +++ b/Source/Core/Core/PowerPC/Jit64/JitAsm.cpp @@ -91,33 +91,23 @@ void Jit64AsmRoutineManager::Generate() FixupBranch exit_vmem; if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) mask = JIT_ICACHE_EXRAM_BIT; - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU || SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack) - mask |= JIT_ICACHE_VMEM_BIT; - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii || SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU || SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack) - { - TEST(32, R(RSCRATCH), Imm32(mask)); - no_mem = J_CC(CC_NZ); - } + mask |= JIT_ICACHE_VMEM_BIT; + TEST(32, R(RSCRATCH), Imm32(mask)); + no_mem = J_CC(CC_NZ); AND(32, R(RSCRATCH), Imm32(JIT_ICACHE_MASK)); MOV(64, R(RSCRATCH2), Imm64((u64)jit->GetBlockCache()->iCache)); MOV(32, R(RSCRATCH), MComplex(RSCRATCH2, RSCRATCH, SCALE_1, 0)); - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii || SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU || SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack) - { - exit_mem = J(); - SetJumpTarget(no_mem); - } - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU || SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack) - { - TEST(32, R(RSCRATCH), Imm32(JIT_ICACHE_VMEM_BIT)); - FixupBranch no_vmem = J_CC(CC_Z); - AND(32, R(RSCRATCH), Imm32(JIT_ICACHE_MASK)); - MOV(64, R(RSCRATCH2), Imm64((u64)jit->GetBlockCache()->iCacheVMEM)); - MOV(32, R(RSCRATCH), MComplex(RSCRATCH2, RSCRATCH, SCALE_1, 0)); + exit_mem = J(); + SetJumpTarget(no_mem); + TEST(32, R(RSCRATCH), Imm32(JIT_ICACHE_VMEM_BIT)); + FixupBranch no_vmem = J_CC(CC_Z); + AND(32, R(RSCRATCH), Imm32(JIT_ICACHE_MASK)); + MOV(64, R(RSCRATCH2), Imm64((u64)jit->GetBlockCache()->iCacheVMEM)); + MOV(32, R(RSCRATCH), MComplex(RSCRATCH2, RSCRATCH, SCALE_1, 0)); - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) exit_vmem = J(); - SetJumpTarget(no_vmem); - } + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) exit_vmem = J(); + SetJumpTarget(no_vmem); if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) { TEST(32, R(RSCRATCH), Imm32(JIT_ICACHE_EXRAM_BIT)); @@ -128,9 +118,8 @@ void Jit64AsmRoutineManager::Generate() SetJumpTarget(no_exram); } - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii || SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU || SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack) - SetJumpTarget(exit_mem); - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii && (SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU || SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack)) + SetJumpTarget(exit_mem); + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) SetJumpTarget(exit_vmem); TEST(32, R(RSCRATCH), R(RSCRATCH)); diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp index 9680a8439d..a2abade26b 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp @@ -294,8 +294,9 @@ void Jit64::dcbz(UGeckoInstruction inst) int b = inst.RB; u32 mem_mask = Memory::ADDR_MASK_HW_ACCESS; - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU || SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack) - mem_mask |= Memory::ADDR_MASK_MEM1; + + // The following masks the region used by the GC/Wii virtual memory lib + mem_mask |= Memory::ADDR_MASK_MEM1; MOV(32, R(RSCRATCH), gpr.R(b)); if (a) diff --git a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp index 45f37b6889..0e9853948a 100644 --- a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp @@ -312,10 +312,9 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg & opAddress, else { u32 mem_mask = Memory::ADDR_MASK_HW_ACCESS; - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU || SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack) - { - mem_mask |= Memory::ADDR_MASK_MEM1; - } + + // The following masks the region used by the GC/Wii virtual memory lib + mem_mask |= Memory::ADDR_MASK_MEM1; #ifdef ENABLE_MEM_CHECK if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging) @@ -517,10 +516,8 @@ void EmuCodeBlock::SafeWriteRegToReg(OpArg reg_value, X64Reg reg_addr, int acces u32 mem_mask = Memory::ADDR_MASK_HW_ACCESS; - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU || SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack) - { - mem_mask |= Memory::ADDR_MASK_MEM1; - } + // The following masks the region used by the GC/Wii virtual memory lib + mem_mask |= Memory::ADDR_MASK_MEM1; #ifdef ENABLE_MEM_CHECK if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging) diff --git a/Source/Core/Core/PowerPC/JitInterface.cpp b/Source/Core/Core/PowerPC/JitInterface.cpp index 6a598a736a..c2a3114804 100644 --- a/Source/Core/Core/PowerPC/JitInterface.cpp +++ b/Source/Core/Core/PowerPC/JitInterface.cpp @@ -46,8 +46,8 @@ namespace JitInterface } CPUCoreBase *InitJitCore(int core) { - bFakeVMEM = SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack == true; bMMU = SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU; + bFakeVMEM = !bMMU; CPUCoreBase *ptr = nullptr; switch (core) diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 73dead18d1..60978b6693 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -102,7 +102,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, sizerRight->Add(new wxButton(this, IDM_DUMP_MEMORY, _("&Dump MRAM"))); sizerRight->Add(new wxButton(this, IDM_DUMP_MEM2, _("&Dump EXRAM"))); - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack == true) + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU) sizerRight->Add(new wxButton(this, IDM_DUMP_FAKEVMEM, _("&Dump FakeVMEM"))); wxStaticBoxSizer* sizerSearchType = new wxStaticBoxSizer(wxVERTICAL, this, _("Search")); diff --git a/Source/Core/DolphinWX/ISOProperties.cpp b/Source/Core/DolphinWX/ISOProperties.cpp index e2bb1710b7..9f64c00159 100644 --- a/Source/Core/DolphinWX/ISOProperties.cpp +++ b/Source/Core/DolphinWX/ISOProperties.cpp @@ -389,8 +389,6 @@ void CISOProperties::CreateGUIControls(bool IsWad) SkipIdle = new wxCheckBox(m_GameConfig, ID_IDLESKIP, _("Enable Idle Skipping"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "SkipIdle")); MMU = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable MMU"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "MMU")); MMU->SetToolTip(_("Enables the Memory Management Unit, needed for some games. (ON = Compatible, OFF = Fast)")); - TLBHack = new wxCheckBox(m_GameConfig, ID_TLBHACK, _("MMU Speed Hack"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "TLBHack")); - 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, GetElementStyle("Core", "DCBZ")); 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, _("VBeam Speed Hack"), wxDefaultPosition, wxDefaultSize, GetElementStyle("Core", "VBeam")); @@ -426,7 +424,6 @@ 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(TLBHack, 0, wxLEFT, 5); sbCoreOverrides->Add(DCBZOFF, 0, wxLEFT, 5); sbCoreOverrides->Add(VBeam, 0, wxLEFT, 5); sbCoreOverrides->Add(SyncGPU, 0, wxLEFT, 5); @@ -1013,7 +1010,6 @@ void CISOProperties::LoadGameConfig() SetCheckboxValueFromGameini("Core", "CPUThread", CPUThread); SetCheckboxValueFromGameini("Core", "SkipIdle", SkipIdle); SetCheckboxValueFromGameini("Core", "MMU", MMU); - SetCheckboxValueFromGameini("Core", "TLBHack", TLBHack); SetCheckboxValueFromGameini("Core", "DCBZ", DCBZOFF); SetCheckboxValueFromGameini("Core", "VBeam", VBeam); SetCheckboxValueFromGameini("Core", "SyncGPU", SyncGPU); @@ -1088,7 +1084,6 @@ bool CISOProperties::SaveGameConfig() SaveGameIniValueFrom3StateCheckbox("Core", "CPUThread", CPUThread); SaveGameIniValueFrom3StateCheckbox("Core", "SkipIdle", SkipIdle); SaveGameIniValueFrom3StateCheckbox("Core", "MMU", MMU); - SaveGameIniValueFrom3StateCheckbox("Core", "TLBHack", TLBHack); SaveGameIniValueFrom3StateCheckbox("Core", "DCBZ", DCBZOFF); SaveGameIniValueFrom3StateCheckbox("Core", "VBeam", VBeam); SaveGameIniValueFrom3StateCheckbox("Core", "SyncGPU", SyncGPU); diff --git a/Source/Core/DolphinWX/ISOProperties.h b/Source/Core/DolphinWX/ISOProperties.h index bdcf252068..0f7ce53711 100644 --- a/Source/Core/DolphinWX/ISOProperties.h +++ b/Source/Core/DolphinWX/ISOProperties.h @@ -67,7 +67,7 @@ private: DECLARE_EVENT_TABLE(); // Core - wxCheckBox *CPUThread, *SkipIdle, *MMU, *DCBZOFF, *TLBHack; + wxCheckBox *CPUThread, *SkipIdle, *MMU, *DCBZOFF; wxCheckBox *VBeam, *SyncGPU, *FastDiscSpeed, *BlockMerging, *DSPHLE; // Wii wxCheckBox *EnableWideScreen; @@ -128,7 +128,6 @@ private: ID_IDLESKIP, ID_MMU, ID_DCBZOFF, - ID_TLBHACK, ID_VBEAM, ID_SYNCGPU, ID_DISCSPEED,