Implement a rewind frequency option, for now it is hardcoded to 2 for SNES and similarly sized states, and 60 for n64/saturn sizes, else it is 1. TODO: some time of UI for the user to set this
This commit is contained in:
parent
58359d5ac9
commit
55471ce891
|
@ -24,8 +24,8 @@ namespace BizHawk.MultiClient
|
|||
FloatButtons[type.FloatControls[i]] = type.FloatRanges[i].Mid;
|
||||
FloatRanges[type.FloatControls[i]] = type.FloatRanges[i];
|
||||
}
|
||||
FloatBinds.Add("J5 X", "P1 X Axis");
|
||||
FloatBinds.Add("J5 Y", "P1 Y Axis");
|
||||
FloatBinds.Add("J1 X", "P1 X Axis");
|
||||
FloatBinds.Add("J1 Y", "P1 Y Axis");
|
||||
}
|
||||
|
||||
public ControllerDefinition Type { get { return type; } }
|
||||
|
|
|
@ -7,6 +7,8 @@ namespace BizHawk.MultiClient
|
|||
private readonly MruStack<MemoryStream> RewindBuf = new MruStack<MemoryStream>(15000);
|
||||
private byte[] LastState;
|
||||
private bool RewindImpossible;
|
||||
private int RewindFrequency = 1;
|
||||
|
||||
|
||||
void CaptureRewindState()
|
||||
{
|
||||
|
@ -17,23 +19,35 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
// This is the first frame. Capture the state, and put it in LastState for future deltas to be compared against.
|
||||
LastState = Global.Emulator.SaveStateBinary();
|
||||
|
||||
|
||||
if (LastState.Length > 0x100000)
|
||||
{
|
||||
RewindImpossible = true;
|
||||
LastState = null;
|
||||
Global.OSD.AddMessage("Rewind Disabled: State too large.");
|
||||
if (Global.Emulator.SystemId == "PCE")
|
||||
Global.OSD.AddMessage("See 'Arcade Card Rewind Hack' in Emulation->PC Engine options.");
|
||||
//RewindImpossible = true;
|
||||
//LastState = null;
|
||||
//Global.OSD.AddMessage("Rewind Disabled: State too large.");
|
||||
//if (Global.Emulator.SystemId == "PCE")
|
||||
// Global.OSD.AddMessage("See 'Arcade Card Rewind Hack' in Emulation->PC Engine options.");
|
||||
RewindFrequency = 60;
|
||||
Global.OSD.AddMessage("Rewind frequency set to 60");
|
||||
}
|
||||
else if (LastState.Length > 32768)
|
||||
{
|
||||
RewindFrequency = 2;
|
||||
Global.OSD.AddMessage("Rewind frequency set to 2");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, it's not the first frame, so build a delta.
|
||||
if (LastState.Length <= 0x10000)
|
||||
CaptureRewindState64K();
|
||||
else
|
||||
CaptureRewindStateLarge();
|
||||
if (Global.Emulator.Frame%RewindFrequency == 0)
|
||||
{
|
||||
if (LastState.Length <= 0x10000)
|
||||
CaptureRewindState64K();
|
||||
else
|
||||
CaptureRewindStateLarge();
|
||||
}
|
||||
}
|
||||
|
||||
// Builds a delta for states that are <= 64K in size.
|
||||
|
|
Loading…
Reference in New Issue