add 'crop SGB frame' option; fixes #871

This commit is contained in:
zeromus 2017-06-11 18:20:55 -05:00
parent 6227ae2770
commit 6db010e384
4 changed files with 59 additions and 5 deletions

View File

@ -39,13 +39,15 @@
this.lblDoubleSize = new System.Windows.Forms.Label();
this.cbForceDeterminism = new System.Windows.Forms.CheckBox();
this.label3 = new System.Windows.Forms.Label();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.cbCropSGBFrame = new System.Windows.Forms.CheckBox();
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(136, 286);
this.btnOk.Location = new System.Drawing.Point(136, 308);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 0;
@ -57,7 +59,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(217, 286);
this.btnCancel.Location = new System.Drawing.Point(217, 308);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
@ -78,6 +80,7 @@
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioButton1);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.rbAccuracy);
this.groupBox1.Controls.Add(this.rbPerformance);
@ -145,7 +148,7 @@
// cbForceDeterminism
//
this.cbForceDeterminism.AutoSize = true;
this.cbForceDeterminism.Location = new System.Drawing.Point(19, 212);
this.cbForceDeterminism.Location = new System.Drawing.Point(15, 234);
this.cbForceDeterminism.Name = "cbForceDeterminism";
this.cbForceDeterminism.Size = new System.Drawing.Size(113, 17);
this.cbForceDeterminism.TabIndex = 8;
@ -155,12 +158,33 @@
//
// label3
//
this.label3.Location = new System.Drawing.Point(38, 236);
this.label3.Location = new System.Drawing.Point(34, 258);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(251, 41);
this.label3.TabIndex = 9;
this.label3.Text = "Guarantee deterministic emulation by savestating every frame. Don\'t TAS without i" +
"t! Only ~75% of runs sync without it, but speed boost is ~30%.";
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(37, 46);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(202, 17);
this.radioButton1.TabIndex = 9;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Performance (only for casual gaming!)";
this.radioButton1.UseVisualStyleBackColor = true;
//
// cbCropSGBFrame
//
this.cbCropSGBFrame.AutoSize = true;
this.cbCropSGBFrame.Location = new System.Drawing.Point(15, 211);
this.cbCropSGBFrame.Name = "cbCropSGBFrame";
this.cbCropSGBFrame.Size = new System.Drawing.Size(105, 17);
this.cbCropSGBFrame.TabIndex = 10;
this.cbCropSGBFrame.Text = "Crop SGB Frame";
this.cbCropSGBFrame.UseVisualStyleBackColor = true;
//
// SNESOptions
//
@ -168,7 +192,8 @@
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(304, 321);
this.ClientSize = new System.Drawing.Size(304, 343);
this.Controls.Add(this.cbCropSGBFrame);
this.Controls.Add(this.label3);
this.Controls.Add(this.cbForceDeterminism);
this.Controls.Add(this.lblDoubleSize);
@ -204,5 +229,7 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox cbForceDeterminism;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.CheckBox cbCropSGBFrame;
}
}

View File

@ -23,6 +23,7 @@ namespace BizHawk.Client.EmuHawk
{
AlwaysDoubleSize = s.AlwaysDoubleSize,
ForceDeterminism = s.ForceDeterminism,
CropSGBFrame = s.CropSGBFrame,
Profile = ss.Profile
};
@ -31,6 +32,7 @@ namespace BizHawk.Client.EmuHawk
{
s.AlwaysDoubleSize = dlg.AlwaysDoubleSize;
s.ForceDeterminism = dlg.ForceDeterminism;
s.CropSGBFrame = dlg.CropSGBFrame;
ss.Profile = dlg.Profile;
GlobalWin.MainForm.PutCoreSettings(s);
GlobalWin.MainForm.PutCoreSyncSettings(ss);
@ -92,6 +94,12 @@ namespace BizHawk.Client.EmuHawk
set { cbForceDeterminism.Checked = value; }
}
private bool CropSGBFrame
{
get { return cbCropSGBFrame.Checked; }
set { cbCropSGBFrame.Checked = value; }
}
void RefreshDoubleSizeOption()
{
_suppressDoubleSize = true;

View File

@ -55,6 +55,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
public bool ShowOBJ_2 { get; set; } = true;
public bool ShowOBJ_3 { get; set; } = true;
public bool CropSGBFrame { get; set; } = false;
public bool AlwaysDoubleSize { get; set; } = false;
public bool ForceDeterminism { get; set; } = true;
public string Palette { get; set; } = "BizHawk";

View File

@ -520,12 +520,30 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
xskip = 2;
}
if (_settings.CropSGBFrame)
{
_videoWidth = 160;
_videoHeight = 144;
}
int size = _videoWidth * _videoHeight;
if (_videoBuffer.Length != size)
{
_videoBuffer = new int[size];
}
if (_settings.CropSGBFrame)
{
int di = 0;
for (int y = 0; y < 144; y++)
{
int si = ((y+39) * srcPitch) + 48;
for(int x=0;x<160;x++)
_videoBuffer[di++] = data[si++];
}
return;
}
for (int j = 0; j < 2; j++)
{
if (j == 1 && !dotDouble)