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
/
BHD5_1.bt
71 lines (60 loc) · 1.81 KB
/
BHD5_1.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
//------------------------------------------------
//--- 010 Editor v9.0.1 Binary Template
//
// File: BHD5.bt
// Authors: HotPocketRemix, TKGP
// Version:
// Purpose: DS1 dvdbnd headers
// Category: Dark Souls
// File Mask: *.bhd5
// ID Bytes: 42 48 44 35 FF 00 00 00 01 00 00 00
// History:
//------------------------------------------------
if (ReadByte(4) == 0)
BigEndian();
else
LittleEndian();
typedef struct {
char magic[4]; Assert(magic == "BHD5");
// 0 for PS3, -1 for PC
byte unk04; Assert(unk04 == 0 || unk04 == -1);
byte unk05; Assert(unk05 == 0);
byte unk06; Assert(unk06 == 0);
byte unk07; Assert(unk07 == 0);
int unk08; Assert(unk08 == 1);
int fileSize <format=hex>;
int bucketCount;
int bucketsOffset <format=hex>; Assert(bucketsOffset == 0x18);
} Header <bgcolor=cLtRed>;
typedef struct (Header& header) {
int fileNameHash <format=hex>;
int fileSize <format=hex>;
quad fileOffset <format=hex>;
} FileHeader <read=ReadFileHeader, bgcolor=cAqua, optimize=false>;
string ReadFileHeader(FileHeader& header) {
string str;
SPrintf(str, "%08X : %8X+%X",
header.fileNameHash, header.fileOffset, header.fileSize);
return str;
}
typedef struct (Header& header) {
int fileHeaderCount;
int fileHeadersOffset <format=hex>;
if (fileHeaderCount > 0) {
local quad pos <hidden=true> = FTell();
FSeek(fileHeadersOffset);
struct {
FileHeader fileHeaders(header)[fileHeaderCount];
} fileHeaders;
FSeek(pos);
}
} Bucket <read=ReadBucket, bgcolor=cLtGreen, optimize=false>;
string ReadBucket(Bucket& bucket) {
string str;
SPrintf(str, "[%2i]", bucket.fileHeaderCount);
return str;
}
Header header;
struct {
Bucket buckets(header)[header.bucketCount];
} buckets;