mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-04 17:59:16 +00:00
ad0c9b147d
Was looking in the wrong segment of save data. Now points to the correct span (pokedex). Extract a few more save blocks and interactions. Basically try to get rid of any remaining `SAV.Data` references. Still a few left, but aren't broken. Closes #4259
26 lines
768 B
C#
26 lines
768 B
C#
using System;
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
public sealed class Contest6(SAV6AO sav, Memory<byte> raw) : SaveBlock<SAV6AO>(sav, raw)
|
|
{
|
|
public const int CountBlock = 12;
|
|
public const uint MaxBlock = 999;
|
|
|
|
public uint GetBlockCount(int index)
|
|
{
|
|
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual((uint)index, (uint)CountBlock);
|
|
return ReadUInt32LittleEndian(Data[(index * 4)..]);
|
|
}
|
|
|
|
public void SetBlockCount(int index, uint value)
|
|
{
|
|
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual((uint)index, (uint)CountBlock);
|
|
if (value > MaxBlock)
|
|
value = MaxBlock;
|
|
WriteUInt32LittleEndian(Data[(index * 4)..], value);
|
|
}
|
|
|
|
// 0x48.. ???
|
|
}
|