wut  1.0.0-beta9
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 
MEMExpHeapBlockList::head
MEMExpHeapBlock * head
Definition: memexpheap.h:52
MEMGetGroupIDForMBlockExpHeap
uint16_t MEMGetGroupIDForMBlockExpHeap(void *block)
MEMFreeToExpHeap
void MEMFreeToExpHeap(MEMHeapHandle heap, void *block)
MEMExpHeap::groupId
uint16_t groupId
Definition: memexpheap.h:64
MEMGetAllocModeForExpHeap
MEMExpHeapMode MEMGetAllocModeForExpHeap(MEMHeapHandle heap)
MEMGetAllocDirForMBlockExpHeap
MEMExpHeapDirection MEMGetAllocDirForMBlockExpHeap(void *block)
memheap.h
MEM_EXP_HEAP_DIR_FROM_BOTTOM
@ MEM_EXP_HEAP_DIR_FROM_BOTTOM
Definition: memexpheap.h:31
MEMExpHeapDirection
MEMExpHeapDirection
Definition: memexpheap.h:28
MEMSetGroupIDForExpHeap
uint16_t MEMSetGroupIDForExpHeap(MEMHeapHandle heap, uint16_t id)
MEMExpHeapBlockList
Definition: memexpheap.h:50
MEMAdjustExpHeap
uint32_t MEMAdjustExpHeap(MEMHeapHandle heap)
MEMGetGroupIDForExpHeap
uint16_t MEMGetGroupIDForExpHeap(MEMHeapHandle heap)
MEMVisitAllocatedForExpHeap
void MEMVisitAllocatedForExpHeap(MEMHeapHandle heap, MEMExpHeapBlockVisitor callback, void *context)
MEMAllocFromExpHeapEx
void * MEMAllocFromExpHeapEx(MEMHeapHandle heap, uint32_t size, int alignment)
MEM_EXP_HEAP_MODE_NEAREST_SIZE
@ MEM_EXP_HEAP_MODE_NEAREST_SIZE
Definition: memexpheap.h:25
wut.h
MEMCreateExpHeapEx
MEMHeapHandle MEMCreateExpHeapEx(void *heap, uint32_t size, uint16_t flags)
MEMExpHeap
Definition: memexpheap.h:59
MEMExpHeap::freeList
MEMExpHeapBlockList freeList
Definition: memexpheap.h:62
MEMSetAllocModeForExpHeap
MEMExpHeapMode MEMSetAllocModeForExpHeap(MEMHeapHandle heap, MEMExpHeapMode mode)
MEM_EXP_HEAP_DIR_FROM_TOP
@ MEM_EXP_HEAP_DIR_FROM_TOP
Definition: memexpheap.h:30
MEMGetAllocatableSizeForExpHeapEx
uint32_t MEMGetAllocatableSizeForExpHeapEx(MEMHeapHandle heap, int alignment)
MEMExpHeapBlock::prev
MEMExpHeapBlock * prev
Definition: memexpheap.h:38
MEMExpHeap::header
MEMHeapHeader header
Definition: memexpheap.h:61
MEMGetSizeForMBlockExpHeap
uint32_t MEMGetSizeForMBlockExpHeap(void *block)
MEMExpHeapMode
MEMExpHeapMode
Definition: memexpheap.h:22
MEMExpHeapBlock::blockSize
uint32_t blockSize
Definition: memexpheap.h:37
MEMExpHeapBlock::tag
uint16_t tag
Definition: memexpheap.h:40
MEM_EXP_HEAP_MODE_FIRST_FREE
@ MEM_EXP_HEAP_MODE_FIRST_FREE
Definition: memexpheap.h:24
MEMExpHeap::attribs
uint16_t attribs
Definition: memexpheap.h:65
MEMGetTotalFreeSizeForExpHeap
uint32_t MEMGetTotalFreeSizeForExpHeap(MEMHeapHandle heap)
MEMExpHeapBlock::next
MEMExpHeapBlock * next
Definition: memexpheap.h:39
MEMExpHeapBlock
Definition: memexpheap.h:34
MEMHeapHeader
Definition: memheap.h:51
MEMDestroyExpHeap
void * MEMDestroyExpHeap(MEMHeapHandle heap)
MEMExpHeap::usedList
MEMExpHeapBlockList usedList
Definition: memexpheap.h:63
MEMResizeForMBlockExpHeap
uint32_t MEMResizeForMBlockExpHeap(MEMHeapHandle heap, void *block, uint32_t size)
MEMExpHeapBlockList::tail
MEMExpHeapBlock * tail
Definition: memexpheap.h:53
MEMExpHeapBlockVisitor
void(* MEMExpHeapBlockVisitor)(void *block, MEMHeapHandle heap, void *context)
Definition: memexpheap.h:19
MEMExpHeapBlock::attribs
uint32_t attribs
Definition: memexpheap.h:36