2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-07-25 21:25:35 +00:00
metaforce/Runtime/CMemory.hpp
2015-08-23 13:58:07 -10:00

41 lines
1.0 KiB
C++

#ifndef __RETRO_CMEMORY_HPP__
#define __RETRO_CMEMORY_HPP__
#include "IAllocator.hpp"
namespace Retro
{
class COsContext;
class CMemory
{
public:
static void Startup(COsContext&);
static void Shutdown();
static void SetAllocator(COsContext&, IAllocator&);
static void OffsetFakeStatics(int);
static void SetOutOfMemoryCallback(const IAllocator::TOutOfMemoryCallback, void*);
static void Free(void*);
static void* Alloc(size_t, IAllocator::EHint, IAllocator::EScope, IAllocator::EType, const CCallStack&);
};
class CMemorySys
{
public:
CMemorySys(COsContext&, IAllocator&);
~CMemorySys();
static IAllocator& GetGameAllocator();
};
}
/* Custom new funcs */
void* operator new(std::size_t sz, const char* funcName, const char* typeName);
void* operator new[](std::size_t sz, const char* funcName, const char* typeName);
/* Macro to perform custom with debug strings */
#define NEW(T) new (AT_PRETTY_FUNCTION, typeid(T).name()) T
#define NEWA(T, N) new (AT_PRETTY_FUNCTION, typeid(T).name()) T[N]
#endif // __RETRO_CMEMORY_HPP__