Allow detection of ek6/ek7/eb7 from bytes

This commit is contained in:
Kurt
2022-06-14 17:29:47 -07:00
parent 2ed1fc1e86
commit 15c4e96097

View File

@@ -48,11 +48,7 @@ private static EntityFormatDetected GetFormat67_PGT(ReadOnlySpan<byte> data)
private static bool IsFormat67(ReadOnlySpan<byte> data)
{
if (ReadUInt16LittleEndian(data[0x04..]) != 0) // Bad Sanity?
return false; // non-zero ItemID
if (ReadUInt16LittleEndian(data[0x06..]) == GetCHK(data, SIZE_6STORED))
return true;
if (ReadUInt16LittleEndian(data[0x58..]) != 0) // Not encrypted terminator
return false;
return false; // PGT with non-zero ItemID
// PGT files have the last 0x10 bytes 00; PK6/etc will have data here.
var tail = data[..^0x10];
@@ -61,6 +57,9 @@ private static bool IsFormat67(ReadOnlySpan<byte> data)
if (b != 0)
return true;
}
if (ReadUInt16LittleEndian(data[0x06..]) == GetCHK(data, SIZE_6STORED))
return true; // decrypted
return false;
}