From d80178bd89294b64ec961e81e909c7b5e03d01e8 Mon Sep 17 00:00:00 2001 From: "XTra.KrazzY" Date: Mon, 29 Sep 2008 14:49:01 +0000 Subject: [PATCH] Added simple EXI Channel caching. Great for SRAM intensive games such as LoZ:WW (Indoor performance increased from 4500MHz to 6000MHz) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@727 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/HW/EXI_Channel.cpp | 30 +++++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/Src/HW/EXI_Channel.cpp b/Source/Core/Core/Src/HW/EXI_Channel.cpp index 4650e6268d..1dddb00a6a 100644 --- a/Source/Core/Core/Src/HW/EXI_Channel.cpp +++ b/Source/Core/Core/Src/HW/EXI_Channel.cpp @@ -125,8 +125,16 @@ void CEXIChannel::Update() } } +bool bDirty = true; +u32 lastReg = -1, lastChan, lastVal; + void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister) { + if(lastReg == _iRegister && m_ChannelId == lastChan && !bDirty) { + _uReturnValue = lastVal; + return; + } + LOG(EXPANSIONINTERFACE, "ExtensionInterface(R): channel: %i reg: %i", m_ChannelId, _iRegister); switch (_iRegister) @@ -143,31 +151,39 @@ void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister) } } _uReturnValue = m_Status.hex; - return; + break; } case EXI_DMAADDR: _uReturnValue = m_DMAMemoryAddress; - return; + break; case EXI_DMALENGTH: _uReturnValue = m_DMALength; - return; + break; case EXI_DMACONTROL: _uReturnValue = m_Control.hex; - return; + break; case EXI_IMMDATA: _uReturnValue = m_ImmData; - return; + break; + + default: + _dbg_assert_(EXPANSIONINTERFACE, 0); + _uReturnValue = 0xDEADBEEF; } - _dbg_assert_(EXPANSIONINTERFACE, 0); - _uReturnValue = 0xDEADBEEF; + + lastReg = _iRegister; + lastChan = m_ChannelId; + lastVal = _uReturnValue; + bDirty = false; } void CEXIChannel::Write32(const u32 _iValue, const u32 _iRegister) { + bDirty = true; LOG(EXPANSIONINTERFACE, "ExtensionInterface(W): 0x%08x channel: %i reg: %i", _iValue, m_ChannelId, _iRegister); switch (_iRegister)