Add LGPE to block editor

thanks for nobody noticing this yet :)
This commit is contained in:
Kurt 2021-09-16 14:06:52 -07:00
parent b9d4721553
commit 02af45cb30
4 changed files with 43 additions and 12 deletions

View file

@ -0,0 +1,20 @@
namespace PKHeX.Core
{
/// <summary>
/// Interface for Accessing named blocks within a Generation 7 LGP/E save file.
/// </summary>
/// <remarks>Blocks common for <see cref="SAV7b"/></remarks>
public interface ISaveBlock7b
{
MyItem Items { get; }
Misc7b Misc { get; }
Zukan7b Zukan { get; }
MyStatus7b Status { get; }
PlayTime7b Played { get; }
ConfigSave7b Config { get; }
EventWork7b EventWork { get; }
PokeListHeader Storage { get; }
WB7Records GiftRecords { get; }
CaptureRecords Captured { get; }
}
}

View file

@ -5,7 +5,7 @@ namespace PKHeX.Core
/// <summary>
/// Information for Accessing individual blocks within a <see cref="SAV7b"/>.
/// </summary>
public sealed class SaveBlockAccessor7b : ISaveBlockAccessor<BlockInfo7b>
public sealed class SaveBlockAccessor7b : ISaveBlockAccessor<BlockInfo7b>, ISaveBlock7b
{
private const int boGG = 0xB8800 - 0x200; // nowhere near 1MB (savedata.bin size)
@ -50,16 +50,16 @@ namespace PKHeX.Core
Captured = new CaptureRecords(sav, GetBlockOffset(BelugaBlockIndex.CaptureRecord));
}
public readonly MyItem Items;
public readonly Misc7b Misc;
public readonly Zukan7b Zukan;
public readonly MyStatus7b Status;
public readonly PlayTime7b Played;
public readonly ConfigSave7b Config;
public readonly EventWork7b EventWork;
public readonly PokeListHeader Storage;
public readonly WB7Records GiftRecords;
public readonly CaptureRecords Captured;
public MyItem Items { get; }
public Misc7b Misc { get; }
public Zukan7b Zukan { get; }
public MyStatus7b Status { get; }
public PlayTime7b Played { get; }
public ConfigSave7b Config { get; }
public EventWork7b EventWork { get; }
public PokeListHeader Storage { get; }
public WB7Records GiftRecords { get; }
public CaptureRecords Captured { get; }
public BlockInfo GetBlock(BelugaBlockIndex index) => BlockInfo[(int)index];
public int GetBlockOffset(BelugaBlockIndex index) => GetBlock(index).Offset;
}

View file

@ -6,7 +6,7 @@ namespace PKHeX.Core
/// <summary>
/// Generation 7 <see cref="SaveFile"/> object for <see cref="GameVersion.GG"/> games.
/// </summary>
public sealed class SAV7b : SAV_BEEF, IGameSync
public sealed class SAV7b : SAV_BEEF, ISaveBlock7b, IGameSync
{
protected internal override string ShortSummary => $"{OT} ({Version}) - {Blocks.Played.LastSavedTime}";
public override string Extension => ".bin";
@ -51,6 +51,16 @@ namespace PKHeX.Core
}
// Save Block accessors
public MyItem Items => Blocks.Items;
public Misc7b Misc => Blocks.Misc;
public Zukan7b Zukan => Blocks.Zukan;
public MyStatus7b Status => Blocks.Status;
public PlayTime7b Played => Blocks.Played;
public ConfigSave7b Config => Blocks.Config;
public EventWork7b EventWork => Blocks.EventWork;
public PokeListHeader Storage => Blocks.Storage;
public WB7Records GiftRecords => Blocks.GiftRecords;
public CaptureRecords Captured => Blocks.Captured;
public override IReadOnlyList<InventoryPouch> Inventory { get => Blocks.Items.Inventory; set => Blocks.Items.Inventory = value; }

View file

@ -590,6 +590,7 @@ namespace PKHeX.WinForms.Controls
SAV6AODemo s => new SAV_Accessor<SaveBlockAccessor6AODemo>(s, s.Blocks),
SAV7SM s => new SAV_Accessor<SaveBlockAccessor7SM>(s, s.Blocks),
SAV7USUM s => new SAV_Accessor<SaveBlockAccessor7USUM>(s, s.Blocks),
SAV7b s => new SAV_Accessor<SaveBlockAccessor7b>(s, s.Blocks),
SAV8SWSH s => new SAV_BlockDump8(s),
_ => GetPropertyForm(sav),
};