mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-13 17:41:49 +01:00
d5effaaf88
Move files to mem*heap.h. Use MEMHeapHandle everywhere to reduce need for unecessary casts. Rename types to match the function names better (e.g. Frame -> Frm).
93 lines
1.9 KiB
C
93 lines
1.9 KiB
C
#pragma once
|
|
#include <wut.h>
|
|
#include "memheap.h"
|
|
|
|
/**
|
|
* \defgroup coreinit_memfrmheap Frame Heap
|
|
* \ingroup coreinit
|
|
* @{
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef enum MEMFrmHeapFreeMode
|
|
{
|
|
MEM_FRM_HEAP_FREE_HEAD = 1 << 0,
|
|
MEM_FRM_HEAP_FREE_TAIL = 1 << 1,
|
|
MEM_FRM_HEAP_FREE_ALL = MEM_FRM_HEAP_FREE_HEAD | MEM_FRM_HEAP_FREE_TAIL,
|
|
} MEMFrmHeapFreeMode;
|
|
|
|
typedef struct MEMFrmHeap MEMFrmHeap;
|
|
typedef struct MEMFrmHeapState MEMFrmHeapState;
|
|
|
|
struct MEMFrmHeapState
|
|
{
|
|
uint32_t tag;
|
|
void *head;
|
|
void *tail;
|
|
MEMFrmHeapState *previous;
|
|
};
|
|
CHECK_OFFSET(MEMFrmHeapState, 0x00, tag);
|
|
CHECK_OFFSET(MEMFrmHeapState, 0x04, head);
|
|
CHECK_OFFSET(MEMFrmHeapState, 0x08, tail);
|
|
CHECK_OFFSET(MEMFrmHeapState, 0x0C, previous);
|
|
CHECK_SIZE(MEMFrmHeapState, 0x10);
|
|
|
|
struct MEMFrmHeap
|
|
{
|
|
MEMHeapHeader header;
|
|
void *head;
|
|
void *tail;
|
|
MEMFrmHeapState *previousState;
|
|
};
|
|
CHECK_OFFSET(MEMFrmHeap, 0x00, header);
|
|
CHECK_OFFSET(MEMFrmHeap, 0x40, head);
|
|
CHECK_OFFSET(MEMFrmHeap, 0x44, tail);
|
|
CHECK_OFFSET(MEMFrmHeap, 0x48, previousState);
|
|
CHECK_SIZE(MEMFrmHeap, 0x4C);
|
|
|
|
MEMHeapHandle
|
|
MEMCreateFrmHeapEx(void *heap,
|
|
uint32_t size,
|
|
uint32_t flags);
|
|
|
|
void *
|
|
MEMDestroyFrmHeap(MEMHeapHandle heap);
|
|
|
|
void *
|
|
MEMAllocFromFrmHeapEx(MEMHeapHandle heap,
|
|
uint32_t size,
|
|
int alignment);
|
|
|
|
void
|
|
MEMFreeToFrmHeap(MEMHeapHandle heap,
|
|
MEMFrmHeapFreeMode mode);
|
|
|
|
BOOL
|
|
MEMRecordStateForFrmHeap(MEMHeapHandle heap,
|
|
uint32_t tag);
|
|
|
|
BOOL
|
|
MEMFreeByStateToFrmHeap(MEMHeapHandle heap,
|
|
uint32_t tag);
|
|
|
|
uint32_t
|
|
MEMAdjustFrmHeap(MEMHeapHandle heap);
|
|
|
|
uint32_t
|
|
MEMResizeForMBlockFrmHeap(MEMHeapHandle heap,
|
|
uint32_t addr,
|
|
uint32_t size);
|
|
|
|
uint32_t
|
|
MEMGetAllocatableSizeForFrmHeapEx(MEMHeapHandle heap,
|
|
int alignment);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
/** @} */
|