Fix bugs when memory size is 0x04C00000/etc.

Was experimenting with trying to match my non-phat's ram size.
This commit is contained in:
Unknown W. Brackets 2013-09-09 00:19:26 -07:00
parent 74418c13bf
commit 38e30e5a67
4 changed files with 18 additions and 11 deletions

View file

@ -57,9 +57,9 @@ u8 *m_pUncachedVRAM;
// Holds the ending address of the PSP's user space.
// Required for HD Remasters to work properly.
// These replace RAM_SIZE and RAM_MASK, respectively.
u32 g_MemoryMask;
// These replace RAM_NORMAL_SIZE and RAM_NORMAL_MASK, respectively.
u32 g_MemorySize;
u32 g_MemoryMask;
// We don't declare the IO region in here since its handled by other means.
static MemoryView views[] =
@ -81,7 +81,10 @@ static const int num_views = sizeof(views) / sizeof(MemoryView);
void Init()
{
int flags = 0;
Memory::g_MemoryMask = Memory::g_MemorySize - 1;
// This mask is used ONLY after validating the address is in the correct range.
// So let's juse use a fixed mask to remove the uncached/user memory bits.
// Using (Memory::g_MemorySize - 1) won't work for e.g. 0x04C00000.
Memory::g_MemoryMask = 0x07FFFFFF;
for (size_t i = 0; i < ARRAY_SIZE(views); i++) {
if (views[i].flags & MV_IS_PRIMARY_RAM)