misc cleanups in remaining platform specific config files

This commit is contained in:
adelikat 2017-05-31 09:56:51 -05:00
parent 735249a841
commit 1116ddfaf6
10 changed files with 114 additions and 112 deletions

View File

@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Emulation.Cores.PCEngine;
using BizHawk.Client.Common;
using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
@ -48,7 +43,8 @@ namespace BizHawk.Client.EmuHawk
.OfType<CheckBox>()
.OrderBy(c => c.Name)
.ToList()
.ForEach(c => {
.ForEach(c =>
{
var index = int.Parse(c.Name.Replace("Controller", ""));
pceSettings.Controllers[index].IsConnected = c.Checked;
});

View File

@ -48,7 +48,7 @@
this.OK.TabIndex = 4;
this.OK.Text = "&OK";
this.OK.UseVisualStyleBackColor = true;
this.OK.Click += new System.EventHandler(this.OK_Click);
this.OK.Click += new System.EventHandler(this.Ok_Click);
//
// Cancel
//

View File

@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
DispBG2.Checked = s.ShowBG2;
}
private void OK_Click(object sender, EventArgs e)
private void Ok_Click(object sender, EventArgs e)
{
var pce = (PCEngine)Global.Emulator;
PCEngine.PCESettings s = pce.GetSettings();

View File

@ -15,8 +15,8 @@ namespace BizHawk.Client.EmuHawk
private void PSXControllerConfigNew_Load(object sender, EventArgs e)
{
//populate combo boxes
foreach(var combo in new[]{combo_1_1,combo_1_2,combo_1_3,combo_1_4,combo_2_1,combo_2_2,combo_2_3,combo_2_4})
// populate combo boxes
foreach (var combo in new[] { combo_1_1, combo_1_2, combo_1_3, combo_1_4, combo_2_1, combo_2_2, combo_2_3, combo_2_4 })
{
combo.Items.Add("-Nothing-");
combo.Items.Add("Gamepad");
@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
RefreshLabels();
}
void GuiFromUserConfig(OctoshockFIOConfigUser user)
private void GuiFromUserConfig(OctoshockFIOConfigUser user)
{
cbMemcard_1.Checked = user.Memcards[0];
cbMemcard_2.Checked = user.Memcards[1];
@ -51,15 +51,13 @@ namespace BizHawk.Client.EmuHawk
}
}
OctoshockFIOConfigUser UserConfigFromGui()
private OctoshockFIOConfigUser UserConfigFromGui()
{
var uc = new OctoshockFIOConfigUser();
uc.Memcards[0] = cbMemcard_1.Checked;
uc.Memcards[1] = cbMemcard_2.Checked;
uc.Multitaps[0] = cbMultitap_1.Checked;
uc.Multitaps[1] = cbMultitap_2.Checked;
var uc = new OctoshockFIOConfigUser
{
Memcards = { [0] = cbMemcard_1.Checked, [1] = cbMemcard_2.Checked },
Multitaps = { [0] = cbMultitap_1.Checked, [1] = cbMultitap_2.Checked }
};
var combos = new[] { combo_1_1, combo_1_2, combo_1_3, combo_1_4, combo_2_1, combo_2_2, combo_2_3, combo_2_4 };
for (int i = 0; i < 8; i++)
@ -75,7 +73,7 @@ namespace BizHawk.Client.EmuHawk
return uc;
}
void RefreshLabels()
private void RefreshLabels()
{
var uc = UserConfigFromGui();
@ -103,33 +101,35 @@ namespace BizHawk.Client.EmuHawk
lbl_p_2_3.Visible = b2;
lbl_p_2_4.Visible = b2;
var LC = uc.ToLogical();
var lc = uc.ToLogical();
var p_labels = new[] { lbl_p_1_1,lbl_p_1_2,lbl_p_1_3,lbl_p_1_4,lbl_p_2_1,lbl_p_2_2,lbl_p_2_3,lbl_p_2_4};
var pLabels = new[] { lbl_p_1_1, lbl_p_1_2, lbl_p_1_3, lbl_p_1_4, lbl_p_2_1, lbl_p_2_2, lbl_p_2_3, lbl_p_2_4 };
for (int i = 0; i < 8; i++)
{
var lbl = p_labels[i];
if (LC.PlayerAssignments[i] == -1)
var lbl = pLabels[i];
if (lc.PlayerAssignments[i] == -1)
{
lbl.Visible = false;
}
else
{
lbl.Text = "P" + LC.PlayerAssignments[i];
lbl.Text = "P" + lc.PlayerAssignments[i];
lbl.Visible = true;
}
}
}
private void cb_changed(object sender, EventArgs e)
private void Cb_Changed(object sender, EventArgs e)
{
RefreshLabels();
}
private void combo_SelectedIndexChanged(object sender, EventArgs e)
private void Combo_SelectedIndexChanged(object sender, EventArgs e)
{
RefreshLabels();
}
private void btnOK_Click(object sender, EventArgs e)
private void BtnOk_Click(object sender, EventArgs e)
{
var psxSettings = ((Octoshock)Global.Emulator).GetSyncSettings();

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
@ -20,18 +14,18 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent();
}
private void btnHash_Click(object sender, EventArgs e)
private void BtnHash_Click(object sender, EventArgs e)
{
txtHashes.Text = "";
btnHash.Enabled = false;
try
{
var psx = ((Octoshock)Global.Emulator);
var psx = (Octoshock)Global.Emulator;
foreach (var disc in psx.Discs)
{
DiscHasher hasher = new DiscHasher(disc);
uint hash = hasher.Calculate_PSX_RedumpHash();
txtHashes.Text += string.Format("{0:X8} {1}\r\n", hash, disc.Name);
txtHashes.Text += $"{hash:X8} {disc.Name}\r\n";
}
}
finally

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Emulation.Cores.Sony.PSX;
@ -14,10 +9,10 @@ namespace BizHawk.Client.EmuHawk
{
public partial class PSXOptions : Form
{
//backups of the labels for string replacing
string lblPixelPro_text, lblMednafen_text, lblTweakedMednafen_text;
// backups of the labels for string replacing
private readonly string lblPixelPro_text, lblMednafen_text, lblTweakedMednafen_text;
public PSXOptions(Octoshock.Settings settings, Octoshock.SyncSettings syncSettings, OctoshockDll.eVidStandard vidStandard, Size currentVideoSize)
private PSXOptions(Octoshock.Settings settings, Octoshock.SyncSettings syncSettings, OctoshockDll.eVidStandard vidStandard, Size currentVideoSize)
{
InitializeComponent();
_settings = settings;
@ -26,8 +21,13 @@ namespace BizHawk.Client.EmuHawk
_previewVideoSize = currentVideoSize;
if (_previewVideoStandard == OctoshockDll.eVidStandard.NTSC)
lblNTSC.Font = new System.Drawing.Font(lblNTSC.Font, FontStyle.Bold);
else lblPAL.Font = new System.Drawing.Font(lblPAL.Font, FontStyle.Bold);
{
lblNTSC.Font = new Font(lblNTSC.Font, FontStyle.Bold);
}
else
{
lblPAL.Font = new Font(lblPAL.Font, FontStyle.Bold);
}
lblPixelPro_text = lblPixelPro.Text;
lblMednafen_text = lblMednafen.Text;
@ -54,13 +54,13 @@ namespace BizHawk.Client.EmuHawk
PAL_LastLineNumeric.Value = _settings.ScanlineEnd_PAL;
}
Size _previewVideoSize;
OctoshockDll.eVidStandard _previewVideoStandard;
Octoshock.Settings _settings;
Octoshock.SyncSettings _syncSettings;
bool _dispSettingsSet = false;
private Size _previewVideoSize;
private readonly OctoshockDll.eVidStandard _previewVideoStandard;
private readonly Octoshock.Settings _settings;
private readonly Octoshock.SyncSettings _syncSettings;
private bool _dispSettingsSet;
private void btnNiceDisplayConfig_Click(object sender, EventArgs e)
private void BtnNiceDisplayConfig_Click(object sender, EventArgs e)
{
_dispSettingsSet = true;
MessageBox.Show("Finetuned Display Options will take effect if you OK from PSX Options");
@ -68,18 +68,18 @@ namespace BizHawk.Client.EmuHawk
public static DialogResult DoSettingsDialog(IWin32Window owner)
{
var psx = ((Octoshock)Global.Emulator);
var psx = (Octoshock)Global.Emulator;
var s = psx.GetSettings();
var ss = psx.GetSyncSettings();
var vid = psx.SystemVidStandard;
var size = psx.CurrentVideoSize;
var dlg = new PSXOptions(s,ss,vid,size);
var dlg = new PSXOptions(s, ss, vid, size);
var result = dlg.ShowDialog(owner);
return result;
}
void SyncSettingsFromGui(Octoshock.Settings settings, Octoshock.SyncSettings syncSettings)
private void SyncSettingsFromGui(Octoshock.Settings settings, Octoshock.SyncSettings syncSettings)
{
if (rbPixelPro.Checked) settings.ResolutionMode = Octoshock.eResolutionMode.PixelPro;
if (rbDebugMode.Checked) settings.ResolutionMode = Octoshock.eResolutionMode.Debug;
@ -90,9 +90,9 @@ namespace BizHawk.Client.EmuHawk
if (rbClipBasic.Checked) settings.HorizontalClipping = Octoshock.eHorizontalClipping.Basic;
if (rbClipToFramebuffer.Checked) settings.HorizontalClipping = Octoshock.eHorizontalClipping.Framebuffer;
if(rbWeave.Checked) _settings.DeinterlaceMode = Octoshock.eDeinterlaceMode.Weave;
if(rbBob.Checked) _settings.DeinterlaceMode = Octoshock.eDeinterlaceMode.Bob;
if(rbBobOffset.Checked) _settings.DeinterlaceMode = Octoshock.eDeinterlaceMode.BobOffset;
if (rbWeave.Checked) _settings.DeinterlaceMode = Octoshock.eDeinterlaceMode.Weave;
if (rbBob.Checked) _settings.DeinterlaceMode = Octoshock.eDeinterlaceMode.Bob;
if (rbBobOffset.Checked) _settings.DeinterlaceMode = Octoshock.eDeinterlaceMode.BobOffset;
settings.ScanlineStart_NTSC = (int)NTSC_FirstLineNumeric.Value;
settings.ScanlineEnd_NTSC = (int)NTSC_LastLineNumeric.Value;
@ -104,14 +104,14 @@ namespace BizHawk.Client.EmuHawk
syncSettings.EnableLEC = cbLEC.Checked;
}
private void btnOk_Click(object sender, EventArgs e)
private void BtnOk_Click(object sender, EventArgs e)
{
if (_dispSettingsSet)
{
Global.Config.DispManagerAR = Config.EDispManagerAR.System;
Global.Config.DispFixAspectRatio = true;
Global.Config.DispFixScaleInteger = false;
Global.Config.DispFinalFilter = 1; //bilinear, I hope
Global.Config.DispFinalFilter = 1; // bilinear, I hope
}
SyncSettingsFromGui(_settings, _syncSettings);
@ -123,7 +123,7 @@ namespace BizHawk.Client.EmuHawk
Close();
}
private void btnAreaFull_Click(object sender, EventArgs e)
private void BtnAreaFull_Click(object sender, EventArgs e)
{
NTSC_FirstLineNumeric.Value = 0;
NTSC_LastLineNumeric.Value = 239;
@ -132,28 +132,28 @@ namespace BizHawk.Client.EmuHawk
SyncLabels();
}
void SyncLabels()
private void SyncLabels()
{
var temp = _settings.Clone();
var syncTemp = _syncSettings.Clone();
SyncSettingsFromGui(temp, syncTemp);
_settings.Validate();
//actually, I think this is irrelevant. But it's nice in case we want to do some kind of a more detailed simulation later
// actually, I think this is irrelevant. But it's nice in case we want to do some kind of a more detailed simulation later
int w = _previewVideoSize.Width;
int h = _previewVideoSize.Height;
temp.ResolutionMode = Octoshock.eResolutionMode.PixelPro;
var ri = Octoshock.CalculateResolution(_previewVideoStandard, temp, w, h);
lblPixelPro.Text = lblPixelPro_text.Replace("800x480", string.Format("{0}x{1}", ri.Resolution.Width, ri.Resolution.Height)); ;
lblPixelPro.Text = lblPixelPro_text.Replace("800x480", $"{ri.Resolution.Width}x{ri.Resolution.Height}");
temp.ResolutionMode = Octoshock.eResolutionMode.Mednafen;
ri = Octoshock.CalculateResolution(_previewVideoStandard, temp, w, h);
lblMednafen.Text = lblMednafen_text.Replace("320x240", string.Format("{0}x{1}", ri.Resolution.Width, ri.Resolution.Height));
lblMednafen.Text = lblMednafen_text.Replace("320x240", $"{ri.Resolution.Width}x{ri.Resolution.Height}");
temp.ResolutionMode = Octoshock.eResolutionMode.TweakedMednafen;
ri = Octoshock.CalculateResolution(_previewVideoStandard, temp, w, h);
lblTweakedMednafen.Text = lblTweakedMednafen_text.Replace("400x300", string.Format("{0}x{1}", ri.Resolution.Width, ri.Resolution.Height));
lblTweakedMednafen.Text = lblTweakedMednafen_text.Replace("400x300", $"{ri.Resolution.Width}x{ri.Resolution.Height}");
}
private void DrawingArea_ValueChanged(object sender, EventArgs e)
@ -161,23 +161,22 @@ namespace BizHawk.Client.EmuHawk
SyncLabels();
}
private void rbClipHorizontal_CheckedChanged(object sender, EventArgs e)
private void RbClipHorizontal_CheckedChanged(object sender, EventArgs e)
{
SyncLabels();
}
private void rbClipToFramebuffer_CheckedChanged(object sender, EventArgs e)
private void RbClipToFramebuffer_CheckedChanged(object sender, EventArgs e)
{
SyncLabels();
}
private void rbClipNone_CheckedChanged(object sender, EventArgs e)
private void RbClipNone_CheckedChanged(object sender, EventArgs e)
{
SyncLabels();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
MessageBox.Show(@"These options control BizHawk's Display Options to make it act quite a lot like Mednafen:
@ -191,7 +190,5 @@ But: 1. we think we improved on it a tiny bit with the tweaked mode
And: 2. It's not suitable for detailed scrutinizing of graphics
");
}
}
}

View File

@ -8,7 +8,6 @@ namespace BizHawk.Client.EmuHawk
{
public partial class SMSGraphicsConfig : Form
{
public SMSGraphicsConfig()
{
InitializeComponent();
@ -21,7 +20,7 @@ namespace BizHawk.Client.EmuHawk
DispBG.Checked = s.DispBG;
}
private void OK_Click(object sender, EventArgs e)
private void Ok_Click(object sender, EventArgs e)
{
var s = ((SMS)Global.Emulator).GetSettings();
s.DispOBJ = DispOBJ.Checked;

View File

@ -10,7 +10,7 @@ namespace BizHawk.Client.EmuHawk
public partial class SNESControllerSettings : Form
{
private LibsnesCore.SnesSyncSettings _syncSettings;
private bool _supressDropdownChangeEvents = false;
private bool _supressDropdownChangeEvents;
public SNESControllerSettings()
{

View File

@ -7,13 +7,13 @@ namespace BizHawk.Client.EmuHawk
{
public partial class SNESOptions : Form
{
public SNESOptions()
private SNESOptions()
{
InitializeComponent();
}
bool SuppressDoubleSize;
bool UserDoubleSizeOption;
private bool _suppressDoubleSize;
private bool _userDoubleSizeOption;
public static void DoSettingsDialog(IWin32Window owner)
{
@ -42,31 +42,51 @@ namespace BizHawk.Client.EmuHawk
rbAccuracy.Visible = VersionInfo.DeveloperBuild;
}
public string Profile
private string Profile
{
get
{
if (rbCompatibility.Checked) return "Compatibility";
else if (rbPerformance.Checked) return "Performance";
else if (rbAccuracy.Checked) return "Accuracy";
else throw new InvalidOperationException();
if (rbCompatibility.Checked)
{
return "Compatibility";
}
if (rbPerformance.Checked)
{
return "Performance";
}
if (rbAccuracy.Checked)
{
return "Accuracy";
}
throw new InvalidOperationException();
}
set
{
rbCompatibility.Checked = (value == "Compatibility");
rbPerformance.Checked = (value == "Performance");
rbAccuracy.Checked = (value == "Accuracy");
rbCompatibility.Checked = value == "Compatibility";
rbPerformance.Checked = value == "Performance";
rbAccuracy.Checked = value == "Accuracy";
}
}
public bool AlwaysDoubleSize
private bool AlwaysDoubleSize
{
get { return UserDoubleSizeOption; }
set { UserDoubleSizeOption = value; RefreshDoubleSizeOption(); }
get
{
return _userDoubleSizeOption;
}
set
{
_userDoubleSizeOption = value;
RefreshDoubleSizeOption();
}
}
public bool ForceDeterminism
private bool ForceDeterminism
{
get { return cbForceDeterminism.Checked; }
set { cbForceDeterminism.Checked = value; }
@ -74,38 +94,39 @@ namespace BizHawk.Client.EmuHawk
void RefreshDoubleSizeOption()
{
SuppressDoubleSize = true;
if (cbDoubleSize.Enabled)
cbDoubleSize.Checked = UserDoubleSizeOption;
else cbDoubleSize.Checked = true;
SuppressDoubleSize = false;
_suppressDoubleSize = true;
cbDoubleSize.Checked = !cbDoubleSize.Enabled || _userDoubleSizeOption;
_suppressDoubleSize = false;
}
private void rbAccuracy_CheckedChanged(object sender, EventArgs e)
private void RbAccuracy_CheckedChanged(object sender, EventArgs e)
{
cbDoubleSize.Enabled = !rbAccuracy.Checked;
lblDoubleSize.ForeColor = cbDoubleSize.Enabled ? System.Drawing.SystemColors.ControlText : System.Drawing.SystemColors.GrayText;
RefreshDoubleSizeOption();
}
private void cbDoubleSize_CheckedChanged(object sender, EventArgs e)
private void CbDoubleSize_CheckedChanged(object sender, EventArgs e)
{
if (SuppressDoubleSize) return;
UserDoubleSizeOption = cbDoubleSize.Checked;
if (_suppressDoubleSize)
{
return;
}
_userDoubleSizeOption = cbDoubleSize.Checked;
}
private void cbForceDeterminism_CheckedChanged(object sender, EventArgs e)
private void CbForceDeterminism_CheckedChanged(object sender, EventArgs e)
{
}
private void btnOk_Click(object sender, EventArgs e)
private void BtnOk_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
private void btnCancel_Click(object sender, EventArgs e)
private void BtnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
@ -59,7 +54,7 @@ namespace BizHawk.Client.EmuHawk
AllowFullOpen = true,
AnyColor = true,
Color = BackgroundPanel.BackColor,
CustomColors = new int[] { customColor }
CustomColors = new[] { customColor }
};
if (dlg.ShowDialog() == DialogResult.OK)
@ -80,7 +75,7 @@ namespace BizHawk.Client.EmuHawk
AllowFullOpen = true,
AnyColor = true,
Color = ForeGroundPanel.BackColor,
CustomColors = new int[] { customColor }
CustomColors = new[] { customColor }
};
if (dlg.ShowDialog() == DialogResult.OK)