-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathconfig.h
94 lines (79 loc) · 1.75 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef CONFIG_H_
#define CONFIG_H_
typedef enum
{
TYPE_INVALID,
TYPE_ASM,
TYPE_BIN,
TYPE_BLAST,
TYPE_GZIP,
TYPE_HEADER,
TYPE_INSTRUMENT_SET,
TYPE_M64,
TYPE_SFX_CTL,
TYPE_SFX_TBL,
TYPE_MIO0,
TYPE_PTR,
// F3D display lists and related
TYPE_F3D_DL,
TYPE_F3D_LIGHT,
TYPE_F3D_VERTEX,
// Textures
TYPE_TEX_CI,
TYPE_TEX_I,
TYPE_TEX_IA,
TYPE_TEX_RGBA,
TYPE_TEX_SKYBOX,
// SM64 specific types
TYPE_SM64_GEO,
TYPE_SM64_BEHAVIOR,
TYPE_SM64_COLLISION,
TYPE_SM64_LEVEL,
} section_type;
typedef struct _label
{
unsigned int ram_addr;
char name[128];
} label;
typedef struct _texture
{
unsigned int offset;
unsigned int palette; // only for CI textures
unsigned short width;
unsigned short height;
unsigned short depth;
section_type format;
} texture;
typedef struct _split_section
{
char label[128];
unsigned int start;
unsigned int end;
unsigned int vaddr;
section_type type;
int subtype;
// texture specific data
texture tex;
struct _split_section *children;
int child_count;
} split_section;
typedef struct _rom_config
{
char name[128];
char basename[128];
unsigned int checksum1;
unsigned int checksum2;
split_section *sections;
int section_count;
label *labels;
int label_count;
} rom_config;
int config_parse_file(const char *filename, rom_config *config);
void config_print(const rom_config *config);
int config_validate(const rom_config *config, unsigned int max_len);
void config_free(rom_config *config);
section_type config_str2section(const char *type_name);
const char *config_section2str(section_type section);
// get version of underlying config library
const char *config_get_version(void);
#endif // CONFIG_H_