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 <game/mLib/m_heap.hpp>
4#include <lib/egg/core/eggAllocator.h>
5
6/**
7 * @brief An allocator class that wraps an EGG:Allocator .
8 */
9class mAllocator_c : public EGG::Allocator {
10public:
11 mAllocator_c(); ///< Constructs a new allocator.
12 virtual ~mAllocator_c(); ///< Destroys the allocator.
13
14 virtual void *alloc(size_t size);
15 virtual void free(void *ptr);
16
17 bool attach(EGG::Heap *heap, int alignment);
18
19 static void init(EGG::Heap *heap);
20};
21
22/**
23 * @brief An allocator with some helper functions that manage the heap
24 * from which it allocates memory.
25 */
27public:
28 mHeapAllocator_c(); ///< Constructs a new heap allocator.
29 virtual ~mHeapAllocator_c(); ///< Destroys the heap allocator.
30
31 bool createFrmHeap(size_t size, EGG::Heap *parent, const char *name, ulong align, mHeap::AllocOptBit_t opt);
32 bool createFrmHeapToCurrent(size_t size, EGG::Heap *parent, const char *name, ulong align, mHeap::AllocOptBit_t opt);
33
34 void destroyHeap(); ///< Destroys the underlying heap and replaces it with the dummy heap.
35 size_t adjustFrmHeap();
36 size_t adjustFrmHeapRestoreCurrent();
37};
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.
mHeapAllocator_c()
Constructs a new heap allocator.