Files
ss/include/lib/rvl/MEM/mem_allocator.h
T
lepelog 42880ec9ae init
2023-08-09 16:59:04 +02:00

41 lines
1.2 KiB
C

#ifndef RVL_SDK_MEM_ALLOCATOR_H
#define RVL_SDK_MEM_ALLOCATOR_H
#include <lib/rvl/types.h>
#ifdef __cplusplus
extern "C" {
#endif
// Forward declarations
typedef struct MEMAllocator;
typedef struct MEMiHeapHead;
typedef void* (*MEMAllocatorAllocFunc)(struct MEMAllocator* allocator,
u32 size);
typedef void (*MEMAllocatorFreeFunc)(struct MEMAllocator* allocator,
void* block);
typedef struct MEMAllocatorFuncs {
MEMAllocatorAllocFunc allocFunc; // at 0x0
MEMAllocatorFreeFunc freeFunc; // at 0x4
} MEMAllocatorFuncs;
typedef struct MEMAllocator {
const MEMAllocatorFuncs* funcs; // at 0x0
struct MEMiHeapHead* heap; // at 0x4
u32 heapParam1; // at 0x8
u32 heapParam2; // at 0xC
} MEMAllocator;
void* MEMAllocFromAllocator(MEMAllocator* allocator, u32 size);
void MEMFreeToAllocator(MEMAllocator* allocator, void* block);
void MEMInitAllocatorForExpHeap(MEMAllocator* allocator,
struct MEMiHeapHead* heap, s32 align);
void MEMInitAllocatorForFrmHeap(MEMAllocator* allocator,
struct MEMiHeapHead* heap, s32 align);
#ifdef __cplusplus
}
#endif
#endif