mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
Fix sav4 stored slot redirect
all Get*Slot fetches are now used like the Set*Slot methods. https://projectpokemon.org/home/forums/topic/55067-box-2-bug/?do=findComment&comment=249136
This commit is contained in:
parent
02014273b8
commit
ea5b498f8f
2 changed files with 5 additions and 9 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue