mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
Add gen3 pk3 encryption detection
pokebox gba can export encrypted, just recalc the checksum and if invalid try decrypting.
This commit is contained in:
parent
1b3294c8b3
commit
623b836cdf
1 changed files with 8 additions and 1 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue