forked from WerWolv/ImHex-Patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgbx.hexpat
More file actions
61 lines (51 loc) · 1.21 KB
/
Copy pathgbx.hexpat
File metadata and controls
61 lines (51 loc) · 1.21 KB
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
#pragma author gmestanley
#pragma description GameBoy ROM file GBX footer
#pragma source hhug.me/gbx/1.0
import gb;
bitfield SachenMMC2SolderPad {
padding : 5;
opt1 : 1;
openBus512KiBOuterBanks : 1;
openBus1MiBOuterBanks : 1;
};
bitfield VastFameRunningValueType {
TaiwanReleases : 1;
MainlandChinaReleases : 1;
};
enum VastFamePCBType : u8 {
DSHGGB81,
BCR1616T3P
};
fn specialMapper(str value) { return value == "SAM2" || value == "VF01" || value == "GB81"; };
struct MapperVariables {
match(parent.mapper) {
("SAM2"): SachenMMC2SolderPad solderPadConfig;
("VF01"): VastFameRunningValueType runningValue;
("GB81"): VastFamePCBType pcb; }
padding[3*specialMapper(parent.mapper)];
u32 mapperVariables[8-specialMapper(parent.mapper)];
};
struct CartridgeInformation {
char mapper[4];
bool battery;
bool rumble;
bool timer;
padding[1];
u32 romSize;
u32 ramSize;
if (specialMapper(mapper))
MapperVariables mapperVariables;
else
MapperVariables mapperVariables [[inline]];
};
struct GBXMetadata {
u32 footerSize;
u32 majorVersion;
u32 minorVersion;
char signature[4];
};
struct GBXFooter {
CartridgeInformation cartInfo;
GBXMetadata metadata;
};
be GBXFooter gbxFooter @ std::mem::size() - 0x40;