AxibugEmuOnline/AxibugEmuOnline.Client/Assets/VirtualNes.Core/State/RAMSTAT.cs
2024-08-29 17:20:01 +08:00

39 lines
1.0 KiB
C#

namespace VirtualNes.Core
{
public struct RAMSTAT : IStateBufferObject
{
/// <summary> Internal NES RAM </summary>
public byte[] RAM;
/// <summary> BG Palette </summary>
public byte[] BGPAL;
/// <summary> SP Palette </summary>
public byte[] SPPAL;
/// <summary> Sprite RAM </summary>
public byte[] SPRAM;
public static RAMSTAT GetDefault()
{
var res = new RAMSTAT();
res.RAM = new byte[2 * 1024];
res.BGPAL = new byte[16];
res.SPPAL = new byte[16];
res.SPRAM = new byte[256];
return res;
}
public readonly uint GetSize()
{
return (uint)(RAM.Length + BGPAL.Length + SPPAL.Length + SPRAM.Length);
}
public readonly void SaveState(StateBuffer buffer)
{
buffer.Write(RAM);
buffer.Write(BGPAL);
buffer.Write(SPPAL);
buffer.Write(SPRAM);
}
}
}