mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-10 22:00:16 -05:00
Update box format size get
fixes importing and exporting concatenated binaries
This commit is contained in:
parent
c87674fd6d
commit
19784aaa41
|
|
@ -793,7 +793,7 @@ public int ClearBoxes(int BoxStart = 0, int BoxEnd = -1, Func<PKM, bool>? delete
|
|||
if (BoxEnd < 0)
|
||||
BoxEnd = BoxCount - 1;
|
||||
|
||||
var blank = BlankPKM.EncryptedBoxData;
|
||||
var blank = GetDataForBox(BlankPKM);
|
||||
int deleted = 0;
|
||||
for (int i = BoxStart; i <= BoxEnd; i++)
|
||||
{
|
||||
|
|
@ -877,15 +877,15 @@ public virtual void SetBoxWallpaper(int box, int value)
|
|||
#endregion
|
||||
|
||||
#region Box Binaries
|
||||
public byte[] GetPCBinary() => BoxData.SelectMany(pk => pk.EncryptedBoxData).ToArray();
|
||||
public byte[] GetBoxBinary(int box) => GetBoxData(box).SelectMany(pk => pk.EncryptedBoxData).ToArray();
|
||||
public byte[] GetPCBinary() => BoxData.SelectMany(pk => GetDataForBox(BlankPKM)).ToArray();
|
||||
public byte[] GetBoxBinary(int box) => GetBoxData(box).SelectMany(pk => GetDataForBox(BlankPKM)).ToArray();
|
||||
|
||||
public bool SetPCBinary(byte[] data)
|
||||
{
|
||||
if (IsRegionOverwriteProtected(0, SlotCount))
|
||||
return false;
|
||||
|
||||
int expectLength = SlotCount * BlankPKM.EncryptedBoxData.Length;
|
||||
int expectLength = SlotCount * GetDataForBox(BlankPKM).Length;
|
||||
return SetConcatenatedBinary(data, expectLength);
|
||||
}
|
||||
|
||||
|
|
@ -897,7 +897,7 @@ public bool SetBoxBinary(byte[] data, int box)
|
|||
if (IsRegionOverwriteProtected(start, end))
|
||||
return false;
|
||||
|
||||
int expectLength = BoxSlotCount * BlankPKM.EncryptedBoxData.Length;
|
||||
int expectLength = BoxSlotCount * GetDataForBox(BlankPKM).Length;
|
||||
return SetConcatenatedBinary(data, expectLength, start);
|
||||
}
|
||||
|
||||
|
|
@ -907,7 +907,7 @@ private bool SetConcatenatedBinary(byte[] data, int expectLength, int start = 0)
|
|||
return false;
|
||||
|
||||
var BD = BoxData;
|
||||
var entryLength = BlankPKM.EncryptedBoxData.Length;
|
||||
var entryLength = GetDataForBox(BlankPKM).Length;
|
||||
var pkdata = ArrayUtil.EnumerateSplit(data, entryLength);
|
||||
pkdata.Select(GetPKM).CopyTo(BD, IsSlotOverwriteProtected, start);
|
||||
BoxData = BD;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user