snes-add gui option for ring buffer mode. its unclear whether it speeds things up, but its possible that it might, and it was a lot of work, so here it is as a user option.

This commit is contained in:
zeromus 2013-01-18 05:06:26 +00:00
parent 11aef10c2e
commit 9cf0a3f30f
9 changed files with 45 additions and 20 deletions

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -1018,12 +1018,6 @@
<None Include="images\reboot.png" />
<None Include="images\SNESControllerIcon.png" />
<None Include="images\pencil.png" />
<Content Include="output\gamedb_sega_md.txt" />
<Content Include="output\gamedb.txt" />
<Content Include="output\gamedb_neshomebrew.txt" />
<Content Include="output\gamedb_pce_cd.txt" />
<Content Include="output\gamedb_pce_hucards.txt" />
<Content Include="output\gamedb_sega_8bit.txt" />
<None Include="images\Refresh.bmp" />
<None Include="images\TruncateFromRW.png" />
<None Include="images\TruncateFromFile.png" />

View File

@ -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];

View File

@ -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();
}
}

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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;