From 3f49a01ae844fc42effe6daf0c9940ef74e58658 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 4 Jul 2024 18:42:27 -0500 Subject: [PATCH] Sanity check save file personal info https://projectpokemon.org/home/forums/topic/65409-2-exception-logs-found-on-latest-pkhex/?do=findComment&comment=290422 --- PKHeX.Core/Legality/LegalityAnalysis.cs | 2 +- PKHeX.Drawing.PokeSprite/Util/SpriteUtil.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/PKHeX.Core/Legality/LegalityAnalysis.cs b/PKHeX.Core/Legality/LegalityAnalysis.cs index 6316bfde9..06db5a554 100644 --- a/PKHeX.Core/Legality/LegalityAnalysis.cs +++ b/PKHeX.Core/Legality/LegalityAnalysis.cs @@ -1,4 +1,4 @@ -//#define SUPPRESS +#define SUPPRESS using System; using System.Collections.Generic; diff --git a/PKHeX.Drawing.PokeSprite/Util/SpriteUtil.cs b/PKHeX.Drawing.PokeSprite/Util/SpriteUtil.cs index 916f3da7d..95023bb04 100644 --- a/PKHeX.Drawing.PokeSprite/Util/SpriteUtil.cs +++ b/PKHeX.Drawing.PokeSprite/Util/SpriteUtil.cs @@ -110,7 +110,10 @@ public static class SpriteUtil } if (flagIllegal) { - var la = new LegalityAnalysis(pk, sav.Personal, storage); + var la = pk.GetType() == sav.PKMType // quick sanity check + ? new LegalityAnalysis(pk, sav.Personal, storage) + : new LegalityAnalysis(pk, pk.PersonalInfo, storage); + if (!la.Valid) sprite = ImageUtil.LayerImage(sprite, Resources.warn, 0, FlagIllegalShiftY); else if (pk.Format >= 8 && MoveInfo.IsDummiedMoveAny(pk))