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
/
MOSB.bt
153 lines (130 loc) · 4.22 KB
/
MOSB.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
144
145
146
147
148
149
150
151
152
153
//------------------------------------------------
//--- 010 Editor v10.0.1 Binary Template
//
// File: MOSB.bt
// Authors: TKGP
// Version:
// Purpose: Demon's Souls .mosb files
// Category: Dantelion
// File Mask: *.mosb
// ID Bytes: 4D 4F 53 42
// History:
//------------------------------------------------
#include "Util.bt"
BigEndian();
struct Struct4;
struct Struct5;
struct Struct6;
struct Struct10;
//------------------------------------------------
typedef struct {
char magic[4]; Assert(magic == "MOSB");
short unk04; Assert(unk04 == 2);
short unk06; Assert(unk06 == 0);
int count1;
int count2;
char name[0x20]; // Longest name in practice is 0xC so this is a bit of a guess
int offset1 <format=hex>;
int offset2 <format=hex>;
int offset3 <format=hex>;
int offset4 <format=hex>;
int offset5 <format=hex>;
int offset6 <format=hex>;
int offset7 <format=hex>;
int offset8 <format=hex>;
int offset9 <format=hex>;
int offset10 <format=hex>;
int offset11 <format=hex>;
int offset12 <format=hex>;
} Header <bgcolor=cLtRed>;
typedef struct {
float unk00;
float unk04;
byte unk08;
byte unk09 <hidden=true>; Assert(unk09 == 0);
byte struct3Count;
byte struct4Count;
int struct3Offset <format=hex>;
int struct4Offset <format=hex>;
local quad pos <hidden=true> = FTell();
if (struct3Count > 0) {
FSeek(header.offset3 + struct3Offset);
short struct3s[struct3Count] <bgcolor=cGreen>;
}
FSeek(header.offset4 + struct4Offset);
Struct4 struct4s[struct4Count];
FSeek(pos);
} Struct1 <bgcolor=cLtGreen, optimize=false>;
typedef struct {
int nameOffset <format=hex>;
byte struct10Count;
byte unk05 <hidden=true>; Assert(unk05 == 0);
byte unk06 <hidden=true>; Assert(unk06 == 0);
byte unk07 <hidden=true>; Assert(unk07 == 0);
byte unk08;
byte unk09;
short unk0A <hidden=true>; Assert(unk0A == 0);
short unk0C; Assert(!(unk0C & 0xFF00)); // Byte or short?
short unk0E <hidden=true>; Assert(unk0E == 0);
int unk10 <hidden=true>; Assert(unk10 == 0);
int unk14 <hidden=true>; Assert(unk14 == 0);
int struct10Offset <format=hex>;
local quad pos <hidden=true> = FTell();
FSeek(header.offset12 + nameOffset);
string name;
FSeek(header.offset10 + struct10Offset);
Struct10 struct10s[struct10Count];
FSeek(pos);
} Struct2 <read=ReadStruct2, bgcolor=cDkYellow, optimize=false>;
string ReadStruct2(Struct2& s2) {
return s2.name;
}
typedef struct {
float unk00;
byte struct5Count; Assert(struct5Count == 1);
byte unk05 <hidden=true>; Assert(unk05 == 0);
byte unk06 <hidden=true>; Assert(unk06 == 0);
byte unk07 <hidden=true>; Assert(unk07 == 0);
int struct5Offset <format=hex>;
int unk0C <hidden=true>; Assert(unk0C == 0);
int unk10 <hidden=true>; Assert(unk10 == 0);
int unk14 <hidden=true>; Assert(unk14 == 0);
local quad pos <hidden=true> = FTell();
FSeek(header.offset5 + struct5Offset);
Struct5 struct5[struct5Count];
FSeek(pos);
} Struct4 <bgcolor=cDkGreen, optimize=false>;
typedef struct {
short unk00;
short struct6Count;
int unk04 <hidden=true>; Assert(unk04 == 0);
int unk08 <hidden=true>; Assert(unk08 == 0);
int unk0C <hidden=true>; Assert(unk0C == 0);
int unk10 <hidden=true>; Assert(unk10 == 0);
int struct6Offset <format=hex>;
local quad pos <hidden=true> = FTell();
FSeek(header.offset6 + struct6Offset);
Struct6 struct6s[struct6Count];
FSeek(pos);
} Struct5 <bgcolor=cLtYellow, optimize=false>;
typedef struct {
int unk00;
int unk04;
} Struct6 <bgcolor=cYellow>;
typedef struct {
int unk00;
int unk04;
int unk08;
} Struct10 <bgcolor=cAqua>;
//------------------------------------------------
Header header;
FSeek(header.offset1);
struct { Struct1 struct1s[header.count1]; } struct1s;
if (header.count2 > 0) {
FSeek(header.offset2);
struct { Struct2 struct2s[header.count2]; } struct2s;
}
FSeek(header.offset11);
// This is probably referenced somewhere but since the offsets are relative
// and there's only ever one string, I don't know where
string fileNameAgain <bgcolor=cRed>; Assert(fileNameAgain == header.name);