mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-25 21:40:03 -05:00
Allow detection of ek6/ek7/eb7 from bytes
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user