2024-12-04 00:04:31 +08:00
|
|
|
|
namespace VirtualNes.Core
|
2024-08-29 17:20:01 +08:00
|
|
|
|
{
|
|
|
|
|
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-09-13 17:39:48 +08:00
|
|
|
|
|
|
|
|
|
|
2024-12-20 18:44:55 +08:00
|
|
|
|
public uint GetSize()
|
2024-09-13 17:39:48 +08:00
|
|
|
|
{
|
|
|
|
|
return (uint)(ID.Length + sizeof(ushort) + sizeof(uint) + sizeof(ushort) + sizeof(ushort));
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-20 18:44:55 +08:00
|
|
|
|
public void SaveState(StateBuffer buffer)
|
2024-08-29 17:20:01 +08:00
|
|
|
|
{
|
|
|
|
|
buffer.Write(ID);
|
|
|
|
|
buffer.Write(BlockVersion);
|
2024-08-29 17:30:56 +08:00
|
|
|
|
buffer.Write(Ext0);
|
2024-08-29 17:20:01 +08:00
|
|
|
|
buffer.Write(Ext1);
|
|
|
|
|
buffer.Write(Ext2);
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-13 17:39:48 +08:00
|
|
|
|
public void LoadState(StateReader buffer)
|
2024-08-29 17:20:01 +08:00
|
|
|
|
{
|
2024-09-13 17:39:48 +08:00
|
|
|
|
ID = buffer.Read_string(12);
|
|
|
|
|
BlockVersion = buffer.Read_ushort();
|
|
|
|
|
Ext0 = buffer.Read_uint();
|
|
|
|
|
Ext1 = buffer.Read_ushort();
|
|
|
|
|
Ext2 = buffer.Read_ushort();
|
2024-08-29 17:20:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|