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
|
||||
{
|
||||
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 byte[] LastState;
|
||||
|
@ -17,13 +17,13 @@ namespace BizHawk.MultiClient
|
|||
private bool RewindDeltaEnable = false;
|
||||
|
||||
public float Rewind_FullnessRatio { get { return RewindBuf.FullnessRatio; } }
|
||||
public int Rewind_Count { get { return RewindBuf.Count; } }
|
||||
public long Rewind_Size { get { return RewindBuf.Size; } }
|
||||
public int Rewind_Count { get { return RewindBuf != null ? RewindBuf.Count : 0; } }
|
||||
public long Rewind_Size { get { return RewindBuf != null ? RewindBuf.Size : 0; } }
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
class StreamBlobDatabase : IDisposable
|
||||
public class StreamBlobDatabase : IDisposable
|
||||
{
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
|
@ -17,39 +17,58 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void RewindConfig_Load(object sender, EventArgs e)
|
||||
{
|
||||
FullnessLabel.Text = String.Format("{0:0.00}", Global.MainForm.Rewind_FullnessRatio * 100) + "%";
|
||||
RewindFramesUsedLabel.Text = Global.MainForm.Rewind_Count.ToString();
|
||||
StateSize = Global.Emulator.SaveStateBinary().Length;
|
||||
RewindIsThreadedCheckbox.Checked = Global.Config.Rewind_IsThreaded;
|
||||
DiskBufferCheckbox.Checked = Global.Config.Rewind_OnDisk;
|
||||
BufferSizeUpDown.Value = Global.Config.Rewind_BufferSize;
|
||||
if (Global.MainForm.RewindBuf != null)
|
||||
{
|
||||
FullnessLabel.Text = String.Format("{0:0.00}", Global.MainForm.Rewind_FullnessRatio * 100) + "%";
|
||||
RewindFramesUsedLabel.Text = Global.MainForm.Rewind_Count.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
FullnessLabel.Text = "N/A";
|
||||
RewindFramesUsedLabel.Text = "N/A";
|
||||
}
|
||||
|
||||
MediumStateSize = Global.Config.Rewind_MediumStateSize;
|
||||
LargeStateSize = Global.Config.Rewind_LargeStateSize;
|
||||
try
|
||||
{
|
||||
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;
|
||||
MediumSavestateNumeric.Value = Global.Config.RewindFrequencyMedium;
|
||||
LargeSavestateNumeric.Value = Global.Config.RewindFrequencyLarge;
|
||||
UseDeltaCompression.Checked = Global.Config.Rewind_UseDelta;
|
||||
|
||||
SmallStateEnabledBox.Checked = Global.Config.RewindEnabledSmall;
|
||||
MediumStateEnabledBox.Checked = Global.Config.RewindEnabledMedium;
|
||||
LargeStateEnabledBox.Checked = Global.Config.RewindEnabledLarge;
|
||||
SmallSavestateNumeric.Value = Global.Config.RewindFrequencySmall;
|
||||
MediumSavestateNumeric.Value = Global.Config.RewindFrequencyMedium;
|
||||
LargeSavestateNumeric.Value = Global.Config.RewindFrequencyLarge;
|
||||
|
||||
SetSmallEnabled();
|
||||
SetMediumEnabled();
|
||||
SetLargeEnabled();
|
||||
SmallStateEnabledBox.Checked = Global.Config.RewindEnabledSmall;
|
||||
MediumStateEnabledBox.Checked = Global.Config.RewindEnabledMedium;
|
||||
LargeStateEnabledBox.Checked = Global.Config.RewindEnabledLarge;
|
||||
|
||||
SetStateSize();
|
||||
SetSmallEnabled();
|
||||
SetMediumEnabled();
|
||||
SetLargeEnabled();
|
||||
|
||||
int medium_state_size_kb = Global.Config.Rewind_MediumStateSize / 1024;
|
||||
int large_state_size_kb = Global.Config.Rewind_LargeStateSize / 1024;
|
||||
SetStateSize();
|
||||
|
||||
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;
|
||||
int medium_state_size_kb = Global.Config.Rewind_MediumStateSize / 1024;
|
||||
int large_state_size_kb = Global.Config.Rewind_LargeStateSize / 1024;
|
||||
|
||||
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()
|
||||
|
|
Loading…
Reference in New Issue