mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Add support for BDSP 1.2.0 save files
This commit is contained in:
parent
5b981f2832
commit
0404b94f86
3 changed files with 18 additions and 4 deletions
|
@ -77,10 +77,15 @@ namespace PKHeX.Core
|
|||
// MT_DATA mtData; -- 0x400 bytes
|
||||
// DENDOU_SAVE_ADD -- language tracking of members (hall of fame?); ADD_POKE_MEMBER[30], ADD_POKE[6]
|
||||
|
||||
Initialize();
|
||||
// v1.2 additions
|
||||
// ReBuffnameData reBuffNameDat -- RE_DENDOU_RECORD[], RE_DENDOU_RECORD is an RE_DENDOU_POKEMON_DATA_INSIDE[] with nicknames
|
||||
// PLAYREPORT_DATA playReportData sizeof(0xF8)
|
||||
// PLAYREPORT_DATA playReportDataRef sizeof(0xF8)
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public SAV8BS() : this(new byte[SaveUtil.SIZE_G8BDSP_1], false) => SaveRevision = (int)Gem8Version.V1_1;
|
||||
public SAV8BS() : this(new byte[SaveUtil.SIZE_G8BDSP_2], false) => SaveRevision = (int)Gem8Version.V1_2;
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
|
@ -118,6 +123,7 @@ namespace PKHeX.Core
|
|||
public override int MaxAbilityID => Legal.MaxAbilityID_8b;
|
||||
|
||||
public bool HasFirstSaveFileExpansion => (Gem8Version)SaveRevision >= Gem8Version.V1_1;
|
||||
public bool HasSecondSaveFileExpansion => (Gem8Version)SaveRevision >= Gem8Version.V1_2;
|
||||
|
||||
public int SaveRevision
|
||||
{
|
||||
|
|
|
@ -19,6 +19,12 @@ namespace PKHeX.Core
|
|||
/// </summary>
|
||||
/// <remarks><see cref="SaveUtil.SIZE_G8BDSP_1"/></remarks>
|
||||
V1_1 = 0x2C, // 44
|
||||
|
||||
/// <summary>
|
||||
/// February patch.
|
||||
/// </summary>
|
||||
/// <remarks><see cref="SaveUtil.SIZE_G8BDSP_2"/></remarks>
|
||||
V1_2 = 0x32, // 50
|
||||
}
|
||||
|
||||
public static class Gem8VersionExtensions
|
||||
|
@ -31,6 +37,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
V1_0 => "-1.0.0", // Launch Revision
|
||||
V1_1 => "-1.1.0", // 1.1.0
|
||||
V1_2 => "-1.2.0", // 1.2.0
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(version)),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace PKHeX.Core
|
|||
|
||||
public const int SIZE_G8BDSP = 0xE9828;
|
||||
public const int SIZE_G8BDSP_1 = 0xEDC20;
|
||||
public const int SIZE_G8BDSP_2 = 0xEED8C;
|
||||
|
||||
public const int SIZE_G8SWSH = 0x1716B3; // 1.0
|
||||
public const int SIZE_G8SWSH_1 = 0x17195E; // 1.0 -> 1.1
|
||||
|
@ -99,7 +100,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static readonly HashSet<int> Sizes = new(SizesGen2.Concat(SizesSWSH))
|
||||
{
|
||||
SIZE_G8LA, SIZE_G8BDSP, SIZE_G8BDSP_1,
|
||||
SIZE_G8LA, SIZE_G8BDSP, SIZE_G8BDSP_1, SIZE_G8BDSP_2,
|
||||
// SizesSWSH covers gen8 sizes since there's so many
|
||||
SIZE_G7SM, SIZE_G7USUM, SIZE_G7GG,
|
||||
SIZE_G6XY, SIZE_G6ORAS, SIZE_G6ORASDEMO,
|
||||
|
@ -501,7 +502,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static GameVersion GetIsG8SAV_BDSP(ReadOnlySpan<byte> data)
|
||||
{
|
||||
if (data.Length is not SIZE_G8BDSP && data.Length is not SIZE_G8BDSP_1)
|
||||
if (data.Length is not (SIZE_G8BDSP or SIZE_G8BDSP_1 or SIZE_G8BDSP_2))
|
||||
return Invalid;
|
||||
|
||||
return BDSP;
|
||||
|
|
Loading…
Reference in a new issue