summaryrefslogtreecommitdiff
path: root/include
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 /include
parent07552dea8ca77f2b8225a3eda02da71f629084d2 (diff)
THeap: Add `THeap` class
Some matching issues, but still a good start.
Diffstat (limited to 'include')
-rw-r--r--include/pso/THeap.h28
-rw-r--r--include/pso/forward.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/include/pso/THeap.h b/include/pso/THeap.h
new file mode 100644
index 0000000..fa8df22
--- /dev/null
+++ b/include/pso/THeap.h
@@ -0,0 +1,28 @@
+#ifndef TMAINTASK_H
+#define TMAINTASK_H
+
+#include "pso/forward.h"
+#include "pso/macros.h"
+#include <global_types.h>
+#include <stdlib.h>
+
+void *heap_xfree(void *ptr);
+void *heap_xmalloc(size_t size);
+
+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);
+};
+#endif
diff --git a/include/pso/forward.h b/include/pso/forward.h
index ae055af..6c97f81 100644
--- a/include/pso/forward.h
+++ b/include/pso/forward.h
@@ -1,6 +1,7 @@
#ifndef FORWARD_H
#define FORWARD_H
+class THeap;
class TObject;
class TMainTask;