2024-12-17 01:30:13 +08:00
|
|
|
|
namespace VirtualNes.Core
|
|
|
|
|
{
|
|
|
|
|
public struct FILEHDR2 : IStateBufferObject
|
|
|
|
|
{
|
|
|
|
|
public string ID;
|
|
|
|
|
/// <summary> 2字节 </summary>
|
|
|
|
|
public ushort BlockVersion;
|
|
|
|
|
/// <summary> 4字节 </summary>
|
|
|
|
|
public uint Ext0;
|
|
|
|
|
/// <summary> 2字节 </summary>
|
|
|
|
|
public ushort Ext1;
|
|
|
|
|
/// <summary> 2字节 </summary>
|
|
|
|
|
public ushort Ext2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-20 17:24:09 +08:00
|
|
|
|
public uint GetSize()
|
2024-12-17 01:30:13 +08:00
|
|
|
|
{
|
|
|
|
|
return (uint)(ID.Length + sizeof(ushort) + sizeof(uint) + sizeof(ushort) + sizeof(ushort));
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-20 17:24:09 +08:00
|
|
|
|
public void SaveState(StateBuffer buffer)
|
2024-12-17 01:30:13 +08:00
|
|
|
|
{
|
|
|
|
|
buffer.Write(ID);
|
|
|
|
|
buffer.Write(BlockVersion);
|
|
|
|
|
buffer.Write(Ext0);
|
|
|
|
|
buffer.Write(Ext1);
|
|
|
|
|
buffer.Write(Ext2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void LoadState(StateReader buffer)
|
|
|
|
|
{
|
|
|
|
|
ID = buffer.Read_string(12);
|
|
|
|
|
BlockVersion = buffer.Read_ushort();
|
|
|
|
|
Ext0 = buffer.Read_uint();
|
|
|
|
|
Ext1 = buffer.Read_ushort();
|
|
|
|
|
Ext2 = buffer.Read_ushort();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|