1use core::ffi::c_void;
2
3#[repr(C)]
5pub struct GeContext {
6 pub context: [u32; 512],
7}
8
9#[repr(C)]
10pub struct GeStack {
12 pub stack: [u32; 8],
13}
14
15#[repr(C)]
16pub struct GeCallbackData {
18 pub signal_func: Option<extern "C" fn(id: i32, arg: *mut c_void)>,
19 pub signal_arg: *mut c_void,
20 pub finish_func: Option<extern "C" fn(id: i32, arg: *mut c_void)>,
21 pub finish_arg: *mut c_void,
22}
23
24#[repr(C)]
25pub struct GeListArgs {
26 pub size: u32,
27 pub context: *mut GeContext,
28 pub num_stacks: u32,
29 pub stacks: *mut GeStack,
30}
31
32impl Default for GeListArgs {
33 #[inline(always)]
34 fn default() -> Self {
35 Self {
36 size: 0,
37 context: core::ptr::null_mut(),
38 num_stacks: 0,
39 stacks: core::ptr::null_mut(),
40 }
41 }
42}
43
44#[repr(C)]
45pub struct GeBreakParam {
47 pub buf: [u32; 4],
48}
49
50#[repr(i32)]
52pub enum GeMatrixType {
53 Bone0 = 0,
55 Bone1,
56 Bone2,
57 Bone3,
58 Bone4,
59 Bone5,
60 Bone6,
61 Bone7,
62 World,
64 View,
66 Projection,
68 TexGen,
69}
70
71#[repr(i32)]
73pub enum GeListState {
74 Done = 0,
75 Queued,
76 DrawingDone,
77 StallReached,
78 CancelDone,
79}
80
81#[repr(u8)]
82#[derive(Copy, Clone, Debug)]
83pub enum GeCommand {
84 Nop = 0,
85 Vaddr = 0x1,
86 Iaddr = 0x2,
87 Prim = 0x4,
88 Bezier = 0x5,
89 Spline = 0x6,
90 BoundingBox = 0x7,
91 Jump = 0x8,
92 BJump = 0x9,
93 Call = 0xa,
94 Ret = 0xb,
95 End = 0xc,
96 Signal = 0xe,
97 Finish = 0xf,
98 Base = 0x10,
99 VertexType = 0x12,
100 OffsetAddr = 0x13,
101 Origin = 0x14,
102 Region1 = 0x15,
103 Region2 = 0x16,
104 LightingEnable = 0x17,
105 LightEnable0 = 0x18,
106 LightEnable1 = 0x19,
107 LightEnable2 = 0x1a,
108 LightEnable3 = 0x1b,
109 DepthClampEnable = 0x1c,
110 CullFaceEnable = 0x1d,
111 TextureMapEnable = 0x1e,
112 FogEnable = 0x1f,
113 DitherEnable = 0x20,
114 AlphaBlendEnable = 0x21,
115 AlphaTestEnable = 0x22,
116 ZTestEnable = 0x23,
117 StencilTestEnable = 0x24,
118 AntiAliasEnable = 0x25,
119 PatchCullEnable = 0x26,
120 ColorTestEnable = 0x27,
121 LogicOpEnable = 0x28,
122 BoneMatrixNumber = 0x2a,
123 BoneMatrixData = 0x2b,
124 MorphWeight0 = 0x2c,
125 MorphWeight1 = 0x2d,
126 MorphWeight2 = 0x2e,
127 MorphWeight3 = 0x2f,
128 MorphWeight4 = 0x30,
129 MorphWeight5 = 0x31,
130 MorphWeight6 = 0x32,
131 MorphWeight7 = 0x33,
132 PatchDivision = 0x36,
133 PatchPrimitive = 0x37,
134 PatchFacing = 0x38,
135 WorldMatrixNumber = 0x3a,
136 WorldMatrixData = 0x3b,
137 ViewMatrixNumber = 0x3c,
138 ViewMatrixData = 0x3d,
139 ProjMatrixNumber = 0x3e,
140 ProjMatrixData = 0x3f,
141 TGenMatrixNumber = 0x40,
142 TGenMatrixData = 0x41,
143 ViewportXScale = 0x42,
144 ViewportYScale = 0x43,
145 ViewportZScale = 0x44,
146 ViewportXCenter = 0x45,
147 ViewportYCenter = 0x46,
148 ViewportZCenter = 0x47,
149 TexScaleU = 0x48,
150 TexScaleV = 0x49,
151 TexOffsetU = 0x4a,
152 TexOffsetV = 0x4b,
153 OffsetX = 0x4c,
154 OffsetY = 0x4d,
155 ShadeMode = 0x50,
157 ReverseNormal = 0x51,
158 MaterialUpdate = 0x53,
159 MaterialEmissive = 0x54, MaterialAmbient = 0x55, MaterialDiffuse = 0x56,
162 MaterialSpecular = 0x57,
163 MaterialAlpha = 0x58,
164 MaterialSpecularCoef = 0x5b,
165 AmbientColor = 0x5c,
166 AmbientAlpha = 0x5d,
167 LightMode = 0x5e,
168 LightType0 = 0x5f,
169 LightType1 = 0x60,
170 LightType2 = 0x61,
171 LightType3 = 0x62,
172 Light0X = 0x63,
173 Light0Y,
174 Light0Z,
175 Light1X,
176 Light1Y,
177 Light1Z,
178 Light2X,
179 Light2Y,
180 Light2Z,
181 Light3X,
182 Light3Y,
183 Light3Z,
184 Light0DirectionX = 0x6f,
185 Light0DirectionY,
186 Light0DirectionZ,
187 Light1DirectionX,
188 Light1DirectionY,
189 Light1DirectionZ,
190 Light2DirectionX,
191 Light2DirectionY,
192 Light2DirectionZ,
193 Light3DirectionX,
194 Light3DirectionY,
195 Light3DirectionZ,
196 Light0ConstantAtten = 0x7b,
197 Light0LinearAtten,
198 Light0QuadtraticAtten,
199 Light1ConstantAtten,
200 Light1LinearAtten,
201 Light1QuadtraticAtten,
202 Light2ConstantAtten,
203 Light2LinearAtten,
204 Light2QuadtraticAtten,
205 Light3ConstantAtten,
206 Light3LinearAtten,
207 Light3QuadtraticAtten,
208 Light0ExponentAtten = 0x87,
209 Light1ExponentAtten,
210 Light2ExponentAtten,
211 Light3ExponentAtten,
212 Light0CutoffAtten = 0x8b,
213 Light1CutoffAtten,
214 Light2CutoffAtten,
215 Light3CutoffAtten,
216 Light0Ambient = 0x8f,
217 Light0Diffuse,
218 Light0Specular,
219 Light1Ambient,
220 Light1Diffuse,
221 Light1Specular,
222 Light2Ambient,
223 Light2Diffuse,
224 Light2Specular,
225 Light3Ambient,
226 Light3Diffuse,
227 Light3Specular,
228 Cull = 0x9b,
229 FrameBufPtr = 0x9c,
230 FrameBufWidth = 0x9d,
231 ZBufPtr = 0x9e,
232 ZBufWidth = 0x9f,
233 TexAddr0 = 0xa0,
234 TexAddr1,
235 TexAddr2,
236 TexAddr3,
237 TexAddr4,
238 TexAddr5,
239 TexAddr6,
240 TexAddr7,
241 TexBufWidth0 = 0xa8,
242 TexBufWidth1,
243 TexBufWidth2,
244 TexBufWidth3,
245 TexBufWidth4,
246 TexBufWidth5,
247 TexBufWidth6,
248 TexBufWidth7,
249 ClutAddr = 0xb0,
250 ClutAddrUpper = 0xb1,
251 TransferSrc,
252 TransferSrcW,
253 TransferDst,
254 TransferDstW,
255 TexSize0 = 0xb8,
256 TexSize1,
257 TexSize2,
258 TexSize3,
259 TexSize4,
260 TexSize5,
261 TexSize6,
262 TexSize7,
263 TexMapMode = 0xc0,
264 TexShadeLs = 0xc1,
265 TexMode = 0xc2,
266 TexFormat = 0xc3,
267 LoadClut = 0xc4,
268 ClutFormat = 0xc5,
269 TexFilter = 0xc6,
270 TexWrap = 0xc7,
271 TexLevel = 0xc8,
272 TexFunc = 0xc9,
273 TexEnvColor = 0xca,
274 TexFlush = 0xcb,
275 TexSync = 0xcc,
276 Fog1 = 0xcd,
277 Fog2 = 0xce,
278 FogColor = 0xcf,
279 TexLodSlope = 0xd0,
280 FramebufPixFormat = 0xd2,
281 ClearMode = 0xd3,
282 Scissor1 = 0xd4,
283 Scissor2 = 0xd5,
284 MinZ = 0xd6,
285 MaxZ = 0xd7,
286 ColorTest = 0xd8,
287 ColorRef = 0xd9,
288 ColorTestmask = 0xda,
289 AlphaTest = 0xdb,
290 StencilTest = 0xdc,
291 StencilOp = 0xdd,
292 ZTest = 0xde,
293 BlendMode = 0xdf,
294 BlendFixedA = 0xe0,
295 BlendFixedB = 0xe1,
296 Dith0 = 0xe2,
297 Dith1,
298 Dith2,
299 Dith3,
300 LogicOp = 0xe6,
301 ZWriteDisable = 0xe7,
302 MaskRgb = 0xe8,
303 MaskAlpha = 0xe9,
304 TransferStart = 0xea,
305 TransferSrcPos = 0xeb,
306 TransferDstPos = 0xec,
307 TransferSize = 0xee,
308
309 Vscx = 0xf0,
311 Vscy = 0xf1,
312 Vscz = 0xf2,
313 Vtcs = 0xf3,
314 Vtct = 0xf4,
315 Vtcq = 0xf5,
316 Vcv = 0xf6,
317 Vap = 0xf7,
318 Vfc = 0xf8,
319 Vscv = 0xf9,
320
321 Unknown03 = 0x03,
322 Unknown0D = 0x0d,
323 Unknown11 = 0x11,
324 Unknown29 = 0x29,
325 Unknown34 = 0x34,
326 Unknown35 = 0x35,
327 Unknown39 = 0x39,
328 Unknown4E = 0x4e,
329 Unknown4F = 0x4f,
330 Unknown52 = 0x52,
331 Unknown59 = 0x59,
332 Unknown5A = 0x5a,
333 UnknownB6 = 0xb6,
334 UnknownB7 = 0xb7,
335 UnknownD1 = 0xd1,
336 UnknownED = 0xed,
337 UnknownEF = 0xef,
338 UnknownFA = 0xfa,
339 UnknownFB = 0xfb,
340 UnknownFC = 0xfc,
341 UnknownFD = 0xfd,
342 UnknownFE = 0xfe,
343 NopFF = 0xff,
344}
345
346psp_extern! {
347 #![name = "sceGe_user"]
348 #![flags = 0x4001]
349 #![version = (0, 0)]
350
351 #[psp(0x1F6752AD)]
352 pub fn sceGeEdramGetSize() -> u32;
358
359 #[psp(0xE47E40E4)]
360 pub fn sceGeEdramGetAddr() -> *mut u8;
366
367 #[psp(0xB77905EA)]
368 pub fn sceGeEdramSetAddrTranslation(width: i32) -> i32;
378
379 #[psp(0xDC93CFEF)]
380 pub fn sceGeGetCmd(cmd: i32) -> u32;
390
391 #[psp(0x57C8945B)]
392 pub fn sceGeGetMtx(type_: GeMatrixType, matrix: *mut c_void) -> i32;
403
404 #[psp(0xE66CB92E)]
405 pub fn sceGeGetStack(stack_id: i32, stack: *mut GeStack) -> i32;
416
417 #[psp(0x438A385A)]
418 pub fn sceGeSaveContext(context: *mut GeContext) -> i32;
428
429 #[psp(0x0BF608FB)]
430 pub fn sceGeRestoreContext(context: *const GeContext) -> i32;
440
441 #[psp(0xAB49E76A)]
442 pub fn sceGeListEnQueue(
456 list: *const c_void,
457 stall: *mut c_void,
458 cbid: i32,
459 arg: *mut GeListArgs,
460 ) -> i32;
461
462 #[psp(0x1C0D95A6)]
463 pub fn sceGeListEnQueueHead(list: *const c_void, stall: *mut c_void, cbid: i32, arg: *mut GeListArgs) -> i32;
477
478 #[psp(0x5FB86AB0)]
479 pub fn sceGeListDeQueue(qid: i32) -> i32;
489
490 #[psp(0xE0D68148)]
491 pub fn sceGeListUpdateStallAddr(qid: i32, stall: *mut c_void) -> i32;
502
503 #[psp(0x03444EB4)]
504 pub fn sceGeListSync(qid: i32, sync_type: i32) -> GeListState;
516
517 #[psp(0xB287BD61)]
518 pub fn sceGeDrawSync(sync_type: i32) -> GeListState;
529
530 #[psp(0xB448EC0D)]
531 pub fn sceGeBreak(mode: i32, p_param: *mut GeBreakParam) -> i32;
542
543 #[psp(0x4C06E472)]
544 pub fn sceGeContinue() -> i32;
550
551 #[psp(0xA4FC06A4)]
552 pub fn sceGeSetCallback(cb: *mut GeCallbackData) -> i32;
562
563 #[psp(0x05DB22CE)]
564 pub fn sceGeUnsetCallback(cbid: i32) -> i32;
574}