From ebc47a4b367022997d0053263ff70b7837f197ff Mon Sep 17 00:00:00 2001 From: degasus Date: Sun, 4 Sep 2016 10:50:48 +0200 Subject: [PATCH] Memmap: Drop redundant global bFakeVMEM flag. --- Source/Core/Core/HW/Memmap.cpp | 10 ++++------ Source/Core/Core/HW/Memmap.h | 1 - Source/Core/Core/PowerPC/MMU.cpp | 14 +++++++------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Source/Core/Core/HW/Memmap.cpp b/Source/Core/Core/HW/Memmap.cpp index 05d731efcc..c82380b903 100644 --- a/Source/Core/Core/HW/Memmap.cpp +++ b/Source/Core/Core/HW/Memmap.cpp @@ -34,9 +34,6 @@ namespace Memory { -// (See comment below describing memory map.) -bool bFakeVMEM = false; - // ================================= // Init() declarations // ---------------- @@ -169,6 +166,7 @@ void Init() { bool wii = SConfig::GetInstance().bWii; bool bMMU = SConfig::GetInstance().bMMU; + bool bFakeVMEM = false; #ifndef _ARCH_32 // If MMU is turned off in GameCube mode, turn on fake VMEM hack. // The fake VMEM hack's address space is above the memory space that we @@ -269,7 +267,7 @@ void DoState(PointerWrap& p) p.DoArray(m_pRAM, RAM_SIZE); p.DoArray(m_pL1Cache, L1_CACHE_SIZE); p.DoMarker("Memory RAM"); - if (bFakeVMEM) + if (m_pFakeVMEM) p.DoArray(m_pFakeVMEM, FAKEVMEM_SIZE); p.DoMarker("Memory FakeVMEM"); if (wii) @@ -283,7 +281,7 @@ void Shutdown() u32 flags = 0; if (SConfig::GetInstance().bWii) flags |= PhysicalMemoryRegion::WII_ONLY; - if (bFakeVMEM) + if (m_pFakeVMEM) flags |= PhysicalMemoryRegion::FAKE_VMEM; for (PhysicalMemoryRegion& region : physical_regions) { @@ -397,7 +395,7 @@ u8* GetPointer(u32 address) if (address < REALRAM_SIZE) return m_pRAM + address; - if (SConfig::GetInstance().bWii) + if (m_pEXRAM) { if ((address >> 28) == 0x1 && (address & 0x0fffffff) < EXRAM_SIZE) return m_pEXRAM + (address & EXRAM_MASK); diff --git a/Source/Core/Core/HW/Memmap.h b/Source/Core/Core/HW/Memmap.h index 02c0650818..1e628fe215 100644 --- a/Source/Core/Core/HW/Memmap.h +++ b/Source/Core/Core/HW/Memmap.h @@ -35,7 +35,6 @@ extern u8* m_pRAM; extern u8* m_pEXRAM; extern u8* m_pL1Cache; extern u8* m_pFakeVMEM; -extern bool bFakeVMEM; enum { diff --git a/Source/Core/Core/PowerPC/MMU.cpp b/Source/Core/Core/PowerPC/MMU.cpp index a637399ce0..d114a75c34 100644 --- a/Source/Core/Core/PowerPC/MMU.cpp +++ b/Source/Core/Core/PowerPC/MMU.cpp @@ -211,7 +211,7 @@ __forceinline static T ReadFromHardware(u32 em_address) // In Fake-VMEM mode, we need to map the memory somewhere into // physical memory for BAT translation to work; we currently use // [0x7E000000, 0x80000000). - if (Memory::bFakeVMEM && ((em_address & 0xFE000000) == 0x7E000000)) + if (Memory::m_pFakeVMEM && ((em_address & 0xFE000000) == 0x7E000000)) { return bswap(*(T*)&Memory::m_pFakeVMEM[em_address & Memory::RAM_MASK]); } @@ -295,7 +295,7 @@ __forceinline static void WriteToHardware(u32 em_address, const T data) // In Fake-VMEM mode, we need to map the memory somewhere into // physical memory for BAT translation to work; we currently use // [0x7E000000, 0x80000000). - if (Memory::bFakeVMEM && ((em_address & 0xFE000000) == 0x7E000000)) + if (Memory::m_pFakeVMEM && ((em_address & 0xFE000000) == 0x7E000000)) { *(T*)&Memory::m_pFakeVMEM[em_address & Memory::RAM_MASK] = bswap(data); return; @@ -395,7 +395,7 @@ TryReadInstResult TryReadInstruction(u32 address) u32 hex; // TODO: Refactor this. This icache implementation is totally wrong if used with the fake vmem. - if (Memory::bFakeVMEM && ((address & 0xFE000000) == 0x7E000000)) + if (Memory::m_pFakeVMEM && ((address & 0xFE000000) == 0x7E000000)) { hex = bswap(*(const u32*)&Memory::m_pFakeVMEM[address & Memory::FAKEVMEM_MASK]); } @@ -639,7 +639,7 @@ bool HostIsRAMAddress(u32 address) return true; else if (Memory::m_pEXRAM && segment == 0x1 && (address & 0x0FFFFFFF) < Memory::EXRAM_SIZE) return true; - else if (Memory::bFakeVMEM && ((address & 0xFE000000) == 0x7E000000)) + else if (Memory::m_pFakeVMEM && ((address & 0xFE000000) == 0x7E000000)) return true; else if (segment == 0xE && (address < (0xE0000000 + Memory::L1_CACHE_SIZE))) return true; @@ -1166,7 +1166,7 @@ static void UpdateBATs(BatTable& bat_table, u32 base_spr) // The bottom bit is whether the translation is valid; the second // bit from the bottom is whether we can use the fastmem arena. u32 valid_bit = 0x1; - if (Memory::bFakeVMEM && ((address & 0xFE000000) == 0x7E000000)) + if (Memory::m_pFakeVMEM && ((address & 0xFE000000) == 0x7E000000)) valid_bit = 0x3; else if (address < Memory::REALRAM_SIZE) valid_bit = 0x3; @@ -1202,7 +1202,7 @@ void DBATUpdated() bool extended_bats = SConfig::GetInstance().bWii && HID4.SBE; if (extended_bats) UpdateBATs(dbat_table, SPR_DBAT4U); - if (Memory::bFakeVMEM) + if (Memory::m_pFakeVMEM) { // In Fake-MMU mode, insert some extra entries into the BAT tables. UpdateFakeMMUBat(dbat_table, 0x40000000); @@ -1221,7 +1221,7 @@ void IBATUpdated() bool extended_bats = SConfig::GetInstance().bWii && HID4.SBE; if (extended_bats) UpdateBATs(ibat_table, SPR_IBAT4U); - if (Memory::bFakeVMEM) + if (Memory::m_pFakeVMEM) { // In Fake-MMU mode, insert some extra entries into the BAT tables. UpdateFakeMMUBat(ibat_table, 0x40000000);