NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
mem_allocator.h
1#ifndef RVL_SDK_MEM_ALLOCATOR_H
2#define RVL_SDK_MEM_ALLOCATOR_H
3#include <types.h>
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8// Forward declarations
9typedef struct MEMAllocator MEMAllocator;
10typedef struct MEMiHeapHead MEMiHeapHead;
11
12typedef void* (*MEMAllocatorAllocFunc)(MEMAllocator* allocator, size_t size);
13typedef void (*MEMAllocatorFreeFunc)(MEMAllocator* allocator, void* block);
14
15typedef struct MEMAllocatorFuncs {
16 MEMAllocatorAllocFunc allocFunc; // at 0x0
17 MEMAllocatorFreeFunc freeFunc; // at 0x4
19
20typedef struct MEMAllocator {
21 const MEMAllocatorFuncs* funcs; // at 0x0
22 MEMiHeapHead* heap; // at 0x4
23 u32 heapParam1; // at 0x8
24 u32 heapParam2; // at 0xC
26
27void* MEMAllocFromAllocator(MEMAllocator* allocator, u32 size);
28void MEMFreeToAllocator(MEMAllocator* allocator, void* block);
29
30void MEMInitAllocatorForExpHeap(MEMAllocator* allocator, MEMiHeapHead* heap,
31 s32 align);
32void MEMInitAllocatorForFrmHeap(MEMAllocator* allocator, MEMiHeapHead* heap,
33 s32 align);
34
35#ifdef __cplusplus
36}
37#endif
38#endif