Add gen3 pk3 encryption detection

pokebox gba can export encrypted, just recalc the checksum and if
invalid try decrypting.
This commit is contained in:
Kurt 2017-03-19 15:54:16 -07:00
parent 1b3294c8b3
commit 623b836cdf

View file

@ -297,7 +297,14 @@ namespace PKHeX.Core
switch (format) switch (format)
{ {
case 1: case 1:
case 3: // TOneverDO, nobody exports encrypted pk3s case 2: // no encryption
return;
case 3:
ushort chk = 0;
for (int i = 0x20; i < PKX.SIZE_3STORED; i += 2)
chk += BitConverter.ToUInt16(pkm, i);
if (chk != BitConverter.ToUInt16(pkm, 0x1C))
pkm = PKX.decryptArray3(pkm);
return; return;
case 4: case 4:
case 5: case 5: