PKHeX/PKHeX.Core/Saves/Substructures/Gen6/SecretBase/SecretBase6GoodPlacement.cs
Kurt 0686922d5c Rewrite gen6ao secret base handling, i/o, GUI
Closes #3177

Format sizes are now accurate to game structure sizes. Added a few more editable fields, rid of label/textbox/etc for general base editing -- use a PropertyGrid instead.

Feels nice having a bank of saves to reference + idb to discover the struct layout.
2021-06-13 00:38:47 -07:00

40 lines
1.2 KiB
C#

using System;
namespace PKHeX.Core
{
public sealed class SecretBase6GoodPlacement
{
public const int SIZE = 12;
public ushort Good { get; set; }
public ushort X { get; set; }
public ushort Y { get; set; }
public byte Rotation { get; set; }
// byte unused
public ushort Param1 { get; set; }
public ushort Param2 { get; set; }
public SecretBase6GoodPlacement(byte[] data, int offset)
{
Good = BitConverter.ToUInt16(data, offset);
X = BitConverter.ToUInt16(data, offset + 2);
Y = BitConverter.ToUInt16(data, offset + 4);
Rotation = data[offset + 6];
Param1 = BitConverter.ToUInt16(data, offset + 8);
Param2 = BitConverter.ToUInt16(data, offset + 10);
}
public void Write(byte[] data, int offset)
{
BitConverter.GetBytes(Good).CopyTo(data, offset);
BitConverter.GetBytes(X).CopyTo(data, offset + 2);
BitConverter.GetBytes(Y).CopyTo(data, offset + 4);
data[6] = Rotation;
BitConverter.GetBytes(Param1).CopyTo(data, offset + 8);
BitConverter.GetBytes(Param2).CopyTo(data, offset + 10);
}
}
}