Add Memory utility to detect shutdown.

This commit is contained in:
Unknown W. Brackets 2016-05-19 21:17:17 -07:00
parent 68717411b1
commit eee98966f4
2 changed files with 9 additions and 6 deletions

View File

@ -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()
{

View File

@ -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
{