minor BSNESOptions cleanup

This commit is contained in:
Morilli 2023-03-10 02:24:46 +01:00
parent cb785c4cdb
commit 8c780e42cb
2 changed files with 19 additions and 34 deletions

View File

@ -269,10 +269,6 @@
//
this.EntropyBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.EntropyBox.FormattingEnabled = true;
this.EntropyBox.Items.AddRange(new object[] {
"None",
"Low",
"High"});
this.EntropyBox.Location = new System.Drawing.Point(17, 219);
this.EntropyBox.Name = "EntropyBox";
this.EntropyBox.Size = new System.Drawing.Size(128, 21);
@ -288,10 +284,6 @@
//
this.RegionBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.RegionBox.FormattingEnabled = true;
this.RegionBox.Items.AddRange(new object[] {
"Auto",
"NTSC",
"PAL"});
this.RegionBox.Location = new System.Drawing.Point(162, 219);
this.RegionBox.Name = "RegionBox";
this.RegionBox.Size = new System.Drawing.Size(128, 21);
@ -378,11 +370,6 @@
//
this.AspectRatioCorrectionBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.AspectRatioCorrectionBox.FormattingEnabled = true;
this.AspectRatioCorrectionBox.Items.AddRange(new object[] {
"None",
"Auto",
"NTSC",
"PAL"});
this.AspectRatioCorrectionBox.Location = new System.Drawing.Point(162, 174);
this.AspectRatioCorrectionBox.Name = "AspectRatioCorrectionBox";
this.AspectRatioCorrectionBox.Size = new System.Drawing.Size(128, 21);
@ -437,6 +424,7 @@
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "BSNES Options";
this.Load += new System.EventHandler(this.OnLoad);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);

View File

@ -9,24 +9,33 @@ namespace BizHawk.Client.EmuHawk
{
public partial class BSNESOptions : Form
{
private BSNESOptions()
private readonly BsnesCore.SnesSettings _settings;
private readonly BsnesCore.SnesSyncSettings _syncSettings;
private BSNESOptions(BsnesCore.SnesSettings s, BsnesCore.SnesSyncSettings ss)
{
_settings = s;
_syncSettings = ss;
InitializeComponent();
}
private void OnLoad(object sender, EventArgs e)
{
EntropyBox.PopulateFromEnum(_syncSettings.Entropy);
AspectRatioCorrectionBox.PopulateFromEnum(_settings.AspectRatioCorrection);
RegionBox.PopulateFromEnum(_syncSettings.RegionOverride);
}
public static DialogResult DoSettingsDialog(IDialogParent dialogParent, ISettingsAdapter settable)
{
var s = (BsnesCore.SnesSettings) settable.GetSettings();
var ss = (BsnesCore.SnesSyncSettings) settable.GetSyncSettings();
using var dlg = new BSNESOptions
using var dlg = new BSNESOptions(s, ss)
{
AlwaysDoubleSize = s.AlwaysDoubleSize,
CropSGBFrame = s.CropSGBFrame,
NoPPUSpriteLimit = s.NoPPUSpriteLimit,
ShowOverscan = s.ShowOverscan,
AspectRatioCorrection = s.AspectRatioCorrection,
Entropy = ss.Entropy,
RegionOverride = ss.RegionOverride,
Hotfixes = ss.Hotfixes,
FastPPU = ss.FastPPU,
FastDSP = ss.FastDSP,
@ -102,11 +111,7 @@ namespace BizHawk.Client.EmuHawk
init => cbShowOverscan.Checked = value;
}
private BsnesApi.ASPECT_RATIO_CORRECTION AspectRatioCorrection
{
get => (BsnesApi.ASPECT_RATIO_CORRECTION)AspectRatioCorrectionBox.SelectedIndex;
init => AspectRatioCorrectionBox.SelectedIndex = (int)value;
}
private BsnesApi.ASPECT_RATIO_CORRECTION AspectRatioCorrection => (BsnesApi.ASPECT_RATIO_CORRECTION)AspectRatioCorrectionBox.SelectedIndex;
private bool Hotfixes
{
@ -138,18 +143,10 @@ namespace BizHawk.Client.EmuHawk
init => cbUseSGB2.Checked = value;
}
private BsnesApi.ENTROPY Entropy
{
get => (BsnesApi.ENTROPY) EntropyBox.SelectedIndex;
init => EntropyBox.SelectedIndex = (int) value;
}
private BsnesApi.REGION_OVERRIDE RegionOverride
{
get => (BsnesApi.REGION_OVERRIDE)RegionBox.SelectedIndex;
init => RegionBox.SelectedIndex = (int)value;
}
private BsnesApi.ENTROPY Entropy => (BsnesApi.ENTROPY) EntropyBox.SelectedIndex;
private BsnesApi.REGION_OVERRIDE RegionOverride => (BsnesApi.REGION_OVERRIDE)RegionBox.SelectedIndex;
private bool ShowObj1 { get => Obj1Checkbox.Checked; init => Obj1Checkbox.Checked = value; }
private bool ShowObj2 { get => Obj2Checkbox.Checked; init => Obj2Checkbox.Checked = value; }
private bool ShowObj3 { get => Obj3Checkbox.Checked; init => Obj3Checkbox.Checked = value; }