psx - add lag frame boilerplate junk from wonderswan, should fix movie states and stuff
This commit is contained in:
parent
909144857c
commit
ecb94a1ce9
|
@ -519,6 +519,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] savebuff;
|
byte[] savebuff;
|
||||||
|
byte[] savebuff2;
|
||||||
|
|
||||||
void StudySaveBufferSize()
|
void StudySaveBufferSize()
|
||||||
{
|
{
|
||||||
|
@ -526,6 +527,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
||||||
transaction.transaction = OctoshockDll.eShockStateTransaction.BinarySize;
|
transaction.transaction = OctoshockDll.eShockStateTransaction.BinarySize;
|
||||||
int size = OctoshockDll.shock_StateTransaction(psx, ref transaction);
|
int size = OctoshockDll.shock_StateTransaction(psx, ref transaction);
|
||||||
savebuff = new byte[size];
|
savebuff = new byte[size];
|
||||||
|
savebuff2 = new byte[savebuff.Length + 13];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveStateBinary(BinaryWriter writer)
|
public void SaveStateBinary(BinaryWriter writer)
|
||||||
|
@ -544,6 +546,11 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
||||||
throw new InvalidOperationException("eShockStateTransaction.BinarySave returned error!");
|
throw new InvalidOperationException("eShockStateTransaction.BinarySave returned error!");
|
||||||
writer.Write(savebuff.Length);
|
writer.Write(savebuff.Length);
|
||||||
writer.Write(savebuff);
|
writer.Write(savebuff);
|
||||||
|
|
||||||
|
// other variables
|
||||||
|
writer.Write(IsLagFrame);
|
||||||
|
writer.Write(LagCount);
|
||||||
|
writer.Write(Frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,12 +572,25 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
||||||
int ret = OctoshockDll.shock_StateTransaction(psx, ref transaction);
|
int ret = OctoshockDll.shock_StateTransaction(psx, ref transaction);
|
||||||
if (ret != OctoshockDll.SHOCK_OK)
|
if (ret != OctoshockDll.SHOCK_OK)
|
||||||
throw new InvalidOperationException("eShockStateTransaction.BinaryLoad returned error!");
|
throw new InvalidOperationException("eShockStateTransaction.BinaryLoad returned error!");
|
||||||
|
|
||||||
|
// other variables
|
||||||
|
IsLagFrame = reader.ReadBoolean();
|
||||||
|
LagCount = reader.ReadInt32();
|
||||||
|
Frame = reader.ReadInt32();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] SaveStateBinary()
|
public byte[] SaveStateBinary()
|
||||||
{
|
{
|
||||||
return savebuff;
|
//this are objectionable shenanigans, but theyre required to get the extra info in the stream. we need a better approach.
|
||||||
|
var ms = new MemoryStream(savebuff2, true);
|
||||||
|
var bw = new BinaryWriter(ms);
|
||||||
|
SaveStateBinary(bw);
|
||||||
|
bw.Flush();
|
||||||
|
if (ms.Position != savebuff2.Length)
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
ms.Close();
|
||||||
|
return savebuff2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool BinarySaveStatesPreferred
|
public bool BinarySaveStatesPreferred
|
||||||
|
|
Loading…
Reference in New Issue