Rewind - remove ability to define Small, Medium, Large state sizes
This commit is contained in:
parent
a58a10e633
commit
9d17cd40e8
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public interface IRewindSettings
|
||||
{
|
||||
|
@ -11,8 +9,6 @@ namespace BizHawk.Client.Common
|
|||
public int FrequencySmall { get; }
|
||||
public int FrequencyMedium { get; }
|
||||
public int FrequencyLarge { get; }
|
||||
public int MediumStateSize { get; }
|
||||
public int LargeStateSize { get; }
|
||||
public int BufferSize { get; }
|
||||
public bool OnDisk { get; }
|
||||
}
|
||||
|
@ -27,8 +23,6 @@ namespace BizHawk.Client.Common
|
|||
public int FrequencyMedium { get; set; } = 4;
|
||||
public int FrequencyLarge { get; set; } = 60;
|
||||
|
||||
public int MediumStateSize { get; set; } = 262144; // 256kb
|
||||
public int LargeStateSize { get; set; } = 1048576; // 1mb
|
||||
public int BufferSize { get; set; } = 128; // in mb
|
||||
public bool OnDisk { get; set; }
|
||||
|
||||
|
|
|
@ -51,15 +51,6 @@
|
|||
this.UseCompression = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.StateSizeLabel = new System.Windows.Forms.Label();
|
||||
this.MediumStateTrackbar = new System.Windows.Forms.TrackBar();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.LargeStateUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.MediumStateUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.LargeStateSizeLabel = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.LargeStateTrackbar = new System.Windows.Forms.TrackBar();
|
||||
this.MediumStateSizeLabel = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.label19 = new System.Windows.Forms.Label();
|
||||
this.RewindSpeedNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
|
@ -103,11 +94,6 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.LargeSavestateNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MediumSavestateNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SmallSavestateNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MediumStateTrackbar)).BeginInit();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LargeStateUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MediumStateUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LargeStateTrackbar)).BeginInit();
|
||||
this.groupBox3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.RewindSpeedNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.BufferSizeUpDown)).BeginInit();
|
||||
|
@ -387,132 +373,7 @@
|
|||
this.StateSizeLabel.Size = new System.Drawing.Size(30, 13);
|
||||
this.StateSizeLabel.TabIndex = 6;
|
||||
this.StateSizeLabel.Text = "0 KB";
|
||||
//
|
||||
// MediumStateTrackbar
|
||||
//
|
||||
this.MediumStateTrackbar.LargeChange = 256;
|
||||
this.MediumStateTrackbar.Location = new System.Drawing.Point(67, 22);
|
||||
this.MediumStateTrackbar.Maximum = 4096;
|
||||
this.MediumStateTrackbar.Minimum = 1;
|
||||
this.MediumStateTrackbar.Name = "MediumStateTrackbar";
|
||||
this.MediumStateTrackbar.Size = new System.Drawing.Size(186, 45);
|
||||
this.MediumStateTrackbar.TabIndex = 1;
|
||||
this.MediumStateTrackbar.TickFrequency = 256;
|
||||
this.MediumStateTrackbar.Value = 1;
|
||||
this.MediumStateTrackbar.ValueChanged += new System.EventHandler(this.MediumStateTrackBar_ValueChanged);
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.LargeStateUpDown);
|
||||
this.groupBox2.Controls.Add(this.MediumStateUpDown);
|
||||
this.groupBox2.Controls.Add(this.LargeStateSizeLabel);
|
||||
this.groupBox2.Controls.Add(this.label5);
|
||||
this.groupBox2.Controls.Add(this.LargeStateTrackbar);
|
||||
this.groupBox2.Controls.Add(this.MediumStateSizeLabel);
|
||||
this.groupBox2.Controls.Add(this.label2);
|
||||
this.groupBox2.Controls.Add(this.MediumStateTrackbar);
|
||||
this.groupBox2.Location = new System.Drawing.Point(12, 387);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(371, 105);
|
||||
this.groupBox2.TabIndex = 5;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "State Size Definition";
|
||||
//
|
||||
// LargeStateUpDown
|
||||
//
|
||||
this.LargeStateUpDown.Location = new System.Drawing.Point(259, 67);
|
||||
this.LargeStateUpDown.Maximum = new decimal(new int[] {
|
||||
16384,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.LargeStateUpDown.Minimum = new decimal(new int[] {
|
||||
256,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.LargeStateUpDown.Name = "LargeStateUpDown";
|
||||
this.LargeStateUpDown.Size = new System.Drawing.Size(52, 20);
|
||||
this.LargeStateUpDown.TabIndex = 6;
|
||||
this.LargeStateUpDown.Value = new decimal(new int[] {
|
||||
256,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.LargeStateUpDown.ValueChanged += new System.EventHandler(this.LargeStateUpDown_ValueChanged);
|
||||
//
|
||||
// MediumStateUpDown
|
||||
//
|
||||
this.MediumStateUpDown.Location = new System.Drawing.Point(259, 31);
|
||||
this.MediumStateUpDown.Maximum = new decimal(new int[] {
|
||||
4096,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.MediumStateUpDown.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.MediumStateUpDown.Name = "MediumStateUpDown";
|
||||
this.MediumStateUpDown.Size = new System.Drawing.Size(52, 20);
|
||||
this.MediumStateUpDown.TabIndex = 2;
|
||||
this.MediumStateUpDown.Value = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.MediumStateUpDown.ValueChanged += new System.EventHandler(this.MediumStateUpDown_ValueChanged);
|
||||
//
|
||||
// LargeStateSizeLabel
|
||||
//
|
||||
this.LargeStateSizeLabel.AutoSize = true;
|
||||
this.LargeStateSizeLabel.Location = new System.Drawing.Point(312, 71);
|
||||
this.LargeStateSizeLabel.Name = "LargeStateSizeLabel";
|
||||
this.LargeStateSizeLabel.Size = new System.Drawing.Size(21, 13);
|
||||
this.LargeStateSizeLabel.TabIndex = 7;
|
||||
this.LargeStateSizeLabel.Text = "KB";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(27, 63);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(34, 13);
|
||||
this.label5.TabIndex = 4;
|
||||
this.label5.Text = "Large";
|
||||
//
|
||||
// LargeStateTrackbar
|
||||
//
|
||||
this.LargeStateTrackbar.LargeChange = 1024;
|
||||
this.LargeStateTrackbar.Location = new System.Drawing.Point(67, 58);
|
||||
this.LargeStateTrackbar.Maximum = 16384;
|
||||
this.LargeStateTrackbar.Minimum = 256;
|
||||
this.LargeStateTrackbar.Name = "LargeStateTrackbar";
|
||||
this.LargeStateTrackbar.Size = new System.Drawing.Size(186, 45);
|
||||
this.LargeStateTrackbar.TabIndex = 5;
|
||||
this.LargeStateTrackbar.TickFrequency = 1024;
|
||||
this.LargeStateTrackbar.Value = 256;
|
||||
this.LargeStateTrackbar.ValueChanged += new System.EventHandler(this.LargeStateTrackBar_ValueChanged);
|
||||
//
|
||||
// MediumStateSizeLabel
|
||||
//
|
||||
this.MediumStateSizeLabel.AutoSize = true;
|
||||
this.MediumStateSizeLabel.Location = new System.Drawing.Point(313, 35);
|
||||
this.MediumStateSizeLabel.Name = "MediumStateSizeLabel";
|
||||
this.MediumStateSizeLabel.Size = new System.Drawing.Size(21, 13);
|
||||
this.MediumStateSizeLabel.TabIndex = 3;
|
||||
this.MediumStateSizeLabel.Text = "KB";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(18, 31);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(44, 13);
|
||||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "Medium";
|
||||
//
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.label19);
|
||||
|
@ -969,7 +830,6 @@
|
|||
this.Controls.Add(this.groupBox7);
|
||||
this.Controls.Add(this.groupBox4);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.Cancel);
|
||||
this.Controls.Add(this.OK);
|
||||
|
@ -986,12 +846,6 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.LargeSavestateNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MediumSavestateNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SmallSavestateNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MediumStateTrackbar)).EndInit();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LargeStateUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MediumStateUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LargeStateTrackbar)).EndInit();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.RewindSpeedNumeric)).EndInit();
|
||||
|
@ -1033,15 +887,6 @@
|
|||
private System.Windows.Forms.CheckBox UseCompression;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label StateSizeLabel;
|
||||
private System.Windows.Forms.TrackBar MediumStateTrackbar;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label MediumStateSizeLabel;
|
||||
private System.Windows.Forms.Label LargeStateSizeLabel;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TrackBar LargeStateTrackbar;
|
||||
private System.Windows.Forms.NumericUpDown LargeStateUpDown;
|
||||
private System.Windows.Forms.NumericUpDown MediumStateUpDown;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.CheckBox DiskBufferCheckbox;
|
||||
private System.Windows.Forms.Label label4;
|
||||
|
|
|
@ -14,8 +14,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
private readonly IStatable _statableCore;
|
||||
|
||||
private long _stateSize;
|
||||
private int _mediumStateSize;
|
||||
private int _largeStateSize;
|
||||
private int _stateSizeCategory = 1; // 1 = small, 2 = med, 3 = large // TODO: enum
|
||||
|
||||
public RewindConfig(MainForm mainForm, Config config, IStatable statableCore)
|
||||
|
@ -44,9 +42,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
_stateSize = _statableCore.CloneSavestate().Length;
|
||||
BufferSizeUpDown.Value = Math.Max(_config.Rewind.BufferSize, BufferSizeUpDown.Minimum);
|
||||
|
||||
_mediumStateSize = _config.Rewind.MediumStateSize;
|
||||
_largeStateSize = _config.Rewind.LargeStateSize;
|
||||
|
||||
UseCompression.Checked = _config.Rewind.UseCompression;
|
||||
|
||||
SmallSavestateNumeric.Value = _config.Rewind.FrequencySmall;
|
||||
|
@ -63,14 +58,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
SetStateSize();
|
||||
|
||||
var mediumStateSizeKb = _config.Rewind.MediumStateSize / 1024;
|
||||
var largeStateSizeKb = _config.Rewind.LargeStateSize / 1024;
|
||||
|
||||
MediumStateTrackbar.Value = mediumStateSizeKb;
|
||||
MediumStateUpDown.Value = mediumStateSizeKb;
|
||||
LargeStateTrackbar.Value = largeStateSizeKb;
|
||||
LargeStateUpDown.Value = largeStateSizeKb;
|
||||
|
||||
nudCompression.Value = _config.Savestates.CompressionLevelNormal;
|
||||
|
||||
rbStatesBinary.Checked = _config.Savestates.Type == SaveStateType.Binary;
|
||||
|
@ -109,31 +96,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
StateSizeLabel.Text = FormatKB(_stateSize);
|
||||
|
||||
SmallLabel.Text = $"Small savestates (less than {_mediumStateSize / 1024}KB)";
|
||||
MediumLabel.Text = $"Medium savestates ({_mediumStateSize / 1024} - {_largeStateSize / 1024}KB)";
|
||||
LargeLabel.Text = $"Large savestates ({_largeStateSize / 1024}KB or more)";
|
||||
SmallLabel.Text = $"Small savestates";
|
||||
MediumLabel.Text = $"Medium savestates";
|
||||
LargeLabel.Text = $"Large savestates";
|
||||
|
||||
if (_stateSize >= _largeStateSize)
|
||||
{
|
||||
_stateSizeCategory = 3;
|
||||
SmallLabel.Font = new Font(SmallLabel.Font, FontStyle.Regular);
|
||||
MediumLabel.Font = new Font(SmallLabel.Font, FontStyle.Regular);
|
||||
LargeLabel.Font = new Font(SmallLabel.Font, FontStyle.Italic);
|
||||
}
|
||||
else if (_stateSize >= _mediumStateSize)
|
||||
{
|
||||
_stateSizeCategory = 2;
|
||||
SmallLabel.Font = new Font(SmallLabel.Font, FontStyle.Regular);
|
||||
MediumLabel.Font = new Font(SmallLabel.Font, FontStyle.Italic);
|
||||
LargeLabel.Font = new Font(SmallLabel.Font, FontStyle.Regular);
|
||||
}
|
||||
else
|
||||
{
|
||||
_stateSizeCategory = 1;
|
||||
SmallLabel.Font = new Font(SmallLabel.Font, FontStyle.Italic);
|
||||
MediumLabel.Font = new Font(SmallLabel.Font, FontStyle.Regular);
|
||||
LargeLabel.Font = new Font(SmallLabel.Font, FontStyle.Regular);
|
||||
}
|
||||
_stateSizeCategory = 1;
|
||||
SmallLabel.Font = new Font(SmallLabel.Font, FontStyle.Italic);
|
||||
MediumLabel.Font = new Font(SmallLabel.Font, FontStyle.Regular);
|
||||
LargeLabel.Font = new Font(SmallLabel.Font, FontStyle.Regular);
|
||||
|
||||
CalculateEstimates();
|
||||
}
|
||||
|
@ -166,8 +136,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
_config.Rewind.FrequencySmall = PutRewindSetting(_config.Rewind.FrequencySmall, (int)SmallSavestateNumeric.Value);
|
||||
_config.Rewind.FrequencyMedium = PutRewindSetting(_config.Rewind.FrequencyMedium, (int)MediumSavestateNumeric.Value);
|
||||
_config.Rewind.FrequencyLarge = PutRewindSetting(_config.Rewind.FrequencyLarge, (int)LargeSavestateNumeric.Value);
|
||||
_config.Rewind.MediumStateSize = PutRewindSetting(_config.Rewind.MediumStateSize, (int)MediumStateUpDown.Value * 1024);
|
||||
_config.Rewind.LargeStateSize = PutRewindSetting(_config.Rewind.LargeStateSize, (int)LargeStateUpDown.Value * 1024);
|
||||
_config.Rewind.BufferSize = PutRewindSetting(_config.Rewind.BufferSize, (int)BufferSizeUpDown.Value);
|
||||
_config.Rewind.OnDisk = PutRewindSetting(_config.Rewind.OnDisk, DiskBufferCheckbox.Checked);
|
||||
|
||||
|
@ -241,68 +209,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
SmallStateEnabledBox.Checked ^= true;
|
||||
}
|
||||
|
||||
private void MediumStateTrackBar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
MediumStateUpDown.Value = ((TrackBar)sender).Value;
|
||||
if (MediumStateUpDown.Value > LargeStateUpDown.Value)
|
||||
{
|
||||
LargeStateUpDown.Value = MediumStateUpDown.Value;
|
||||
LargeStateTrackbar.Value = (int)MediumStateUpDown.Value;
|
||||
}
|
||||
|
||||
_mediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
_largeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
SetStateSize();
|
||||
}
|
||||
|
||||
private void MediumStateUpDown_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
MediumStateTrackbar.Value = (int)((NumericUpDown)sender).Value;
|
||||
if (MediumStateUpDown.Value > LargeStateUpDown.Value)
|
||||
{
|
||||
LargeStateUpDown.Value = MediumStateUpDown.Value;
|
||||
LargeStateTrackbar.Value = (int)MediumStateUpDown.Value;
|
||||
}
|
||||
|
||||
_mediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
_largeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
SetStateSize();
|
||||
}
|
||||
|
||||
private void LargeStateTrackBar_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (LargeStateTrackbar.Value < MediumStateTrackbar.Value)
|
||||
{
|
||||
LargeStateTrackbar.Value = MediumStateTrackbar.Value;
|
||||
LargeStateUpDown.Value = MediumStateTrackbar.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
LargeStateUpDown.Value = ((TrackBar)sender).Value;
|
||||
}
|
||||
|
||||
_mediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
_largeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
SetStateSize();
|
||||
}
|
||||
|
||||
private void LargeStateUpDown_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (LargeStateUpDown.Value < MediumStateUpDown.Value)
|
||||
{
|
||||
LargeStateTrackbar.Value = MediumStateTrackbar.Value;
|
||||
LargeStateUpDown.Value = MediumStateTrackbar.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
LargeStateTrackbar.Value = (int)((NumericUpDown)sender).Value;
|
||||
}
|
||||
|
||||
_mediumStateSize = MediumStateTrackbar.Value * 1024;
|
||||
_largeStateSize = LargeStateTrackbar.Value * 1024;
|
||||
SetStateSize();
|
||||
}
|
||||
|
||||
private void CalculateEstimates()
|
||||
{
|
||||
long avgStateSize;
|
||||
|
|
Loading…
Reference in New Issue