Change decrypted check for gen4/5

pkm files with bad checksums (bad data || modifier by the program <---)
trigger decryption; just check unused bytes like for gen6/7.
This commit is contained in:
Kurt
2016-12-30 23:09:35 -08:00
parent 7eee266f17
commit 4bfaf27e5f

View File

@@ -248,12 +248,11 @@ internal static void checkEncrypted(ref byte[] pkm)
case 5:
if (BitConverter.ToUInt16(pkm, 4) != 0) // BK4
return;
for (int i = 8; i < PKX.SIZE_4STORED; i += 2)
chk += BitConverter.ToUInt16(pkm, i);
if (chk != BitConverter.ToUInt16(pkm, 0x06))
if (BitConverter.ToUInt32(pkm, 0x64) != 0)
pkm = PKX.decryptArray45(pkm);
return;
case 6:
case 7:
if (BitConverter.ToUInt16(pkm, 0xC8) != 0 && BitConverter.ToUInt16(pkm, 0x58) != 0)
pkm = PKX.decryptArray(pkm);
return;