From cf274bba701e0e5f69adfec2e8400af91a4a652e Mon Sep 17 00:00:00 2001 From: Jonathan Herbert Date: Fri, 23 Feb 2024 15:19:01 -0400 Subject: [PATCH] Add LGPE Adventure Begin Date (#4189) --- PKHeX.Core/Saves/Access/ISaveBlock7b.cs | 3 ++- PKHeX.Core/Saves/Access/SaveBlockAccessor7b.cs | 2 ++ PKHeX.Core/Saves/SAV7b.cs | 1 + .../Substructures/Gen7/LGPE/PlayerGeoLocation7b.cs | 10 ++++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 PKHeX.Core/Saves/Substructures/Gen7/LGPE/PlayerGeoLocation7b.cs diff --git a/PKHeX.Core/Saves/Access/ISaveBlock7b.cs b/PKHeX.Core/Saves/Access/ISaveBlock7b.cs index 8ddad3553..2a36184aa 100644 --- a/PKHeX.Core/Saves/Access/ISaveBlock7b.cs +++ b/PKHeX.Core/Saves/Access/ISaveBlock7b.cs @@ -1,4 +1,4 @@ -namespace PKHeX.Core; +namespace PKHeX.Core; /// /// Interface for Accessing named blocks within a Generation 7 LGP/E save file. @@ -16,4 +16,5 @@ public interface ISaveBlock7b PokeListHeader Storage { get; } WB7Records GiftRecords { get; } CaptureRecords Captured { get; } + PlayerGeoLocation7b PlayerGeoLocation { get; } } diff --git a/PKHeX.Core/Saves/Access/SaveBlockAccessor7b.cs b/PKHeX.Core/Saves/Access/SaveBlockAccessor7b.cs index f0af8a325..daf3181a9 100644 --- a/PKHeX.Core/Saves/Access/SaveBlockAccessor7b.cs +++ b/PKHeX.Core/Saves/Access/SaveBlockAccessor7b.cs @@ -51,6 +51,7 @@ public SaveBlockAccessor7b(SAV7b sav) Captured = new CaptureRecords(sav, GetBlockOffset(BelugaBlockIndex.CaptureRecord)); FashionPlayer = new Fashion7b(sav, GetBlockOffset(BelugaBlockIndex.FashionPlayer)); FashionStarter = new Fashion7b(sav, GetBlockOffset(BelugaBlockIndex.FashionStarter)); + PlayerGeoLocation = new PlayerGeoLocation7b(sav, GetBlockOffset(BelugaBlockIndex.PlayerGeoLocation)); } public MyItem Items { get; } @@ -66,6 +67,7 @@ public SaveBlockAccessor7b(SAV7b sav) public CaptureRecords Captured { get; } public Fashion7b FashionPlayer { get; } public Fashion7b FashionStarter { get; } + public PlayerGeoLocation7b PlayerGeoLocation { get; } public BlockInfo GetBlock(BelugaBlockIndex index) => BlockInfo[(int)index]; public int GetBlockOffset(BelugaBlockIndex index) => GetBlock(index).Offset; } diff --git a/PKHeX.Core/Saves/SAV7b.cs b/PKHeX.Core/Saves/SAV7b.cs index 827736a0c..34d1a4c77 100644 --- a/PKHeX.Core/Saves/SAV7b.cs +++ b/PKHeX.Core/Saves/SAV7b.cs @@ -61,6 +61,7 @@ private void Initialize() public PokeListHeader Storage => Blocks.Storage; public WB7Records GiftRecords => Blocks.GiftRecords; public CaptureRecords Captured => Blocks.Captured; + public PlayerGeoLocation7b PlayerGeoLocation => Blocks.PlayerGeoLocation; public override IReadOnlyList Inventory { get => Blocks.Items.Inventory; set => Blocks.Items.Inventory = value; } diff --git a/PKHeX.Core/Saves/Substructures/Gen7/LGPE/PlayerGeoLocation7b.cs b/PKHeX.Core/Saves/Substructures/Gen7/LGPE/PlayerGeoLocation7b.cs new file mode 100644 index 000000000..31ef6d818 --- /dev/null +++ b/PKHeX.Core/Saves/Substructures/Gen7/LGPE/PlayerGeoLocation7b.cs @@ -0,0 +1,10 @@ +using System; + +namespace PKHeX.Core; + +public sealed class PlayerGeoLocation7b : SaveBlock +{ + public PlayerGeoLocation7b(SAV7b sav, int offset) : base(sav) => Offset = offset; + + public Epoch1970Value AdventureBegin => new(Data.AsMemory(Offset + 0x48)); +}