diff --git a/PKHeX.Core/Saves/SAV4.cs b/PKHeX.Core/Saves/SAV4.cs index 97d269bc4..a2dd9fa09 100644 --- a/PKHeX.Core/Saves/SAV4.cs +++ b/PKHeX.Core/Saves/SAV4.cs @@ -454,13 +454,8 @@ namespace PKHeX.Core public override uint SecondsToStart { get => BitConverter.ToUInt32(General, AdventureInfo + 0x34); set => BitConverter.GetBytes(value).CopyTo(General, AdventureInfo + 0x34); } public override uint SecondsToFame { get => BitConverter.ToUInt32(General, AdventureInfo + 0x3C); set => BitConverter.GetBytes(value).CopyTo(General, AdventureInfo + 0x3C); } - public override PKM GetStoredSlot(int offset) - { - var bank = Storage; // terrible todo hack - if (offset == GTS || offset == GetDaycareSlotOffset(0, 0) || offset == GetDaycareSlotOffset(0, 1)) - bank = General; - return GetDecryptedPKM(bank.Slice(offset, SIZE_STORED)); - } + public override PKM GetStoredSlot(int offset) => GetDecryptedPKM(General.Slice(offset, SIZE_STORED)); + public override PKM GetBoxSlot(int offset) => GetDecryptedPKM(Storage.Slice(offset, SIZE_STORED)); protected override PKM GetPKM(byte[] data) => new PK4(data); protected override byte[] DecryptPKM(byte[] data) => PKX.DecryptArray45(data); diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs index 59ceee54a..93b6ba5bb 100644 --- a/PKHeX.Core/Saves/SaveFile.cs +++ b/PKHeX.Core/Saves/SaveFile.cs @@ -454,6 +454,7 @@ namespace PKHeX.Core public virtual PKM GetDecryptedPKM(byte[] data) => GetPKM(DecryptPKM(data)); public virtual PKM GetPartySlot(int offset) => GetDecryptedPKM(GetData(offset, SIZE_PARTY)); public virtual PKM GetStoredSlot(int offset) => GetDecryptedPKM(GetData(offset, SIZE_STORED)); + public virtual PKM GetBoxSlot(int offset) => GetStoredSlot(offset); protected virtual void WritePartySlot(PKM pkm, int offset) => SetData(pkm.EncryptedPartyData, offset); protected virtual void WriteStoredSlot(PKM pkm, int offset) => SetData(pkm.EncryptedBoxData, offset); @@ -622,7 +623,7 @@ namespace PKHeX.Core #region Storage Offsets and Indexing public abstract int GetBoxOffset(int box); public int GetBoxSlotOffset(int box, int slot) => GetBoxOffset(box) + (slot * SIZE_STORED); - public PKM GetBoxSlotAtIndex(int box, int slot) => GetStoredSlot(GetBoxSlotOffset(box, slot)); + public PKM GetBoxSlotAtIndex(int box, int slot) => GetBoxSlot(GetBoxSlotOffset(box, slot)); public void GetBoxSlotFromIndex(int index, out int box, out int slot) { @@ -816,7 +817,7 @@ namespace PKHeX.Core continue; if (deleteCriteria != null) { - var pk = GetStoredSlot(ofs); + var pk = GetBoxSlotAtIndex(i, p); if (!deleteCriteria(pk)) continue; }