From 8b68a07dbdb1abbef7cfd52a1a52c3e32f48d19f Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 13 May 2024 00:16:29 -0500 Subject: [PATCH] SAV1: Use current box span for source of boxdata Maybe only a GSC thing where Stadium 2 doesn't know better? --- PKHeX.Core/Saves/SAV1.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/PKHeX.Core/Saves/SAV1.cs b/PKHeX.Core/Saves/SAV1.cs index 936e21b19..693ef39d7 100644 --- a/PKHeX.Core/Saves/SAV1.cs +++ b/PKHeX.Core/Saves/SAV1.cs @@ -85,10 +85,12 @@ public sealed class SAV1 : SaveFile, ILangDeviantSave, IEventFlagArray, IEventWo var dest = BoxBuffer[(i * SIZE_BOX_AS_SINGLES)..]; PokeList1.Unpack(src, dest, StringLength, capacity, false); } - - // Don't treat the CurrentBox segment as valid; Stadium ignores it and will de-synchronize it. - // The main box data segment is the truth, the CurrentBox copy is not always up-to-date. - // When exporting an updated save file in this program, be nice and re-synchronize. + if (CurrentBox < BoxCount) // Load Current Box + { + var src = Data.AsSpan(Offsets.CurrentBox, stored); + var dest = BoxBuffer[(CurrentBox * SIZE_BOX_AS_SINGLES)..]; + PokeList1.Unpack(src, dest, StringLength, capacity, false); + } // Stash party immediately after. {