2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 13:47:43 +00:00

Basic CGameAllocator implementation (WIP)

This commit is contained in:
2017-09-12 08:27:48 -07:00
parent c0d5cee8b1
commit 001125429f
21 changed files with 363 additions and 59 deletions

View File

@@ -0,0 +1,34 @@
#ifndef __URDE_CGAMEALLOCATOR_HPP__
#define __URDE_CGAMEALLOCATOR_HPP__
#include "RetroTypes.hpp"
namespace urde
{
class CGameAllocator
{
struct SAllocationDescription
{
std::unique_ptr<u8[]> memptr;
size_t allocSize = 0;
ptrdiff_t freeOffset = 0;
};
struct SChunkDescription
{
u32 magic = 0xE8E8E8E8;
SAllocationDescription* parent;
size_t len = 0;
u32 sentinal = 0xEFEFEFEF;
};
static std::vector<SAllocationDescription> m_allocations;
public:
static u8* Alloc(size_t len);
static void Free(u8* ptr);
};
}
#endif