Rewind Config - don't crash on load when rewind is off for the core currently loaded
This commit is contained in:
parent
6193be13e9
commit
cec62d38f5
|
@ -8,7 +8,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
public partial class MainForm
|
public partial class MainForm
|
||||||
{
|
{
|
||||||
private StreamBlobDatabase RewindBuf;// = new StreamBlobDatabase(Global.Config.Rewind_OnDisk, Global.Config.Rewind_BufferSize * (long)1024 * (long)1024);
|
public StreamBlobDatabase RewindBuf;// = new StreamBlobDatabase(Global.Config.Rewind_OnDisk, Global.Config.Rewind_BufferSize * (long)1024 * (long)1024);
|
||||||
private RewindThreader RewindThread;
|
private RewindThreader RewindThread;
|
||||||
|
|
||||||
private byte[] LastState;
|
private byte[] LastState;
|
||||||
|
@ -17,13 +17,13 @@ namespace BizHawk.MultiClient
|
||||||
private bool RewindDeltaEnable = false;
|
private bool RewindDeltaEnable = false;
|
||||||
|
|
||||||
public float Rewind_FullnessRatio { get { return RewindBuf.FullnessRatio; } }
|
public float Rewind_FullnessRatio { get { return RewindBuf.FullnessRatio; } }
|
||||||
public int Rewind_Count { get { return RewindBuf.Count; } }
|
public int Rewind_Count { get { return RewindBuf != null ? RewindBuf.Count : 0; } }
|
||||||
public long Rewind_Size { get { return RewindBuf.Size; } }
|
public long Rewind_Size { get { return RewindBuf != null ? RewindBuf.Size : 0; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manages a ring buffer of storage which can continually chow its own tail to keep growing forward.
|
/// Manages a ring buffer of storage which can continually chow its own tail to keep growing forward.
|
||||||
/// Probably only useful for the rewind buffer, so I didnt put it in another file
|
/// Probably only useful for the rewind buffer, so I didnt put it in another file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class StreamBlobDatabase : IDisposable
|
public class StreamBlobDatabase : IDisposable
|
||||||
{
|
{
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,39 +17,58 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
private void RewindConfig_Load(object sender, EventArgs e)
|
private void RewindConfig_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FullnessLabel.Text = String.Format("{0:0.00}", Global.MainForm.Rewind_FullnessRatio * 100) + "%";
|
if (Global.MainForm.RewindBuf != null)
|
||||||
RewindFramesUsedLabel.Text = Global.MainForm.Rewind_Count.ToString();
|
{
|
||||||
StateSize = Global.Emulator.SaveStateBinary().Length;
|
FullnessLabel.Text = String.Format("{0:0.00}", Global.MainForm.Rewind_FullnessRatio * 100) + "%";
|
||||||
RewindIsThreadedCheckbox.Checked = Global.Config.Rewind_IsThreaded;
|
RewindFramesUsedLabel.Text = Global.MainForm.Rewind_Count.ToString();
|
||||||
DiskBufferCheckbox.Checked = Global.Config.Rewind_OnDisk;
|
}
|
||||||
BufferSizeUpDown.Value = Global.Config.Rewind_BufferSize;
|
else
|
||||||
|
{
|
||||||
|
FullnessLabel.Text = "N/A";
|
||||||
|
RewindFramesUsedLabel.Text = "N/A";
|
||||||
|
}
|
||||||
|
|
||||||
MediumStateSize = Global.Config.Rewind_MediumStateSize;
|
try
|
||||||
LargeStateSize = Global.Config.Rewind_LargeStateSize;
|
{
|
||||||
|
DiskBufferCheckbox.Checked = Global.Config.Rewind_OnDisk;
|
||||||
|
RewindIsThreadedCheckbox.Checked = Global.Config.Rewind_IsThreaded;
|
||||||
|
StateSize = Global.Emulator.SaveStateBinary().Length;
|
||||||
|
BufferSizeUpDown.Value = Global.Config.Rewind_BufferSize;
|
||||||
|
|
||||||
UseDeltaCompression.Checked = Global.Config.Rewind_UseDelta;
|
MediumStateSize = Global.Config.Rewind_MediumStateSize;
|
||||||
|
LargeStateSize = Global.Config.Rewind_LargeStateSize;
|
||||||
|
|
||||||
SmallSavestateNumeric.Value = Global.Config.RewindFrequencySmall;
|
UseDeltaCompression.Checked = Global.Config.Rewind_UseDelta;
|
||||||
MediumSavestateNumeric.Value = Global.Config.RewindFrequencyMedium;
|
|
||||||
LargeSavestateNumeric.Value = Global.Config.RewindFrequencyLarge;
|
|
||||||
|
|
||||||
SmallStateEnabledBox.Checked = Global.Config.RewindEnabledSmall;
|
SmallSavestateNumeric.Value = Global.Config.RewindFrequencySmall;
|
||||||
MediumStateEnabledBox.Checked = Global.Config.RewindEnabledMedium;
|
MediumSavestateNumeric.Value = Global.Config.RewindFrequencyMedium;
|
||||||
LargeStateEnabledBox.Checked = Global.Config.RewindEnabledLarge;
|
LargeSavestateNumeric.Value = Global.Config.RewindFrequencyLarge;
|
||||||
|
|
||||||
SetSmallEnabled();
|
SmallStateEnabledBox.Checked = Global.Config.RewindEnabledSmall;
|
||||||
SetMediumEnabled();
|
MediumStateEnabledBox.Checked = Global.Config.RewindEnabledMedium;
|
||||||
SetLargeEnabled();
|
LargeStateEnabledBox.Checked = Global.Config.RewindEnabledLarge;
|
||||||
|
|
||||||
SetStateSize();
|
SetSmallEnabled();
|
||||||
|
SetMediumEnabled();
|
||||||
|
SetLargeEnabled();
|
||||||
|
|
||||||
int medium_state_size_kb = Global.Config.Rewind_MediumStateSize / 1024;
|
SetStateSize();
|
||||||
int large_state_size_kb = Global.Config.Rewind_LargeStateSize / 1024;
|
|
||||||
|
|
||||||
MediumStateTrackbar.Value = medium_state_size_kb;
|
int medium_state_size_kb = Global.Config.Rewind_MediumStateSize / 1024;
|
||||||
MediumStateUpDown.Value = (decimal)medium_state_size_kb;
|
int large_state_size_kb = Global.Config.Rewind_LargeStateSize / 1024;
|
||||||
LargeStateTrackbar.Value = large_state_size_kb;
|
|
||||||
LargeStateUpDown.Value = (decimal)large_state_size_kb;
|
MediumStateTrackbar.Value = medium_state_size_kb;
|
||||||
|
MediumStateUpDown.Value = (decimal)medium_state_size_kb;
|
||||||
|
LargeStateTrackbar.Value = large_state_size_kb;
|
||||||
|
LargeStateUpDown.Value = (decimal)large_state_size_kb;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
x++;
|
||||||
|
int y = x;
|
||||||
|
y++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetStateSize()
|
private void SetStateSize()
|
||||||
|
|
Loading…
Reference in New Issue