NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
m_allocator.hpp
1#pragma once
2#include <types.h>
3#include <lib/egg/allocator.hpp>
4
5/**
6 * @brief An allocator class that wraps an EGG:Allocator .
7 */
9public:
10 mAllocator_c(); ///< @brief Constructs a new allocator.
11 virtual ~mAllocator_c(); ///< @brief Destroys the allocator.
12
13 virtual void *alloc(size_t size);
14 virtual void free(void *ptr);
15
16 bool attach(EGG::Heap *heap, int alignment);
17
18 static void init(EGG::Heap *heap);
19};
20
21/**
22 * @brief An allocator with some helper functions that manage the heap
23 * from which it allocates memory.
24 */
26public:
27 mHeapAllocator_c(); ///< @brief Constructs a new heap allocator.
28 virtual ~mHeapAllocator_c(); ///< @brief Destroys the heap allocator.
29
30 /// @unofficial
31 bool createHeap(size_t size, EGG::Heap *parent, const char *name, u32 align, u32 opt);
32
33 /// @unofficial
34 bool createHeapRestoreCurrent(size_t size, EGG::Heap *parent, const char *name, u32 align, u32 opt);
35
36 void destroyHeap(); ///< @brief destroys the underlying heap and replaces it with the dummy heap;
37 size_t adjustFrmHeap();
38 size_t adjustFrmHeapRestoreCurrent();
39};
mAllocator_c()
Constructs a new allocator.
virtual ~mAllocator_c()
Destroys the allocator.
void destroyHeap()
destroys the underlying heap and replaces it with the dummy heap;
virtual ~mHeapAllocator_c()
Destroys the heap allocator.
bool createHeapRestoreCurrent(size_t size, EGG::Heap *parent, const char *name, u32 align, u32 opt)
mHeapAllocator_c()
Constructs a new heap allocator.
bool createHeap(size_t size, EGG::Heap *parent, const char *name, u32 align, u32 opt)