forked from mikeryan/ems-flasher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.h
39 lines (31 loc) · 1.09 KB
/
header.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
#ifndef EMS_HEADER_H
#define EMS_HEADER_H
#include "ems.h"
#define HEADER_SIZE 336
#define HEADER_TITLE_SIZE 16
enum header_enh {
HEADER_ENH_GBC = 1,
HEADER_ENH_SGB = 2,
HEADER_ENH_ALL = HEADER_ENH_GBC | HEADER_ENH_SGB
};
#define HEADER_ENH_NOT(x) (~(unsigned)(x)&HEADER_ENH_ALL)
/*
* struct header is a selection of decoded fields of a ROM header.
* title: title as it would be displayed by the menu software (only Nintendo
* ASCII characters). Invalid characters are replaced by a space.
* Trailing spaces are ignored.
* romsize: size of the ROM. May not match the real size. Equals 0 if the
* field contained an incorrect size code.
* enhancements: GBC, SGB, both or none
* gbc_only: if true, the header is marked Game Boy Color Only. This fact is
* not enforced by the hardware.
*/
struct header {
char title[HEADER_TITLE_SIZE+1];
ems_size_t romsize;
enum header_enh enhancements;
int gbc_only;
};
int header_validate(unsigned char*);
void header_decode(struct header*, unsigned char*);
#endif /* EMS_HEADER_H */