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

@ -151,8 +151,16 @@ inline void ReadFromHardware(T &_var, const u32 em_address, const u32 effective_
} }
else else
{ {
_var <<= 8; if (m_pEXRAM && (tlb_addr & 0xF0000000) == 0x10000000)
_var |= m_pRAM[tlb_addr & RAM_MASK]; {
_var <<= 8;
_var = m_pEXRAM[tlb_addr & EXRAM_MASK];
}
else
{
_var <<= 8;
_var |= m_pRAM[tlb_addr & RAM_MASK];
}
} }
} }
} }
@ -168,7 +176,14 @@ inline void ReadFromHardware(T &_var, const u32 em_address, const u32 effective_
} }
else else
{ {
_var = bswap((*(const T*)&m_pRAM[tlb_addr & RAM_MASK])); 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]));
}
} }
} }
} }
@ -263,8 +278,16 @@ inline void WriteToHardware(u32 em_address, const T data, u32 effective_address,
} }
else else
{ {
m_pRAM[tlb_addr & RAM_MASK] = (u8)val; if (m_pEXRAM && (tlb_addr & 0xF0000000) == 0x10000000)
val >>= 8; {
m_pEXRAM[tlb_addr & EXRAM_MASK] = (u8)val;
val >>= 8;
}
else
{
m_pRAM[tlb_addr & RAM_MASK] = (u8)val;
val >>= 8;
}
} }
} }
} }
@ -280,7 +303,14 @@ inline void WriteToHardware(u32 em_address, const T data, u32 effective_address,
} }
else else
{ {
*(T*)&m_pRAM[tlb_addr & RAM_MASK] = bswap(data); 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);
}
} }
} }
} }