Skip to content

Commit

Permalink
Add Memory utility to detect shutdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed May 20, 2016
1 parent 6871741 commit eee9896
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Core/MemMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
{
Expand Down
2 changes: 2 additions & 0 deletions Core/MemMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit eee9896

Please sign in to comment.