From eee98966f4a852e192bedcde580558bc69176ee8 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 19 May 2016 21:17:17 -0700 Subject: [PATCH] Add Memory utility to detect shutdown. --- Core/MemMap.cpp | 13 +++++++------ Core/MemMap.h | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index e13d7275c..d01fb17df 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -383,18 +383,15 @@ void DoState(PointerWrap &p) p.DoMarker("ScratchPad"); } -void Shutdown() -{ +void Shutdown() { lock_guard guard(g_shutdownLock); u32 flags = 0; - MemoryMap_Shutdown(flags); - base = NULL; + base = nullptr; DEBUG_LOG(MEMMAP, "Memory system shut down."); } -void Clear() -{ +void Clear() { if (m_pRAM) memset(GetPointerUnchecked(PSP_GetKernelMemoryBase()), 0, g_MemorySize); if (m_pScratchPad) @@ -403,6 +400,10 @@ void Clear() memset(m_pVRAM, 0, VRAM_SIZE); } +bool IsActive() { + return base != nullptr; +} + // Wanting to avoid include pollution, MemMap.h is included a lot. MemoryInitedLock::MemoryInitedLock() { diff --git a/Core/MemMap.h b/Core/MemMap.h index c2b4ad3b1..b397781c3 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -130,6 +130,8 @@ void Init(); void Shutdown(); void DoState(PointerWrap &p); void Clear(); +// False when shutdown has already been called. +bool IsActive(); class MemoryInitedLock {