Set dex skin active flag on import

This commit is contained in:
Kurt 2024-11-17 12:47:38 -06:00
parent 8b071073d8
commit adb67922c5
2 changed files with 11 additions and 1 deletions

View file

@ -294,6 +294,15 @@ public abstract class SAV5 : SaveFile, ISaveBlock5BW, IEventFlagProvider37, IBox
{ {
WriteExtSection(data, ExtPokeDexSkinOffset, PokeDexSkin5.SIZE, count); WriteExtSection(data, ExtPokeDexSkinOffset, PokeDexSkin5.SIZE, count);
PlayerData.UpdateExtData(ExtDataSectionNote5.PokedexSkin, count); PlayerData.UpdateExtData(ExtDataSectionNote5.PokedexSkin, count);
IsAvailablePokedexSkin = true;
}
private Span<byte> DexSkinFooter => Data.AsSpan((ExtPokeDexSkinOffset + PokeDexSkin5.SIZE - 4)..);
public bool IsAvailablePokedexSkin
{
get => ReadUInt32LittleEndian(DexSkinFooter) == 1;
set => WriteUInt32LittleEndian(DexSkinFooter, value ? 1u : 0u);
} }
public void SetHallOfFame(ReadOnlySpan<byte> data, ushort count = 1) public void SetHallOfFame(ReadOnlySpan<byte> data, ushort count = 1)

View file

@ -447,7 +447,8 @@ public partial class SAV_DLC5 : Form
private void B_PokeDexSkinLoad_Click(object sender, EventArgs e) private void B_PokeDexSkinLoad_Click(object sender, EventArgs e)
{ {
if (!ImportFile(PokeDexSkin5.Extension, PokeDexFileName, SAV.PokedexSkinData.Length, out var data)) const int pporg = 0x6200; // missing 4 bytes, flag
if (!ImportFile(PokeDexSkin5.Extension, PokeDexFileName, SAV.PokedexSkinData.Length, out var data, otherSize: pporg))
return; return;
SAV.SetPokeDexSkin(data); SAV.SetPokeDexSkin(data);
LoadPokedexSkin(data); LoadPokedexSkin(data);