wut  v1.7.0
Wii U Toolchain
memexpheap.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 #include "memheap.h"
4 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 typedef struct MEMExpHeap MEMExpHeap;
16 typedef struct MEMExpHeapBlock MEMExpHeapBlock;
18 
19 typedef void (*MEMExpHeapBlockVisitor)(void *block, MEMHeapHandle heap,
20  void *context);
21 
22 typedef enum MEMExpHeapMode
23 {
27 
28 typedef enum MEMExpHeapDirection
29 {
33 
35 {
39 
41 {
42  uint32_t attribs;
43  uint32_t blockSize;
46  uint16_t tag;
47  WUT_UNKNOWN_BYTES(0x02);
48 };
49 WUT_CHECK_OFFSET(MEMExpHeapBlock, 0x00, attribs);
50 WUT_CHECK_OFFSET(MEMExpHeapBlock, 0x04, blockSize);
51 WUT_CHECK_OFFSET(MEMExpHeapBlock, 0x08, prev);
52 WUT_CHECK_OFFSET(MEMExpHeapBlock, 0x0c, next);
53 WUT_CHECK_OFFSET(MEMExpHeapBlock, 0x10, tag);
54 WUT_CHECK_SIZE(MEMExpHeapBlock, 0x14);
55 
57 {
60 };
61 WUT_CHECK_OFFSET(MEMExpHeapBlockList, 0x00, head);
62 WUT_CHECK_OFFSET(MEMExpHeapBlockList, 0x04, tail);
63 WUT_CHECK_SIZE(MEMExpHeapBlockList, 0x08);
64 
65 struct WUT_PACKED MEMExpHeap
66 {
70  uint16_t groupId;
71  uint16_t attribs;
72 };
73 WUT_CHECK_OFFSET(MEMExpHeap, 0x00, header);
74 WUT_CHECK_OFFSET(MEMExpHeap, 0x40, freeList);
75 WUT_CHECK_OFFSET(MEMExpHeap, 0x48, usedList);
76 WUT_CHECK_OFFSET(MEMExpHeap, 0x50, groupId);
77 WUT_CHECK_OFFSET(MEMExpHeap, 0x52, attribs);
78 WUT_CHECK_SIZE(MEMExpHeap, 0x54);
79 
81 MEMCreateExpHeapEx(void *heap,
82  uint32_t size,
83  uint16_t flags);
84 
85 void *
87 
88 void *
90  uint32_t size,
91  int alignment);
92 
93 void
95  void *block);
96 
99  MEMExpHeapMode mode);
100 
103 
104 uint32_t
106 
107 uint32_t
109  void *block,
110  uint32_t size);
111 
112 uint32_t
114 
115 uint32_t
117  int alignment);
118 
119 uint16_t
121  uint16_t id);
122 
123 uint16_t
125 
126 uint32_t
128 
129 uint16_t
131 
134 
135 void
137  MEMExpHeapBlockVisitor callback,
138  void *context);
139 
140 BOOL
142  MEMExpHeapCheckFlags mode);
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
MEMExpHeapBlock * tail
Definition: memexpheap.h:59
uint16_t tag
Definition: memexpheap.h:46
MEMExpHeapBlockList usedList
Definition: memexpheap.h:69
MEMHeapHeader header
Definition: memexpheap.h:67
uint16_t groupId
Definition: memexpheap.h:70
uint32_t attribs
Definition: memexpheap.h:42
MEMExpHeapBlock * head
Definition: memexpheap.h:58
MEMExpHeapBlockList freeList
Definition: memexpheap.h:68
MEMExpHeapBlock * next
Definition: memexpheap.h:45
uint32_t blockSize
Definition: memexpheap.h:43
MEMExpHeapBlock * prev
Definition: memexpheap.h:44
uint16_t attribs
Definition: memexpheap.h:71
MEMHeapHandle MEMCreateExpHeapEx(void *heap, uint32_t size, uint16_t flags)
MEMExpHeapCheckFlags
Definition: memexpheap.h:35
uint32_t MEMResizeForMBlockExpHeap(MEMHeapHandle heap, void *block, uint32_t size)
MEMExpHeapDirection MEMGetAllocDirForMBlockExpHeap(void *block)
MEMExpHeapMode MEMSetAllocModeForExpHeap(MEMHeapHandle heap, MEMExpHeapMode mode)
void * MEMAllocFromExpHeapEx(MEMHeapHandle heap, uint32_t size, int alignment)
uint32_t MEMGetTotalFreeSizeForExpHeap(MEMHeapHandle heap)
MEMExpHeapMode MEMGetAllocModeForExpHeap(MEMHeapHandle heap)
uint32_t MEMGetAllocatableSizeForExpHeapEx(MEMHeapHandle heap, int alignment)
uint32_t MEMAdjustExpHeap(MEMHeapHandle heap)
void MEMFreeToExpHeap(MEMHeapHandle heap, void *block)
uint32_t MEMGetSizeForMBlockExpHeap(void *block)
uint16_t MEMGetGroupIDForMBlockExpHeap(void *block)
BOOL MEMCheckExpHeap(MEMHeapHandle handle, MEMExpHeapCheckFlags mode)
void MEMVisitAllocatedForExpHeap(MEMHeapHandle heap, MEMExpHeapBlockVisitor callback, void *context)
uint16_t MEMGetGroupIDForExpHeap(MEMHeapHandle heap)
uint16_t MEMSetGroupIDForExpHeap(MEMHeapHandle heap, uint16_t id)
void(* MEMExpHeapBlockVisitor)(void *block, MEMHeapHandle heap, void *context)
Definition: memexpheap.h:19
void * MEMDestroyExpHeap(MEMHeapHandle heap)
MEMExpHeapDirection
Definition: memexpheap.h:29
MEMExpHeapMode
Definition: memexpheap.h:23
@ MEM_EXP_HEAP_CHECK_FLAGS_LOG_ERRORS
Definition: memexpheap.h:37
@ MEM_EXP_HEAP_CHECK_FLAGS_NONE
Definition: memexpheap.h:36
@ MEM_EXP_HEAP_DIR_FROM_TOP
Definition: memexpheap.h:30
@ MEM_EXP_HEAP_DIR_FROM_BOTTOM
Definition: memexpheap.h:31
@ MEM_EXP_HEAP_MODE_NEAREST_SIZE
Definition: memexpheap.h:25
@ MEM_EXP_HEAP_MODE_FIRST_FREE
Definition: memexpheap.h:24
int32_t BOOL
Definition: wut_types.h:7