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
This commit is contained in:
XTra.KrazzY 2008-09-29 14:49:01 +00:00
parent 739c18ff28
commit d80178bd89
1 changed files with 23 additions and 7 deletions

View File

@ -125,8 +125,16 @@ void CEXIChannel::Update()
} }
} }
bool bDirty = true;
u32 lastReg = -1, lastChan, lastVal;
void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister) 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); LOG(EXPANSIONINTERFACE, "ExtensionInterface(R): channel: %i reg: %i", m_ChannelId, _iRegister);
switch (_iRegister) switch (_iRegister)
@ -143,31 +151,39 @@ void CEXIChannel::Read32(u32& _uReturnValue, const u32 _iRegister)
} }
} }
_uReturnValue = m_Status.hex; _uReturnValue = m_Status.hex;
return; break;
} }
case EXI_DMAADDR: case EXI_DMAADDR:
_uReturnValue = m_DMAMemoryAddress; _uReturnValue = m_DMAMemoryAddress;
return; break;
case EXI_DMALENGTH: case EXI_DMALENGTH:
_uReturnValue = m_DMALength; _uReturnValue = m_DMALength;
return; break;
case EXI_DMACONTROL: case EXI_DMACONTROL:
_uReturnValue = m_Control.hex; _uReturnValue = m_Control.hex;
return; break;
case EXI_IMMDATA: case EXI_IMMDATA:
_uReturnValue = m_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) 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); LOG(EXPANSIONINTERFACE, "ExtensionInterface(W): 0x%08x channel: %i reg: %i", _iValue, m_ChannelId, _iRegister);
switch (_iRegister) switch (_iRegister)