Added a check for out of bounds memory accesses. Fixes Avatar: The Last Airbender (GC).

This commit is contained in:
skidau 2012-08-17 22:14:35 +10:00
parent 08a9c66037
commit 28bc5eca37
1 changed files with 6 additions and 3 deletions

View File

@ -635,7 +635,8 @@ u8 *GetPointer(const u32 _Address)
{
case 0x0:
case 0x8:
return m_pPhysicalRAM + (_Address & RAM_MASK);
if ((_Address & 0xfffffff) < REALRAM_SIZE)
return m_pPhysicalRAM + (_Address & RAM_MASK);
case 0xc:
switch (_Address >> 24)
{
@ -647,14 +648,16 @@ u8 *GetPointer(const u32 _Address)
break;
default:
return m_pPhysicalRAM + (_Address & RAM_MASK);
if ((_Address & 0xfffffff) < REALRAM_SIZE)
return m_pPhysicalRAM + (_Address & RAM_MASK);
}
case 0x1:
case 0x9:
case 0xd:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
return m_pPhysicalEXRAM + (_Address & EXRAM_MASK);
if ((_Address & 0xfffffff) < EXRAM_SIZE)
return m_pPhysicalEXRAM + (_Address & EXRAM_MASK);
else
break;