diff --git a/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesApi.cs b/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesApi.cs
index f1406e7bf6..16683f527e 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesApi.cs
+++ b/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesApi.cs
@@ -1,9 +1,4 @@
-//controls whether the new shared memory ring buffer communication system is used
-//on the whole it seems to boost performance slightly for me, at the cost of exacerbating spikes
-//not sure if we should keep it
-#define USE_BUFIO
-
-using System;
+using System;
using System.Linq;
using System.Diagnostics;
using System.Globalization;
@@ -550,22 +545,19 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public void BeginBufferIO()
{
-#if USE_BUFIO
bufio = true;
WritePipeMessage(eMessage.eMessage_BeginBufferIO);
rstream.SetCurrStream(rbufstr);
wstream.SetCurrStream(wbufstr);
-#endif
}
public void EndBufferIO()
{
-#if USE_BUFIO
+ if(!bufio) return;
bufio = false;
WritePipeMessage(eMessage.eMessage_EndBufferIO);
rstream.SetCurrStream(pipe);
wstream.SetCurrStream(pipe);
-#endif
}
void WritePipeString(string str)
diff --git a/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesCore.cs
index b0c80f20cd..bba2fcb787 100644
--- a/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesCore.cs
+++ b/BizHawk.Emulation/Consoles/Nintendo/SNES/LibsnesCore.cs
@@ -344,7 +344,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
{
api.MessageCounter = 0;
- api.BeginBufferIO();
+ if(CoreComm.SNES_UseRingBuffer)
+ api.BeginBufferIO();
// for deterministic emulation, save the state we're going to use before frame advance
// don't do this during nocallbacks though, since it's already been done
diff --git a/BizHawk.Emulation/Interfaces/CoreComms.cs b/BizHawk.Emulation/Interfaces/CoreComms.cs
index 2287df7966..cfef0be1ba 100644
--- a/BizHawk.Emulation/Interfaces/CoreComms.cs
+++ b/BizHawk.Emulation/Interfaces/CoreComms.cs
@@ -17,6 +17,7 @@ namespace BizHawk
public string SNES_ExePath;
public string SNES_Profile;
+ public bool SNES_UseRingBuffer;
public bool SNES_ShowBG1_0, SNES_ShowBG2_0, SNES_ShowBG3_0, SNES_ShowBG4_0;
public bool SNES_ShowBG1_1, SNES_ShowBG2_1, SNES_ShowBG3_1, SNES_ShowBG4_1;
diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj
index 8fb8f635fd..0a418c0afd 100644
--- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj
+++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj
@@ -1018,12 +1018,6 @@
-
-
-
-
-
-
diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs
index 2af567bed8..502e256199 100644
--- a/BizHawk.MultiClient/Config.cs
+++ b/BizHawk.MultiClient/Config.cs
@@ -749,6 +749,7 @@ namespace BizHawk.MultiClient
public SNESControllerTemplate[] SNESAutoController = new SNESControllerTemplate[4];
public NESConsoleButtonTemplate SNESConsoleButtons = new NESConsoleButtonTemplate();
public string SNESProfile = "Compatibility";
+ public bool SNESUseRingBuffer = true;
//TI 83 settings
public TI83ControllerTemplate[] TI83Controller = new TI83ControllerTemplate[1];
diff --git a/BizHawk.MultiClient/MainForm.MenuItems.cs b/BizHawk.MultiClient/MainForm.MenuItems.cs
index c0c74ee3d1..93b19a5a32 100644
--- a/BizHawk.MultiClient/MainForm.MenuItems.cs
+++ b/BizHawk.MultiClient/MainForm.MenuItems.cs
@@ -1814,12 +1814,15 @@ namespace BizHawk.MultiClient
private void miSnesOptions_Click(object sender, EventArgs e)
{
var so = new SNESOptions();
+ so.UseRingBuffer = Global.Config.SNESUseRingBuffer;
so.Profile = Global.Config.SNESProfile;
if (so.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
bool reboot = Global.Config.SNESProfile != so.Profile;
Global.Config.SNESProfile = so.Profile;
+ Global.Config.SNESUseRingBuffer = so.UseRingBuffer;
if (reboot) FlagNeedsReboot();
+ SyncCoreCommInputSignals();
}
}
diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs
index 2892d2f9a7..959836bf15 100644
--- a/BizHawk.MultiClient/MainForm.cs
+++ b/BizHawk.MultiClient/MainForm.cs
@@ -431,6 +431,7 @@ namespace BizHawk.MultiClient
target.SNES_ShowOBJ_3 = Global.Config.SNES_ShowOBJ4;
target.SNES_Profile = Global.Config.SNESProfile;
+ target.SNES_UseRingBuffer = Global.Config.SNESUseRingBuffer;
target.GG_HighlightActiveDisplayRegion = Global.Config.GGHighlightActiveDisplayRegion;
target.GG_ShowClippedRegions = Global.Config.GGShowClippedRegions;
diff --git a/BizHawk.MultiClient/SNESTools/SNESOptions.Designer.cs b/BizHawk.MultiClient/SNESTools/SNESOptions.Designer.cs
index 5ad3627d4c..f8530fa8af 100644
--- a/BizHawk.MultiClient/SNESTools/SNESOptions.Designer.cs
+++ b/BizHawk.MultiClient/SNESTools/SNESOptions.Designer.cs
@@ -33,13 +33,15 @@
this.rbCompatibility = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rbPerformance = new System.Windows.Forms.RadioButton();
+ this.cbRingbuf = new System.Windows.Forms.CheckBox();
+ this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// btnOk
//
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnOk.Location = new System.Drawing.Point(141, 102);
+ this.btnOk.Location = new System.Drawing.Point(141, 172);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 0;
@@ -51,7 +53,7 @@
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Location = new System.Drawing.Point(222, 102);
+ this.btnCancel.Location = new System.Drawing.Point(222, 172);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
@@ -91,6 +93,25 @@
this.rbPerformance.TabStop = true;
this.rbPerformance.Text = "Performance (only for casual gaming!)";
this.rbPerformance.UseVisualStyleBackColor = true;
+ //
+ // cbRingbuf
+ //
+ this.cbRingbuf.AutoSize = true;
+ this.cbRingbuf.Location = new System.Drawing.Point(18, 97);
+ this.cbRingbuf.Name = "cbRingbuf";
+ this.cbRingbuf.Size = new System.Drawing.Size(115, 17);
+ this.cbRingbuf.TabIndex = 4;
+ this.cbRingbuf.Text = "Use Ring Buffer IO";
+ this.cbRingbuf.UseVisualStyleBackColor = true;
+ //
+ // label1
+ //
+ this.label1.Location = new System.Drawing.Point(34, 117);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(254, 45);
+ this.label1.TabIndex = 5;
+ this.label1.Text = "This was designed as an optimization but it isn\'t clear whether it works. Feel fr" +
+ "ee to try different settings and let us know the results.";
//
// SNESOptions
//
@@ -98,7 +119,9 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
- this.ClientSize = new System.Drawing.Size(300, 128);
+ this.ClientSize = new System.Drawing.Size(300, 198);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.cbRingbuf);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
@@ -107,6 +130,7 @@
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -117,5 +141,7 @@
private System.Windows.Forms.RadioButton rbCompatibility;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton rbPerformance;
+ private System.Windows.Forms.CheckBox cbRingbuf;
+ private System.Windows.Forms.Label label1;
}
}
\ No newline at end of file
diff --git a/BizHawk.MultiClient/SNESTools/SNESOptions.cs b/BizHawk.MultiClient/SNESTools/SNESOptions.cs
index 6ef1c0466f..c6b0b58868 100644
--- a/BizHawk.MultiClient/SNESTools/SNESOptions.cs
+++ b/BizHawk.MultiClient/SNESTools/SNESOptions.cs
@@ -26,6 +26,12 @@ namespace BizHawk.MultiClient
}
}
+ public bool UseRingBuffer
+ {
+ get { return cbRingbuf.Checked; }
+ set { cbRingbuf.Checked = value; }
+ }
+
private void btnOk_Click(object sender, EventArgs e)
{
DialogResult = System.Windows.Forms.DialogResult.OK;