Misc tweaks - static namespace using

This commit is contained in:
Kurt 2022-04-15 09:54:12 -07:00
parent f740e1dd72
commit ac7947fd66
4 changed files with 15 additions and 14 deletions

View File

@ -65,7 +65,8 @@ public SaveBlockAccessor8LA(SAV8LA sav)
private const uint KFashionUnlockedOverall = 0x45851092;
private const uint KFashionUnlockedShoes = 0x636A5ABD;
private const uint KFashionUnlockedGlasses = 0x58AB6233;
private const uint KSwarm = 0x1E0F1BA3; // 5 entries, 0x50 each
public const uint KMassOutbreak = 0x1E0F1BA3;
public const uint KMassiveMassOutbreak = 0x7799EB86;
private const uint KCaptureRecords = 0x6506EE96; // 1000 entries, 0x1C each
private const uint KOtherPlayerLostSatchels = 0x05E7EBEB;
private const uint KMyLostSatchels = 0xC5D7112B;

View File

@ -1,6 +1,6 @@
using System;
using System.Buffers.Binary;
using System.ComponentModel;
using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core;
@ -17,8 +17,8 @@ public sealed class AdventureStart8a : SaveBlock
/// </summary>
public ulong Seconds
{
get => BinaryPrimitives.ReadUInt64LittleEndian(Data.AsSpan(Offset));
set => BinaryPrimitives.WriteUInt64LittleEndian(Data.AsSpan(Offset), value);
get => ReadUInt64LittleEndian(Data.AsSpan(Offset));
set => WriteUInt64LittleEndian(Data.AsSpan(Offset), value);
}
private static DateTime Epoch => new(1970, 1, 1);

View File

@ -1,6 +1,6 @@
using System;
using System.Buffers.Binary;
using System.ComponentModel;
using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core;
@ -14,14 +14,14 @@ public sealed class MyStatus8a : SaveBlock
public int TID
{
get => BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(0x10));
set => BinaryPrimitives.WriteUInt16LittleEndian(Data.AsSpan(0x10), (ushort)value);
get => ReadUInt16LittleEndian(Data.AsSpan(0x10));
set => WriteUInt16LittleEndian(Data.AsSpan(0x10), (ushort)value);
}
public int SID
{
get => BinaryPrimitives.ReadUInt16LittleEndian(Data.AsSpan(0x12));
set => BinaryPrimitives.WriteUInt16LittleEndian(Data.AsSpan(0x12), (ushort)value);
get => ReadUInt16LittleEndian(Data.AsSpan(0x12));
set => WriteUInt16LittleEndian(Data.AsSpan(0x12), (ushort)value);
}
public int Game

View File

@ -1,5 +1,5 @@
using System;
using System.Buffers.Binary;
using static System.Buffers.Binary.BinaryPrimitives;
namespace PKHeX.Core;
@ -17,15 +17,15 @@ public override void Clear()
public static InventoryItem8a Read(ReadOnlySpan<byte> data) => new()
{
Index = BinaryPrimitives.ReadInt16LittleEndian(data),
Count = BinaryPrimitives.ReadInt16LittleEndian(data[2..]),
Index = ReadInt16LittleEndian(data),
Count = ReadInt16LittleEndian(data[2..]),
};
public void Write(Span<byte> data)
{
// Index is not saved.
BinaryPrimitives.WriteUInt16LittleEndian(data, (ushort)Index);
BinaryPrimitives.WriteUInt16LittleEndian(data[2..], (ushort)Count);
WriteUInt16LittleEndian(data, (ushort)Index);
WriteUInt16LittleEndian(data[2..], (ushort)Count);
}
public static void Clear(Span<byte> data, int offset) => data.Slice(offset, SIZE).Clear();