summaryrefslogtreecommitdiff
path: root/include/user/compat.h
blob: 3548e6b4cc41eea082aca6f29f26f101f7b9b9cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
#ifndef _PSP2_COMPAT_H_
#define _PSP2_COMPAT_H_

#include <kernel/iofilemgr.h>
#include <rtc.h>
#include <scetypes.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef enum SceCompatCacheMode {
	SCE_COMPAT_CACHE_NONE           = 0,
	SCE_COMPAT_CACHE_INVALIDATE     = 1,
	SCE_COMPAT_CACHE_WRITEBACK      = 2
} SceCompatCacheMode;

typedef enum SceCompatPeripheralMode {
	SCE_COMPAT_PERIPHERAL_POWER_IS_SUSPEND_REQUIRED   = 1,
	SCE_COMPAT_PERIPHERAL_POWER_GET_BATTERY_LIFETIME  = 2,
	SCE_COMPAT_PERIPHERAL_POWER_GET_BATTERY_PERCENT   = 3,
	SCE_COMPAT_PERIPHERAL_HPREMOTE_IS_HEADPHONE_EXIST = 4
} SceCompatPeripheralMode;

typedef struct SceCompatCdram {
	void *cached_cdram;
	void *uncached_cdram;
} SceCompatCdram;

typedef struct SceCtrlDataPsp {
	unsigned int TimeStamp;
	unsigned int Buttons;
	unsigned char Lx;
	unsigned char Ly;
	unsigned char Rx;
	unsigned char Ry;
	unsigned char Rsrv[4];
} SceCtrlDataPsp;

/**
 * Init compat
 *
 * @param[in] unk - Unknown, pass 0
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatInitEx(int unk);

/**
 * Uninit compat
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatUninit(void);

/**
 * Start compat
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatStart(void);

/**
 * Stop compat
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatStop(void);

/**
 * Allocate cdram with hole
 *
 * @param[out] cdram - A pointer to a ::SceCompatCdram structure.
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatAllocCdramWithHole(SceCompatCdram *cdram);

/**
 * Framebuffer init
 *
 * @param[in] framebuffer - Pointer to framebuffer
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatFrameBufferInit(void *framebuffer);

/**
 * Set suspend semaphores
 *
 * @param[in] semaid1 - Semaphore id 1
 * @param[in] semaid2 - Semaphore id 2
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatSetSuspendSema(SceUID semaid1, SceUID semaid2);

/**
 * Suspend/resume compat
 *
 * @param[in] unk - Unknown, pass 1
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatSuspendResume(int unk);

/**
 * Cache operation
 *
 * @param[in] mode - One of ::SceCompatCacheMode
 * @param[in] addr - Address
 * @param[in] size - Size
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatCache(int mode, void *addr, SceSize size);

/**
 * Wait for special request
 *
 * @param[in] unk - Unknown, pass 1
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatWaitSpecialRequest(int unk);

/**
 * Interrupt code
 *
 * @param[in] intr_code - Interrupt code
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatInterrupt(int intr_code);

/**
 * LCDC sync
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatLCDCSync(void);

/**
 * Get primary head
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatGetPrimaryHead(void);

/**
 * Get peripheral state
 *
 * @param[in] mode - One of ::SceCompatPeripheralMode
 *
 * @return state on success, < 0 on error.
*/
int sceCompatGetPeripheralState(int mode);

/**
 * Get compat status
 *
 * @return status on success, < 0 on error.
*/
int sceCompatGetStatus(void);

/**
 * Get update state
 *
 * @return state on success, < 0 on error.
*/
int sceCompatGetUpdateState(void);

/**
 * Set update state
 *
 * @param[in] state - State
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatSetUpdateState(int state);

/**
 * Set display config
 *
 * @param[in] unk0 - Unknown
 * @param[in] unk1 - Unknown
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatSetDisplayConfig(int unk0, int unk1);

/**
 * Set RIF name
 *
 * @param[in] rif - RIF name (max. 36 chars)
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatSetRif(const char *rif);

/**
 * Get PSP system software version
 *
 * @return version on success, < 0 on error.
*/
int sceCompatGetPspSystemSoftwareVersion(void);

/**
 * Get color space setting availability
 *
 * @return 1 if true, 0 if false, < 0 on error.
*/
int sceCompatAvailableColorSpaceSetting(void);

/**
 * Check if pocket station application is available
 *
 * @return 1 if true, 0 if false, < 0 on error.
*/
int sceCompatCheckPocketStation(void);

/**
 * Check if current title is a pocket station game
 *
 * @return 1 if true, 0 if false, < 0 on error.
*/
int sceCompatIsPocketStationTitle(void);

/**
 * Wait for command and get request
 *
 * @param[in] mode - Mode
 * @param[in] id - ID
 *
 * @return pointer to request in PspEmu RAM on success, < 0 on error.
*/
int sceCompatWaitAndGetRequest(int mode, int id);

/**
 * Read from shared sram
 *
 * @param[in] location - Location
 * @param[out] value - Pointer to a int buffer to hold the value
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatReadShared32(int location, int *value);

/**
 * Write to shared sram
 *
 * @param[in] location - Location
 * @param[in] value - Value
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatWriteShared32(int location, int value);

/**
 * Write shared control
 *
 * @param[in] info - A pointer to a ::SceCtrlDataPsp structure.
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatWriteSharedCtrl(SceCtrlDataPsp *pad_data);

/**
 * Get title list
 *
 * @param[out] buf - A 100 bytes buffer for the title list
 * @param[in] length - Must be 100
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatGetTitleList(void *buf, SceSize length);

/**
 * Get Memory Card device information
 *
 * @param[out] info - A pointer to a ::SceIoDevInfo structure.
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatGetDevInf(SceIoDevInfo *info);

/**
 * Get current secure tick
 *
 * @param[out] tick - A pointer to a ::SceRtcTick structure.
 *
 * @return 0 on success, < 0 on error.
*/
int sceCompatGetCurrentSecureTick(SceRtcTick *tick);

#ifdef __cplusplus
}
#endif

#endif /* _PSP2_COMPAT_H_ */