wut v1.9.1
Wii U Toolchain
Loading...
Searching...
No Matches
memallocator.h
Go to the documentation of this file.
1#pragma once
2#include <wut.h>
3#include "memheap.h"
4
13#ifdef __cplusplus
14extern "C" {
15#endif
16
19
20typedef void *(*MEMAllocatorAllocFn)(MEMAllocator *allocator, uint32_t size);
21typedef void (*MEMAllocatorFreeFn)(MEMAllocator *allocator, void *ptr);
22
25{
31 uint32_t align;
32 WUT_UNKNOWN_BYTES(4);
33};
34WUT_CHECK_OFFSET(MEMAllocator, 0x0, funcs);
35WUT_CHECK_OFFSET(MEMAllocator, 0x4, heap);
36WUT_CHECK_OFFSET(MEMAllocator, 0x8, align);
37WUT_CHECK_SIZE(MEMAllocator, 0x10);
38
45WUT_CHECK_OFFSET(MEMAllocatorFunctions, 0x0, alloc);
46WUT_CHECK_OFFSET(MEMAllocatorFunctions, 0x4, free);
47WUT_CHECK_SIZE(MEMAllocatorFunctions, 0x8);
48
54void *
56 uint32_t size);
57
63void
65 void *ptr);
66
70void
72 MEMHeapHandle heap,
73 uint32_t alignment);
74
78void
80 MEMHeapHandle heap,
81 uint32_t alignment);
82
86void
88 MEMHeapHandle heap);
89
93void
95
99void
101 MEMHeapHandle heap,
102 uint32_t alignment);
103
104#ifdef __cplusplus
105}
106#endif
107
MEMAllocatorAllocFn alloc
MEMAllocatorFunctions * funcs
Points to the alloc/free functions.
uint32_t align
The alignment the allocator will use.
MEMAllocatorFreeFn free
MEMHeapHandle heap
The heap handle.
void * MEMAllocFromAllocator(MEMAllocator *allocator, uint32_t size)
Allocates memory from the allocator.
void MEMInitAllocatorForUnitHeap(MEMAllocator *allocator, MEMHeapHandle heap)
Initializes an allocator from a Unit Heap.
void MEMInitAllocatorForBlockHeap(MEMAllocator *allocator, MEMHeapHandle heap, uint32_t alignment)
Initializes an allocator from a Block Heap.
void MEMInitAllocatorForExpHeap(MEMAllocator *allocator, MEMHeapHandle heap, uint32_t alignment)
Initializes an allocator from an Expanded Heap.
void *(* MEMAllocatorAllocFn)(MEMAllocator *allocator, uint32_t size)
void(* MEMAllocatorFreeFn)(MEMAllocator *allocator, void *ptr)
void MEMFreeToAllocator(MEMAllocator *allocator, void *ptr)
Frees memory back to the allocator.
void MEMInitAllocatorForFrmHeap(MEMAllocator *allocator, MEMHeapHandle heap, uint32_t alignment)
Initializes an allocator from a Frame Heap.
void MEMInitAllocatorForDefaultHeap(MEMAllocator *allocator)
Initializes an allocator from the Default Heap.
Holds context information that will be used to allocate and free memory.
The alloc/free functions.