This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
ONAV.bt
143 lines (124 loc) · 3.64 KB
/
ONAV.bt
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//------------------------------------------------
//--- 010 Editor v10.0 Binary Template
//
// File: ONAV.bt
// Authors: TKGP
// Version:
// Purpose: BB/DS3 onav files
// Category: Dantelion
// File Mask: *.onav
// ID Bytes: 4F 4E 41 56 30 31 32 30
// History:
//------------------------------------------------
#include "Util.bt"
LittleEndian();
//------------------------------------------------
typedef struct {
char magic[4]; Assert(magic == "ONAV");
char version[4]; Assert(version == "0120");
int unk08; Assert(unk08 == 0);
short count0C;
short count0E;
int unk10; Assert(unk10 == 0);
int unk14; Assert(unk14 == 0xC);
quad offset18 <format=hex>;
quad offset20 <format=hex>;
quad offset28 <format=hex>;
quad unk30 <hidden=true>; Assert(unk30 == 0);
} Header <bgcolor=cLtRed>;
typedef struct {
quad count;
quad offsets[count] <format=hex>;
} OffsetIndex <bgcolor=cBlack>;
typedef struct {
short unk00;
short unk02;
short unk04;
short unk06;
int count08;
int unk0C <hidden=true>; Assert(unk0C == 0);
quad offset10 <format=hex>;
if (count08 > 0) {
local quad pos <hidden=true> = FTell();
FSeek(offset10);
short data[count08] <bgcolor=cDkAqua>;
FSeek(pos);
}
} Struct1A <bgcolor=cAqua, optimize=false>;
typedef struct {
short unk00;
byte count02;
byte unk03; // Perhaps total count of data shorts in Struct1As?
int unk04 <hidden=true>; Assert(unk04 == 0);
quad offset08 <format=hex>; Assert(FTell() == offset08);
if (count02 > 0) {
FSeek(offset08);
struct { Struct1A struct1As[count02]; } struct1As;
}
} Struct1 <bgcolor=cLtAqua>;
typedef struct {
short unk00;
short unk02;
Vector3 unk04; // Not 100% sure these are Vector3s
Vector3 unk10;
Vector3 unk1C; // Not 100% sure these are even floats
short count28;
short unk2A;
int unk2C;
int unk30;
int unk34;
quad offset38 <format=hex>;
if (count28 > 0) {
local quad pos <hidden=true> = FTell();
FSeek(offset38);
int data[count28] <bgcolor=cDkGreen>;
FSeek(pos);
}
} Struct2A <bgcolor=cGreen, optimize=false>;
// Align to 8 when writing because of Struct2A data
typedef struct {
short unk00;
short count02;
int unk04;
int unk08 <hidden=true>; Assert(unk08 == 0);
int unk0C <hidden=true>; Assert(unk0C == 0);
int unk10 <hidden=true>; Assert(unk10 == 0);
int unk14 <hidden=true>; Assert(unk14 == 0);
int unk18 <hidden=true>; Assert(unk18 == 0);
int unk1C <hidden=true>; Assert(unk1C == 0);
quad offset20 <format=hex>;
Vector3 unk28; // Bounding box?
Vector3 unk34;
if (count02 > 0) {
FSeek(offset20);
struct { Struct2A struct2As[count02]; } struct2As;
}
} Struct2 <bgcolor=cLtGreen>;
//------------------------------------------------
Header header;
Assert(FTell() == header.offset18);
OffsetIndex offsetIndex;
Assert(FTell() == header.offset20);
if (header.count0C > 0)
quad struct1Offsets[header.count0C] <format=hex, bgcolor=cLtAqua>;
Assert(FTell() == header.offset28);
if (header.count0E > 0)
quad struct2Offsets[header.count0E] <format=hex, bgcolor=cLtGreen>;
if (header.count0C > 0) {
struct {
local int i <hidden=true>;
for (i = 0; i < header.count0C; i++) {
FSeek(struct1Offsets[i]);
Struct1 struct1s;
}
} struct1s;
}
if (header.count0E > 0) {
struct {
local int i <hidden=true>;
for (i = 0; i < header.count0E; i++) {
FSeek(struct2Offsets[i]);
Struct2 struct2s;
}
} struct2s;
}