2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 17:47:42 +00:00

several core runtime stubs added

This commit is contained in:
Jack Andersen
2015-08-16 19:26:58 -10:00
parent 53256dea15
commit 387332ed70
38 changed files with 373 additions and 6 deletions

40
Runtime/CMemory.cpp Normal file
View File

@@ -0,0 +1,40 @@
#include "CMemory.hpp"
#include "CGameAllocator.hpp"
static CGameAllocator GAME_ALLOCATOR;
static IAllocator* MEMORY_ALLOCATOR = &GAME_ALLOCATOR;
static bool MEMORY_ALLOCATOR_READY = false;
void CMemory::Startup(COsContext& cos)
{
MEMORY_ALLOCATOR_READY = MEMORY_ALLOCATOR->Initialize(cos);
}
void CMemory::Shutdown()
{
MEMORY_ALLOCATOR->Shutdown();
MEMORY_ALLOCATOR_READY = false;
}
void CMemory::SetAllocator(COsContext& cos, IAllocator& alloc)
{
if (&alloc != MEMORY_ALLOCATOR)
{
MEMORY_ALLOCATOR = &alloc;
MEMORY_ALLOCATOR->Initialize(cos);
}
}
CMemorySys::CMemorySys(COsContext& cos, IAllocator& alloc)
{
CMemory::Startup(cos);
CMemory::SetAllocator(cos, alloc);
}
CMemorySys::~CMemorySys()
{
CMemory::Shutdown();
}
IAllocator* CMemorySys::GetGameAllocator() {return &GAME_ALLOCATOR;}