mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Fix sav4 checksum calc
DPPt have a footer that's 0x14 bytes; HGSS is only 0x10 (first u32 was removed from struct).
This commit is contained in:
parent
d60731940c
commit
edf36e8a34
3 changed files with 6 additions and 3 deletions
|
@ -83,9 +83,10 @@ namespace PKHeX.Core
|
|||
public bool DP => Version == GameVersion.DP;
|
||||
|
||||
// Checksums
|
||||
private static ushort CalcBlockChecksum(byte[] data) => Checksums.CRC16_CCITT(data, 0, data.Length - 0x14);
|
||||
protected abstract int FooterSize { get; }
|
||||
private ushort CalcBlockChecksum(byte[] data) => Checksums.CRC16_CCITT(data, 0, data.Length - FooterSize);
|
||||
private static ushort GetBlockChecksumSaved(byte[] data) => BitConverter.ToUInt16(data, data.Length - 2);
|
||||
private static bool GetBlockChecksumValid(byte[] data) => CalcBlockChecksum(data) == GetBlockChecksumSaved(data);
|
||||
private bool GetBlockChecksumValid(byte[] data) => CalcBlockChecksum(data) == GetBlockChecksumSaved(data);
|
||||
|
||||
protected override void SetChecksums()
|
||||
{
|
||||
|
|
|
@ -12,8 +12,9 @@ namespace PKHeX.Core
|
|||
protected override SAV4 CloneInternal() => Exportable ? new SAV4HGSS(Data) : new SAV4HGSS();
|
||||
|
||||
protected override int GeneralSize => 0xF628;
|
||||
protected override int StorageSize => 0x12300; // Start 0xF700, +0 starts box data
|
||||
protected override int StorageSize => 0x12310; // Start 0xF700, +0 starts box data
|
||||
protected override int StorageStart => 0xF700; // unused section right after GeneralSize, alignment?
|
||||
protected override int FooterSize => 0x10;
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace PKHeX.Core
|
|||
public abstract class SAV4Sinnoh : SAV4
|
||||
{
|
||||
protected override int StorageStart => GeneralSize;
|
||||
protected override int FooterSize => 0x14;
|
||||
protected SAV4Sinnoh() { }
|
||||
protected SAV4Sinnoh(byte[] data) : base(data) { }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue