Jo Engine 2026.11.6
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1/*
2** Jo Sega Saturn Engine
3** Copyright (c) 2012-2026, Johannes Fetz (johannesfetz@gmail.com)
4** All rights reserved.
5**
6** Redistribution and use in source and binary forms, with or without
7** modification, are permitted provided that the following conditions are met:
8** * Redistributions of source code must retain the above copyright
9** notice, this list of conditions and the following disclaimer.
10** * Redistributions in binary form must reproduce the above copyright
11** notice, this list of conditions and the following disclaimer in the
12** documentation and/or other materials provided with the distribution.
13** * Neither the name of the Johannes Fetz nor the
14** names of its contributors may be used to endorse or promote products
15** derived from this software without specific prior written permission.
16**
17** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
34
35#ifndef __JO_TYPES_H__
36# define __JO_TYPES_H__
37
39# define __jo_force_inline __attribute__((always_inline)) inline
40
44# define __jo_may_alias __attribute__((__may_alias__))
45
47typedef unsigned int __jo_may_alias __jo_uint32_alias;
48
50typedef unsigned short __jo_may_alias __jo_uint16_alias;
51
53typedef unsigned short jo_color;
54
59typedef int jo_fixed;
60
65typedef short jo_angle;
66
68typedef struct
69{
70 int x;
71 int y;
72} jo_pos2D;
73
75typedef struct
76{
80
84typedef struct
85{
86 int x;
87 int y;
88 int z;
89} jo_pos3D;
90
93typedef struct
94{
95 float x;
96 float y;
97 float z;
98} jo_pos3Df;
99
108
111typedef struct
112{
113 int rx;
114 int ry;
115 int rz;
116} jo_rot3D;
117
120typedef struct
121{
122 float rx;
123 float ry;
124 float rz;
125} jo_rot3Df;
126
130typedef struct
131{
133 short rz;
135
139typedef struct
140{
142 short rx;
143 short ry;
145
147typedef struct
148{
149 float x;
150 float y;
151 float z;
152} jo_vectorf;
153
157typedef struct
158{
160} jo_vector;
161
165typedef struct
166{
169
171typedef struct
172{
176
185
187typedef union
188{
189 float m[4][4];
190 float table[16];
191 struct
192 {
193 float m00, m01, m02, m03;
194 float m10, m11, m12, m13;
195 float m20, m21, m22, m23;
196 float m30, m31, m32, m33;
197 };
198} jo_matrixf;
199
201typedef union
202{
203 jo_fixed m[4][4];
205 struct
206 {
211 };
212} jo_matrix;
213
215typedef struct __jo_size
216{
217 unsigned short width;
218 unsigned short height;
220
224typedef struct
225{
226 unsigned short width;
227 unsigned short height;
228 unsigned short adr;
229 unsigned short size;
231
233typedef struct
234{
235 unsigned short index;
236 unsigned short color_mode;
237 void *data;
239
241typedef struct
242{
243 unsigned short width;
244 unsigned short height;
246} jo_img;
247
249typedef struct
250{
251 unsigned short width;
252 unsigned short height;
253 unsigned char *data;
255
259typedef struct __jo_may_alias
260{
261 unsigned short width;
262 unsigned short height;
263 void *data;
265
267typedef struct
268{
270 int id;
271} jo_palette;
272
274typedef struct
275{
276 int x;
277 int y;
278 unsigned short width;
279 unsigned short height;
280} jo_tile;
281
283typedef struct
284{
285 unsigned short effect;
286 unsigned short direction;
287 unsigned int color_table_index;
291 unsigned int clipping;
292 unsigned int mask_lut; // The 16 colors textures drawn as masks: this color lookup table (VRAM address / 8,
293 // all its colors 0) instead of their own, 0: none (see jo_3d_transparency_mask_begin())
295
297typedef union
298{
299 float f;
300 struct
301 {
302 unsigned int sign : 1;
303 unsigned int exponent : 8;
304 unsigned int mantissa : 23;
305
306 } field;
307} jo_IEEE754;
308
310typedef struct
311{
312 int id;
313 int size;
314 int read;
315 void *handle;
319 void *lz; // Compressed file (see jo_fs_open()): the state of the decompression, JO_NULL: not compressed
320 int raw_size; // Compressed file: its size on the CD (size: the data once decompressed)
321 int raw_read; // Compressed file: the bytes read on the CD
322} jo_file;
323
337
355
356#endif /* !__JO_TYPES_H__ */
357
358/*
359** END OF FILE
360*/
void * data
Definition entity.h:19
int height
Definition entity.h:4
float y
Definition types.h:150
jo_fixed w
Definition types.h:183
void * handle
Definition types.h:315
unsigned short height
Definition types.h:252
int ry
Definition types.h:114
char * read_buffer
Definition types.h:316
#define __jo_may_alias
The memory of an object of another type can be accessed through this type (the strict aliasing rule o...
Definition types.h:44
unsigned short width
Definition types.h:217
void * data
Definition types.h:237
jo_fixed z
Definition types.h:106
int y
Definition types.h:71
short jo_angle
Angle.
Definition types.h:65
float f
Definition types.h:299
int y
Definition types.h:87
unsigned short width
Definition types.h:278
int raw_read
Definition types.h:321
float rz
Definition types.h:124
unsigned int color_table_index
Definition types.h:287
jo_fixed y
Definition types.h:78
float y
Definition types.h:96
unsigned short height
Definition types.h:244
int rx
Definition types.h:113
int y
Definition types.h:277
unsigned short jo_color
15 bits color type
Definition types.h:53
unsigned short height
Definition types.h:227
int read_index
Definition types.h:317
short rz
Definition types.h:133
int read_buffer_size
Definition types.h:318
jo_pos3D
Definition types.h:159
unsigned short effect
Definition types.h:285
jo_fixed x
Definition types.h:173
float z
Definition types.h:97
unsigned short index
Definition types.h:235
unsigned short height
Definition types.h:218
jo_pos3D_fixed
Definition types.h:167
unsigned int clipping
Definition types.h:291
float x
Definition types.h:149
jo_fixed x
Definition types.h:104
int x
Definition types.h:70
jo_fixed y
Definition types.h:105
unsigned short size
Definition types.h:229
jo_pos3D
Definition types.h:132
int size
Definition types.h:313
unsigned short width
Definition types.h:226
jo_color * data
Definition types.h:245
int id
Definition types.h:270
unsigned short width
Definition types.h:243
float z
Definition types.h:151
short rx
Definition types.h:142
jo_fixed fixed_scale_y
Definition types.h:290
jo_fixed y
Definition types.h:174
int jo_fixed
Fixed point Q16.16 number.
Definition types.h:59
int x
Definition types.h:276
unsigned char * data
Definition types.h:253
jo_pos3D_fixed
Definition types.h:182
struct __jo_size jo_size
Size struct.
jo_2d_object_attributes
Definition types.h:141
jo_color * data
Definition types.h:269
int read
Definition types.h:314
unsigned short width
Definition types.h:251
unsigned short adr
Definition types.h:228
int id
Definition types.h:312
int x
Definition types.h:86
unsigned short height
Definition types.h:279
int raw_size
Definition types.h:320
float rx
Definition types.h:122
unsigned int mask_lut
Definition types.h:292
int z
Definition types.h:88
float x
Definition types.h:95
jo_8_directions
8 directions definition
Definition types.h:326
@ DOWN_LEFT
Definition types.h:334
@ DOWN_RIGHT
Definition types.h:335
@ UP_RIGHT
Definition types.h:333
@ DOWN
Definition types.h:331
@ UP_LEFT
Definition types.h:332
@ UP
Definition types.h:330
@ NONE
Definition types.h:327
@ LEFT
Definition types.h:328
@ RIGHT
Definition types.h:329
unsigned int gouraud_shading_index
Definition types.h:288
jo_fixed x
Definition types.h:77
unsigned short direction
Definition types.h:286
void * lz
Definition types.h:319
short ry
Definition types.h:143
unsigned short color_mode
Definition types.h:236
jo_raw_img
Definition types.h:264
jo_scroll_screen
Sega Saturn Scroll Screen Ids.
Definition types.h:340
@ JO_NBG3_SCREEN
Definition types.h:345
@ JO_ALL_SCROLL_SCREEN
Definition types.h:353
@ JO_NBG2_SCREEN
Definition types.h:344
@ JO_NBG0_SCREEN
Definition types.h:342
@ JO_RBG0_SCREEN
Definition types.h:346
@ JO_BACK_SCREEN
Definition types.h:347
@ JO_LNCL_SCREEN
Definition types.h:351
@ JO_SPRITE_SCREEN
Definition types.h:348
@ JO_VDP2_3D_PLANE_SCREEN
Definition types.h:350
@ JO_NBG1_SCREEN
Definition types.h:343
jo_fixed fixed_scale_x
Definition types.h:289
int rz
Definition types.h:115
float ry
Definition types.h:123
Size struct.
Definition types.h:216
Object for 2D manipulation (storyboard) using fixed number.
Definition types.h:131
Object for 3D manipulation (storyboard) using fixed number.
Definition types.h:140
File definition.
Definition types.h:311
15 bits image struct
Definition types.h:242
8 bits image struct
Definition types.h:250
Palette contents struct.
Definition types.h:268
Picture definition.
Definition types.h:234
2D position
Definition types.h:69
2D position using fixed number
Definition types.h:76
3D position
Definition types.h:85
3D position using fixed numbers
Definition types.h:103
3D position using floating numbers
Definition types.h:94
3D rotation angles
Definition types.h:112
3D rotation angles
Definition types.h:121
Sprite attributes.
Definition types.h:284
Texture definition.
Definition types.h:225
Struct of one tile (pos and size).
Definition types.h:275
Vector for 3D computation using integer.
Definition types.h:158
Vector for 2D computation using fixed number.
Definition types.h:172
Vector4 for 3D computation using fixed number.
Definition types.h:181
Vector for 3D computation using fixed number.
Definition types.h:166
Vector for 3D computation using floating numbers.
Definition types.h:148
Float IEEE 754 format.
Definition types.h:298
4x4 MATRIX for 3D computation using fixed number
Definition types.h:202
jo_fixed table[16]
Definition types.h:204
jo_fixed m[4][4]
Definition types.h:203
4x4 MATRIX for 3D computation using floating numbers
Definition types.h:188
float table[16]
Definition types.h:190
float m[4][4]
Definition types.h:189