GPGX - keep a savestate buffer for SaveStateBinary, yeah maybe it shoudln't be every cores responsibility, but until it doesn't, this greatly improves rewind and tastudio performance
This commit is contained in:
parent
a118763409
commit
c50c38d88b
|
@ -5,6 +5,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
{
|
||||
public partial class GPGX : IStatable
|
||||
{
|
||||
private byte[] _stateBuffer;
|
||||
|
||||
public void LoadStateBinary(BinaryReader reader)
|
||||
{
|
||||
_elf.LoadStateBinary(reader);
|
||||
|
@ -37,12 +39,23 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
|
||||
public byte[] SaveStateBinary()
|
||||
{
|
||||
if (_stateBuffer != null)
|
||||
{
|
||||
using var stream = new MemoryStream(_stateBuffer);
|
||||
using var writer = new BinaryWriter(stream);
|
||||
SaveStateBinary(writer);
|
||||
writer.Flush();
|
||||
writer.Close();
|
||||
return _stateBuffer;
|
||||
}
|
||||
|
||||
using var ms = new MemoryStream();
|
||||
using var bw = new BinaryWriter(ms);
|
||||
SaveStateBinary(bw);
|
||||
bw.Flush();
|
||||
ms.Close();
|
||||
return ms.ToArray();
|
||||
_stateBuffer = ms.ToArray();
|
||||
bw.Close();
|
||||
return _stateBuffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue