From 0ec531587c3b07ed71e67eae4665f4f6ae1faad4 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 16 Mar 2013 19:43:34 -0700 Subject: [PATCH] Fix valid address checking. Fastmem crashes if it hits these addresses, but they're not reported as wrong. --- Core/MemMapFunctions.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index dcc895d212..9e58bbf19c 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -41,11 +41,11 @@ namespace Memory u8 *GetPointer(const u32 address) { - if ((address & 0x0E000000) == 0x08000000) + if ((address & 0x3E000000) == 0x08000000) { return m_pRAM + (address & RAM_MASK); } - else if ((address & 0x0F800000) == 0x04000000) + else if ((address & 0x3F800000) == 0x04000000) { return m_pVRAM + (address & VRAM_MASK); } @@ -72,11 +72,11 @@ inline void ReadFromHardware(T &var, const u32 address) // Could just do a base-relative read, too.... TODO - if ((address & 0x0E000000) == 0x08000000) + if ((address & 0x3E000000) == 0x08000000) { var = *((const T*)&m_pRAM[address & RAM_MASK]); } - else if ((address & 0x0F800000) == 0x04000000) + else if ((address & 0x3F800000) == 0x04000000) { var = *((const T*)&m_pVRAM[address & VRAM_MASK]); } @@ -105,11 +105,11 @@ inline void WriteToHardware(u32 address, const T data) { // Could just do a base-relative write, too.... TODO - if ((address & 0x0E000000) == 0x08000000) + if ((address & 0x3E000000) == 0x08000000) { *(T*)&m_pRAM[address & RAM_MASK] = data; } - else if ((address & 0x0F800000) == 0x04000000) + else if ((address & 0x3F800000) == 0x04000000) { *(T*)&m_pVRAM[address & VRAM_MASK] = data; } @@ -135,11 +135,11 @@ inline void WriteToHardware(u32 address, const T data) bool IsValidAddress(const u32 address) { - if ((address & 0x0E000000) == 0x08000000) + if ((address & 0x3E000000) == 0x08000000) { return true; } - else if ((address & 0x0F800000) == 0x04000000) + else if ((address & 0x3F800000) == 0x04000000) { return true; }