wut  1.0.0-beta8
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;
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 {
36  uint32_t attribs;
37  uint32_t blockSize;
40  uint16_t tag;
41  WUT_UNKNOWN_BYTES(0x02);
42 };
43 WUT_CHECK_OFFSET(MEMExpHeapBlock, 0x00, attribs);
44 WUT_CHECK_OFFSET(MEMExpHeapBlock, 0x04, blockSize);
45 WUT_CHECK_OFFSET(MEMExpHeapBlock, 0x08, prev);
46 WUT_CHECK_OFFSET(MEMExpHeapBlock, 0x0c, next);
47 WUT_CHECK_OFFSET(MEMExpHeapBlock, 0x10, tag);
48 WUT_CHECK_SIZE(MEMExpHeapBlock, 0x14);
49 
51 {
54 };
55 WUT_CHECK_OFFSET(MEMExpHeapBlockList, 0x00, head);
56 WUT_CHECK_OFFSET(MEMExpHeapBlockList, 0x04, tail);
57 WUT_CHECK_SIZE(MEMExpHeapBlockList, 0x08);
58 
59 struct WUT_PACKED MEMExpHeap
60 {
64  uint16_t groupId;
65  uint16_t attribs;
66 };
67 WUT_CHECK_OFFSET(MEMExpHeap, 0x00, header);
68 WUT_CHECK_OFFSET(MEMExpHeap, 0x40, freeList);
69 WUT_CHECK_OFFSET(MEMExpHeap, 0x48, usedList);
70 WUT_CHECK_OFFSET(MEMExpHeap, 0x50, groupId);
71 WUT_CHECK_OFFSET(MEMExpHeap, 0x52, attribs);
72 WUT_CHECK_SIZE(MEMExpHeap, 0x54);
73 
75 MEMCreateExpHeapEx(void *heap,
76  uint32_t size,
77  uint16_t flags);
78 
79 void *
81 
82 void *
84  uint32_t size,
85  int alignment);
86 
87 void
89  void *block);
90 
93  MEMExpHeapMode mode);
94 
97 
98 uint32_t
100 
101 uint32_t
103  void *block,
104  uint32_t size);
105 
106 uint32_t
108 
109 uint32_t
111  int alignment);
112 
113 uint16_t
115  uint16_t id);
116 
117 uint16_t
119 
120 uint32_t
121 MEMGetSizeForMBlockExpHeap(void *block);
122 
123 uint16_t
124 MEMGetGroupIDForMBlockExpHeap(void *block);
125 
127 MEMGetAllocDirForMBlockExpHeap(void *block);
128 
129 void
131  MEMExpHeapBlockVisitor callback,
132  void *context);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
void MEMFreeToExpHeap(MEMHeapHandle heap, void *block)
uint32_t MEMResizeForMBlockExpHeap(MEMHeapHandle heap, void *block, uint32_t size)
void(* MEMExpHeapBlockVisitor)(void *block, MEMHeapHandle heap, void *context)
Definition: memexpheap.h:19
MEMExpHeapDirection MEMGetAllocDirForMBlockExpHeap(void *block)
uint32_t blockSize
Definition: memexpheap.h:37
MEMExpHeapMode MEMGetAllocModeForExpHeap(MEMHeapHandle heap)
MEMExpHeapDirection
Definition: memexpheap.h:28
uint32_t MEMAdjustExpHeap(MEMHeapHandle heap)
uint16_t tag
Definition: memexpheap.h:40
uint16_t MEMSetGroupIDForExpHeap(MEMHeapHandle heap, uint16_t id)
MEMExpHeapBlock * next
Definition: memexpheap.h:39
void * MEMAllocFromExpHeapEx(MEMHeapHandle heap, uint32_t size, int alignment)
uint16_t MEMGetGroupIDForExpHeap(MEMHeapHandle heap)
MEMHeapHandle MEMCreateExpHeapEx(void *heap, uint32_t size, uint16_t flags)
uint16_t attribs
Definition: memexpheap.h:65
void MEMVisitAllocatedForExpHeap(MEMHeapHandle heap, MEMExpHeapBlockVisitor callback, void *context)
uint32_t attribs
Definition: memexpheap.h:36
MEMExpHeapMode MEMSetAllocModeForExpHeap(MEMHeapHandle heap, MEMExpHeapMode mode)
MEMExpHeapBlock * head
Definition: memexpheap.h:52
MEMExpHeapBlockList usedList
Definition: memexpheap.h:63
uint32_t MEMGetAllocatableSizeForExpHeapEx(MEMHeapHandle heap, int alignment)
MEMExpHeapBlock * tail
Definition: memexpheap.h:53
MEMExpHeapMode
Definition: memexpheap.h:22
uint32_t MEMGetSizeForMBlockExpHeap(void *block)
uint16_t groupId
Definition: memexpheap.h:64
void * MEMDestroyExpHeap(MEMHeapHandle heap)
uint32_t MEMGetTotalFreeSizeForExpHeap(MEMHeapHandle heap)
MEMExpHeapBlock * prev
Definition: memexpheap.h:38
MEMHeapHeader header
Definition: memexpheap.h:61
MEMExpHeapBlockList freeList
Definition: memexpheap.h:62
uint16_t MEMGetGroupIDForMBlockExpHeap(void *block)