From 5f4bbcf8de2ef62e45e8319d6a3d38a6eae35a67 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 13 Apr 2022 10:42:35 -0700 Subject: [PATCH] Permit 0x1FF00 saves as stadium saves Closes #3479 emulators are stupid --- PKHeX.Core/Saves/SAV1Stadium.cs | 2 +- PKHeX.Core/Saves/SAV2Stadium.cs | 2 +- PKHeX.Core/Saves/Util/SaveUtil.cs | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/PKHeX.Core/Saves/SAV1Stadium.cs b/PKHeX.Core/Saves/SAV1Stadium.cs index 2167916bd..406bee4de 100644 --- a/PKHeX.Core/Saves/SAV1Stadium.cs +++ b/PKHeX.Core/Saves/SAV1Stadium.cs @@ -270,7 +270,7 @@ namespace PKHeX.Core public static bool IsStadium(ReadOnlySpan data) { - if (data.Length != SaveUtil.SIZE_G1STAD) + if (data.Length is not (SaveUtil.SIZE_G1STAD or SaveUtil.SIZE_G1STADF)) return false; if (IsStadiumU(data)) return true; diff --git a/PKHeX.Core/Saves/SAV2Stadium.cs b/PKHeX.Core/Saves/SAV2Stadium.cs index 38446fe06..f183b88f5 100644 --- a/PKHeX.Core/Saves/SAV2Stadium.cs +++ b/PKHeX.Core/Saves/SAV2Stadium.cs @@ -177,7 +177,7 @@ namespace PKHeX.Core public static bool IsStadium(ReadOnlySpan data) { - if (data.Length != SaveUtil.SIZE_G2STAD) + if (data.Length is not (SaveUtil.SIZE_G2STAD or SaveUtil.SIZE_G2STADF)) return false; return StadiumUtil.IsMagicPresentEither(data, TeamSize, MAGIC_FOOTER); } diff --git a/PKHeX.Core/Saves/Util/SaveUtil.cs b/PKHeX.Core/Saves/Util/SaveUtil.cs index abfab3cb3..dad2b1ba7 100644 --- a/PKHeX.Core/Saves/Util/SaveUtil.cs +++ b/PKHeX.Core/Saves/Util/SaveUtil.cs @@ -49,6 +49,7 @@ namespace PKHeX.Core public const int SIZE_G3RAW = 0x20000; public const int SIZE_G3RAWHALF = 0x10000; public const int SIZE_G2STAD = 0x20000; // same as G3RAW_U + public const int SIZE_G2STADF = 0x1FF00; public const int SIZE_G2RAW_U = 0x8000; public const int SIZE_G2VC_U = 0x8010; public const int SIZE_G2BAT_U = 0x802C; @@ -58,6 +59,7 @@ namespace PKHeX.Core public const int SIZE_G2BAT_J = 0x1002C; public const int SIZE_G2EMU_J = 0x10030; public const int SIZE_G1STAD = 0x20000; // same as G3RAW_U + public const int SIZE_G1STADF = 0x1FF00; public const int SIZE_G1STADJ = 0x8000; // same as G1RAW public const int SIZE_G1RAW = 0x8000; public const int SIZE_G1BAT = 0x802C;