master #31

Merged
sin365 merged 9 commits from Alienjack/AxibugEmuOnline:master into master 2024-08-30 18:18:47 +08:00
4 changed files with 54 additions and 4 deletions
Showing only changes of commit 273015f95b - Show all commits

View File

@ -1,7 +1,17 @@
namespace VirtualNes.Core
{
public struct DISKDATA
public struct DISKDATA : IStateBufferObject
{
public int DifferentSize;
public uint GetSize()
{
return sizeof(int);
}
public void SaveState(StateBuffer buffer)
{
buffer.Write(DifferentSize);
}
}
}

View File

@ -11,7 +11,7 @@
public readonly void SaveState(StateBuffer buffer)
{
throw new System.NotImplementedException();
buffer.Write(data);
}
}
}

View File

@ -16,15 +16,16 @@ namespace VirtualNes.Core
/// <summary> 2字节 </summary>
public ushort Ext2;
public void SaveState(StateBuffer buffer)
public readonly void SaveState(StateBuffer buffer)
{
buffer.Write(ID);
buffer.Write(BlockVersion);
buffer.Write(Ext0);
buffer.Write(Ext1);
buffer.Write(Ext2);
}
public uint GetSize()
public readonly uint GetSize()
{
return (uint)(ID.Length + sizeof(ushort) + sizeof(uint) + sizeof(ushort) + sizeof(ushort));
}

View File

@ -35,5 +35,44 @@ namespace VirtualNes.Core
public BLOCKHDR exctrBLOCK;
public EXCTRSTAT exctr;
public readonly byte[] ToBytes()
{
StateBuffer buffer = new StateBuffer();
HEADER.SaveState(buffer);
regBLOCK.SaveState(buffer);
reg.SaveState(buffer);
ramBLOCK.SaveState(buffer);
ram.SaveState(buffer);
if(WRAM!=null) buffer.Write(WRAM);
mmuBLOCK.SaveState(buffer);
mmu.SaveState(buffer);
buffer.Write(CPU_MEM_BANK.ToArray());
buffer.Write(VRAM);
buffer.Write(CRAM.ToArray());
mmcBLOCK.SaveState(buffer);
mmc.SaveState(buffer);
ctrBLOCK.SaveState(buffer);
ctr.SaveState(buffer);
sndBLOCK.SaveState(buffer);
snd.SaveState(buffer);
dskBLOCK.SaveState(buffer);
dsk.SaveState(buffer);
buffer.Write(dskdata);
exctrBLOCK.SaveState(buffer);
exctr.SaveState(buffer);
return buffer.Data.ToArray();
}
}
}