diff --git a/PKHeX.Core/Editing/Saves/Slots/SlotChange.cs b/PKHeX.Core/Editing/Saves/Slots/SlotChange.cs
index 95fd31518..dc793244d 100644
--- a/PKHeX.Core/Editing/Saves/Slots/SlotChange.cs
+++ b/PKHeX.Core/Editing/Saves/Slots/SlotChange.cs
@@ -5,9 +5,6 @@
/// Parent of the object that initiated the slot change.
public object Parent { get; set; }
- /// Original Data of the slot.
- public byte[] OriginalData { get; set; }
-
public int Slot { get; set; } = -1;
public int Box { get; set; } = -1;
public PKM PKM { get; set; }
diff --git a/PKHeX.Core/Editing/Saves/Slots/SlotChangeInfo.cs b/PKHeX.Core/Editing/Saves/Slots/SlotChangeInfo.cs
index 24dc65c7e..05272f8e2 100644
--- a/PKHeX.Core/Editing/Saves/Slots/SlotChangeInfo.cs
+++ b/PKHeX.Core/Editing/Saves/Slots/SlotChangeInfo.cs
@@ -12,11 +12,11 @@
public SlotChange Source { get; set; }
public SlotChange Destination { get; set; }
- private readonly byte[] BlankData;
+ private readonly PKM Blank;
public SlotChangeInfo(SaveFile sav)
{
- BlankData = sav.BlankPKM.EncryptedPartyData;
+ Blank = sav.BlankPKM;
Reset();
}
@@ -25,7 +25,7 @@
public void Reset()
{
LeftMouseIsDown = RightMouseIsDown = DragDropInProgress = false;
- Source = new SlotChange { OriginalData = BlankData };
+ Source = new SlotChange { PKM = Blank };
Destination = new SlotChange();
Cursor = CurrentPath = null;
}
diff --git a/PKHeX.Core/Saves/SAV1.cs b/PKHeX.Core/Saves/SAV1.cs
index 8a98e2698..e746f948c 100644
--- a/PKHeX.Core/Saves/SAV1.cs
+++ b/PKHeX.Core/Saves/SAV1.cs
@@ -453,14 +453,14 @@ namespace PKHeX.Core
// Don't allow for custom box names
}
- public override PKM GetPKM(byte[] data)
+ protected override PKM GetPKM(byte[] data)
{
if (data.Length == SIZE_STORED)
return new PokeList1(data, PokeListType.Single, Japanese)[0];
return new PK1(data);
}
- public override byte[] DecryptPKM(byte[] data)
+ protected override byte[] DecryptPKM(byte[] data)
{
return data;
}
diff --git a/PKHeX.Core/Saves/SAV2.cs b/PKHeX.Core/Saves/SAV2.cs
index c68ca6179..5a3a1709e 100644
--- a/PKHeX.Core/Saves/SAV2.cs
+++ b/PKHeX.Core/Saves/SAV2.cs
@@ -487,14 +487,14 @@ namespace PKHeX.Core
SetData(data, Offsets.BoxNames + (box * len));
}
- public override PKM GetPKM(byte[] data)
+ protected override PKM GetPKM(byte[] data)
{
if (data.Length == SIZE_STORED)
return new PokeList2(data, PokeListType.Single, Japanese)[0];
return new PK2(data);
}
- public override byte[] DecryptPKM(byte[] data)
+ protected override byte[] DecryptPKM(byte[] data)
{
return data;
}
diff --git a/PKHeX.Core/Saves/SAV3.cs b/PKHeX.Core/Saves/SAV3.cs
index 7482f2dc4..09a377ff1 100644
--- a/PKHeX.Core/Saves/SAV3.cs
+++ b/PKHeX.Core/Saves/SAV3.cs
@@ -708,12 +708,12 @@ namespace PKHeX.Core
SetString(value, 8).CopyTo(Data, offset + (box * 9));
}
- public override PKM GetPKM(byte[] data)
+ protected override PKM GetPKM(byte[] data)
{
return new PK3(data);
}
- public override byte[] DecryptPKM(byte[] data)
+ protected override byte[] DecryptPKM(byte[] data)
{
return PKX.DecryptArray3(data);
}
diff --git a/PKHeX.Core/Saves/SAV3Colosseum.cs b/PKHeX.Core/Saves/SAV3Colosseum.cs
index 0cf7b39a1..22495db68 100644
--- a/PKHeX.Core/Saves/SAV3Colosseum.cs
+++ b/PKHeX.Core/Saves/SAV3Colosseum.cs
@@ -302,14 +302,14 @@ namespace PKHeX.Core
SetString(value, 8).CopyTo(Data, Box + (0x24A4 * box));
}
- public override PKM GetPKM(byte[] data)
+ protected override PKM GetPKM(byte[] data)
{
if (data.Length != SIZE_STORED)
Array.Resize(ref data, SIZE_STORED);
return new CK3(data);
}
- public override byte[] DecryptPKM(byte[] data)
+ protected override byte[] DecryptPKM(byte[] data)
{
return data;
}
diff --git a/PKHeX.Core/Saves/SAV3RSBox.cs b/PKHeX.Core/Saves/SAV3RSBox.cs
index 9c0855e05..c9c4212c5 100644
--- a/PKHeX.Core/Saves/SAV3RSBox.cs
+++ b/PKHeX.Core/Saves/SAV3RSBox.cs
@@ -165,14 +165,14 @@ namespace PKHeX.Core
SetData(data, offset);
}
- public override PKM GetPKM(byte[] data)
+ protected override PKM GetPKM(byte[] data)
{
if (data.Length != PKX.SIZE_3STORED)
Array.Resize(ref data, PKX.SIZE_3STORED);
return new PK3(data);
}
- public override byte[] DecryptPKM(byte[] data)
+ protected override byte[] DecryptPKM(byte[] data)
{
if (data.Length != PKX.SIZE_3STORED)
Array.Resize(ref data, PKX.SIZE_3STORED);
diff --git a/PKHeX.Core/Saves/SAV3XD.cs b/PKHeX.Core/Saves/SAV3XD.cs
index 690b92b32..8e7ae110e 100644
--- a/PKHeX.Core/Saves/SAV3XD.cs
+++ b/PKHeX.Core/Saves/SAV3XD.cs
@@ -264,20 +264,20 @@ namespace PKHeX.Core
SetString(value, 8).CopyTo(Data, GetBoxInfoOffset(box));
}
- public override PKM GetPKM(byte[] data)
+ protected override PKM GetPKM(byte[] data)
{
if (data.Length != SIZE_STORED)
Array.Resize(ref data, SIZE_STORED);
return new XK3(data);
}
- public override byte[] DecryptPKM(byte[] data) => data;
+ protected override byte[] DecryptPKM(byte[] data) => data;
public override PKM GetPartySlot(int offset) => GetStoredSlot(offset);
public override PKM GetStoredSlot(int offset)
{
// Get Shadow Data
- var pk = (XK3)GetPKM(DecryptPKM(GetData(offset, SIZE_STORED)));
+ var pk = (XK3)base.GetStoredSlot(offset);
if (pk.ShadowID > 0 && pk.ShadowID < ShadowInfo.Count)
pk.Purification = ShadowInfo[pk.ShadowID - 1].Purification;
return pk;
diff --git a/PKHeX.Core/Saves/SAV4.cs b/PKHeX.Core/Saves/SAV4.cs
index afa50a8ae..12ae2681f 100644
--- a/PKHeX.Core/Saves/SAV4.cs
+++ b/PKHeX.Core/Saves/SAV4.cs
@@ -627,12 +627,12 @@ namespace PKHeX.Core
SetData(SetString(value, 13), offset + (box * 0x28));
}
- public override PKM GetPKM(byte[] data)
+ protected override PKM GetPKM(byte[] data)
{
return new PK4(data);
}
- public override byte[] DecryptPKM(byte[] data)
+ protected override byte[] DecryptPKM(byte[] data)
{
return PKX.DecryptArray45(data);
}
diff --git a/PKHeX.Core/Saves/SAV4BR.cs b/PKHeX.Core/Saves/SAV4BR.cs
index 8b767ab2b..c3ff1bd1b 100644
--- a/PKHeX.Core/Saves/SAV4BR.cs
+++ b/PKHeX.Core/Saves/SAV4BR.cs
@@ -205,14 +205,14 @@ namespace PKHeX.Core
SetData(data, ofs);
}
- public override PKM GetPKM(byte[] data)
+ protected override PKM GetPKM(byte[] data)
{
if (data.Length != SIZE_STORED)
Array.Resize(ref data, SIZE_STORED);
return new BK4(data);
}
- public override byte[] DecryptPKM(byte[] data) => data;
+ protected override byte[] DecryptPKM(byte[] data) => data;
protected override void SetDex(PKM pkm) { /* There's no PokéDex */ }
diff --git a/PKHeX.Core/Saves/SAV5.cs b/PKHeX.Core/Saves/SAV5.cs
index 91e960e5c..d5e4e8f72 100644
--- a/PKHeX.Core/Saves/SAV5.cs
+++ b/PKHeX.Core/Saves/SAV5.cs
@@ -262,12 +262,12 @@ namespace PKHeX.Core
set { }
}
- public override PKM GetPKM(byte[] data)
+ protected override PKM GetPKM(byte[] data)
{
return new PK5(data);
}
- public override byte[] DecryptPKM(byte[] data)
+ protected override byte[] DecryptPKM(byte[] data)
{
return PKX.DecryptArray45(data);
}
diff --git a/PKHeX.Core/Saves/SAV6.cs b/PKHeX.Core/Saves/SAV6.cs
index 09623a20c..300ea8179 100644
--- a/PKHeX.Core/Saves/SAV6.cs
+++ b/PKHeX.Core/Saves/SAV6.cs
@@ -778,7 +778,7 @@ namespace PKHeX.Core
SetData(Encoding.Unicode.GetBytes(value.PadRight(LongStringLength / 2, '\0')), PCLayout + (LongStringLength * box));
}
- public override PKM GetPKM(byte[] data)
+ protected override PKM GetPKM(byte[] data)
{
return new PK6(data);
}
@@ -939,7 +939,7 @@ namespace PKHeX.Core
return false;
}
- public override byte[] DecryptPKM(byte[] data)
+ protected override byte[] DecryptPKM(byte[] data)
{
return PKX.DecryptArray(data);
}
diff --git a/PKHeX.Core/Saves/SAV7.cs b/PKHeX.Core/Saves/SAV7.cs
index 0d9239a8f..d2c89da00 100644
--- a/PKHeX.Core/Saves/SAV7.cs
+++ b/PKHeX.Core/Saves/SAV7.cs
@@ -967,7 +967,7 @@ namespace PKHeX.Core
Edited = true;
}
- public override PKM GetPKM(byte[] data)
+ protected override PKM GetPKM(byte[] data)
{
return new PK7(data);
}
@@ -1233,7 +1233,7 @@ namespace PKHeX.Core
return false;
}
- public override byte[] DecryptPKM(byte[] data)
+ protected override byte[] DecryptPKM(byte[] data)
{
return PKX.DecryptArray(data);
}
diff --git a/PKHeX.Core/Saves/SAV7b.cs b/PKHeX.Core/Saves/SAV7b.cs
index 0f3b6b7e8..3237af185 100644
--- a/PKHeX.Core/Saves/SAV7b.cs
+++ b/PKHeX.Core/Saves/SAV7b.cs
@@ -170,8 +170,8 @@ namespace PKHeX.Core
public override bool GetCaught(int species) => Zukan.GetCaught(species);
public override bool GetSeen(int species) => Zukan.GetSeen(species);
- public override PKM GetPKM(byte[] data) => new PB7(data);
- public override byte[] DecryptPKM(byte[] data) => PKX.DecryptArray(data);
+ protected override PKM GetPKM(byte[] data) => new PB7(data);
+ protected override byte[] DecryptPKM(byte[] data) => PKX.DecryptArray(data);
public override int GetBoxOffset(int box) => Box + (box * BoxSlotCount * SIZE_STORED);
protected override IList[] SlotPointers => new[] { Storage.PokeListInfo };
diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs
index 8b9c9f4d7..8d3df66c9 100644
--- a/PKHeX.Core/Saves/SaveFile.cs
+++ b/PKHeX.Core/Saves/SaveFile.cs
@@ -38,9 +38,9 @@ namespace PKHeX.Core
// General PKM Properties
public abstract Type PKMType { get; }
- public abstract PKM GetPKM(byte[] data);
+ protected abstract PKM GetPKM(byte[] data);
+ protected abstract byte[] DecryptPKM(byte[] data);
public abstract PKM BlankPKM { get; }
- public abstract byte[] DecryptPKM(byte[] data);
public abstract int SIZE_STORED { get; }
protected abstract int SIZE_PARTY { get; }
public abstract int MaxEV { get; }
@@ -596,11 +596,7 @@ namespace PKHeX.Core
=> SetPartySlot(pkm, GetPartyOffset(index), trade, dex);
public virtual PKM GetPartySlot(int offset) => GetPKM(DecryptPKM(GetData(offset, SIZE_PARTY)));
-
- public virtual PKM GetStoredSlot(int offset)
- {
- return GetPKM(DecryptPKM(GetData(offset, SIZE_STORED)));
- }
+ public virtual PKM GetStoredSlot(int offset) => GetPKM(DecryptPKM(GetData(offset, SIZE_STORED)));
public void SetPartySlot(PKM pkm, int offset, PKMImportSetting trade = PKMImportSetting.UseDefault, PKMImportSetting dex = PKMImportSetting.UseDefault)
{
diff --git a/PKHeX.Core/Saves/Storage/BulkStorage.cs b/PKHeX.Core/Saves/Storage/BulkStorage.cs
index 08c8043bd..b6da3dfd0 100644
--- a/PKHeX.Core/Saves/Storage/BulkStorage.cs
+++ b/PKHeX.Core/Saves/Storage/BulkStorage.cs
@@ -36,8 +36,8 @@ namespace PKHeX.Core
public override Type PKMType => blank.GetType();
public override PKM BlankPKM => blank.Clone();
- public override PKM GetPKM(byte[] data) => PKMConverter.GetPKMfromBytes(data, prefer: Generation);
- public override byte[] DecryptPKM(byte[] data) => GetPKM(data).Data;
+ protected override PKM GetPKM(byte[] data) => PKMConverter.GetPKMfromBytes(data, prefer: Generation);
+ protected override byte[] DecryptPKM(byte[] data) => GetPKM(data).Data;
public override int SIZE_STORED => blank.SIZE_STORED;
protected override int SIZE_PARTY => blank.SIZE_PARTY;
diff --git a/PKHeX.Core/Saves/Storage/SAV4Ranch.cs b/PKHeX.Core/Saves/Storage/SAV4Ranch.cs
index e08cf5905..beda23d62 100644
--- a/PKHeX.Core/Saves/Storage/SAV4Ranch.cs
+++ b/PKHeX.Core/Saves/Storage/SAV4Ranch.cs
@@ -20,8 +20,8 @@ namespace PKHeX.Core
public override string Extension => ".bin";
public override string Filter { get; } = "Ranch G4 Storage|*.bin*";
- public override PKM GetPKM(byte[] data) => new PK4(data);
- public override byte[] DecryptPKM(byte[] data) => PKX.DecryptArray45(data);
+ protected override PKM GetPKM(byte[] data) => new PK4(data);
+ protected override byte[] DecryptPKM(byte[] data) => PKX.DecryptArray45(data);
public override StorageSlotFlag GetSlotFlags(int index) => index >= SlotCount ? StorageSlotFlag.Locked : StorageSlotFlag.None;
protected override bool IsSlotSwapProtected(int box, int slot) => IsSlotOverwriteProtected(box, slot);
diff --git a/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs b/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs
index 5f37e0b06..2e59ed455 100644
--- a/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs
+++ b/PKHeX.WinForms/Controls/SAV Editor/SlotChangeManager.cs
@@ -247,7 +247,7 @@ namespace PKHeX.WinForms.Controls
// Prepare Data
DragInfo.Source = GetViewParent(pb).GetSlotData(pb);
- DragInfo.Source.OriginalData = SAV.GetData(DragInfo.Source.Offset, SAV.SIZE_STORED);
+ DragInfo.Source.PKM = SAV.GetStoredSlot(DragInfo.Source.Offset);
// Make a new file name based off the PID
string newfile = CreateDragDropPKM(pb, encrypt, out bool external);
@@ -272,11 +272,8 @@ namespace PKHeX.WinForms.Controls
private string CreateDragDropPKM(PictureBox pb, bool encrypt, out bool external)
{
- byte[] dragdata = SAV.DecryptPKM(DragInfo.Source.OriginalData);
- Array.Resize(ref dragdata, SAV.SIZE_STORED);
-
// Make File
- PKM pk = SAV.GetPKM(dragdata);
+ PKM pk = DragInfo.Source.PKM;
string newfile = FileUtil.GetPKMTempFileName(pk, encrypt);
try
{
diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_FestivalPlaza.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_FestivalPlaza.cs
index 946a62891..5e8045003 100644
--- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_FestivalPlaza.cs
+++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_FestivalPlaza.cs
@@ -278,9 +278,9 @@ namespace PKHeX.WinForms
private void LoadBattleAgency()
{
- p[0] = SAV.GetPKM(SAV.DecryptPKM(SAV.GetData(0x6C200, 0xE8)));
- p[1] = SAV.GetPKM(SAV.DecryptPKM(SAV.GetData(0x6C2E8, 0x104)));
- p[2] = SAV.GetPKM(SAV.DecryptPKM(SAV.GetData(0x6C420, 0x104)));
+ p[0] = SAV.GetStoredSlot(0x6C200);
+ p[1] = SAV.GetPartySlot(0x6C2E8);
+ p[2] = SAV.GetPartySlot(0x6C420);
LoadPictureBox();
B_ImportParty.Visible = SAV.HasParty;
CHK_Choosed.Checked = SAV.GetFlag(0x6C55E, 1);