2#include <lib/egg/core/eggAssertHeap.h>
3#include <lib/egg/core/eggFrmHeap.h>
4#include <lib/egg/core/eggExpHeap.h>
5#include <lib/egg/core/eggUnitHeap.h>
78 size_t untHeapCost(
size_t size, ulong count, ulong align);
134 inline bool isValidGameHeapId(u32 idx) {
145 EGG::Heap *
createHeap(
size_t size, EGG::Heap *parent,
const char *name);
154 EGG::Heap *
createGameHeap(
int idx,
size_t size, EGG::Heap* parent);
Provides high-level heap management utilities built on top of the EGG heap system.
EGG::FrmHeap * createFrmHeap(size_t size, EGG::Heap *parent, const char *name, ulong align, AllocOptBit_t opt)
Creates a frame heap.
void saveCurrentHeap()
Saves the currently active heap. The saved heap can later be restored using restoreCurrentHeap().
const char *const s_GameHeapNames[GAME_HEAP_COUNT]
The game heap names.
u16 GetOptFlag(AllocOptBit_t opt)
Converts the allocation option bits to internal MEM heap flags.
EGG::Heap * createAssertHeap(EGG::Heap *parent)
Creates the assert heap.
EGG::Heap * createGameHeap(int idx, size_t size, EGG::Heap *parent)
Creates a game heap.
GAME_HEAP_e
The identifiers for the predefined game heaps.
@ GAME_HEAP_COUNT
The total number of game heaps.
@ GAME_HEAP_DEFAULT
The default game heap (alias of MEM1 or MEM2).
@ GAME_HEAP_MEM1
The game heap allocated in MEM1.
@ GAME_HEAP_MEM2
The game heap allocated in MEM2.
size_t frmHeapCost(size_t size, ulong align)
Calculates the total required size for a frame heap, including internal overhead.
size_t adjustFrmHeap(EGG::FrmHeap *heap)
Adjusts a frame heap to release unused memory.
EGG::Heap * createGameHeap2(size_t size, EGG::Heap *parent)
Creates the MEM2 game heap. See createGameHeap().
EGG::UnitHeap * createUntHeap(size_t size, ulong count, EGG::Heap *parent, const char *name, ulong align, AllocOptBit_t opt)
Creates a unit heap.
void restoreCurrentHeap()
Restores the previously saved heap as current.
EGG::ExpHeap * createExpHeap(size_t size, EGG::Heap *parent, const char *name, ulong align, AllocOptBit_t opt)
Creates an expandable heap.
u8 g_DefaultGameHeapId
The default game heap to be used if one isn't specified.
EGG::Heap * createHeap(size_t size, EGG::Heap *parent, const char *name)
Creates a generic expandable heap, with fast allocation mode and thread-safe de/allocation.
size_t untHeapCost(size_t size, ulong count, ulong align)
Calculates the total required size for an unit heap, including internal overhead.
EGG::Heap * g_gameHeaps[GAME_HEAP_COUNT]
The game heaps.
EGG::Heap * createGameHeap1(size_t size, EGG::Heap *parent)
Creates the MEM1 game heap. See createGameHeap().
EGG::Heap * createArchiveHeap(size_t size, EGG::Heap *parent)
Creates the archive heap. See createHeap().
void destroyFrmHeap(EGG::FrmHeap *heap)
Destroys a frame heap.
EGG::Heap * createCommandHeap(size_t size, EGG::Heap *parent)
Creates the DVD command heap. See createHeap().
EGG::Heap * g_assertHeap
The assert heap.
EGG::FrmHeap * createFrmHeapToCurrent(size_t size, EGG::Heap *parent, const char *name, ulong align, AllocOptBit_t opt)
Creates a frame heap and sets it as current.
EGG::Heap * s_SavedCurrentHeap
The saved current heap.
size_t expHeapCost(size_t size, ulong align)
Calculates the total required size for an expandable heap, including internal overhead.
EGG::Heap * g_archiveHeap
The archive resource heap.
EGG::Heap * g_dylinkHeap
The REL linking heap.
AllocOptBit_t
Bit flags controlling heap allocation behavior. These flags are translated into internal MEM heap fla...
@ OPT_CLEAR_ALLOC
Memory blocks are cleared upon allocation.
@ OPT_DEBUG_FILL
Memory blocks are filled with different values depending on the heap status.
@ OPT_THREAD_SAFE
Enables thread-safe memory block de/allocation.
@ OPT_NONE
No special allocation options.
EGG::Heap * createDylinkHeap(size_t size, EGG::Heap *parent)
Creates the REL linking heap. See createHeap().
EGG::Heap * g_commandHeap
The DVD command heap.
EGG::Heap * setCurrentHeap(EGG::Heap *heap)
Sets the specified heap as the current heap.