Jo Engine
2026.11.1
Jo Sega Saturn Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
jo_engine
jo
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
42
typedef
unsigned
short
jo_color
;
43
48
typedef
int
jo_fixed
;
49
54
typedef
short
jo_angle
;
55
57
typedef
struct
58
{
59
int
x
;
60
int
y
;
61
}
jo_pos2D
;
62
64
typedef
struct
65
{
66
jo_fixed
x
;
67
jo_fixed
y
;
68
}
jo_pos2D_fixed
;
69
73
typedef
struct
74
{
75
int
x
;
76
int
y
;
77
int
z
;
78
}
jo_pos3D
;
79
82
typedef
struct
83
{
84
float
x
;
85
float
y
;
86
float
z
;
87
}
jo_pos3Df
;
88
91
typedef
struct
92
{
93
jo_fixed
x
;
94
jo_fixed
y
;
95
jo_fixed
z
;
96
}
jo_pos3D_fixed
;
97
100
typedef
struct
101
{
102
int
rx
;
103
int
ry
;
104
int
rz
;
105
}
jo_rot3D
;
106
109
typedef
struct
110
{
111
float
rx
;
112
float
ry
;
113
float
rz
;
114
}
jo_rot3Df
;
115
119
typedef
struct
120
{
121
jo_pos3D
;
122
short
rz
;
123
}
jo_2d_object_attributes
;
124
128
typedef
struct
129
{
130
jo_2d_object_attributes
;
131
short
rx
;
132
short
ry
;
133
}
jo_3d_object_attributes
;
134
136
typedef
struct
137
{
138
float
x
;
139
float
y
;
140
float
z
;
141
}
jo_vectorf
;
142
146
typedef
struct
147
{
148
jo_pos3D
;
149
}
jo_vector
;
150
154
typedef
struct
155
{
156
jo_pos3D_fixed
;
157
}
jo_vector_fixed
;
158
160
typedef
struct
161
{
162
jo_fixed
x
;
163
jo_fixed
y
;
164
}
jo_vector2_fixed
;
165
169
typedef
struct
170
{
171
jo_pos3D_fixed
;
172
jo_fixed
w
;
173
}
jo_vector4_fixed
;
174
176
typedef
union
177
{
178
float
m
[4][4];
179
float
table
[16];
180
struct
181
{
182
float
m00
,
m01
,
m02
,
m03
;
183
float
m10
,
m11
,
m12
,
m13
;
184
float
m20
,
m21
,
m22
,
m23
;
185
float
m30
,
m31
,
m32
,
m33
;
186
};
187
}
jo_matrixf
;
188
190
typedef
union
191
{
192
jo_fixed
m
[4][4];
193
jo_fixed
table
[16];
194
struct
195
{
196
jo_fixed
m00
,
m01
,
m02
,
m03
;
197
jo_fixed
m10
,
m11
,
m12
,
m13
;
198
jo_fixed
m20
,
m21
,
m22
,
m23
;
199
jo_fixed
m30
,
m31
,
m32
,
m33
;
200
};
201
}
jo_matrix
;
202
204
typedef
struct
__jo_size
205
{
206
unsigned
short
width
;
207
unsigned
short
height
;
208
}
jo_size
;
209
213
typedef
struct
214
{
215
unsigned
short
width
;
216
unsigned
short
height
;
217
unsigned
short
adr
;
218
unsigned
short
size
;
219
}
jo_texture_definition
;
220
222
typedef
struct
223
{
224
unsigned
short
index
;
225
unsigned
short
color_mode
;
226
void
*
data
;
227
}
jo_picture_definition
;
228
230
typedef
struct
231
{
232
unsigned
short
width
;
233
unsigned
short
height
;
234
jo_color
*
data
;
235
}
jo_img
;
236
238
typedef
struct
239
{
240
unsigned
short
width
;
241
unsigned
short
height
;
242
unsigned
char
*
data
;
243
}
jo_img_8bits
;
244
246
typedef
struct
247
{
248
unsigned
short
width
;
249
unsigned
short
height
;
250
void
*
data
;
251
}
jo_raw_img
;
252
254
typedef
struct
255
{
256
jo_color
*
data
;
257
int
id
;
258
}
jo_palette
;
259
261
typedef
struct
262
{
263
int
x
;
264
int
y
;
265
unsigned
short
width
;
266
unsigned
short
height
;
267
}
jo_tile
;
268
270
typedef
struct
271
{
272
unsigned
short
effect
;
273
unsigned
short
direction
;
274
unsigned
int
color_table_index
;
275
unsigned
int
gouraud_shading_index
;
276
jo_fixed
fixed_scale_x
;
277
jo_fixed
fixed_scale_y
;
278
unsigned
int
clipping
;
279
}
jo_sprite_attributes
;
280
282
typedef
union
283
{
284
float
f
;
285
struct
286
{
287
unsigned
int
sign
: 1;
288
unsigned
int
exponent
: 8;
289
unsigned
int
mantissa
: 23;
290
291
} field;
292
}
jo_IEEE754
;
293
295
typedef
struct
296
{
297
int
id
;
298
int
size
;
299
int
read
;
300
void
*
handle
;
301
char
*
read_buffer
;
302
int
read_index
;
303
int
read_buffer_size
;
304
}
jo_file
;
305
307
typedef
enum
308
{
309
NONE
,
310
LEFT
,
311
RIGHT
,
312
UP
,
313
DOWN
,
314
UP_LEFT
,
315
UP_RIGHT
,
316
DOWN_LEFT
,
317
DOWN_RIGHT
318
}
jo_8_directions
;
319
321
typedef
enum
322
{
323
/* Technical Name */
324
JO_NBG0_SCREEN
= (1<<0),
325
JO_NBG1_SCREEN
= (1<<1),
326
JO_NBG2_SCREEN
= (1<<2),
327
JO_NBG3_SCREEN
= (1<<3),
328
JO_RBG0_SCREEN
= (1<<4),
329
JO_BACK_SCREEN
= (1<<5),
330
JO_SPRITE_SCREEN
= (1<<6),
331
/* User friendly alias */
332
JO_VDP2_3D_PLANE_SCREEN
=
JO_RBG0_SCREEN
,
333
JO_LNCL_SCREEN
=
JO_BACK_SCREEN
,
334
/* Helper */
335
JO_ALL_SCROLL_SCREEN
=
JO_NBG0_SCREEN
|
JO_NBG1_SCREEN
|
JO_NBG2_SCREEN
|
JO_NBG3_SCREEN
|
JO_RBG0_SCREEN
|
JO_BACK_SCREEN
|
JO_SPRITE_SCREEN
336
}
jo_scroll_screen
;
337
338
#endif
/* !__JO_TYPES_H__ */
339
340
/*
341
** END OF FILE
342
*/
jo_vectorf::y
float y
Definition
types.h:139
jo_raw_img::height
unsigned short height
Definition
types.h:249
jo_vector4_fixed::w
jo_fixed w
Definition
types.h:172
jo_file::handle
void * handle
Definition
types.h:300
jo_img_8bits::height
unsigned short height
Definition
types.h:241
jo_rot3D::ry
int ry
Definition
types.h:103
jo_file::read_buffer
char * read_buffer
Definition
types.h:301
__jo_size::width
unsigned short width
Definition
types.h:206
jo_picture_definition::data
void * data
Definition
types.h:226
jo_pos3D_fixed::z
jo_fixed z
Definition
types.h:95
jo_pos2D::y
int y
Definition
types.h:60
jo_angle
short jo_angle
Angle.
Definition
types.h:54
jo_IEEE754::f
float f
Definition
types.h:284
jo_pos3D::y
int y
Definition
types.h:76
jo_tile::width
unsigned short width
Definition
types.h:265
jo_rot3Df::rz
float rz
Definition
types.h:113
jo_sprite_attributes::color_table_index
unsigned int color_table_index
Definition
types.h:274
jo_pos2D_fixed::y
jo_fixed y
Definition
types.h:67
jo_pos3Df::y
float y
Definition
types.h:85
jo_img::height
unsigned short height
Definition
types.h:233
jo_rot3D::rx
int rx
Definition
types.h:102
jo_tile::y
int y
Definition
types.h:264
jo_raw_img::data
void * data
Definition
types.h:250
jo_color
unsigned short jo_color
15 bits color type
Definition
types.h:42
jo_texture_definition::height
unsigned short height
Definition
types.h:216
jo_file::read_index
int read_index
Definition
types.h:302
jo_2d_object_attributes::rz
short rz
Definition
types.h:122
jo_file::read_buffer_size
int read_buffer_size
Definition
types.h:303
jo_vector::jo_pos3D
jo_pos3D
Definition
types.h:148
jo_sprite_attributes::effect
unsigned short effect
Definition
types.h:272
jo_vector2_fixed::x
jo_fixed x
Definition
types.h:162
jo_pos3Df::z
float z
Definition
types.h:86
jo_picture_definition::index
unsigned short index
Definition
types.h:224
__jo_size::height
unsigned short height
Definition
types.h:207
jo_IEEE754::[struct].field::mantissa
unsigned int mantissa
jo_vector_fixed::jo_pos3D_fixed
jo_pos3D_fixed
Definition
types.h:156
jo_sprite_attributes::clipping
unsigned int clipping
Definition
types.h:278
jo_vectorf::x
float x
Definition
types.h:138
jo_pos3D_fixed::x
jo_fixed x
Definition
types.h:93
jo_pos2D::x
int x
Definition
types.h:59
jo_pos3D_fixed::y
jo_fixed y
Definition
types.h:94
jo_texture_definition::size
unsigned short size
Definition
types.h:218
jo_IEEE754::[struct].field::sign
unsigned int sign
jo_2d_object_attributes::jo_pos3D
jo_pos3D
Definition
types.h:121
jo_file::size
int size
Definition
types.h:298
jo_texture_definition::width
unsigned short width
Definition
types.h:215
jo_img::data
jo_color * data
Definition
types.h:234
jo_palette::id
int id
Definition
types.h:257
jo_img::width
unsigned short width
Definition
types.h:232
jo_vectorf::z
float z
Definition
types.h:140
jo_3d_object_attributes::rx
short rx
Definition
types.h:131
jo_sprite_attributes::fixed_scale_y
jo_fixed fixed_scale_y
Definition
types.h:277
jo_vector2_fixed::y
jo_fixed y
Definition
types.h:163
jo_fixed
int jo_fixed
Fixed point Q16.16 number.
Definition
types.h:48
jo_IEEE754::[struct].field::exponent
unsigned int exponent
jo_tile::x
int x
Definition
types.h:263
jo_img_8bits::data
unsigned char * data
Definition
types.h:242
jo_vector4_fixed::jo_pos3D_fixed
jo_pos3D_fixed
Definition
types.h:171
jo_size
struct __jo_size jo_size
Size struct.
jo_3d_object_attributes::jo_2d_object_attributes
jo_2d_object_attributes
Definition
types.h:130
jo_raw_img::width
unsigned short width
Definition
types.h:248
jo_palette::data
jo_color * data
Definition
types.h:256
jo_file::read
int read
Definition
types.h:299
jo_img_8bits::width
unsigned short width
Definition
types.h:240
jo_texture_definition::adr
unsigned short adr
Definition
types.h:217
jo_file::id
int id
Definition
types.h:297
jo_pos3D::x
int x
Definition
types.h:75
jo_tile::height
unsigned short height
Definition
types.h:266
jo_rot3Df::rx
float rx
Definition
types.h:111
jo_pos3D::z
int z
Definition
types.h:77
jo_pos3Df::x
float x
Definition
types.h:84
jo_8_directions
jo_8_directions
8 directions definition
Definition
types.h:308
DOWN_LEFT
@ DOWN_LEFT
Definition
types.h:316
DOWN_RIGHT
@ DOWN_RIGHT
Definition
types.h:317
UP_RIGHT
@ UP_RIGHT
Definition
types.h:315
DOWN
@ DOWN
Definition
types.h:313
UP_LEFT
@ UP_LEFT
Definition
types.h:314
UP
@ UP
Definition
types.h:312
NONE
@ NONE
Definition
types.h:309
LEFT
@ LEFT
Definition
types.h:310
RIGHT
@ RIGHT
Definition
types.h:311
jo_sprite_attributes::gouraud_shading_index
unsigned int gouraud_shading_index
Definition
types.h:275
jo_pos2D_fixed::x
jo_fixed x
Definition
types.h:66
jo_sprite_attributes::direction
unsigned short direction
Definition
types.h:273
jo_3d_object_attributes::ry
short ry
Definition
types.h:132
jo_picture_definition::color_mode
unsigned short color_mode
Definition
types.h:225
jo_scroll_screen
jo_scroll_screen
Sega Saturn Scroll Screen Ids.
Definition
types.h:322
JO_NBG3_SCREEN
@ JO_NBG3_SCREEN
Definition
types.h:327
JO_ALL_SCROLL_SCREEN
@ JO_ALL_SCROLL_SCREEN
Definition
types.h:335
JO_NBG2_SCREEN
@ JO_NBG2_SCREEN
Definition
types.h:326
JO_NBG0_SCREEN
@ JO_NBG0_SCREEN
Definition
types.h:324
JO_RBG0_SCREEN
@ JO_RBG0_SCREEN
Definition
types.h:328
JO_BACK_SCREEN
@ JO_BACK_SCREEN
Definition
types.h:329
JO_LNCL_SCREEN
@ JO_LNCL_SCREEN
Definition
types.h:333
JO_SPRITE_SCREEN
@ JO_SPRITE_SCREEN
Definition
types.h:330
JO_VDP2_3D_PLANE_SCREEN
@ JO_VDP2_3D_PLANE_SCREEN
Definition
types.h:332
JO_NBG1_SCREEN
@ JO_NBG1_SCREEN
Definition
types.h:325
jo_sprite_attributes::fixed_scale_x
jo_fixed fixed_scale_x
Definition
types.h:276
jo_rot3D::rz
int rz
Definition
types.h:104
jo_rot3Df::ry
float ry
Definition
types.h:112
__jo_size
Size struct.
Definition
types.h:205
jo_2d_object_attributes
Object for 2D manipulation (storyboard) using fixed number.
Definition
types.h:120
jo_3d_object_attributes
Object for 3D manipulation (storyboard) using fixed number.
Definition
types.h:129
jo_file
File definition.
Definition
types.h:296
jo_img
15 bits image struct
Definition
types.h:231
jo_img_8bits
8 bits image struct
Definition
types.h:239
jo_palette
Palette contents struct.
Definition
types.h:255
jo_picture_definition
Picture definition.
Definition
types.h:223
jo_pos2D
2D position
Definition
types.h:58
jo_pos2D_fixed
2D position using fixed number
Definition
types.h:65
jo_pos3D
3D position
Definition
types.h:74
jo_pos3D_fixed
3D position using fixed numbers
Definition
types.h:92
jo_pos3Df
3D position using floating numbers
Definition
types.h:83
jo_raw_img
Raw image struct.
Definition
types.h:247
jo_rot3D
3D rotation angles
Definition
types.h:101
jo_rot3Df
3D rotation angles
Definition
types.h:110
jo_sprite_attributes
Sprite attributes.
Definition
types.h:271
jo_texture_definition
Texture definition.
Definition
types.h:214
jo_tile
Struct of one tile (pos and size).
Definition
types.h:262
jo_vector
Vector for 3D computation using integer.
Definition
types.h:147
jo_vector2_fixed
Vector for 2D computation using fixed number.
Definition
types.h:161
jo_vector4_fixed
Vector4 for 3D computation using fixed number.
Definition
types.h:170
jo_vector_fixed
Vector for 3D computation using fixed number.
Definition
types.h:155
jo_vectorf
Vector for 3D computation using floating numbers.
Definition
types.h:137
jo_IEEE754
Float IEEE 754 format.
Definition
types.h:283
jo_matrix
4x4 MATRIX for 3D computation using fixed number
Definition
types.h:191
jo_matrix::table
jo_fixed table[16]
Definition
types.h:193
jo_matrix::[struct].__unnamed0__::m32
jo_fixed m32
jo_matrix::[struct].__unnamed0__::m00
jo_fixed m00
jo_matrix::[struct].__unnamed0__::m22
jo_fixed m22
jo_matrix::[struct].__unnamed0__::m33
jo_fixed m33
jo_matrix::[struct].__unnamed0__::m12
jo_fixed m12
jo_matrix::[struct].__unnamed0__::m13
jo_fixed m13
jo_matrix::[struct].__unnamed0__::m11
jo_fixed m11
jo_matrix::[struct].__unnamed0__::m20
jo_fixed m20
jo_matrix::m
jo_fixed m[4][4]
Definition
types.h:192
jo_matrix::[struct].__unnamed0__::m03
jo_fixed m03
jo_matrix::[struct].__unnamed0__::m31
jo_fixed m31
jo_matrix::[struct].__unnamed0__::m01
jo_fixed m01
jo_matrix::[struct].__unnamed0__::m02
jo_fixed m02
jo_matrix::[struct].__unnamed0__::m21
jo_fixed m21
jo_matrix::[struct].__unnamed0__::m10
jo_fixed m10
jo_matrix::[struct].__unnamed0__::m30
jo_fixed m30
jo_matrix::[struct].__unnamed0__::m23
jo_fixed m23
jo_matrixf
4x4 MATRIX for 3D computation using floating numbers
Definition
types.h:177
jo_matrixf::[struct].__unnamed0__::m33
float m33
jo_matrixf::table
float table[16]
Definition
types.h:179
jo_matrixf::[struct].__unnamed0__::m30
float m30
jo_matrixf::[struct].__unnamed0__::m01
float m01
jo_matrixf::[struct].__unnamed0__::m32
float m32
jo_matrixf::m
float m[4][4]
Definition
types.h:178
jo_matrixf::[struct].__unnamed0__::m11
float m11
jo_matrixf::[struct].__unnamed0__::m13
float m13
jo_matrixf::[struct].__unnamed0__::m21
float m21
jo_matrixf::[struct].__unnamed0__::m10
float m10
jo_matrixf::[struct].__unnamed0__::m23
float m23
jo_matrixf::[struct].__unnamed0__::m22
float m22
jo_matrixf::[struct].__unnamed0__::m12
float m12
jo_matrixf::[struct].__unnamed0__::m31
float m31
jo_matrixf::[struct].__unnamed0__::m20
float m20
jo_matrixf::[struct].__unnamed0__::m00
float m00
jo_matrixf::[struct].__unnamed0__::m03
float m03
jo_matrixf::[struct].__unnamed0__::m02
float m02
Generated by
1.18.0