mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 06:34:19 +00:00
Add more annotations
Fix typo in swsh block name
This commit is contained in:
parent
61ab70f6bf
commit
ef68886554
7 changed files with 25 additions and 22 deletions
|
@ -17,7 +17,7 @@ public abstract class HomeOptional1
|
|||
public const int HeaderSize = 3; // u8 format, u16 length(data[u8])
|
||||
protected abstract HomeGameDataFormat Format { get; }
|
||||
|
||||
protected HomeOptional1(ushort size) => Buffer = new byte[size];
|
||||
protected HomeOptional1([ConstantExpected] ushort size) => Buffer = new byte[size];
|
||||
protected HomeOptional1(Memory<byte> buffer) => Buffer = buffer;
|
||||
|
||||
protected void EnsureSize([ConstantExpected] int size)
|
||||
|
|
|
@ -220,7 +220,7 @@ public sealed class SaveBlockAccessor8SWSH : SCBlockAccessor, ISaveBlock8Main
|
|||
public const uint KPlayRecordsQuest = 0xBF24DDAE; // FSYS_PLAY_POKEMON_QUEST
|
||||
|
||||
// Dojo event flags (bool)
|
||||
public const uint KDojoHairSylistAvailable = 0xE02A722C;
|
||||
public const uint KDojoHairStylistAvailable = 0xE02A722C;
|
||||
public const uint KDojoBrokenRotomiDisappeared = 0x60E04225;
|
||||
public const uint KDojoRotomiDisappeared = 0x82E071A0;
|
||||
public const uint KDojoTableDisappeared = 0x3D83DC85;
|
||||
|
|
|
@ -226,16 +226,8 @@ public abstract class SAV3 : SaveFile, ILangDeviantSave, IEventFlag37
|
|||
return;
|
||||
|
||||
// Hall of Fame Checksums
|
||||
{
|
||||
var sector = Data.AsSpan(0x1C000, SIZE_SECTOR);
|
||||
ushort chk = Checksums.CheckSum32(sector[..SIZE_SECTOR_USED]);
|
||||
WriteUInt16LittleEndian(sector[0xFF4..], chk);
|
||||
}
|
||||
{
|
||||
var sector = Data.AsSpan(0x1D000, SIZE_SECTOR);
|
||||
ushort chk = Checksums.CheckSum32(sector[..SIZE_SECTOR_USED]);
|
||||
WriteUInt16LittleEndian(sector[0xFF4..], chk);
|
||||
}
|
||||
SetSectoryValidExtra(0x1C000);
|
||||
SetSectoryValidExtra(0x1D000);
|
||||
}
|
||||
|
||||
public sealed override bool ChecksumsValid
|
||||
|
@ -259,9 +251,16 @@ public abstract class SAV3 : SaveFile, ILangDeviantSave, IEventFlag37
|
|||
}
|
||||
}
|
||||
|
||||
private bool IsSectorValidExtra(int ofs)
|
||||
private void SetSectoryValidExtra(int offset)
|
||||
{
|
||||
var sector = Data.AsSpan(ofs, SIZE_SECTOR);
|
||||
var sector = Data.AsSpan(offset, SIZE_SECTOR);
|
||||
var expect = Checksums.CheckSum32(sector[..SIZE_SECTOR_USED]);
|
||||
WriteUInt16LittleEndian(sector[0xFF4..], expect);
|
||||
}
|
||||
|
||||
private bool IsSectorValidExtra(int offset)
|
||||
{
|
||||
var sector = Data.AsSpan(offset, SIZE_SECTOR);
|
||||
var expect = Checksums.CheckSum32(sector[..SIZE_SECTOR_USED]);
|
||||
var actual = ReadUInt16LittleEndian(sector[0xFF4..]);
|
||||
return expect == actual;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
@ -13,8 +14,8 @@ public abstract class SAV6 : SAV_BEEF, ITrainerStatRecord, ISaveBlock6Core, IReg
|
|||
protected internal override string ShortSummary => $"{OT} ({Version}) - {Played.LastSavedTime}";
|
||||
public override string Extension => string.Empty;
|
||||
|
||||
protected SAV6(byte[] data, int biOffset) : base(data, biOffset) { }
|
||||
protected SAV6(int size, int biOffset) : base(size, biOffset) { }
|
||||
protected SAV6(byte[] data, [ConstantExpected] int biOffset) : base(data, biOffset) { }
|
||||
protected SAV6([ConstantExpected] int size, [ConstantExpected] int biOffset) : base(size, biOffset) { }
|
||||
|
||||
// Configuration
|
||||
protected override int SIZE_STORED => PokeCrypto.SIZE_6STORED;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
@ -19,11 +20,11 @@ public abstract class SAV7 : SAV_BEEF, ITrainerStatRecord, ISaveBlock7Main, IReg
|
|||
return gen <= 7 && f[1] != 'b'; // ignore PB7
|
||||
});
|
||||
|
||||
protected SAV7(byte[] data, int biOffset) : base(data, biOffset)
|
||||
protected SAV7(byte[] data, [ConstantExpected] int biOffset) : base(data, biOffset)
|
||||
{
|
||||
}
|
||||
|
||||
protected SAV7(int size, int biOffset) : base(size, biOffset)
|
||||
protected SAV7([ConstantExpected] int size, [ConstantExpected] int biOffset) : base(size, biOffset)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using static System.Buffers.Binary.BinaryPrimitives;
|
||||
|
||||
|
@ -11,12 +12,12 @@ namespace PKHeX.Core;
|
|||
/// <remarks>Shared logic is used by Gen6 and Gen7 save files.</remarks>
|
||||
public abstract class SAV_BEEF : SaveFile, ISecureValueStorage
|
||||
{
|
||||
protected SAV_BEEF(byte[] data, int biOffset) : base(data)
|
||||
protected SAV_BEEF(byte[] data, [ConstantExpected] int biOffset) : base(data)
|
||||
{
|
||||
BlockInfoOffset = biOffset;
|
||||
}
|
||||
|
||||
protected SAV_BEEF(int size, int biOffset) : base(size)
|
||||
protected SAV_BEEF([ConstantExpected] int size, [ConstantExpected] int biOffset) : base(size)
|
||||
{
|
||||
BlockInfoOffset = biOffset;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX.Core;
|
||||
|
@ -22,7 +23,7 @@ public abstract class SaveFile : ITrainerInfo, IGameValueLimit, IBoxDetailWallpa
|
|||
Metadata = new SaveFileMetadata(this);
|
||||
}
|
||||
|
||||
protected SaveFile(int size = 0) : this(size == 0 ? [] : new byte[size], false) { }
|
||||
protected SaveFile([ConstantExpected] int size = 0) : this(size == 0 ? [] : new byte[size], false) { }
|
||||
|
||||
protected internal abstract string ShortSummary { get; }
|
||||
public abstract string Extension { get; }
|
||||
|
|
Loading…
Reference in a new issue