Iniital CGameAllocator stubs

This commit is contained in:
Phillip Stephens 2020-10-30 15:56:02 -07:00
parent f660266750
commit aa400c7ff6
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
1 changed files with 39 additions and 4 deletions

View File

@ -10,11 +10,46 @@ namespace metaforce {
class CCallStack { class CCallStack {
const char* x0_line; const char* x0_line;
const char* x4_type; const char* x4_type;
public: public:
CCallStack(int lineNum, const char* lineStr, const char* type) : x0_line(lineStr), x4_type(type) {} CCallStack(int lineNum, const char* lineStr, const char* type) : x0_line(lineStr), x4_type(type) {}
}; };
class CGameAllocator { struct SAllocInfo {};
enum class EHint {
Unk = (1 << 0),
RoundUpLen = (1 << 1),
};
ENABLE_BITWISE_ENUM(EHint);
enum class EScope {
};
enum class EType {
};
class IAllocator {
public:
virtual bool Initialize() = 0; // const COSContext& ctx) = 0;
virtual void* Alloc() = 0;
virtual s32 Free(void* ptr) = 0;
virtual void ReleaseAll() = 0;
virtual void AllocSecondary() = 0;
virtual void FreeSecondary() = 0;
virtual void ReleaseAllSecondary() = 0;
virtual void SetOutOfMemoryCallback() = 0;
virtual void EnumAllocations() = 0;
virtual SAllocInfo GetAllocInfo() = 0;
virtual void sub80351138() = 0;
virtual void GetMetrics() = 0;
};
class CGameAllocator : public IAllocator {
struct SGameMemInfo { struct SGameMemInfo {
u32 x0_sentinel = 0xefefefef; u32 x0_sentinel = 0xefefefef;
size_t x4_len = 0; size_t x4_len = 0;
@ -26,10 +61,10 @@ class CGameAllocator {
u32 x1c_canary = 0xeaeaeaea; u32 x1c_canary = 0xeaeaeaea;
}; };
static u32 GetFreeBinEntryForSize(size_t len); static u32 GetFreeBinEntryForSize(size_t len);
std::array<SGameMemInfo, 16> x14_bins; std::array<SGameMemInfo*, 16> x14_bins;
public:
bool Initialize();//const COsContext& ctx); public:
bool Initialize(); // const COsContext& ctx);
}; };
} // namespace metaforce } // namespace metaforce