Skip to content

Commit 87d7604

Browse files
committed
tank: support version 12 trg
1 parent 5ff9103 commit 87d7604

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

TACTLib/Core/Product/Tank/ResourceGraph.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,13 @@ public uint GetNonEncryptedMagic() {
117117
}
118118

119119
public byte GetVersion() {
120-
var shift = IsPost217(this) ? 25 : 24; // todo: why?
120+
var shift = 24;
121+
if (Is217(this)) shift = 25; // todo: why did this happen
121122

122123
var magic = GetNonEncryptedMagic();
123124
var version = magic >> shift;
124125

125-
// if we see version lower than 11 with new shift, build check is wrong
126+
// if we see version lower than 11 with s17 shift, build check is wrong
126127
Debug.Assert(shift < 25 || version >= 11);
127128
return (byte)version;
128129
}
@@ -234,8 +235,9 @@ public static bool IsPre212(TRGHeader header) {
234235
return header.m_buildVersion < 128702; // 128702 = 2.12 on pro
235236
}
236237

237-
public static bool IsPost217(TRGHeader header) {
238-
return header.m_buildVersion >= 139475; // 139475 = 2.17 on pro
238+
public static bool Is217(TRGHeader header) {
239+
return header.m_buildVersion >= 139475 && // 139475 = 2.17 on pro
240+
header.m_buildVersion < 141395; // 141395 = 2.18 on pro
239241
}
240242

241243
public ResourceGraph(ClientHandler client, Stream stream, string name) {
@@ -251,14 +253,15 @@ public ResourceGraph(ClientHandler client, Stream stream, string name) {
251253
}
252254

253255
var version = m_header.GetVersion();
254-
if (version is < 5 or > 11) {
255-
throw new UnsupportedBuildVersionException($"unable to parse TRG. invalid version {version}, expected 5, 6, 7, 8, 9, 10, or 11");
256+
if (version is < 5 or > 12) {
257+
throw new UnsupportedBuildVersionException($"unable to parse TRG. invalid version {version}, expected 5, 6, 7, 8, 9, 10, 11 or 12");
256258
}
257259

258260
// version 7: type bundle index added
259261
// version 10: added extra entries to skin assets.. for trg runtime overrides (instead of on the skin asset)
260262
// version 11: 2 new header fields, unknown
261263
// s17: no version change but 1 bit was stolen from magic (shift for version number changed)...
264+
// version 12(s18): shift change undone, graph changed to raise size limit
262265

263266
var isEnc = m_header.IsEncrypted();
264267

0 commit comments

Comments
 (0)