wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
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
8extern "C" {
9#endif
10
13typedef 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};
36WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x00, pushIndex);
37WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x04, popIndex);
38WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x08, count);
39WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x0C, maxCount);
40WUT_CHECK_OFFSET(IPCBufPoolFIFO, 0x10, messages);
41WUT_CHECK_SIZE(IPCBufPoolFIFO, 0x14);
42
48 uint32_t messageSize;
49
51 uint32_t poolSize;
52
54 uint32_t numMessages;
55};
56WUT_CHECK_OFFSET(IPCBufPoolAttributes, 0x00, messageSize);
57WUT_CHECK_OFFSET(IPCBufPoolAttributes, 0x04, poolSize);
58WUT_CHECK_OFFSET(IPCBufPoolAttributes, 0x08, numMessages);
59WUT_CHECK_SIZE(IPCBufPoolAttributes, 0x0C);
60
61#define IPC_BUF_POOL_MAGIC 0x0BADF00Du
62
66struct IPCBufPool {
68 uint32_t magic;
69
71 void *buffer;
72
74 uint32_t size;
75
76 uint32_t unk0x0C;
77 uint32_t unk0x10;
78
81
84
86 uint32_t messageCount;
87
89 void *messages;
90
93
96
99
100 WUT_UNKNOWN_BYTES(0x04);
101};
102WUT_CHECK_OFFSET(IPCBufPool, 0x00, magic);
103WUT_CHECK_OFFSET(IPCBufPool, 0x04, buffer);
104WUT_CHECK_OFFSET(IPCBufPool, 0x08, size);
105WUT_CHECK_OFFSET(IPCBufPool, 0x0C, unk0x0C);
106WUT_CHECK_OFFSET(IPCBufPool, 0x10, unk0x10);
107WUT_CHECK_OFFSET(IPCBufPool, 0x14, messageSize0x14);
108WUT_CHECK_OFFSET(IPCBufPool, 0x18, messageSize0x18);
109WUT_CHECK_OFFSET(IPCBufPool, 0x1C, messageCount);
110WUT_CHECK_OFFSET(IPCBufPool, 0x20, messages);
111WUT_CHECK_OFFSET(IPCBufPool, 0x24, messageIndexSize);
112WUT_CHECK_OFFSET(IPCBufPool, 0x28, fifo);
113WUT_CHECK_OFFSET(IPCBufPool, 0x3C, mutex);
114WUT_CHECK_SIZE(IPCBufPool, 0x6C);
115
117IPCBufPoolCreate(void *buffer,
118 uint32_t size,
119 uint32_t messageSize,
120 uint32_t *outNumMessages,
121 uint32_t unk0x0c);
122
123void *
125 uint32_t size);
126
129 void *message);
130
133 IPCBufPoolAttributes *attribs);
134
135
136#ifdef __cplusplus
137}
138#endif
IOSError
Definition ios.h:25
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 * IPCBufPoolAllocate(IPCBufPool *pool, uint32_t size)
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
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
IPCBufPool * IPCBufPoolCreate(void *buffer, uint32_t size, uint32_t messageSize, uint32_t *outNumMessages, uint32_t unk0x0c)
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