Corrected the physical memory access to MEM2 via the MMU. Fixes Toy Story 3.

This commit is contained in:
skidau 2014-10-13 00:06:43 +11:00
parent 9551650c42
commit 69a2d0cb96
1 changed files with 36 additions and 6 deletions

View File

@ -150,12 +150,20 @@ inline void ReadFromHardware(T &_var, const u32 em_address, const u32 effective_
}
}
else
{
if (m_pEXRAM && (tlb_addr & 0xF0000000) == 0x10000000)
{
_var <<= 8;
_var = m_pEXRAM[tlb_addr & EXRAM_MASK];
}
else
{
_var <<= 8;
_var |= m_pRAM[tlb_addr & RAM_MASK];
}
}
}
}
else
{
u32 tlb_addr = TranslateAddress(em_address, flag);
@ -167,11 +175,18 @@ inline void ReadFromHardware(T &_var, const u32 em_address, const u32 effective_
}
}
else
{
if (m_pEXRAM && (tlb_addr & 0xF0000000) == 0x10000000)
{
_var = bswap((*(const T*)&m_pEXRAM[tlb_addr & EXRAM_MASK]));
}
else
{
_var = bswap((*(const T*)&m_pRAM[tlb_addr & RAM_MASK]));
}
}
}
}
}
@ -262,12 +277,20 @@ inline void WriteToHardware(u32 em_address, const T data, u32 effective_address,
}
}
else
{
if (m_pEXRAM && (tlb_addr & 0xF0000000) == 0x10000000)
{
m_pEXRAM[tlb_addr & EXRAM_MASK] = (u8)val;
val >>= 8;
}
else
{
m_pRAM[tlb_addr & RAM_MASK] = (u8)val;
val >>= 8;
}
}
}
}
else
{
u32 tlb_addr = TranslateAddress(em_address, flag);
@ -279,11 +302,18 @@ inline void WriteToHardware(u32 em_address, const T data, u32 effective_address,
}
}
else
{
if (m_pEXRAM && (tlb_addr & 0xF0000000) == 0x10000000)
{
*(T*)&m_pEXRAM[tlb_addr & EXRAM_MASK] = bswap(data);
}
else
{
*(T*)&m_pRAM[tlb_addr & RAM_MASK] = bswap(data);
}
}
}
}
}
// =====================