From 55471ce89185df62bd63091606fc9531f02d03a8 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 20 Jul 2013 14:38:09 +0000 Subject: [PATCH] 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 --- .../Input/ControllerBinding.cs | 4 +-- BizHawk.MultiClient/Rewind.cs | 32 +++++++++++++------ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/BizHawk.MultiClient/Input/ControllerBinding.cs b/BizHawk.MultiClient/Input/ControllerBinding.cs index 55406e1552..9dd229920c 100644 --- a/BizHawk.MultiClient/Input/ControllerBinding.cs +++ b/BizHawk.MultiClient/Input/ControllerBinding.cs @@ -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; } } diff --git a/BizHawk.MultiClient/Rewind.cs b/BizHawk.MultiClient/Rewind.cs index 8527decdf7..0643f80da5 100644 --- a/BizHawk.MultiClient/Rewind.cs +++ b/BizHawk.MultiClient/Rewind.cs @@ -7,6 +7,8 @@ namespace BizHawk.MultiClient private readonly MruStack RewindBuf = new MruStack(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.