Fix cxd pouch write, bk4 pid reads

Closes #3429
This commit is contained in:
Kurt 2022-02-10 10:57:59 -08:00
parent a287efe3a1
commit a5d1bf7900
2 changed files with 7 additions and 6 deletions

View file

@ -48,9 +48,9 @@ namespace PKHeX.Core
public override PKM Clone() => new BK4((byte[])Data.Clone());
// Structure
public override uint PID { get => ReadUInt16BigEndian(Data.AsSpan(0x00)); set => WriteUInt32BigEndian(Data.AsSpan(0x00), value); }
public override ushort Sanity { get => ReadUInt16BigEndian(Data.AsSpan(0x04)); set => WriteUInt32BigEndian(Data.AsSpan(0x04), value); }
public override ushort Checksum { get => ReadUInt16BigEndian(Data.AsSpan(0x06)); set => WriteUInt32BigEndian(Data.AsSpan(0x06), value); }
public override uint PID { get => ReadUInt32BigEndian(Data.AsSpan(0x00)); set => WriteUInt32BigEndian(Data.AsSpan(0x00), value); }
public override ushort Sanity { get => ReadUInt16BigEndian(Data.AsSpan(0x04)); set => WriteUInt16BigEndian(Data.AsSpan(0x04), value); }
public override ushort Checksum { get => ReadUInt16BigEndian(Data.AsSpan(0x06)); set => WriteUInt16BigEndian(Data.AsSpan(0x06), value); }
#region Block A
public override int Species { get => ReadUInt16BigEndian(Data.AsSpan(0x08)); set => WriteUInt16BigEndian(Data.AsSpan(0x08), (ushort)value); }

View file

@ -36,9 +36,10 @@ namespace PKHeX.Core
var span = data[Offset..];
for (int i = 0; i < Items.Length; i++)
{
var item = span.Slice(i * 4, 4);
WriteUInt32BigEndian(item, (ushort)Items[i].Index);
WriteUInt32BigEndian(item[2..], (ushort)Items[i].Count);
var item = Items[i];
var slice = span.Slice(i * 4, 4);
WriteUInt16BigEndian(slice, (ushort)item.Index);
WriteUInt16BigEndian(slice[2..], (ushort)item.Count);
}
}
}