summaryrefslogtreecommitdiff
path: root/context.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-02-04 19:17:50 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-02-04 19:17:50 -0400
commitcf8538d2a5cfb3a697015c1bcdea38f645fed2f5 (patch)
tree7df167cccdf220dd6ce567b762b2f636a08b71a9 /context.h
parent07552dea8ca77f2b8225a3eda02da71f629084d2 (diff)
THeap: Add `THeap` class
Some matching issues, but still a good start.
Diffstat (limited to 'context.h')
-rw-r--r--context.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/context.h b/context.h
index 12ae4e9..065559b 100644
--- a/context.h
+++ b/context.h
@@ -54,6 +54,7 @@ typedef int BOOL;
// Class forward.
+class THeap;
class TObject;
class TMainTask;
@@ -73,7 +74,27 @@ u32 old_main_task_flags;
u32 lbl_805c5b98;
u32 lbl_805c5b9c;
+// func defs.
+extern void *heap_xfree(void *ptr);
+extern void *heap_xmalloc(size_t size);
+
// Class defs.
+class THeap {
+public:
+ u8 *heap;
+ size_t alloc_size;
+ s32 align;
+ size_t heap_size;
+ s32 mbr_0x10;
+public:
+ THeap(size_t size, int align);
+ ~THeap();
+ void *operator new(size_t size) { return heap_xmalloc(size); };
+ void operator delete(void *ptr) { heap_xfree(ptr); };
+ void *heap_alloc(size_t size);
+ void *heap_zalloc(size_t size);
+ void heap_free(void *ptr);
+};
class TObject {
public:
const char *name;