PSPSDK 2024-10-31
Loading...
Searching...
No Matches
psptypes.h
Go to the documentation of this file.
1/*
2 * PSP Software Development Kit - https://github.com/pspdev
3 * -----------------------------------------------------------------------
4 * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
5 *
6 * psptypes.h - Commonly used typedefs.
7 *
8 * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
9 * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
10 * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
11 *
12 */
14/* Note: Some of the structures, types, and definitions in this file were
15 extrapolated from symbolic debugging information found in the Japanese
16 version of Puzzle Bobble. */
18#ifndef _PSPTYPES_H_
19#define _PSPTYPES_H_ 1
21#include <stdint.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#ifndef NULL
28#ifdef __cplusplus
29#define NULL 0
30#else
31#define NULL ((void *) 0)
32#endif /* __cplusplus */
33#endif
34
35/* Legacy ps2dev types. */
36#ifndef PSP_LEGACY_TYPES_DEFINED
37#define PSP_LEGACY_TYPES_DEFINED
38typedef uint8_t u8;
39typedef uint16_t u16;
40
41typedef uint32_t u32;
42typedef uint64_t u64;
43
44typedef int8_t s8;
45typedef int16_t s16;
46
47typedef int32_t s32;
48typedef int64_t s64;
49#endif
50
51#ifndef PSP_LEGACY_VOLATILE_TYPES_DEFINED
52#define PSP_LEGACY_VOLATILE_TYPES_DEFINED
53typedef volatile uint8_t vu8;
54typedef volatile uint16_t vu16;
55
56typedef volatile uint32_t vu32;
57typedef volatile uint64_t vu64;
58
59typedef volatile int8_t vs8;
60typedef volatile int16_t vs16;
61
62typedef volatile int32_t vs32;
63typedef volatile int64_t vs64;
64#endif
65
66/* MIPS-like accessor macros. */
67static __inline__ u8 _lb(u32 addr) { return *(vu8 *)addr; }
68static __inline__ u16 _lh(u32 addr) { return *(vu16 *)addr; }
69static __inline__ u32 _lw(u32 addr) { return *(vu32 *)addr; }
70static __inline__ u64 _ld(u32 addr) { return *(vu64 *)addr; }
71
72static __inline__ void _sb(u8 val, u32 addr) { *(vu8 *)addr = val; }
73static __inline__ void _sh(u16 val, u32 addr) { *(vu16 *)addr = val; }
74static __inline__ void _sw(u32 val, u32 addr) { *(vu32 *)addr = val; }
75static __inline__ void _sd(u64 val, u32 addr) { *(vu64 *)addr = val; }
76
77/* SCE types. */
78typedef unsigned char SceUChar8;
79typedef uint16_t SceUShort16;
80typedef uint32_t SceUInt32;
81typedef uint64_t SceUInt64;
82typedef uint64_t SceULong64;
83/*typedef unsigned int SceULong128 __attribute__((mode(TI)));*/
84
85typedef char SceChar8;
86typedef int16_t SceShort16;
87typedef int32_t SceInt32;
88typedef int64_t SceInt64;
89typedef int64_t SceLong64;
90/*typedef int SceLong128 __attribute__((mode(TI)));*/
91
92typedef float SceFloat;
93typedef float SceFloat32;
94
95typedef short unsigned int SceWChar16;
96typedef unsigned int SceWChar32;
97
98typedef int SceBool;
99
100typedef void SceVoid;
101typedef void * ScePVoid;
102
103
104/* PSP types. */
105
106/* Rectangles. */
107typedef struct ScePspSRect {
108 short int x;
109 short int y;
110 short int w;
111 short int h;
113
114typedef struct ScePspIRect {
115 int x;
116 int y;
117 int w;
118 int h;
120
127
128typedef struct ScePspFRect {
129 float x;
130 float y;
131 float w;
132 float h;
134
135/* 2D vectors. */
136typedef struct ScePspSVector2 {
137 short int x;
138 short int y;
140
141typedef struct ScePspIVector2 {
142 int x;
143 int y;
145
150
151typedef struct ScePspFVector2 {
152 float x;
153 float y;
155
162
163/* 3D vectors. */
164typedef struct ScePspSVector3 {
165 short int x;
166 short int y;
167 short int z;
169
170typedef struct ScePspIVector3 {
171 int x;
172 int y;
173 int z;
175
181
182typedef struct ScePspFVector3 {
183 float x;
184 float y;
185 float z;
187
194
195/* 4D vectors. */
196typedef struct ScePspSVector4 {
197 short int x;
198 short int y;
199 short int z;
200 short int w;
202
203typedef struct ScePspIVector4 {
204 int x;
205 int y;
206 int z;
207 int w;
209
216
217typedef struct ScePspFVector4 {
218 float x;
219 float y;
220 float z;
221 float w;
222} ScePspFVector4 __attribute__((aligned(16)));
223
225 float x;
226 float y;
227 float z;
228 float w;
230
231typedef union ScePspVector4 {
234/* SceULong128 qw;*/ /* Missing compiler support. */
235 float f[4];
236 int i[4];
237} ScePspVector4 __attribute__((aligned(16)));
238
239/* 2D matrix types. */
244
249
250typedef union ScePspMatrix2 {
256/* SceULong128 qw[2];*/ /* Missing compiler support. */
257 float f[2][2];
258 int i[2][2];
260
261/* 3D matrix types. */
267
273
274typedef union ScePspMatrix3 {
280/* SceULong128 qw[3];*/ /* Missing compiler support. */
281 float f[3][3];
282 int i[3][3];
284
285/* 4D matrix types. */
292
299
306
313
314typedef union ScePspMatrix4 {
320/* SceULong128 qw[4];*/ /* Missing compiler support. */
321 float f[4][4];
322 int i[4][4];
324
325/* Quaternions. */
326typedef struct ScePspFQuaternion {
327 float x;
328 float y;
329 float z;
330 float w;
331} ScePspFQuaternion __attribute__((aligned(16)));
332
339
340/* Colors and pixel formats. */
341typedef struct ScePspFColor {
342 float r;
343 float g;
344 float b;
345 float a;
346} ScePspFColor __attribute__((aligned(16)));
347
348typedef struct ScePspFColorUnaligned {
349 float r;
350 float g;
351 float b;
352 float a;
354
355typedef unsigned int ScePspRGBA8888;
356typedef unsigned short ScePspRGBA4444;
357typedef unsigned short ScePspRGBA5551;
358typedef unsigned short ScePspRGB565;
359
360/* Unions for converting between types. */
361typedef union ScePspUnion32 {
362 unsigned int ui;
363 int i;
364 unsigned short us[2];
365 short int s[2];
366 unsigned char uc[4];
367 char c[4];
368 float f;
374
392
393typedef union ScePspUnion128 {
394/* SceULong128 qw;*/ /* Missing compiler support. */
395/* SceULong128 uq;*/
396/* SceLong128 q;*/
399 unsigned int ui[4];
400 int i[4];
401 unsigned short us[8];
402 short int s[8];
403 unsigned char uc[16];
404 char c[16];
405 float f[4];
416} ScePspUnion128 __attribute__((aligned(16)));
417
418/* Date and time. */
419typedef struct ScePspDateTime {
420 unsigned short year;
421 unsigned short month;
422 unsigned short day;
423 unsigned short hour;
424 unsigned short minute;
425 unsigned short second;
426 unsigned int microsecond;
428
429#ifdef __cplusplus
430}
431#endif
432
433#endif /* _PSPTYPES_H_ */
struct sockaddr_in __attribute__
Writes gmon.out dump file and stops profiling Called from atexit() handler; will dump out a gmon....
Definition prof.c:169
unsigned short ScePspRGB565
Definition psptypes.h:358
unsigned short ScePspRGBA5551
Definition psptypes.h:357
int64_t s64
Definition psptypes.h:48
void SceVoid
Definition psptypes.h:100
uint64_t u64
Definition psptypes.h:42
int SceBool
Definition psptypes.h:98
volatile int16_t vs16
Definition psptypes.h:60
int32_t SceInt32
Definition psptypes.h:87
int16_t SceShort16
Definition psptypes.h:86
volatile uint64_t vu64
Definition psptypes.h:57
uint16_t SceUShort16
Definition psptypes.h:79
void * ScePVoid
Definition psptypes.h:101
volatile int8_t vs8
Definition psptypes.h:59
int64_t SceLong64
Definition psptypes.h:89
volatile int32_t vs32
Definition psptypes.h:62
volatile int64_t vs64
Definition psptypes.h:63
uint8_t u8
Definition psptypes.h:38
unsigned short ScePspRGBA4444
Definition psptypes.h:356
float SceFloat32
Definition psptypes.h:93
int8_t s8
Definition psptypes.h:44
int64_t SceInt64
Definition psptypes.h:88
int16_t s16
Definition psptypes.h:45
uint64_t SceUInt64
Definition psptypes.h:81
uint32_t SceUInt32
Definition psptypes.h:80
short unsigned int SceWChar16
Definition psptypes.h:95
uint16_t u16
Definition psptypes.h:39
char SceChar8
Definition psptypes.h:85
int32_t s32
Definition psptypes.h:47
unsigned char SceUChar8
Definition psptypes.h:78
volatile uint16_t vu16
Definition psptypes.h:54
uint64_t SceULong64
Definition psptypes.h:82
volatile uint32_t vu32
Definition psptypes.h:56
unsigned int ScePspRGBA8888
Definition psptypes.h:355
uint32_t u32
Definition psptypes.h:41
unsigned int SceWChar32
Definition psptypes.h:96
volatile uint8_t vu8
Definition psptypes.h:53
float SceFloat
Definition psptypes.h:92
Definition psptypes.h:419
unsigned short hour
Definition psptypes.h:423
unsigned short day
Definition psptypes.h:422
unsigned short month
Definition psptypes.h:421
unsigned int microsecond
Definition psptypes.h:426
unsigned short minute
Definition psptypes.h:424
unsigned short year
Definition psptypes.h:420
unsigned short second
Definition psptypes.h:425
Definition psptypes.h:348
float b
Definition psptypes.h:351
float g
Definition psptypes.h:350
float r
Definition psptypes.h:349
float a
Definition psptypes.h:352
Definition psptypes.h:341
float g
Definition psptypes.h:343
float r
Definition psptypes.h:342
float a
Definition psptypes.h:345
float b
Definition psptypes.h:344
Definition psptypes.h:245
ScePspFVector2 x
Definition psptypes.h:246
ScePspFVector2 y
Definition psptypes.h:247
Definition psptypes.h:268
ScePspFVector3 z
Definition psptypes.h:271
ScePspFVector3 y
Definition psptypes.h:270
ScePspFVector3 x
Definition psptypes.h:269
Definition psptypes.h:307
ScePspFVector4 x
Definition psptypes.h:308
ScePspFVector4 w
Definition psptypes.h:311
ScePspFVector4 z
Definition psptypes.h:310
ScePspFVector4 y
Definition psptypes.h:309
Definition psptypes.h:300
ScePspFVector4 w
Definition psptypes.h:304
ScePspFVector4 x
Definition psptypes.h:301
ScePspFVector4 y
Definition psptypes.h:302
ScePspFVector4 z
Definition psptypes.h:303
Definition psptypes.h:333
float w
Definition psptypes.h:337
float y
Definition psptypes.h:335
float x
Definition psptypes.h:334
float z
Definition psptypes.h:336
Definition psptypes.h:326
float z
Definition psptypes.h:329
float y
Definition psptypes.h:328
float x
Definition psptypes.h:327
float w
Definition psptypes.h:330
Definition psptypes.h:128
float y
Definition psptypes.h:130
float x
Definition psptypes.h:129
float w
Definition psptypes.h:131
float h
Definition psptypes.h:132
Definition psptypes.h:151
float y
Definition psptypes.h:153
float x
Definition psptypes.h:152
Definition psptypes.h:182
float y
Definition psptypes.h:184
float z
Definition psptypes.h:185
float x
Definition psptypes.h:183
Definition psptypes.h:224
float y
Definition psptypes.h:226
float w
Definition psptypes.h:228
float x
Definition psptypes.h:225
float z
Definition psptypes.h:227
Definition psptypes.h:217
float x
Definition psptypes.h:218
float z
Definition psptypes.h:220
float w
Definition psptypes.h:221
float y
Definition psptypes.h:219
Definition psptypes.h:240
ScePspIVector2 x
Definition psptypes.h:241
ScePspIVector2 y
Definition psptypes.h:242
Definition psptypes.h:262
ScePspIVector3 x
Definition psptypes.h:263
ScePspIVector3 y
Definition psptypes.h:264
ScePspIVector3 z
Definition psptypes.h:265
Definition psptypes.h:293
ScePspIVector4 w
Definition psptypes.h:297
ScePspIVector4 z
Definition psptypes.h:296
ScePspIVector4 y
Definition psptypes.h:295
ScePspIVector4 x
Definition psptypes.h:294
Definition psptypes.h:286
ScePspIVector4 x
Definition psptypes.h:287
ScePspIVector4 y
Definition psptypes.h:288
ScePspIVector4 w
Definition psptypes.h:290
ScePspIVector4 z
Definition psptypes.h:289
Definition psptypes.h:114
int h
Definition psptypes.h:118
int y
Definition psptypes.h:116
int w
Definition psptypes.h:117
int x
Definition psptypes.h:115
Definition psptypes.h:141
int y
Definition psptypes.h:143
int x
Definition psptypes.h:142
Definition psptypes.h:170
int x
Definition psptypes.h:171
int z
Definition psptypes.h:173
int y
Definition psptypes.h:172
Definition psptypes.h:203
int w
Definition psptypes.h:207
int y
Definition psptypes.h:205
int x
Definition psptypes.h:204
int z
Definition psptypes.h:206
Definition psptypes.h:121
SceLong64 h
Definition psptypes.h:125
SceLong64 w
Definition psptypes.h:124
SceLong64 x
Definition psptypes.h:122
SceLong64 y
Definition psptypes.h:123
Definition psptypes.h:146
SceLong64 x
Definition psptypes.h:147
SceLong64 y
Definition psptypes.h:148
Definition psptypes.h:176
SceLong64 z
Definition psptypes.h:179
SceLong64 y
Definition psptypes.h:178
SceLong64 x
Definition psptypes.h:177
Definition psptypes.h:210
SceLong64 y
Definition psptypes.h:212
SceLong64 x
Definition psptypes.h:211
SceLong64 w
Definition psptypes.h:214
SceLong64 z
Definition psptypes.h:213
Definition psptypes.h:107
short int x
Definition psptypes.h:108
short int w
Definition psptypes.h:110
short int y
Definition psptypes.h:109
short int h
Definition psptypes.h:111
Definition psptypes.h:136
short int x
Definition psptypes.h:137
short int y
Definition psptypes.h:138
Definition psptypes.h:164
short int y
Definition psptypes.h:166
short int x
Definition psptypes.h:165
short int z
Definition psptypes.h:167
Definition psptypes.h:196
short int y
Definition psptypes.h:198
short int z
Definition psptypes.h:199
short int x
Definition psptypes.h:197
short int w
Definition psptypes.h:200
Definition psptypes.h:250
ScePspFMatrix2 fm
Definition psptypes.h:251
float f[2][2]
Definition psptypes.h:257
ScePspIMatrix2 im
Definition psptypes.h:252
ScePspVector2 v[2]
Definition psptypes.h:255
ScePspFVector2 fv[2]
Definition psptypes.h:253
ScePspIVector2 iv[2]
Definition psptypes.h:254
int i[2][2]
Definition psptypes.h:258
Definition psptypes.h:274
float f[3][3]
Definition psptypes.h:281
ScePspVector3 v[3]
Definition psptypes.h:279
int i[3][3]
Definition psptypes.h:282
ScePspIVector3 iv[3]
Definition psptypes.h:278
ScePspFVector3 fv[3]
Definition psptypes.h:277
ScePspIMatrix3 im
Definition psptypes.h:276
ScePspFMatrix3 fm
Definition psptypes.h:275
Definition psptypes.h:314
ScePspFMatrix4 fm
Definition psptypes.h:315
ScePspIMatrix4 im
Definition psptypes.h:316
ScePspFVector4 fv[4]
Definition psptypes.h:317
ScePspVector4 v[4]
Definition psptypes.h:319
int i[4][4]
Definition psptypes.h:322
float f[4][4]
Definition psptypes.h:321
ScePspIVector4 iv[4]
Definition psptypes.h:318
Definition psptypes.h:393
ScePspFQuaternion fq
Definition psptypes.h:410
ScePspFRect fr
Definition psptypes.h:406
int i[4]
Definition psptypes.h:400
ScePspFColor fc
Definition psptypes.h:411
ScePspRGBA8888 rgba8888[4]
Definition psptypes.h:412
ScePspIVector4 iv
Definition psptypes.h:409
unsigned int ui[4]
Definition psptypes.h:399
float f[4]
Definition psptypes.h:405
ScePspRGBA4444 rgba4444[8]
Definition psptypes.h:413
SceLong64 l[2]
Definition psptypes.h:398
char c[16]
Definition psptypes.h:404
SceULong64 ul[2]
Definition psptypes.h:397
short int s[8]
Definition psptypes.h:402
ScePspFVector4 fv
Definition psptypes.h:408
ScePspRGB565 rgb565[8]
Definition psptypes.h:415
ScePspRGBA5551 rgba5551[8]
Definition psptypes.h:414
unsigned char uc[16]
Definition psptypes.h:403
unsigned short us[8]
Definition psptypes.h:401
ScePspIRect ir
Definition psptypes.h:407
Definition psptypes.h:361
unsigned int ui
Definition psptypes.h:362
ScePspRGB565 rgb565[2]
Definition psptypes.h:372
unsigned short us[2]
Definition psptypes.h:364
int i
Definition psptypes.h:363
unsigned char uc[4]
Definition psptypes.h:366
float f
Definition psptypes.h:368
ScePspRGBA5551 rgba5551[2]
Definition psptypes.h:371
ScePspRGBA4444 rgba4444[2]
Definition psptypes.h:370
short int s[2]
Definition psptypes.h:365
ScePspRGBA8888 rgba8888
Definition psptypes.h:369
char c[4]
Definition psptypes.h:367
Definition psptypes.h:375
ScePspSRect sr
Definition psptypes.h:385
SceLong64 l
Definition psptypes.h:377
ScePspRGB565 rgb565[4]
Definition psptypes.h:390
ScePspRGBA5551 rgba5551[4]
Definition psptypes.h:389
int i[2]
Definition psptypes.h:379
unsigned char uc[8]
Definition psptypes.h:382
ScePspSVector4 sv
Definition psptypes.h:386
unsigned int ui[2]
Definition psptypes.h:378
ScePspRGBA8888 rgba8888[2]
Definition psptypes.h:387
short int s[4]
Definition psptypes.h:381
unsigned short us[4]
Definition psptypes.h:380
char c[8]
Definition psptypes.h:383
ScePspRGBA4444 rgba4444[4]
Definition psptypes.h:388
float f[2]
Definition psptypes.h:384
SceULong64 ul
Definition psptypes.h:376
Definition psptypes.h:156
ScePspIVector2 iv
Definition psptypes.h:158
float f[2]
Definition psptypes.h:159
int i[2]
Definition psptypes.h:160
ScePspFVector2 fv
Definition psptypes.h:157
Definition psptypes.h:188
int i[3]
Definition psptypes.h:192
float f[3]
Definition psptypes.h:191
ScePspIVector3 iv
Definition psptypes.h:190
ScePspFVector3 fv
Definition psptypes.h:189
Definition psptypes.h:231
int i[4]
Definition psptypes.h:236
ScePspFVector4 fv
Definition psptypes.h:232
float f[4]
Definition psptypes.h:235
ScePspIVector4 iv
Definition psptypes.h:233