-
Notifications
You must be signed in to change notification settings - Fork 0
/
UPKFile.bt
199 lines (169 loc) · 4.04 KB
/
UPKFile.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
//------------------------------------------------
//--- 010 Editor v11.0.1 Binary Template
//
// File:
// Authors:
// Version:
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------
struct UEVersion {
uint16 FileVersion;
uint16 LicenseeVersion;
};
struct PkgVersion {
uint32 ShaderVersion;
uint32 EngineVersion;
};
struct MidwayStruct {
char FourCC[4];
uint32 EngineVersion;
uint32 CookVersion;
};
struct PackageStruct {
char MainPackage[4];
uint32 Flags;
};
struct TableStruct {
uint32 Count;
uint64 Offset;
};
struct UPKHeader {
uint32 Magic;
UEVersion EngineVersion;
uint32 DataOffset;
PkgVersion PackageVersion;
MidwayStruct MidwayTeamVersion;
PackageStruct Main;
TableStruct Names;
TableStruct Exports;
TableStruct Imports;
uint64 BulkDataOffset;
GUID FileGUID;
uint32 CompressionType;
uint32 PackagesCount;
};
struct DataStruct {
uint64 Offset;
uint64 Size;
};
struct PackageDataStruct
{
DataStruct Data;
DataStruct Package;
};
struct NameStruct {
uint32 Length;
char Name[Length];
};
struct InnerPackage {
NameStruct PackageName;
PackageDataStruct Data;
uint32 SubPackagesCount;
};
struct ExtraTable {
uint32 UNK[2];
NameStruct Name;
uint32 EntriesCount;
};
struct ExtraEntry {
uint64 DecompressedSize;
uint64 CompressedSize;
uint64 DecompressedOffset;
uint64 CompressedOffset;
};
// Loop Stuff
local uint32 i;
local uint32 j;
// Data Struct
UPKHeader MK11Header;
local uint64 TotalSubPackagesCount = 0;
struct {
struct {
local uint32 i;
local uint32 j;
for (i = 0; i < MK11Header.PackagesCount; i++)
{
struct {
InnerPackage Header;
TotalSubPackagesCount += Header.SubPackagesCount;
struct {
for (j = 0; j < Header.SubPackagesCount; j++)
{
PackageDataStruct SubPackage;
}
} Body;
} MK11FilePackage;
}
} Packages;
struct {
uint32 ExternalPackagesCount;
struct {
local uint32 i;
for (i = 0; i < ExternalPackagesCount; i++)
{
InnerPackage Package;
}
} ExternalPackages;
} MK11ExternalPackage;
char Padding[0x18];
NameStruct FileName;
struct ExtraTableEntriesStruct {
local uint32 i;
local uint32 j;
uint32 EntriesCount;
for (i = 0; i < EntriesCount; i++)
{
ExtraTable Table;
for (j = 0; j < Table.EntriesCount; j++)
{
ExtraEntry Entry;
}
uint32 CompressionType;
}
};
ExtraTableEntriesStruct PSFData;
ExtraTableEntriesStruct BulkData;
} MK11Body;
struct CompressionStruct {
uint64 Compressed;
uint64 Decompressed;
};
struct Segment {
uint32 Magic;
uint32 UNK;
uint64 BlockSize;
CompressionStruct SegmentData;
};
struct {
for (i = 0; i < TotalSubPackagesCount; i++)
{
struct {
Segment SegmentHeader;
local uint64 total = 0;
local uint64 i;
local uint64 j = 0;
struct {
struct {
while (total < SegmentHeader.SegmentData.Decompressed)
{
CompressionStruct SegmentData;
total += SegmentData.Decompressed;
j++;
}
} Header;
struct {
for (i = 0; i < j; i++)
{
struct {
ubyte Data[Header.SegmentData[i].Compressed];
} Data;
}
} Body;
} SegmentBody;
} Block;
}
} MK11Data;