NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
ipcclt.h
1#ifndef RVL_SDK_IPC_CLT_H
2#define RVL_SDK_IPC_CLT_H
3#include <revolution/OS.h>
4#include <types.h>
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9typedef enum {
10 IPC_RESULT_FATAL_ERROR = -119,
11 IPC_RESULT_BUSY,
12 IPC_RESULT_NOTEMPTY = -115,
13 IPC_RESULT_ECC_CRIT,
14 IPC_RESULT_OPENFD = -111,
15 IPC_RESULT_MAXFD = -109,
16 IPC_RESULT_MAXBLOCKS,
17 IPC_RESULT_MAXFILES,
18 IPC_RESULT_NOEXISTS,
19 IPC_RESULT_EXISTS,
20 IPC_RESULT_CORRUPT = -103,
21 IPC_RESULT_ACCESS,
22 IPC_RESULT_INVALID,
23
24 IPC_RESULT_ALLOC_FAILED = -22,
25 IPC_RESULT_ECC_CRIT_INTERNAL = -12,
26 IPC_RESULT_BUSY_INTERNAL = -8,
27 IPC_RESULT_NOEXISTS_INTERNAL = -6,
28 IPC_RESULT_CONN_MAX_INTERNAL = -5,
29 IPC_RESULT_INVALID_INTERNAL = -4,
30 IPC_RESULT_EXISTS_INTERNAL = -2,
31 IPC_RESULT_ACCESS_INTERNAL = -1,
32
33 IPC_RESULT_OK = 0
34} IPCResult;
35
36typedef enum {
37 IPC_REQ_NONE,
38 IPC_REQ_OPEN,
39 IPC_REQ_CLOSE,
40 IPC_REQ_READ,
41 IPC_REQ_WRITE,
42 IPC_REQ_SEEK,
43 IPC_REQ_IOCTL,
44 IPC_REQ_IOCTLV
45} IPCRequestType;
46
47typedef enum {
48 IPC_OPEN_NONE = 0,
49 IPC_OPEN_READ = (1 << 0),
50 IPC_OPEN_WRITE = (1 << 1),
51 IPC_OPEN_RW = IPC_OPEN_READ | IPC_OPEN_WRITE
52} IPCOpenMode;
53
54typedef enum {
55 IPC_SEEK_BEG,
56 IPC_SEEK_CUR,
57 IPC_SEEK_END,
58} IPCSeekMode;
59
60typedef s32 (*IPCAsyncCallback)(s32 result, void* arg);
61
62typedef struct IPCIOVector {
63 void* base; // at 0x0
64 u32 length; // at 0x4
66
67typedef struct IPCOpenArgs {
68 const char* path; // at 0x0
69 IPCOpenMode mode; // at 0x4
71
72typedef struct IPCReadWriteArgs {
73 void* data; // at 0x0
74 u32 length; // at 0x4
76
77typedef struct IPCSeekArgs {
78 s32 offset; // at 0x0
79 IPCSeekMode mode; // at 0x4
81
82typedef struct IPCIoctlArgs {
83 s32 type; // at 0x0
84 void* in; // at 0x4
85 s32 inSize; // at 0x8
86 void* out; // at 0xC
87 s32 outSize; // at 0x10
89
90typedef struct IPCIoctlvArgs {
91 s32 type; // at 0x0
92 u32 inCount; // at 0x4
93 u32 outCount; // at 0x8
94 IPCIOVector* vectors; // at 0xC
96
97typedef struct IPCRequest {
98 IPCRequestType type; // at 0x0
99 s32 ret; // at 0x4
100 s32 fd; // at 0x8
101 union {
102 IPCOpenArgs open;
104 IPCSeekArgs seek;
105 IPCIoctlArgs ioctl;
106 IPCIoctlvArgs ioctlv;
107 }; // at 0xC
108} IPCRequest;
109
110typedef struct IPCRequestEx {
111 IPCRequest base; // at 0x0
112 IPCAsyncCallback callback; // at 0x20
113 void* callbackArg; // at 0x24
114 BOOL reboot; // at 0x28
115 OSThreadQueue queue; // at 0x2C
116 char padding[64 - 0x34];
118
119s32 IPCCltInit(void);
120s32 IOS_OpenAsync(const char* path, IPCOpenMode mode, IPCAsyncCallback callback,
121 void* callbackArg);
122s32 IOS_Open(const char* path, IPCOpenMode mode);
123s32 IOS_CloseAsync(s32 fd, IPCAsyncCallback callback, void* callbackArg);
124s32 IOS_Close(s32 fd);
125s32 IOS_ReadAsync(s32 fd, void* buf, s32 len, IPCAsyncCallback callback,
126 void* callbackArg);
127s32 IOS_Read(s32 fd, void* buf, s32 len);
128s32 IOS_WriteAsync(s32 fd, const void* buf, s32 len, IPCAsyncCallback callback,
129 void* callbackArg);
130s32 IOS_Write(s32 fd, const void* buf, s32 len);
131s32 IOS_SeekAsync(s32 fd, s32 offset, IPCSeekMode mode,
132 IPCAsyncCallback callback, void* callbackArg);
133s32 IOS_Seek(s32 fd, s32 offset, IPCSeekMode mode);
134s32 IOS_IoctlAsync(s32 fd, s32 type, void* in, s32 inSize, void* out,
135 s32 outSize, IPCAsyncCallback callback, void* callbackArg);
136s32 IOS_Ioctl(s32 fd, s32 type, void* in, s32 inSize, void* out, s32 outSize);
137s32 IOS_IoctlvAsync(s32 fd, s32 type, s32 inCount, s32 outCount,
138 IPCIOVector* vectors, IPCAsyncCallback callback,
139 void* callbackArg);
140s32 IOS_Ioctlv(s32 fd, s32 type, s32 inCount, s32 outCount,
141 IPCIOVector* vectors);
142s32 IOS_IoctlvReboot(s32 fd, s32 type, s32 inCount, s32 outCount,
143 IPCIOVector* vectors);
144
145#ifdef __cplusplus
146}
147#endif
148#endif