wut  v1.7.0
Wii U Toolchain
ipcbufpool.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <wut.h>
4 #include "mutex.h"
5 #include "ios.h"
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
12 typedef struct IPCBufPoolFIFO IPCBufPoolFIFO;
13 typedef struct IPCBufPool IPCBufPool;
14 
22  int32_t pushIndex;
23 
25  int32_t popIndex;
26 
28  int32_t count;
29 
31  int32_t maxCount;
32 
34  void **messages;
35 };
36 WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x00, pushIndex);
37 WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x04, popIndex);
38 WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x08, count);
39 WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x0C, maxCount);
40 WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x10, messages);
41 WUT_CHECK_SIZE(IPCBufPoolFIFO, 0x14);
42 
48  uint32_t messageSize;
49 
51  uint32_t poolSize;
52 
54  uint32_t numMessages;
55 };
56 WUT_CHECK_OFFSET(IPCBufPoolAttributes, 0x00, messageSize);
57 WUT_CHECK_OFFSET(IPCBufPoolAttributes, 0x04, poolSize);
58 WUT_CHECK_OFFSET(IPCBufPoolAttributes, 0x08, numMessages);
59 WUT_CHECK_SIZE(IPCBufPoolAttributes, 0x0C);
60 
61 #define IPC_BUF_POOL_MAGIC 0x0BADF00Du
62 
66 struct IPCBufPool {
68  uint32_t magic;
69 
71  void *buffer;
72 
74  uint32_t size;
75 
76  uint32_t unk0x0C;
77  uint32_t unk0x10;
78 
80  uint32_t messageSize0x14;
81 
83  uint32_t messageSize0x18;
84 
86  uint32_t messageCount;
87 
89  void *messages;
90 
92  uint32_t *messageIndexSize;
93 
96 
99 
100  WUT_UNKNOWN_BYTES(0x04);
101 };
102 WUT_CHECK_OFFSET(IPCBufPool, 0x00, magic);
103 WUT_CHECK_OFFSET(IPCBufPool, 0x04, buffer);
104 WUT_CHECK_OFFSET(IPCBufPool, 0x08, size);
105 WUT_CHECK_OFFSET(IPCBufPool, 0x0C, unk0x0C);
106 WUT_CHECK_OFFSET(IPCBufPool, 0x10, unk0x10);
107 WUT_CHECK_OFFSET(IPCBufPool, 0x14, messageSize0x14);
108 WUT_CHECK_OFFSET(IPCBufPool, 0x18, messageSize0x18);
109 WUT_CHECK_OFFSET(IPCBufPool, 0x1C, messageCount);
110 WUT_CHECK_OFFSET(IPCBufPool, 0x20, messages);
111 WUT_CHECK_OFFSET(IPCBufPool, 0x24, messageIndexSize);
112 WUT_CHECK_OFFSET(IPCBufPool, 0x28, fifo);
113 WUT_CHECK_OFFSET(IPCBufPool, 0x3C, mutex);
114 WUT_CHECK_SIZE(IPCBufPool, 0x6C);
115 
116 IPCBufPool *
117 IPCBufPoolCreate(void *buffer,
118  uint32_t size,
119  uint32_t messageSize,
120  uint32_t *outNumMessages,
121  uint32_t unk0x0c);
122 
123 void *
125  uint32_t size);
126 
127 IOSError
129  void *message);
130 
131 IOSError
133  IPCBufPoolAttributes *attribs);
134 
135 
136 #ifdef __cplusplus
137 }
138 #endif
IOSError
Definition: ios.h:25
Definition: mutex.h:36
void * IPCBufPoolAllocate(IPCBufPool *pool, uint32_t size)
uint32_t * messageIndexSize
Number of bytes used for the message pointers in IPCBufPoolFIFO.
Definition: ipcbufpool.h:92
uint32_t numMessages
Number of pending messages in the pool fifo.
Definition: ipcbufpool.h:54
void ** messages
Messages in the queue.
Definition: ipcbufpool.h:34
uint32_t poolSize
Size of the buffer pool.
Definition: ipcbufpool.h:51
void * messages
Pointer to start of messages.
Definition: ipcbufpool.h:89
void * buffer
Pointer to buffer used for this IPCBufPool.
Definition: ipcbufpool.h:71
int32_t count
The number of messages in the queue.
Definition: ipcbufpool.h:28
IOSError IPCBufPoolFree(IPCBufPool *pool, void *message)
uint32_t magic
Magic header always set to IPCBufPool::MagicHeader.
Definition: ipcbufpool.h:68
uint32_t unk0x0C
Definition: ipcbufpool.h:76
int32_t popIndex
The current message index to pop from.
Definition: ipcbufpool.h:25
IPCBufPool * IPCBufPoolCreate(void *buffer, uint32_t size, uint32_t messageSize, uint32_t *outNumMessages, uint32_t unk0x0c)
uint32_t unk0x10
Definition: ipcbufpool.h:77
uint32_t messageSize0x14
Message size from IPCBufPoolCreate.
Definition: ipcbufpool.h:80
uint32_t size
Size of buffer.
Definition: ipcbufpool.h:74
int32_t maxCount
Tracks the total number of messages in the count.
Definition: ipcbufpool.h:31
uint32_t messageSize0x18
Message size from IPCBufPoolCreate.
Definition: ipcbufpool.h:83
OSMutex mutex
Mutex used to secure access to fifo.
Definition: ipcbufpool.h:98
IPCBufPoolFIFO fifo
FIFO queue of messages.
Definition: ipcbufpool.h:95
int32_t pushIndex
The current message index to push to.
Definition: ipcbufpool.h:22
uint32_t messageCount
Number of messages in the IPCBufPoolFIFO.
Definition: ipcbufpool.h:86
IOSError IPCBufPoolGetAttributes(IPCBufPool *pool, IPCBufPoolAttributes *attribs)
uint32_t messageSize
Size of a message in the buffer pool.
Definition: ipcbufpool.h:48
A simple message buffer pool used for IPC communication.
Definition: ipcbufpool.h:66
Attributes returned by IPCBufPoolGetAttributes.
Definition: ipcbufpool.h:46
FIFO queue for IPCBufPool.
Definition: ipcbufpool.h:20