From 623b836cdfef1f088e32c74b998aef75d1f22ef1 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 19 Mar 2017 15:54:16 -0700 Subject: [PATCH] Add gen3 pk3 encryption detection pokebox gba can export encrypted, just recalc the checksum and if invalid try decrypting. --- PKHeX/PKM/PKMConverter.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PKHeX/PKM/PKMConverter.cs b/PKHeX/PKM/PKMConverter.cs index 6da5762e1..251d27857 100644 --- a/PKHeX/PKM/PKMConverter.cs +++ b/PKHeX/PKM/PKMConverter.cs @@ -297,7 +297,14 @@ namespace PKHeX.Core switch (format) { 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; case 4: case 5: