From 2296d34df3e86846f05b202a0184a6709eb3f577 Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 24 Apr 2024 19:24:49 -0500 Subject: [PATCH] Gen1/2: Fix party read Oopsie false->true ez Closes #4253 --- PKHeX.Core/Saves/SAV1.cs | 4 ++-- PKHeX.Core/Saves/SAV2.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PKHeX.Core/Saves/SAV1.cs b/PKHeX.Core/Saves/SAV1.cs index 56b154b5d..c12fac25c 100644 --- a/PKHeX.Core/Saves/SAV1.cs +++ b/PKHeX.Core/Saves/SAV1.cs @@ -95,7 +95,7 @@ private void Initialize(GameVersion versionOverride) var ofs = Offsets.Party; var src = Data.AsSpan(ofs, SIZE_PARTY_LIST); var dest = PartyBuffer[GetPartyOffset(0)..]; - PokeList1.Unpack(src, dest, StringLength, 6, false); + PokeList1.Unpack(src, dest, StringLength, 6, true); } ReadOnlySpan rawDC = Data.AsSpan(Offsets.Daycare, 0x38); @@ -183,7 +183,7 @@ private int GetBoxRawDataOffset(int box) protected override SAV1 CloneInternal() => new(Write(), Version) { Language = Language }; protected override int SIZE_STORED => Japanese ? PokeCrypto.SIZE_1JLIST : PokeCrypto.SIZE_1ULIST; - protected override int SIZE_PARTY => Japanese ? PokeCrypto.SIZE_1JLIST : PokeCrypto.SIZE_1ULIST; + protected override int SIZE_PARTY => SIZE_STORED; private int SIZE_BOX_AS_SINGLES => BoxSlotCount * SIZE_STORED; private int SIZE_BOX_LIST => (((StringLength * 2) + PokeCrypto.SIZE_1STORED + 1) * BoxSlotCount) + 2; private int SIZE_PARTY_LIST => (((StringLength * 2) + PokeCrypto.SIZE_1PARTY + 1) * 6) + 2; diff --git a/PKHeX.Core/Saves/SAV2.cs b/PKHeX.Core/Saves/SAV2.cs index a81e88b75..70a47c59e 100644 --- a/PKHeX.Core/Saves/SAV2.cs +++ b/PKHeX.Core/Saves/SAV2.cs @@ -99,7 +99,7 @@ private void Initialize() var ofs = Offsets.Party; var src = Data.AsSpan(ofs, SIZE_PARTY_LIST); var dest = PartyBuffer[GetPartyOffset(0)..]; - PokeList2.Unpack(src, dest, StringLength, 6, false); + PokeList2.Unpack(src, dest, StringLength, 6, true); } if (Offsets.Daycare >= 0) @@ -229,11 +229,11 @@ protected override byte[] GetFinalData() protected override SAV2 CloneInternal() => new(Write(), Version) { Language = Language }; protected override int SIZE_STORED => Japanese ? PokeCrypto.SIZE_2JLIST : PokeCrypto.SIZE_2ULIST; - protected override int SIZE_PARTY => Japanese ? PokeCrypto.SIZE_2JLIST : PokeCrypto.SIZE_2ULIST; + protected override int SIZE_PARTY => SIZE_STORED; public override PK2 BlankPKM => new(jp: Japanese); public override Type PKMType => typeof(PK2); - private int SIZE_BOX_AS_SINGLES => BoxSlotCount*SIZE_STORED; + private int SIZE_BOX_AS_SINGLES => BoxSlotCount * SIZE_STORED; private int SIZE_BOX_LIST => (((StringLength * 2) + PokeCrypto.SIZE_2STORED + 1) * BoxSlotCount) + 2; private int SIZE_PARTY_LIST => (((StringLength * 2) + PokeCrypto.SIZE_2PARTY + 1) * 6) + 2; @@ -558,7 +558,7 @@ private int GetDaycareOffset(int index) } public int DaycareSlotCount => 2; - private int GetDaycareSlotOffset(int slot) => GetPartyOffset(7 + (slot * 2)); + private int GetDaycareSlotOffset(int slot) => GetPartyOffset(6 + slot); public Memory GetDaycareSlot(int slot) => Reserved.AsMemory(GetDaycareSlotOffset(slot), SIZE_STORED); public Memory GetDaycareEgg() => Reserved.AsMemory(GetDaycareSlotOffset(2), SIZE_STORED); public bool IsDaycareOccupied(int slot) => (DaycareFlagByte(slot) & 1) != 0;