Save state stuff mgba blah I'm bad
This commit is contained in:
parent
7514547fe0
commit
c3be2879bc
|
@ -386,7 +386,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
LoadStateBinary(new BinaryReader(new MemoryStream(state)));
|
LoadStateBinary(new BinaryReader(new MemoryStream(state)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveStateBinary(BinaryWriter writer)
|
private void StartSaveStateBinaryInternal()
|
||||||
{
|
{
|
||||||
IntPtr p = IntPtr.Zero;
|
IntPtr p = IntPtr.Zero;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
@ -398,6 +398,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
_savebuff2 = new byte[size + 13];
|
_savebuff2 = new byte[size + 13];
|
||||||
}
|
}
|
||||||
LibmGBA.BizFinishGetState(p, _savebuff, size);
|
LibmGBA.BizFinishGetState(p, _savebuff, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FinishSaveStateBinaryInternal(BinaryWriter writer)
|
||||||
|
{
|
||||||
writer.Write(_savebuff.Length);
|
writer.Write(_savebuff.Length);
|
||||||
writer.Write(_savebuff, 0, _savebuff.Length);
|
writer.Write(_savebuff, 0, _savebuff.Length);
|
||||||
|
|
||||||
|
@ -407,6 +411,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
writer.Write(Frame);
|
writer.Write(Frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveStateBinary(BinaryWriter writer)
|
||||||
|
{
|
||||||
|
StartSaveStateBinaryInternal();
|
||||||
|
FinishSaveStateBinaryInternal(writer);
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadStateBinary(BinaryReader reader)
|
public void LoadStateBinary(BinaryReader reader)
|
||||||
{
|
{
|
||||||
int length = reader.ReadInt32();
|
int length = reader.ReadInt32();
|
||||||
|
@ -427,9 +437,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
|
|
||||||
public byte[] SaveStateBinary()
|
public byte[] SaveStateBinary()
|
||||||
{
|
{
|
||||||
|
StartSaveStateBinaryInternal();
|
||||||
var ms = new MemoryStream(_savebuff2, true);
|
var ms = new MemoryStream(_savebuff2, true);
|
||||||
var bw = new BinaryWriter(ms);
|
var bw = new BinaryWriter(ms);
|
||||||
SaveStateBinary(bw);
|
FinishSaveStateBinaryInternal(bw);
|
||||||
bw.Flush();
|
bw.Flush();
|
||||||
ms.Close();
|
ms.Close();
|
||||||
return _savebuff2;
|
return _savebuff2;
|
||||||
|
|
Loading…
Reference in New Issue