Jo Engine
2026.11.1
Jo Sega Saturn Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
jo_engine
jo
level.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
*/
38
39
#ifndef __JO_LEVEL_H__
40
# define __JO_LEVEL_H__
41
42
#ifdef JO_COMPILE_WITH_LEVEL_SUPPORT
43
44
# include "
level_format.h
"
45
47
# define JO_LEVEL_MAX_COPIES (16)
48
50
typedef
struct
51
{
52
unsigned
char
*data;
// The file
53
unsigned
int
size;
54
const
jo_level_directory_entry
*directory;
55
unsigned
int
section_count;
56
const
char
*strings;
// STRS section (JO_NULL: none)
57
unsigned
int
strings_size;
58
void
*copies[JO_LEVEL_MAX_COPIES];
59
unsigned
int
copy_count;
60
} jo_level;
61
67
jo_level *jo_level_load(
const
char
*
const
filename);
68
72
void
jo_level_free(jo_level *
const
level);
73
79
const
jo_level_directory_entry
*jo_level_find_section(
const
jo_level *
const
level,
const
unsigned
int
id
);
80
86
const
void
*jo_level_section_data(
const
jo_level *
const
level,
const
unsigned
int
id
);
87
95
const
void
*jo_level_get_header(jo_level *
const
level,
const
unsigned
int
id
,
const
unsigned
int
size,
96
const
void
*
const
defaults);
97
106
const
void
*jo_level_get_records(jo_level *
const
level,
const
unsigned
int
id
,
const
unsigned
int
size,
107
const
void
*
const
defaults,
unsigned
int
*
const
count);
108
115
const
void
*jo_level_get_array(
const
jo_level *
const
level,
const
unsigned
int
id
,
const
unsigned
int
offset);
116
122
const
char
*jo_level_string(
const
jo_level *
const
level,
const
unsigned
int
offset);
123
125
# define JO_LEVEL_HEADER(LEVEL, ID, NAME) ({ static const jo_level_##NAME##_header __defaults = JO_LEVEL_##ID##_HEADER_DEFAULTS; \
126
(const jo_level_##NAME##_header *)jo_level_get_header((LEVEL), JO_LEVEL_SECTION_##ID, \
127
sizeof(jo_level_##NAME##_header), &__defaults); })
128
130
# define JO_LEVEL_RECORDS(LEVEL, ID, NAME, COUNT) ({ static const jo_level_##NAME##_record __defaults = JO_LEVEL_##ID##_RECORD_DEFAULTS; \
131
(const jo_level_##NAME##_record *)jo_level_get_records((LEVEL), JO_LEVEL_SECTION_##ID, \
132
sizeof(jo_level_##NAME##_record), &__defaults, (COUNT)); })
133
134
#endif
/* !JO_COMPILE_WITH_LEVEL_SUPPORT */
135
136
#endif
/* !__JO_LEVEL_H__ */
137
138
/*
139
** END OF FILE
140
*/
level_format.h
jo_level_directory_entry
Directory entry (one per section, after the file header) (24 bytes).
Definition
level_format.h:37
Generated by
1.18.0