Option to make rewind speed proportional to rewind frequency.

This commit is contained in:
jdpurcell 2015-01-12 05:30:27 +00:00
parent ed43d773a6
commit 3d37e3dc5a
5 changed files with 58 additions and 34 deletions

View File

@ -155,6 +155,7 @@ namespace BizHawk.Client.Common
public int Rewind_BufferSize = 128; //in mb
public bool Rewind_OnDisk = false;
public bool Rewind_IsThreaded = false;
public bool RewindSpeedProportional = false;
// Savestate settings
public SaveStateTypeE SaveStateType = SaveStateTypeE.Default;

View File

@ -51,6 +51,11 @@ namespace BizHawk.Client.Common
get { return _rewindBuffer != null; }
}
public int RewindFrequency
{
get { return _rewindFrequency; }
}
// TOOD: this should not be parameterless?! It is only possible due to passing a static context in
public void CaptureRewindState()
{

View File

@ -1656,6 +1656,7 @@ namespace BizHawk.Client.EmuHawk
//TODO - did we change 'unthrottled' nomenclature to turbo? is turbo defined as 'temporarily disable throttle entirely'?
var rewind = Global.Rewinder.RewindActive && (Global.ClientControls["Rewind"] || PressRewind);
var fastforward = Global.ClientControls["Fast Forward"] || FastForward;
var superfastforward = IsTurboing;
@ -1667,7 +1668,10 @@ namespace BizHawk.Client.EmuHawk
_throttle.SetCoreFps(Global.Emulator.CoreComm.VsyncRate);
_throttle.signal_paused = EmulatorPaused;
_throttle.signal_unthrottle = _unthrottled || superfastforward;
_throttle.SetSpeedPercent(fastforward ? Global.Config.SpeedPercentAlternate : Global.Config.SpeedPercent);
_throttle.SetSpeedPercent(
rewind && Global.Config.RewindSpeedProportional ? Math.Max(100 / Global.Rewinder.RewindFrequency, 5) :
fastforward ? Global.Config.SpeedPercentAlternate :
Global.Config.SpeedPercent);
}
private void SetSpeedPercentAlternate(int value)

View File

@ -62,6 +62,8 @@
this.MediumStateSizeLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.RewindSpeedProportionalCheckbox = new System.Windows.Forms.CheckBox();
this.label17 = new System.Windows.Forms.Label();
this.RewindIsThreadedCheckbox = new System.Windows.Forms.CheckBox();
this.label4 = new System.Windows.Forms.Label();
this.BufferSizeUpDown = new System.Windows.Forms.NumericUpDown();
@ -87,7 +89,6 @@
this.trackBarCompression = new System.Windows.Forms.TrackBar();
this.nudCompression = new System.Windows.Forms.NumericUpDown();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.label12 = new System.Windows.Forms.Label();
this.KbLabel = new System.Windows.Forms.Label();
this.BigScreenshotNumeric = new System.Windows.Forms.NumericUpDown();
this.SaveLargeScreenshotsCheckbox = new System.Windows.Forms.CheckBox();
@ -97,7 +98,7 @@
this.label15 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.BackupSavestatesCheckbox = new System.Windows.Forms.CheckBox();
this.label17 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.LargeSavestateNumeric)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.MediumSavestateNumeric)).BeginInit();
@ -120,7 +121,7 @@
// OK
//
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OK.Location = new System.Drawing.Point(575, 437);
this.OK.Location = new System.Drawing.Point(575, 462);
this.OK.Name = "OK";
this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.TabIndex = 0;
@ -132,7 +133,7 @@
//
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Location = new System.Drawing.Point(656, 437);
this.Cancel.Location = new System.Drawing.Point(656, 462);
this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 1;
@ -360,7 +361,7 @@
// UseDeltaCompression
//
this.UseDeltaCompression.AutoSize = true;
this.UseDeltaCompression.Location = new System.Drawing.Point(16, 59);
this.UseDeltaCompression.Location = new System.Drawing.Point(16, 82);
this.UseDeltaCompression.Name = "UseDeltaCompression";
this.UseDeltaCompression.Size = new System.Drawing.Size(332, 17);
this.UseDeltaCompression.TabIndex = 4;
@ -393,7 +394,7 @@
this.MediumStateTrackbar.Maximum = 4096;
this.MediumStateTrackbar.Minimum = 1;
this.MediumStateTrackbar.Name = "MediumStateTrackbar";
this.MediumStateTrackbar.Size = new System.Drawing.Size(186, 42);
this.MediumStateTrackbar.Size = new System.Drawing.Size(186, 45);
this.MediumStateTrackbar.TabIndex = 7;
this.MediumStateTrackbar.TickFrequency = 256;
this.MediumStateTrackbar.Value = 1;
@ -409,7 +410,7 @@
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, 356);
this.groupBox2.Location = new System.Drawing.Point(12, 378);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(371, 105);
this.groupBox2.TabIndex = 8;
@ -487,7 +488,7 @@
this.LargeStateTrackbar.Maximum = 16384;
this.LargeStateTrackbar.Minimum = 256;
this.LargeStateTrackbar.Name = "LargeStateTrackbar";
this.LargeStateTrackbar.Size = new System.Drawing.Size(186, 42);
this.LargeStateTrackbar.Size = new System.Drawing.Size(186, 45);
this.LargeStateTrackbar.TabIndex = 10;
this.LargeStateTrackbar.TickFrequency = 1024;
this.LargeStateTrackbar.Value = 256;
@ -513,6 +514,7 @@
//
// groupBox3
//
this.groupBox3.Controls.Add(this.RewindSpeedProportionalCheckbox);
this.groupBox3.Controls.Add(this.label17);
this.groupBox3.Controls.Add(this.RewindIsThreadedCheckbox);
this.groupBox3.Controls.Add(this.label4);
@ -522,15 +524,34 @@
this.groupBox3.Controls.Add(this.UseDeltaCompression);
this.groupBox3.Location = new System.Drawing.Point(12, 214);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(371, 136);
this.groupBox3.Size = new System.Drawing.Size(371, 158);
this.groupBox3.TabIndex = 9;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Rewind Options";
//
// RewindSpeedProportionalCheckbox
//
this.RewindSpeedProportionalCheckbox.AutoSize = true;
this.RewindSpeedProportionalCheckbox.Location = new System.Drawing.Point(16, 19);
this.RewindSpeedProportionalCheckbox.Name = "RewindSpeedProportionalCheckbox";
this.RewindSpeedProportionalCheckbox.Size = new System.Drawing.Size(258, 17);
this.RewindSpeedProportionalCheckbox.TabIndex = 3;
this.RewindSpeedProportionalCheckbox.Text = "Rewind speed is proportional to rewind frequency";
this.RewindSpeedProportionalCheckbox.UseVisualStyleBackColor = true;
//
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(6, 40);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(278, 13);
this.label17.TabIndex = 32;
this.label17.Text = "These options affect rewind performance in various ways:";
//
// RewindIsThreadedCheckbox
//
this.RewindIsThreadedCheckbox.AutoSize = true;
this.RewindIsThreadedCheckbox.Location = new System.Drawing.Point(16, 82);
this.RewindIsThreadedCheckbox.Location = new System.Drawing.Point(16, 104);
this.RewindIsThreadedCheckbox.Name = "RewindIsThreadedCheckbox";
this.RewindIsThreadedCheckbox.Size = new System.Drawing.Size(151, 17);
this.RewindIsThreadedCheckbox.TabIndex = 17;
@ -541,7 +562,7 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(140, 106);
this.label4.Location = new System.Drawing.Point(140, 129);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(23, 13);
this.label4.TabIndex = 16;
@ -549,7 +570,7 @@
//
// BufferSizeUpDown
//
this.BufferSizeUpDown.Location = new System.Drawing.Point(85, 102);
this.BufferSizeUpDown.Location = new System.Drawing.Point(85, 125);
this.BufferSizeUpDown.Maximum = new decimal(new int[] {
32768,
0,
@ -573,7 +594,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 106);
this.label3.Location = new System.Drawing.Point(6, 129);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(81, 13);
this.label3.TabIndex = 6;
@ -582,7 +603,7 @@
// DiskBufferCheckbox
//
this.DiskBufferCheckbox.AutoSize = true;
this.DiskBufferCheckbox.Location = new System.Drawing.Point(16, 37);
this.DiskBufferCheckbox.Location = new System.Drawing.Point(16, 60);
this.DiskBufferCheckbox.Name = "DiskBufferCheckbox";
this.DiskBufferCheckbox.Size = new System.Drawing.Size(188, 17);
this.DiskBufferCheckbox.TabIndex = 5;
@ -765,7 +786,7 @@
this.trackBarCompression.Location = new System.Drawing.Point(22, 37);
this.trackBarCompression.Maximum = 9;
this.trackBarCompression.Name = "trackBarCompression";
this.trackBarCompression.Size = new System.Drawing.Size(157, 42);
this.trackBarCompression.Size = new System.Drawing.Size(157, 45);
this.trackBarCompression.TabIndex = 20;
this.toolTip1.SetToolTip(this.trackBarCompression, "0 = None; 9 = Maximum");
this.trackBarCompression.Value = 1;
@ -812,15 +833,6 @@
this.groupBox7.TabStop = false;
this.groupBox7.Text = "Savestate Options";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(19, 21);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(96, 13);
this.label12.TabIndex = 24;
this.label12.Text = "Compression Level";
//
// KbLabel
//
this.KbLabel.AutoSize = true;
@ -919,14 +931,14 @@
this.BackupSavestatesCheckbox.Text = "Backup Savestates";
this.BackupSavestatesCheckbox.UseVisualStyleBackColor = true;
//
// label17
// label12
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(6, 19);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(278, 13);
this.label17.TabIndex = 32;
this.label17.Text = "These options affect rewind performance in various ways:";
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(19, 21);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(96, 13);
this.label12.TabIndex = 24;
this.label12.Text = "Compression Level";
//
// RewindConfig
//
@ -934,7 +946,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(741, 472);
this.ClientSize = new System.Drawing.Size(741, 497);
this.Controls.Add(this.groupBox7);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
@ -1047,5 +1059,6 @@
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.CheckBox BackupSavestatesCheckbox;
private System.Windows.Forms.CheckBox RewindSpeedProportionalCheckbox;
}
}

View File

@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
RewindFramesUsedLabel.Text = "N/A";
}
RewindSpeedProportionalCheckbox.Checked = Global.Config.RewindSpeedProportional;
DiskBufferCheckbox.Checked = Global.Config.Rewind_OnDisk;
RewindIsThreadedCheckbox.Checked = Global.Config.Rewind_IsThreaded;
_stateSize = Global.Emulator.AsStatable().SaveStateBinary().Length;
@ -151,6 +151,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.Rewind_UseDelta = UseDeltaCompression.Checked;
Global.Config.Rewind_MediumStateSize = (int)(MediumStateUpDown.Value * 1024);
Global.Config.Rewind_LargeStateSize = (int)(LargeStateUpDown.Value * 1024);
Global.Config.RewindSpeedProportional = RewindSpeedProportionalCheckbox.Checked;
Global.Config.Rewind_OnDisk = DiskBufferCheckbox.Checked;
Global.Config.Rewind_BufferSize = (int)BufferSizeUpDown.Value;
Global.Config.SaveStateCompressionLevelNormal = (int)nudCompression.Value;