misc cleanups in remaining config files

This commit is contained in:
adelikat 2017-05-31 10:28:06 -05:00
parent 1116ddfaf6
commit 078dc4ddb1
29 changed files with 356 additions and 374 deletions

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;
namespace BizHawk.Client.EmuHawk
@ -51,7 +46,6 @@ namespace BizHawk.Client.EmuHawk
}
}
public bool Radial
{
get
@ -67,15 +61,9 @@ namespace BizHawk.Client.EmuHawk
}
}
private int ScaledX
{
get { return MaxX / ScaleFactor; }
}
private int ScaledX => MaxX / ScaleFactor;
private int ScaledY
{
get { return MaxY / ScaleFactor; }
}
private int ScaledY => MaxY / ScaleFactor;
private Point TopLeft
{
@ -187,10 +175,7 @@ namespace BizHawk.Client.EmuHawk
private void Changed()
{
if (ChangeCallback != null)
{
ChangeCallback();
}
ChangeCallback?.Invoke();
}
}
}

View File

@ -1,17 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
public partial class AnalogRangeConfigControl : UserControl
{
private bool _supressChange = false;
private bool _supressChange;
public AnalogRangeConfigControl()
{

View File

@ -1,4 +1,4 @@
namespace BizHawk.Client.EmuHawk.config
namespace BizHawk.Client.EmuHawk
{
partial class DisplayConfig
{

View File

@ -1,13 +1,6 @@
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 System.Windows.Forms;
namespace BizHawk.Client.EmuHawk.config
namespace BizHawk.Client.EmuHawk
{
public partial class DisplayConfig : Form
{

View File

@ -1,4 +1,4 @@
namespace BizHawk.Client.EmuHawk.config
namespace BizHawk.Client.EmuHawk
{
partial class DisplayConfigLite
{

View File

@ -1,16 +1,10 @@
using System;
using System.IO;
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.Common;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk.config
namespace BizHawk.Client.EmuHawk
{
public partial class DisplayConfigLite : Form
{

View File

@ -1,10 +1,6 @@
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;
@ -24,7 +20,7 @@ namespace BizHawk.Client.EmuHawk
int count = 0;
foreach (var kvp in Global.Config.PreferredPlatformsForExtensions)
{
FileExtensionPreferencesPicker picker = new FileExtensionPreferencesPicker
var picker = new FileExtensionPreferencesPicker
{
FileExtension = kvp.Key,
OriginalPreference = kvp.Value,
@ -38,7 +34,6 @@ namespace BizHawk.Client.EmuHawk
private void OkBtn_Click(object sender, EventArgs e)
{
foreach (var picker in PrefPanel.Controls.OfType<FileExtensionPreferencesPicker>())
{
Global.Config.PreferredPlatformsForExtensions[picker.FileExtension] = picker.CurrentlySelectedSystemId;

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
@ -17,10 +13,10 @@ namespace BizHawk.Client.EmuHawk
public FileExtensionPreferencesPicker()
{
InitializeComponent();
AvailableSystems = new SystemLookup().AllSystems.ToList();
_availableSystems = new SystemLookup().AllSystems.ToList();
}
private readonly List<SystemLookup.SystemInfo> AvailableSystems;
private readonly List<SystemLookup.SystemInfo> _availableSystems;
public string FileExtension { get; set; }
public string OriginalPreference { get; set; }
@ -31,8 +27,8 @@ namespace BizHawk.Client.EmuHawk
{
if (PlatformDropdown.SelectedIndex > 0)
{
return AvailableSystems
.FirstOrDefault(x => x.SystemId == PlatformDropdown.SelectedItem.ToString()).FullName;
return _availableSystems
.First(x => x.SystemId == PlatformDropdown.SelectedItem.ToString()).FullName;
}
return "";
@ -42,25 +38,12 @@ namespace BizHawk.Client.EmuHawk
private void PopulatePlatforms()
{
PlatformDropdown.Items.Add("Ask me on load");
foreach (var platform in AvailableSystems)
foreach (var platform in _availableSystems)
{
PlatformDropdown.Items.Add(platform.FullName);
}
}
private IEnumerable<string> DropdownSystemIds
{
get
{
var dispVals = PlatformDropdown.Items.OfType<string>();
foreach (var val in dispVals)
{
yield return AvailableSystems.FirstOrDefault(x => x.FullName == val).SystemId ?? "";
}
}
}
private void FileExtensionPreferencesPicker_Load(object sender, EventArgs e)
{
PopulatePlatforms();
@ -68,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
var selectedSystemId = Global.Config.PreferredPlatformsForExtensions[FileExtension];
if (!string.IsNullOrEmpty(selectedSystemId))
{
var selectedSystem = AvailableSystems.FirstOrDefault(s => s.SystemId == selectedSystemId);
var selectedSystem = _availableSystems.FirstOrDefault(s => s.SystemId == selectedSystemId);
var selectedItem = PlatformDropdown.Items
.OfType<string>()

View File

@ -2,11 +2,9 @@
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Common;
@ -14,42 +12,41 @@ using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
using BizHawk.Client.EmuHawk.WinFormExtensions;
//notes: eventually, we intend to have a "firmware acquisition interface" exposed to the emulator cores.
//it will be implemented by emuhawk, and use firmware keys to fetch the firmware content.
//however, for now, the cores are using strings from the config class. so we have the `configMember` which is
//used by reflection to set the configuration for firmwares which were found
// notes: eventually, we intend to have a "firmware acquisition interface" exposed to the emulator cores.
// it will be implemented by emuhawk, and use firmware keys to fetch the firmware content.
// however, for now, the cores are using strings from the config class. so we have the `configMember` which is
// used by reflection to set the configuration for firmwares which were found
//TODO - we may eventually need to add a progress dialog for this. we should have one for other reasons.
//I started making one in Bizhawk.Util as QuickProgressPopup but ran out of time
// TODO - we may eventually need to add a progress dialog for this. we should have one for other reasons.
// I started making one in Bizhawk.Util as QuickProgressPopup but ran out of time
//IDEA: show current path in tooltip (esp. for custom resolved)
//IDEA: prepop set customization to dir of current custom
//TODO - display some kind if [!] if you have a user-specified file which is known but defined as incompatible by the firmware DB
// IDEA: show current path in tooltip (esp. for custom resolved)
// IDEA: prepop set customization to dir of current custom
// TODO - display some kind if [!] if you have a user-specified file which is known but defined as incompatible by the firmware DB
namespace BizHawk.Client.EmuHawk
{
public partial class FirmwaresConfig : Form
{
//friendlier names than the system Ids
public static readonly Dictionary<string, string> SystemGroupNames = new Dictionary<string, string>()
{
{ "NES", "NES" },
{ "SNES", "SNES" },
{ "PCECD", "PCE-CD" },
{ "SAT", "Saturn" },
{ "A78", "Atari 7800" },
{ "Coleco", "Colecovision" },
{ "GBA", "GBA" },
{ "TI83", "TI-83" },
{ "INTV", "Intellivision" },
{ "C64", "C64" },
{ "GEN", "Genesis" },
{ "SMS", "Sega Master System" },
{ "PSX", "Sony PlayStation" },
{ "Lynx", "Atari Lynx" },
{ "AppleII", "Apple II" }
};
// friendlier names than the system Ids
private static readonly Dictionary<string, string> SystemGroupNames = new Dictionary<string, string>
{
{ "NES", "NES" },
{ "SNES", "SNES" },
{ "PCECD", "PCE-CD" },
{ "SAT", "Saturn" },
{ "A78", "Atari 7800" },
{ "Coleco", "Colecovision" },
{ "GBA", "GBA" },
{ "TI83", "TI-83" },
{ "INTV", "Intellivision" },
{ "C64", "C64" },
{ "GEN", "Genesis" },
{ "SMS", "Sega Master System" },
{ "PSX", "Sony PlayStation" },
{ "Lynx", "Atari Lynx" },
{ "AppleII", "Apple II" }
};
public string TargetSystem = null;
@ -57,9 +54,9 @@ namespace BizHawk.Client.EmuHawk
private const int idMissing = 1;
private const int idOk = 2;
Font fixedFont, boldFont, boldFixedFont;
private Font fixedFont, boldFont, boldFixedFont;
class ListViewSorter : IComparer
private class ListViewSorter : IComparer
{
public FirmwaresConfig dialog;
public int column;
@ -77,14 +74,14 @@ namespace BizHawk.Client.EmuHawk
}
}
string currSelectorDir;
ListViewSorter listviewSorter;
private string currSelectorDir;
private readonly ListViewSorter listviewSorter;
public FirmwaresConfig(bool retryLoadRom = false, string reloadRomPath = null)
{
InitializeComponent();
//prep imagelist for listview with 3 item states for {idUnsure, idMissing, idOk}
// prep imagelist for listview with 3 item states for {idUnsure, idMissing, idOk}
imageList1.Images.AddRange(new[] { Properties.Resources.RetroQuestion, Properties.Resources.ExclamationRed, Properties.Resources.GreenCheck });
listviewSorter = new ListViewSorter(this, -1);
@ -108,7 +105,7 @@ namespace BizHawk.Client.EmuHawk
}
}
//makes sure that the specified SystemId is selected in the list (and that all the firmwares for it are visible)
// makes sure that the specified SystemId is selected in the list (and that all the firmwares for it are visible)
private void WarpToSystemId(string sysid)
{
bool selectedFirst = false;
@ -125,12 +122,12 @@ namespace BizHawk.Client.EmuHawk
private void FirmwaresConfig_Load(object sender, EventArgs e)
{
//we'll use this font for displaying the hash, so they dont look all jagged in a long list
// we'll use this font for displaying the hash, so they dont look all jagged in a long list
fixedFont = new Font(new FontFamily("Courier New"), 8);
boldFont = new Font(lvFirmwares.Font, FontStyle.Bold);
boldFixedFont = new Font(fixedFont, FontStyle.Bold);
//populate listview from firmware DB
// populate listview from firmware DB
var groups = new Dictionary<string, ListViewGroup>();
foreach (var fr in FirmwareDatabase.FirmwareRecords)
{
@ -142,15 +139,15 @@ namespace BizHawk.Client.EmuHawk
lvi.SubItems.Add(fr.SystemId);
lvi.SubItems.Add(fr.FirmwareId);
lvi.SubItems.Add(fr.Descr);
lvi.SubItems.Add(""); //resolved with
lvi.SubItems.Add(""); //location
lvi.SubItems.Add(""); //size
lvi.SubItems.Add(""); //hash
lvi.SubItems[6].Font = fixedFont; //would be used for hash and size
lvi.SubItems[7].Font = fixedFont; //would be used for hash and size
lvi.SubItems.Add(""); // resolved with
lvi.SubItems.Add(""); // location
lvi.SubItems.Add(""); // size
lvi.SubItems.Add(""); // hash
lvi.SubItems[6].Font = fixedFont; // would be used for hash and size
lvi.SubItems[7].Font = fixedFont; // would be used for hash and size
lvFirmwares.Items.Add(lvi);
//build the groups in the listview as we go:
// build the groups in the listview as we go:
if (!groups.ContainsKey(fr.SystemId))
{
string name;
@ -163,7 +160,7 @@ namespace BizHawk.Client.EmuHawk
lvi.Group = groups[fr.SystemId];
}
//now that we have some items in the listview, we can size some columns to sensible widths
// now that we have some items in the listview, we can size some columns to sensible widths
lvFirmwares.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.ColumnContent);
lvFirmwares.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent);
lvFirmwares.AutoResizeColumn(3, ColumnHeaderAutoResizeStyle.ColumnContent);
@ -198,7 +195,7 @@ namespace BizHawk.Client.EmuHawk
private void tbbGroup_Click(object sender, EventArgs e)
{
//toggle the grouping state
// toggle the grouping state
lvFirmwares.ShowGroups = !lvFirmwares.ShowGroups;
}
@ -217,18 +214,18 @@ namespace BizHawk.Client.EmuHawk
private void tbbScan_Click(object sender, EventArgs e)
{
//user-initiated scan
// user-initiated scan
DoScan();
}
FirmwareManager Manager { get { return Global.FirmwareManager; } }
private FirmwareManager Manager => Global.FirmwareManager;
private void DoScan()
{
lvFirmwares.BeginUpdate();
Manager.DoScanAndResolve();
//for each type of firmware, try resolving and record the result
// for each type of firmware, try resolving and record the result
foreach (ListViewItem lvi in lvFirmwares.Items)
{
var fr = lvi.Tag as FirmwareDatabase.FirmwareRecord;
@ -243,15 +240,15 @@ namespace BizHawk.Client.EmuHawk
}
else
{
//lazy substring extraction. really should do a better job
// lazy substring extraction. really should do a better job
var basePath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null) + Path.DirectorySeparatorChar;
var path = ri.FilePath.Replace(basePath, "");
//bolden the item if the user has specified a path for it
// bolden the item if the user has specified a path for it
bool bolden = ri.UserSpecified;
//set columns based on whether it was a known file
// set columns based on whether it was a known file
if (ri.KnownFirmwareFile == null)
{
lvi.ImageIndex = idUnsure;
@ -265,7 +262,7 @@ namespace BizHawk.Client.EmuHawk
lvi.SubItems[4].Text = ri.KnownFirmwareFile.Description;
}
//bolden the item if necessary
// bolden the item if necessary
if (bolden)
{
foreach (ListViewItem.ListViewSubItem lvsi in lvi.SubItems) lvsi.Font = boldFont;
@ -277,14 +274,14 @@ namespace BizHawk.Client.EmuHawk
lvi.SubItems[6].Font = fixedFont;
}
//if the user specified a file but its missing, mark it as such
// if the user specified a file but its missing, mark it as such
if (ri.Missing)
{
lvi.ImageIndex = idMissing;
lvi.ToolTipText = "Missing!";
}
//if the user specified a known firmware file but its for some other firmware, it was probably a mistake. mark it as suspicious
// if the user specified a known firmware file but its for some other firmware, it was probably a mistake. mark it as suspicious
if (ri.KnownMismatching)
lvi.ImageIndex = idUnsure;
@ -303,7 +300,9 @@ namespace BizHawk.Client.EmuHawk
private void tbbOrganize_Click(object sender, EventArgs e)
{
if (MessageBox.Show(this, "This is going to move/rename every automatically-selected firmware file under your configured firmwares directory to match our recommended organizational scheme (which is not super great right now). Proceed?", "Firmwares Organization Confirm", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
return;
{
return;
}
Manager.DoScanAndResolve();
@ -323,8 +322,8 @@ namespace BizHawk.Client.EmuHawk
}
catch
{
//sometimes moves fail. especially in newer versions of windows with explorers more fragile than your great-grandma.
//I am embarassed that I know that. about windows, not your great-grandma.
// sometimes moves fail. especially in newer versions of windows with explorers more fragile than your great-grandma.
// I am embarassed that I know that. about windows, not your great-grandma.
}
}
@ -360,10 +359,10 @@ namespace BizHawk.Client.EmuHawk
if (ofd.ShowDialog() == DialogResult.OK)
{
//remember the location we selected this firmware from, maybe there are others
// remember the location we selected this firmware from, maybe there are others
currSelectorDir = Path.GetDirectoryName(ofd.FileName);
//for each selected item, set the user choice (even though multiple selection for this operation is no longer allowed)
// for each selected item, set the user choice (even though multiple selection for this operation is no longer allowed)
foreach (ListViewItem lvi in lvFirmwares.SelectedItems)
{
var fr = lvi.Tag as FirmwareDatabase.FirmwareRecord;
@ -377,7 +376,7 @@ namespace BizHawk.Client.EmuHawk
private void tsmiClearCustomization_Click(object sender, EventArgs e)
{
//for each selected item, clear the user choice
// for each selected item, clear the user choice
foreach (ListViewItem lvi in lvFirmwares.SelectedItems)
{
var fr = lvi.Tag as FirmwareDatabase.FirmwareRecord;
@ -390,16 +389,22 @@ namespace BizHawk.Client.EmuHawk
private void tsmiInfo_Click(object sender, EventArgs e)
{
var lvi = lvFirmwares.SelectedItems[0];
var fr = lvi.Tag as FirmwareDatabase.FirmwareRecord;
var fr = (FirmwareDatabase.FirmwareRecord)lvi.Tag;
//get all options for this firmware (in order)
// get all options for this firmware (in order)
var options =
from fo in FirmwareDatabase.FirmwareOptions
where fo.SystemId == fr.SystemId && fo.FirmwareId == fr.FirmwareId
select fo;
FirmwaresConfigInfo fciDialog = new FirmwaresConfigInfo();
fciDialog.lblFirmware.Text = string.Format("{0} : {1} ({2})", fr.SystemId, fr.FirmwareId, fr.Descr);
FirmwaresConfigInfo fciDialog = new FirmwaresConfigInfo
{
lblFirmware =
{
Text = $"{fr.SystemId} : {fr.FirmwareId} ({fr.Descr})"
}
};
foreach (var o in options)
{
ListViewItem olvi = new ListViewItem();
@ -417,15 +422,15 @@ namespace BizHawk.Client.EmuHawk
if (o.Status == FirmwareDatabase.FirmwareOptionStatus.Bad)
olvi.ImageIndex = FirmwaresConfigInfo.idBad;
olvi.SubItems[0].Text = ff.Size.ToString();
olvi.SubItems[0].Font = this.Font; //why doesnt this work?
olvi.SubItems[0].Font = this.Font; // why doesnt this work?
olvi.SubItems[1].Text = "sha1:" + o.Hash;
olvi.SubItems[1].Font = fixedFont;
olvi.SubItems[2].Text = ff.RecommendedName;
olvi.SubItems[2].Font = this.Font; //why doesnt this work?
olvi.SubItems[2].Font = this.Font; // why doesnt this work?
olvi.SubItems[3].Text = ff.Description;
olvi.SubItems[3].Font = this.Font; //why doesnt this work?
olvi.SubItems[3].Font = this.Font; // why doesnt this work?
olvi.SubItems[4].Text = ff.Info;
olvi.SubItems[4].Font = this.Font; //why doesnt this work?
olvi.SubItems[4].Font = this.Font; // why doesnt this work?
fciDialog.lvOptions.Items.Add(olvi);
}
@ -439,7 +444,7 @@ namespace BizHawk.Client.EmuHawk
private void lvFirmwaresContextMenuStrip_Opening(object sender, CancelEventArgs e)
{
//hide menu items that arent appropriate for multi-select
// hide menu items that arent appropriate for multi-select
tsmiSetCustomization.Visible = lvFirmwares.SelectedItems.Count == 1;
tsmiInfo.Visible = lvFirmwares.SelectedItems.Count == 1;
}
@ -456,21 +461,24 @@ namespace BizHawk.Client.EmuHawk
MessageBox.Show("C-C-C-Combo Breaker!", "Nice try, but");
return;
}
new PathConfig().ShowDialog(this);
RefreshBasePath();
}
void RefreshBasePath()
private void RefreshBasePath()
{
string oldBasePath = currSelectorDir;
linkBasePath.Text = currSelectorDir = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null);
if (oldBasePath != currSelectorDir)
{
DoScan();
}
}
private void tbbImport_Click(object sender, EventArgs e)
{
using(var ofd = new OpenFileDialog())
using (var ofd = new OpenFileDialog())
{
ofd.Multiselect = true;
if (ofd.ShowDialog() != DialogResult.OK)
@ -515,7 +523,11 @@ namespace BizHawk.Client.EmuHawk
}
catch
{
if (errors != "") errors += "\n";
if (errors != "")
{
errors += "\n";
}
errors += f;
return false;
}
@ -532,7 +544,7 @@ namespace BizHawk.Client.EmuHawk
{
if (hf.IsArchive)
{
//blech. the worst extraction code in the universe.
// blech. the worst extraction code in the universe.
string extractpath = Path.GetTempFileName() + ".dir";
DirectoryInfo di = Directory.CreateDirectory(extractpath);
@ -588,10 +600,7 @@ namespace BizHawk.Client.EmuHawk
private void lvFirmwares_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
}
private void lvFirmwares_DragDrop(object sender, DragEventArgs e)
@ -602,5 +611,5 @@ namespace BizHawk.Client.EmuHawk
RunImportJob(files);
}
}
} //class FirmwaresConfig
} // class FirmwaresConfig
}

View File

@ -67,8 +67,8 @@
this.lvOptions.TabIndex = 0;
this.lvOptions.UseCompatibleStateImageBehavior = false;
this.lvOptions.View = System.Windows.Forms.View.Details;
this.lvOptions.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lvOptions_KeyDown);
this.lvOptions.MouseClick += new System.Windows.Forms.MouseEventHandler(this.lvOptions_MouseClick);
this.lvOptions.KeyDown += new System.Windows.Forms.KeyEventHandler(this.LvOptions_KeyDown);
this.lvOptions.MouseClick += new System.Windows.Forms.MouseEventHandler(this.LvOptions_MouseClick);
//
// colHash
//
@ -179,7 +179,7 @@
this.tsmiOptionsCopy.Name = "tsmiOptionsCopy";
this.tsmiOptionsCopy.Size = new System.Drawing.Size(99, 22);
this.tsmiOptionsCopy.Text = "&Copy";
this.tsmiOptionsCopy.Click += new System.EventHandler(this.tsmiOptionsCopy_Click);
this.tsmiOptionsCopy.Click += new System.EventHandler(this.TsmiOptionsCopy_Click);
//
// colSize
//

View File

@ -3,15 +3,13 @@ using System.Windows.Forms;
using BizHawk.Client.EmuHawk.WinFormExtensions;
//todo - display details on the current resolution status
//todo - check(mark) the one thats selected
//todo - turn top info into textboxes i guess, labels suck
// todo - display details on the current resolution status
// todo - check(mark) the one thats selected
// todo - turn top info into textboxes i guess, labels suck
namespace BizHawk.Client.EmuHawk
{
public partial class FirmwaresConfigInfo : Form
{
public const int idIdeal = 0;
public const int idAcceptable = 1;
public const int idUnacceptable = 2;
@ -21,11 +19,11 @@ namespace BizHawk.Client.EmuHawk
{
InitializeComponent();
//prep imagelist for listview with 4 item states for (ideal, acceptable, unacceptable, bad)
// prep imagelist for listview with 4 item states for (ideal, acceptable, unacceptable, bad)
imageList1.Images.AddRange(new[] { Properties.Resources.GreenCheck, Properties.Resources.Freeze, Properties.Resources.thumbsdown, Properties.Resources.ExclamationRed });
}
private void lvOptions_KeyDown(object sender, KeyEventArgs e)
private void LvOptions_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.C && e.Control && !e.Alt && !e.Shift)
{
@ -33,21 +31,23 @@ namespace BizHawk.Client.EmuHawk
}
}
void PerformListCopy()
private void PerformListCopy()
{
var str = lvOptions.CopyItemsAsText();
if (str.Length > 0) Clipboard.SetDataObject(str);
}
private void tsmiOptionsCopy_Click(object sender, EventArgs e)
private void TsmiOptionsCopy_Click(object sender, EventArgs e)
{
PerformListCopy();
}
private void lvOptions_MouseClick(object sender, MouseEventArgs e)
private void LvOptions_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right && lvOptions.GetItemAt(e.X, e.Y) != null)
{
lvmiOptionsContextMenuStrip.Show(lvOptions, e.Location);
}
}
}
}

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;

View File

@ -187,21 +187,21 @@
this.clearAllToolStripMenuItem.Name = "clearAllToolStripMenuItem";
this.clearAllToolStripMenuItem.Size = new System.Drawing.Size(167, 22);
this.clearAllToolStripMenuItem.Text = "Clear All";
this.clearAllToolStripMenuItem.Click += new System.EventHandler(this.clearAllToolStripMenuItem_Click);
this.clearAllToolStripMenuItem.Click += new System.EventHandler(this.ClearAllToolStripMenuItem_Click);
//
// clearCurrentTabToolStripMenuItem
//
this.clearCurrentTabToolStripMenuItem.Name = "clearCurrentTabToolStripMenuItem";
this.clearCurrentTabToolStripMenuItem.Size = new System.Drawing.Size(167, 22);
this.clearCurrentTabToolStripMenuItem.Text = "Clear Current Tab";
this.clearCurrentTabToolStripMenuItem.Click += new System.EventHandler(this.clearCurrentTabToolStripMenuItem_Click);
this.clearCurrentTabToolStripMenuItem.Click += new System.EventHandler(this.ClearCurrentTabToolStripMenuItem_Click);
//
// restoreDefaultsToolStripMenuItem
//
this.restoreDefaultsToolStripMenuItem.Name = "restoreDefaultsToolStripMenuItem";
this.restoreDefaultsToolStripMenuItem.Size = new System.Drawing.Size(167, 22);
this.restoreDefaultsToolStripMenuItem.Text = "Restore Defaults";
this.restoreDefaultsToolStripMenuItem.Click += new System.EventHandler(this.restoreDefaultsToolStripMenuItem_Click);
this.restoreDefaultsToolStripMenuItem.Click += new System.EventHandler(this.RestoreDefaultsToolStripMenuItem_Click);
//
// toolStripSeparator1
//

View File

@ -100,10 +100,10 @@ namespace BizHawk.Client.EmuHawk
{
HotkeyTabControl.TabPages.Clear();
//Buckets
var Tabs = Global.Config.HotkeyBindings.Select(x => x.TabGroup).Distinct().ToList();
// Buckets
var tabs = Global.Config.HotkeyBindings.Select(x => x.TabGroup).Distinct().ToList();
foreach (var tab in Tabs)
foreach (var tab in tabs)
{
var _y = UIHelper.ScaleY(14);
var _x = UIHelper.ScaleX(6);
@ -167,7 +167,10 @@ namespace BizHawk.Client.EmuHawk
foreach (var w in InputWidgets)
{
var b = Global.Config.HotkeyBindings.FirstOrDefault(x => x.DisplayName == w.WidgetName);
if (b != null) w.Bindings = b.DefaultBinding;
if (b != null)
{
w.Bindings = b.DefaultBinding;
}
}
}
@ -216,19 +219,19 @@ namespace BizHawk.Client.EmuHawk
private void SearchBox_KeyDown(object sender, KeyEventArgs e)
{
//Tab or Enter
// Tab or Enter
if (!e.Control && !e.Alt && !e.Shift &&
(e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab))
{
var b = Global.Config.HotkeyBindings.FirstOrDefault(x => string.Compare(x.DisplayName,SearchBox.Text,true)==0);
var b = Global.Config.HotkeyBindings.FirstOrDefault(x => string.Compare(x.DisplayName, SearchBox.Text, true) == 0);
//Found
// Found
if (b != null)
{
var w = InputWidgets.FirstOrDefault(x => x.WidgetName == b.DisplayName);
if (w != null)
{
HotkeyTabControl.SelectTab((w.Parent as TabPage));
HotkeyTabControl.SelectTab((TabPage)w.Parent);
Input.Instance.BindUnpress(e.KeyCode);
w.Focus();
}
@ -238,17 +241,17 @@ namespace BizHawk.Client.EmuHawk
}
}
private void clearAllToolStripMenuItem_Click(object sender, EventArgs e)
private void ClearAllToolStripMenuItem_Click(object sender, EventArgs e)
{
ClearAll(true);
}
private void clearCurrentTabToolStripMenuItem_Click(object sender, EventArgs e)
private void ClearCurrentTabToolStripMenuItem_Click(object sender, EventArgs e)
{
ClearAll(false);
}
private void restoreDefaultsToolStripMenuItem_Click(object sender, EventArgs e)
private void RestoreDefaultsToolStripMenuItem_Click(object sender, EventArgs e)
{
Defaults();
}

View File

@ -19,7 +19,7 @@
}
base.Dispose(disposing);
DropdownMenu.Dispose();
_dropdownMenu.Dispose();
}
#region Component Designer generated code
@ -46,7 +46,7 @@
this.btnSpecial.Size = new System.Drawing.Size(20, 20);
this.btnSpecial.TabIndex = 2;
this.btnSpecial.UseVisualStyleBackColor = true;
this.btnSpecial.Click += new System.EventHandler(this.btnSpecial_Click);
this.btnSpecial.Click += new System.EventHandler(this.BtnSpecial_Click);
//
// tableLayoutPanel1
//

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
@ -15,25 +9,24 @@ namespace BizHawk.Client.EmuHawk
{
InitializeComponent();
DropdownMenu = new ContextMenuStrip();
_dropdownMenu = new ContextMenuStrip();
DropdownMenu.ItemClicked += new ToolStripItemClickedEventHandler(DropdownMenu_ItemClicked);
DropdownMenu.PreviewKeyDown += new PreviewKeyDownEventHandler(DropdownMenu_PreviewKeyDown);
_dropdownMenu.ItemClicked += DropdownMenu_ItemClicked;
_dropdownMenu.PreviewKeyDown += DropdownMenu_PreviewKeyDown;
foreach (var spec in InputWidget.SpecialBindings)
{
var tsi = new ToolStripMenuItem(spec.BindingName);
tsi.ToolTipText = spec.TooltipText;
DropdownMenu.Items.Add(tsi);
var tsi = new ToolStripMenuItem(spec.BindingName) { ToolTipText = spec.TooltipText };
_dropdownMenu.Items.Add(tsi);
}
btnSpecial.ContextMenuStrip = DropdownMenu;
btnSpecial.ContextMenuStrip = _dropdownMenu;
widget.CompositeWidget = this;
}
static readonly string WidgetTooltipText = "* Escape clears a key mapping\r\n* Disable Auto Tab to multiply bind";
ToolTip _tooltip;
string _bindingTooltipText;
private static readonly string WidgetTooltipText = "* Escape clears a key mapping\r\n* Disable Auto Tab to multiply bind";
private ToolTip _tooltip;
private string _bindingTooltipText;
public void SetupTooltip(ToolTip tip, string bindingText)
{
@ -47,16 +40,21 @@ namespace BizHawk.Client.EmuHawk
{
string widgetText = "Current Binding: " + widget.Text;
if (_bindingTooltipText != null)
{
widgetText = widgetText + "\r\n---\r\n" + _bindingTooltipText;
}
widgetText = widgetText + "\r\n---\r\n" + WidgetTooltipText;
_tooltip.SetToolTip(widget, widgetText);
}
void DropdownMenu_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
private void DropdownMenu_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
//suppress handling of ALT keys, so that we can receive them as binding modifiers
// suppress handling of ALT keys, so that we can receive them as binding modifiers
if (e.KeyCode == Keys.Menu)
{
e.IsInputKey = true;
}
}
public void TabNext()
@ -64,7 +62,7 @@ namespace BizHawk.Client.EmuHawk
Parent.SelectNextControl(btnSpecial, true, true, true, true);
}
ContextMenuStrip DropdownMenu;
private readonly ContextMenuStrip _dropdownMenu;
public bool AutoTab { get { return widget.AutoTab; } set { widget.AutoTab = value; } }
public string WidgetName { get { return widget.WidgetName; } set { widget.WidgetName = value; } }
@ -76,23 +74,31 @@ namespace BizHawk.Client.EmuHawk
widget.ClearAll();
}
private void btnSpecial_Click(object sender, EventArgs e)
private void BtnSpecial_Click(object sender, EventArgs e)
{
DropdownMenu.Show(Control.MousePosition);
_dropdownMenu.Show(MousePosition);
}
void DropdownMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
private void DropdownMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
Input.ModifierKey mods = new Input.ModifierKey();
if ((Control.ModifierKeys & Keys.Shift) != 0)
mods |= Input.ModifierKey.Shift;
if ((Control.ModifierKeys & Keys.Control) != 0)
mods |= Input.ModifierKey.Control;
if ((Control.ModifierKeys & Keys.Alt) != 0)
mods |= Input.ModifierKey.Alt;
Input.LogicalButton lb = new Input.LogicalButton(e.ClickedItem.Text,mods);
if ((ModifierKeys & Keys.Shift) != 0)
{
mods |= Input.ModifierKey.Shift;
}
if ((ModifierKeys & Keys.Control) != 0)
{
mods |= Input.ModifierKey.Control;
}
if ((ModifierKeys & Keys.Alt) != 0)
{
mods |= Input.ModifierKey.Alt;
}
var lb = new Input.LogicalButton(e.ClickedItem.Text, mods);
widget.SetBinding(lb.ToString());
}

View File

@ -15,27 +15,27 @@ namespace BizHawk.Client.EmuHawk
private string _wasPressed = "";
public InputCompositeWidget CompositeWidget;
public InputCompositeWidget CompositeWidget { get; set; }
public class SpecialBindingInfo
{
public string BindingName;
public string TooltipText;
public string BindingName { get; set; }
public string TooltipText { get; set; }
}
/// <summary>
/// These bindings get ignored by the widget and can only be entered by SetBinding() via the contextmenu from the InputCompositeWidget
/// These bindings get ignored by the widget and can only be entered by SetBinding() via the context menu from the InputCompositeWidget
/// </summary>
public static readonly SpecialBindingInfo[] SpecialBindings = {
new SpecialBindingInfo { BindingName = "Escape", TooltipText = "Binds the Escape key" },
new SpecialBindingInfo { BindingName = "WMouse L", TooltipText = "Binds the left mouse button"},
new SpecialBindingInfo { BindingName = "WMouse M", TooltipText = "Binds the middle mouse button"},
new SpecialBindingInfo { BindingName = "WMouse R", TooltipText = "Binds the right mouse button"},
new SpecialBindingInfo { BindingName = "WMouse 1", TooltipText = "Binds the mouse auxiliary button 1" },
new SpecialBindingInfo { BindingName = "WMouse 2", TooltipText = "Binds the mouse auxiliary button 2" },
public static readonly SpecialBindingInfo[] SpecialBindings =
{
new SpecialBindingInfo { BindingName = "Escape", TooltipText = "Binds the Escape key" },
new SpecialBindingInfo { BindingName = "WMouse L", TooltipText = "Binds the left mouse button" },
new SpecialBindingInfo { BindingName = "WMouse M", TooltipText = "Binds the middle mouse button" },
new SpecialBindingInfo { BindingName = "WMouse R", TooltipText = "Binds the right mouse button" },
new SpecialBindingInfo { BindingName = "WMouse 1", TooltipText = "Binds the mouse auxiliary button 1" },
new SpecialBindingInfo { BindingName = "WMouse 2", TooltipText = "Binds the mouse auxiliary button 2" }
};
public InputWidget()
{
ContextMenu = new ContextMenu();
@ -45,7 +45,6 @@ namespace BizHawk.Client.EmuHawk
Cursor = Cursors.Arrow;
}
public bool AutoTab { get; set; }
public string WidgetName { get; set; }
@ -106,7 +105,7 @@ namespace BizHawk.Client.EmuHawk
ReadKeys();
}
public void EraseMappings()
private void EraseMappings()
{
ClearBindings();
Text = "";
@ -136,9 +135,8 @@ namespace BizHawk.Client.EmuHawk
if (bindingStr != null)
{
//has special meaning for the binding UI system (clear it).
//you can set it through the special bindings dropdown menu
// has special meaning for the binding UI system (clear it).
// you can set it through the special bindings dropdown menu
if (bindingStr == "Escape")
{
EraseMappings();
@ -146,16 +144,20 @@ namespace BizHawk.Client.EmuHawk
return;
}
//seriously, we refuse to allow you to bind this to anything else.
// seriously, we refuse to allow you to bind this to anything else.
if (bindingStr == "Alt+F4")
{
return;
}
//ignore special bindings
foreach(var spec in SpecialBindings)
if(spec.BindingName == bindingStr)
// ignore special bindings
foreach (var spec in SpecialBindings)
{
if (spec.BindingName == bindingStr)
{
return;
}
}
if (!IsDuplicate(bindingStr))
{

View File

@ -98,7 +98,7 @@
this.OK.TabIndex = 1;
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);
//
// MessageTypeBox
//

View File

@ -55,7 +55,7 @@ namespace BizHawk.Client.EmuHawk
private void MessageConfig_Load(object sender, EventArgs e)
{
SetMaxXY();
SetMaxXy();
MessageColorDialog.Color = Color.FromArgb(_messageColor);
AlertColorDialog.Color = Color.FromArgb(_alertColor);
LInputColorDialog.Color = Color.FromArgb(_lastInputColor);
@ -65,7 +65,7 @@ namespace BizHawk.Client.EmuHawk
StackMessagesCheckbox.Checked = Global.Config.StackOSDMessages;
}
private void SetMaxXY()
private void SetMaxXy()
{
var video = Global.Emulator.AsVideoProvider(); // TODO: this is objectively wrong, these are core agnostic settings, why is the current core used here? Also this will crash on a core without a video provider
XNumeric.Maximum = video.BufferWidth - 12;
@ -81,19 +81,19 @@ namespace BizHawk.Client.EmuHawk
{
_messageColor = MessageColorDialog.Color.ToArgb();
ColorPanel.BackColor = MessageColorDialog.Color;
ColorText.Text = String.Format("{0:X8}", _messageColor);
ColorText.Text = $"{_messageColor:X8}";
_alertColor = AlertColorDialog.Color.ToArgb();
AlertColorPanel.BackColor = AlertColorDialog.Color;
AlertColorText.Text = String.Format("{0:X8}", _alertColor);
AlertColorText.Text = $"{_alertColor:X8}";
_lastInputColor = LInputColorDialog.Color.ToArgb();
LInputColorPanel.BackColor = LInputColorDialog.Color;
LInputText.Text = String.Format("{0:X8}", _lastInputColor);
LInputText.Text = $"{_lastInputColor:X8}";
_movieInput = MovieInputColorDialog.Color.ToArgb();
MovieInputColor.BackColor = MovieInputColorDialog.Color;
MovieInputText.Text = String.Format("{0:X8}", _movieInput);
MovieInputText.Text = $"{_movieInput:X8}";
}
private void SetAnchorRadio(int anchor)
@ -102,13 +102,17 @@ namespace BizHawk.Client.EmuHawk
{
default:
case 0:
TL.Checked = true; break;
TL.Checked = true;
break;
case 1:
TR.Checked = true; break;
TR.Checked = true;
break;
case 2:
BL.Checked = true; break;
BL.Checked = true;
break;
case 3:
BR.Checked = true; break;
BR.Checked = true;
break;
}
}
@ -230,7 +234,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.StackOSDMessages = StackMessagesCheckbox.Checked;
}
private void OK_Click(object sender, EventArgs e)
private void Ok_Click(object sender, EventArgs e)
{
SaveSettings();
GlobalWin.OSD.AddMessage("Message settings saved");
@ -324,10 +328,9 @@ namespace BizHawk.Client.EmuHawk
if (mx > XNumeric.Maximum) mx = (int)XNumeric.Maximum;
if (my > YNumeric.Maximum) my = (int)YNumeric.Maximum;
if (TL.Checked)
{
//Do nothing
// Do nothing
}
else if (TR.Checked)
{
@ -488,7 +491,7 @@ namespace BizHawk.Client.EmuHawk
LInputColorDialog.Color = Color.FromArgb(_lastInputColor);
MovieInputColorDialog.Color = Color.FromArgb(_movieInput);
SetMaxXY();
SetMaxXy();
SetColorBox();
SetPositionInfo();
@ -541,6 +544,7 @@ namespace BizHawk.Client.EmuHawk
{
SetAnchorValue(0);
}
PositionPanel.Refresh();
}
@ -550,6 +554,7 @@ namespace BizHawk.Client.EmuHawk
{
SetAnchorValue(1);
}
PositionPanel.Refresh();
}

View File

@ -74,7 +74,7 @@
this.cbMultitap_1.TabIndex = 0;
this.cbMultitap_1.Text = "Multitap";
this.cbMultitap_1.UseVisualStyleBackColor = true;
this.cbMultitap_1.CheckedChanged += new System.EventHandler(this.cb_changed);
this.cbMultitap_1.CheckedChanged += new System.EventHandler(this.Cb_Changed);
//
// groupBox1
//
@ -187,7 +187,7 @@
this.combo_1_4.Name = "combo_1_4";
this.combo_1_4.Size = new System.Drawing.Size(121, 21);
this.combo_1_4.TabIndex = 5;
this.combo_1_4.SelectedIndexChanged += new System.EventHandler(this.combo_SelectedIndexChanged);
this.combo_1_4.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged);
//
// combo_1_3
//
@ -197,7 +197,7 @@
this.combo_1_3.Name = "combo_1_3";
this.combo_1_3.Size = new System.Drawing.Size(121, 21);
this.combo_1_3.TabIndex = 4;
this.combo_1_3.SelectedIndexChanged += new System.EventHandler(this.combo_SelectedIndexChanged);
this.combo_1_3.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged);
//
// combo_1_2
//
@ -207,7 +207,7 @@
this.combo_1_2.Name = "combo_1_2";
this.combo_1_2.Size = new System.Drawing.Size(121, 21);
this.combo_1_2.TabIndex = 3;
this.combo_1_2.SelectedIndexChanged += new System.EventHandler(this.combo_SelectedIndexChanged);
this.combo_1_2.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged);
//
// combo_1_1
//
@ -217,7 +217,7 @@
this.combo_1_1.Name = "combo_1_1";
this.combo_1_1.Size = new System.Drawing.Size(121, 21);
this.combo_1_1.TabIndex = 2;
this.combo_1_1.SelectedIndexChanged += new System.EventHandler(this.combo_SelectedIndexChanged);
this.combo_1_1.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged);
//
// cbMemcard_1
//
@ -228,7 +228,7 @@
this.cbMemcard_1.TabIndex = 1;
this.cbMemcard_1.Text = "Memcard";
this.cbMemcard_1.UseVisualStyleBackColor = true;
this.cbMemcard_1.CheckedChanged += new System.EventHandler(this.cb_changed);
this.cbMemcard_1.CheckedChanged += new System.EventHandler(this.Cb_Changed);
//
// btnOK
//
@ -239,7 +239,7 @@
this.btnOK.TabIndex = 2;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
this.btnOK.Click += new System.EventHandler(this.BtnOk_Click);
//
// btnCancel
//
@ -362,7 +362,7 @@
this.combo_2_4.Name = "combo_2_4";
this.combo_2_4.Size = new System.Drawing.Size(121, 21);
this.combo_2_4.TabIndex = 5;
this.combo_2_4.SelectedIndexChanged += new System.EventHandler(this.combo_SelectedIndexChanged);
this.combo_2_4.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged);
//
// combo_2_3
//
@ -372,7 +372,7 @@
this.combo_2_3.Name = "combo_2_3";
this.combo_2_3.Size = new System.Drawing.Size(121, 21);
this.combo_2_3.TabIndex = 4;
this.combo_2_3.SelectedIndexChanged += new System.EventHandler(this.combo_SelectedIndexChanged);
this.combo_2_3.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged);
//
// combo_2_2
//
@ -382,7 +382,7 @@
this.combo_2_2.Name = "combo_2_2";
this.combo_2_2.Size = new System.Drawing.Size(121, 21);
this.combo_2_2.TabIndex = 3;
this.combo_2_2.SelectedIndexChanged += new System.EventHandler(this.combo_SelectedIndexChanged);
this.combo_2_2.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged);
//
// combo_2_1
//
@ -392,7 +392,7 @@
this.combo_2_1.Name = "combo_2_1";
this.combo_2_1.Size = new System.Drawing.Size(121, 21);
this.combo_2_1.TabIndex = 2;
this.combo_2_1.SelectedIndexChanged += new System.EventHandler(this.combo_SelectedIndexChanged);
this.combo_2_1.SelectedIndexChanged += new System.EventHandler(this.Combo_SelectedIndexChanged);
//
// cbMemcard_2
//
@ -403,7 +403,7 @@
this.cbMemcard_2.TabIndex = 1;
this.cbMemcard_2.Text = "Memcard";
this.cbMemcard_2.UseVisualStyleBackColor = true;
this.cbMemcard_2.CheckedChanged += new System.EventHandler(this.cb_changed);
this.cbMemcard_2.CheckedChanged += new System.EventHandler(this.Cb_Changed);
//
// cbMultitap_2
//
@ -414,7 +414,7 @@
this.cbMultitap_2.TabIndex = 0;
this.cbMultitap_2.Text = "Multitap";
this.cbMultitap_2.UseVisualStyleBackColor = true;
this.cbMultitap_2.CheckedChanged += new System.EventHandler(this.cb_changed);
this.cbMultitap_2.CheckedChanged += new System.EventHandler(this.Cb_Changed);
//
// PSXControllerConfigNew
//

View File

@ -53,7 +53,7 @@
this.btnHash.TabIndex = 1;
this.btnHash.Text = "Hash";
this.btnHash.UseVisualStyleBackColor = true;
this.btnHash.Click += new System.EventHandler(this.btnHash_Click);
this.btnHash.Click += new System.EventHandler(this.BtnHash_Click);
//
// txtHashes
//

View File

@ -98,7 +98,7 @@
this.btnOk.TabIndex = 2;
this.btnOk.Text = "OK";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
this.btnOk.Click += new System.EventHandler(this.BtnOk_Click);
//
// groupBox1
//
@ -128,7 +128,7 @@
this.linkLabel1.TabIndex = 29;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "About Me";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabel1_LinkClicked);
//
// lblTweakedMednafen
//
@ -179,7 +179,7 @@
this.btnNiceDisplayConfig.TabIndex = 24;
this.btnNiceDisplayConfig.Text = "Change My Display Options";
this.btnNiceDisplayConfig.UseVisualStyleBackColor = true;
this.btnNiceDisplayConfig.Click += new System.EventHandler(this.btnNiceDisplayConfig_Click);
this.btnNiceDisplayConfig.Click += new System.EventHandler(this.BtnNiceDisplayConfig_Click);
//
// lblMednafen
//
@ -263,7 +263,7 @@
this.rbClipNone.Text = "None";
this.toolTip1.SetToolTip(this.rbClipNone, resources.GetString("rbClipNone.ToolTip"));
this.rbClipNone.UseVisualStyleBackColor = true;
this.rbClipNone.CheckedChanged += new System.EventHandler(this.rbClipNone_CheckedChanged);
this.rbClipNone.CheckedChanged += new System.EventHandler(this.RbClipNone_CheckedChanged);
//
// rbClipToFramebuffer
//
@ -278,7 +278,7 @@
"s framebuffer.\r\nHorizontal letterbox bars may be re-added in Mednafen-style reso" +
"lution modes to maintain correct AR.");
this.rbClipToFramebuffer.UseVisualStyleBackColor = true;
this.rbClipToFramebuffer.CheckedChanged += new System.EventHandler(this.rbClipToFramebuffer_CheckedChanged);
this.rbClipToFramebuffer.CheckedChanged += new System.EventHandler(this.RbClipToFramebuffer_CheckedChanged);
//
// rbClipBasic
//
@ -291,7 +291,7 @@
this.rbClipBasic.Text = "Basic Clipping";
this.toolTip1.SetToolTip(this.rbClipBasic, "A mednafen option -- appears to be 5.5% horizontally");
this.rbClipBasic.UseVisualStyleBackColor = true;
this.rbClipBasic.CheckedChanged += new System.EventHandler(this.rbClipHorizontal_CheckedChanged);
this.rbClipBasic.CheckedChanged += new System.EventHandler(this.RbClipHorizontal_CheckedChanged);
//
// lblPAL
//
@ -350,7 +350,7 @@
this.btnAreaFull.TabIndex = 40;
this.btnAreaFull.Text = "Full [0,239] and [0,287]";
this.btnAreaFull.UseVisualStyleBackColor = true;
this.btnAreaFull.Click += new System.EventHandler(this.btnAreaFull_Click);
this.btnAreaFull.Click += new System.EventHandler(this.BtnAreaFull_Click);
//
// label4
//

View File

@ -114,7 +114,7 @@
this.RecentForROMs.TabIndex = 207;
this.RecentForROMs.Text = "Always use recent path for ROMs";
this.RecentForROMs.UseVisualStyleBackColor = true;
this.RecentForROMs.CheckedChanged += new System.EventHandler(this.RecentForROMs_CheckedChanged);
this.RecentForROMs.CheckedChanged += new System.EventHandler(this.RecentForRoms_CheckedChanged);
//
// DefaultsBtn
//

View File

@ -13,7 +13,6 @@ namespace BizHawk.Client.EmuHawk
{
// All path text boxes should do some kind of error checking
// Config path under base, config will default to %exe%
private void LockDownCores()
{
if (VersionInfo.DeveloperBuild)
@ -26,23 +25,17 @@ namespace BizHawk.Client.EmuHawk
foreach (var core in coresToHide)
{
PathTabControl.TabPages.Remove(
PathTabControl.TabPages().FirstOrDefault(x => x.Name == core) ?? new TabPage());
PathTabControl.TabPages().FirstOrDefault(tp => tp.Name == core) ?? new TabPage());
}
}
private static AutoCompleteStringCollection AutoCompleteOptions
private static AutoCompleteStringCollection AutoCompleteOptions => new AutoCompleteStringCollection
{
get
{
return new AutoCompleteStringCollection
{
"%recent%",
"%exe%",
".\\",
"..\\",
};
}
}
"%recent%",
"%exe%",
".\\",
"..\\",
};
public PathConfig()
{
@ -71,11 +64,11 @@ namespace BizHawk.Client.EmuHawk
{
var global = PathTabControl.TabPages
.OfType<TabPage>()
.First(x => x.Name.ToUpper().Contains("GLOBAL"));
.First(tp => tp.Name.ToUpper().Contains("GLOBAL"));
return PathTabControl.TabPages
.OfType<TabPage>()
.FirstOrDefault(x => x.Name.ToUpper().StartsWith(name.ToUpper()))
.FirstOrDefault(tp => tp.Name.ToUpper().StartsWith(name.ToUpper()))
?? global;
}
@ -85,17 +78,20 @@ namespace BizHawk.Client.EmuHawk
PathTabControl.TabPages.Clear();
// Separate by system
var systems = Global.Config.PathEntries.Select(x => x.SystemDisplayName).Distinct().ToList();
var systems = Global.Config.PathEntries
.Select(s => s.SystemDisplayName)
.Distinct()
.ToList();
systems.Sort();
// Hacky way to put global first
var global = systems.FirstOrDefault(x => x == "Global");
var global = systems.FirstOrDefault(s => s == "Global");
systems.Remove(global);
systems.Insert(0, global);
var tabPages = new List<TabPage>(systems.Count);
int _x = UIHelper.ScaleX(6);
int x = UIHelper.ScaleX(6);
int textboxWidth = UIHelper.ScaleX(70);
int padding = UIHelper.ScaleX(5);
int buttonWidth = UIHelper.ScaleX(26);
@ -106,7 +102,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var systemDisplayName in systems)
{
var systemId = Global.Config.PathEntries.FirstOrDefault(x => x.SystemDisplayName == systemDisplayName).System;
var systemId = Global.Config.PathEntries.First(p => p.SystemDisplayName == systemDisplayName).System;
var t = new TabPage
{
Text = systemDisplayName,
@ -114,15 +110,19 @@ namespace BizHawk.Client.EmuHawk
Width = UIHelper.ScaleX(200), // Initial Left/Width of child controls are based on this size.
AutoScroll = true
};
var paths = pathCollection.Where(x => x.System == systemId).OrderBy(x => x.Ordinal).ThenBy(x => x.Type).ToList();
var paths = pathCollection
.Where(p => p.System == systemId)
.OrderBy(p => p.Ordinal)
.ThenBy(p => p.Type)
.ToList();
var _y = UIHelper.ScaleY(14);
var y = UIHelper.ScaleY(14);
foreach (var path in paths)
{
var box = new TextBox
{
Text = path.Path,
Location = new Point(_x, _y),
Location = new Point(x, y),
Width = textboxWidth,
Name = path.Type,
Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
@ -136,7 +136,7 @@ namespace BizHawk.Client.EmuHawk
{
Text = "",
Image = Properties.Resources.OpenFile,
Location = new Point(widgetOffset, _y + buttonOffsetY),
Location = new Point(widgetOffset, y + buttonOffsetY),
Size = new Size(buttonWidth, buttonHeight),
Name = path.Type,
Anchor = AnchorStyles.Top | AnchorStyles.Right,
@ -160,7 +160,7 @@ namespace BizHawk.Client.EmuHawk
Name = "Global",
Text = "",
Image = Properties.Resources.Help,
Location = new Point(UIHelper.ScaleX(115), _y + buttonOffsetY),
Location = new Point(UIHelper.ScaleX(115), y + buttonOffsetY),
Size = new Size(buttonWidth, buttonHeight),
Anchor = AnchorStyles.Top | AnchorStyles.Right
};
@ -181,9 +181,9 @@ namespace BizHawk.Client.EmuHawk
}
var label = new Label
{
{
Text = path.Type,
Location = new Point(widgetOffset + buttonWidth + padding + infoPadding, _y + UIHelper.ScaleY(4)),
Location = new Point(widgetOffset + buttonWidth + padding + infoPadding, y + UIHelper.ScaleY(4)),
Size = new Size(UIHelper.ScaleX(100), UIHelper.ScaleY(15)),
Name = path.Type,
Anchor = AnchorStyles.Top | AnchorStyles.Right,
@ -193,7 +193,7 @@ namespace BizHawk.Client.EmuHawk
t.Controls.Add(btn);
t.Controls.Add(box);
_y += rowHeight;
y += rowHeight;
}
var sys = systemDisplayName;
@ -235,7 +235,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var t in AllPathBoxes)
{
var pathEntry = Global.Config.PathEntries.FirstOrDefault(x => x.System == t.Parent.Name && x.Type == t.Name);
var pathEntry = Global.Config.PathEntries.First(p => p.System == t.Parent.Name && p.Type == t.Name);
pathEntry.Path = t.Text;
}
}
@ -243,7 +243,7 @@ namespace BizHawk.Client.EmuHawk
private void DoRomToggle()
{
AllPathControls
.Where(x => x.Name == "ROM")
.Where(c => c.Name == "ROM")
.ToList()
.ForEach(control => control.Enabled = !RecentForROMs.Checked);
}
@ -284,7 +284,7 @@ namespace BizHawk.Client.EmuHawk
LockDownCores();
}
private void RecentForROMs_CheckedChanged(object sender, EventArgs e)
private void RecentForRoms_CheckedChanged(object sender, EventArgs e)
{
DoRomToggle();
}

View File

@ -96,27 +96,27 @@ namespace BizHawk.Client.EmuHawk
snesSettings.Profile = "Performance";
PutSyncSettings<LibsnesCore>(snesSettings);
//Saturn
// Saturn
var saturnSettings = GetSyncSettings<Yabause, Yabause.SaturnSyncSettings>();
saturnSettings.SkipBios = false;
PutSyncSettings<Yabause>(saturnSettings);
//Genesis
// Genesis
var genesisSettings = GetSyncSettings<GPGX, GPGX.GPGXSyncSettings>();
genesisSettings.Region = LibGPGX.Region.Autodetect;
PutSyncSettings<GPGX>(genesisSettings);
//SMS
// SMS
var smsSettings = GetSyncSettings<SMS, SMS.SMSSyncSettings>();
smsSettings.UseBIOS = false;
PutSyncSettings<SMS>(smsSettings);
//Coleco
// Coleco
var colecoSettings = GetSyncSettings<ColecoVision, ColecoVision.ColecoSyncSettings>();
colecoSettings.SkipBiosIntro = false;
PutSyncSettings<ColecoVision>(colecoSettings);
//A2600
// A2600
var a2600Settings = GetSyncSettings<Atari2600, Atari2600.A2600SyncSettings>();
a2600Settings.FastScBios = true;
a2600Settings.LeftDifficulty = false;
@ -302,15 +302,19 @@ namespace BizHawk.Client.EmuHawk
}
else if (Global.Config.SelectedProfile == Config.ClientProfile.Custom)
{
//Disabled for now
//DisplayProfileSettingBoxes(true);
// Disabled for now
////DisplayProfileSettingBoxes(true);
}
bool oldUpdateAutoCheckEnabled = Global.Config.Update_AutoCheckEnabled;
Global.Config.Update_AutoCheckEnabled = AutoCheckForUpdates.Checked;
if (Global.Config.Update_AutoCheckEnabled != oldUpdateAutoCheckEnabled)
{
if (!Global.Config.Update_AutoCheckEnabled) UpdateChecker.ResetHistory();
if (!Global.Config.Update_AutoCheckEnabled)
{
UpdateChecker.ResetHistory();
}
UpdateChecker.BeginCheck(); // Call even if auto checking is disabled to trigger event (it won't actually check)
}
@ -351,10 +355,12 @@ namespace BizHawk.Client.EmuHawk
{
ProfileDialogHelpTexBox.Text = "Save Screenshot with Savestates: \r\n * Required for TASing \r\n * Not Recommended for \r\n Longplays or Casual Gaming";
}
private void SaveLargeScreenshotStatesCheckBox_MouseHover(object sender, EventArgs e)
{
ProfileDialogHelpTexBox.Text = "Save Large Screenshot With States: \r\n * Required for TASing \r\n * Not Recommended for \r\n Longplays or Casual Gaming";
}
private void AllowUDLRCheckBox_MouseHover(object sender, EventArgs e)
{
ProfileDialogHelpTexBox.Text = "All Up+Down or Left+Right: \r\n * Useful for TASing \r\n * Unchecked for Casual Gaming \r\n * Unknown for longplays";
@ -365,11 +371,12 @@ namespace BizHawk.Client.EmuHawk
where TEmulator : IEmulator
{
// should we complain if we get a successful object from the config file, but it is the wrong type?
object fromcore = null;
var settable = new SettingsAdapter(Global.Emulator);
if (settable.HasSyncSettings)
{
fromcore = settable.GetSyncSettings();
}
return fromcore as TSetting
?? Global.Config.GetCoreSyncSettings<TEmulator>() as TSetting
@ -381,11 +388,12 @@ namespace BizHawk.Client.EmuHawk
where TEmulator : IEmulator
{
// should we complain if we get a successful object from the config file, but it is the wrong type?
object fromcore = null;
var settable = new SettingsAdapter(Global.Emulator);
if (settable.HasSettings)
{
fromcore = settable.GetSettings();
}
return fromcore as TSetting
?? Global.Config.GetCoreSettings<TEmulator>() as TSetting

View File

@ -12,7 +12,7 @@ namespace BizHawk.Client.EmuHawk
private long _stateSize;
private int _mediumStateSize;
private int _largeStateSize;
private int _stateSizeCategory = 1; //1 = small, 2 = med, 3 = larg //TODO: enum
private int _stateSizeCategory = 1; // 1 = small, 2 = med, 3 = larg //TODO: enum
public RewindConfig()
{
@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
{
if (Global.Rewinder.HasBuffer)
{
FullnessLabel.Text = String.Format("{0:0.00}", Global.Rewinder.FullnessRatio * 100) + "%";
FullnessLabel.Text = $"{Global.Rewinder.FullnessRatio * 100:0.00}" + "%";
RewindFramesUsedLabel.Text = Global.Rewinder.Count.ToString();
}
else
@ -57,13 +57,13 @@ namespace BizHawk.Client.EmuHawk
SetStateSize();
var medium_state_size_kb = Global.Config.Rewind_MediumStateSize / 1024;
var large_state_size_kb = Global.Config.Rewind_LargeStateSize / 1024;
var mediumStateSizeKb = Global.Config.Rewind_MediumStateSize / 1024;
var largeStateSizeKb = Global.Config.Rewind_LargeStateSize / 1024;
MediumStateTrackbar.Value = medium_state_size_kb;
MediumStateUpDown.Value = medium_state_size_kb;
LargeStateTrackbar.Value = large_state_size_kb;
LargeStateUpDown.Value = large_state_size_kb;
MediumStateTrackbar.Value = mediumStateSizeKb;
MediumStateUpDown.Value = mediumStateSizeKb;
LargeStateTrackbar.Value = largeStateSizeKb;
LargeStateUpDown.Value = largeStateSizeKb;
nudCompression.Value = Global.Config.SaveStateCompressionLevelNormal;
@ -87,19 +87,17 @@ namespace BizHawk.Client.EmuHawk
ScreenshotInStatesCheckbox.Checked;
}
string FormatKB(long n)
private string FormatKB(long n)
{
double num = n / 1024.0;
if (num >= 1024)
{
num /= 1024.0;
return String.Format("{0:0.00}", num) + " MB";
}
else
{
return String.Format("{0:0.00}", num) + " KB";
return $"{num:0.00}" + " MB";
}
return $"{num:0.00}" + " KB";
}
private void SetStateSize()
@ -147,12 +145,16 @@ namespace BizHawk.Client.EmuHawk
private void PutRewindSetting<T>(ref T setting, T value) where T : IEquatable<T>
{
if (setting.Equals(value)) return;
if (setting.Equals(value))
{
return;
}
setting = value;
TriggerRewindSettingsReload = true;
}
private void OK_Click(object sender, EventArgs e)
private void Ok_Click(object sender, EventArgs e)
{
// These settings are used by DoRewindSettings, which we'll only call if anything actually changed (i.e. preserve rewind history if possible)
PutRewindSetting(ref Global.Config.RewindEnabledSmall, SmallStateEnabledBox.Checked);
@ -240,12 +242,13 @@ namespace BizHawk.Client.EmuHawk
private void MediumStateTrackbar_ValueChanged(object sender, EventArgs e)
{
MediumStateUpDown.Value = (sender as TrackBar).Value;
MediumStateUpDown.Value = ((TrackBar)sender).Value;
if (MediumStateUpDown.Value > LargeStateUpDown.Value)
{
LargeStateUpDown.Value = MediumStateUpDown.Value;
LargeStateTrackbar.Value = (int)MediumStateUpDown.Value;
}
_mediumStateSize = MediumStateTrackbar.Value * 1024;
_largeStateSize = LargeStateTrackbar.Value * 1024;
SetStateSize();
@ -253,12 +256,13 @@ namespace BizHawk.Client.EmuHawk
private void MediumStateUpDown_ValueChanged(object sender, EventArgs e)
{
MediumStateTrackbar.Value = (int)(sender as NumericUpDown).Value;
MediumStateTrackbar.Value = (int)((NumericUpDown)sender).Value;
if (MediumStateUpDown.Value > LargeStateUpDown.Value)
{
LargeStateUpDown.Value = MediumStateUpDown.Value;
LargeStateTrackbar.Value = (int)MediumStateUpDown.Value;
}
_mediumStateSize = MediumStateTrackbar.Value * 1024;
_largeStateSize = LargeStateTrackbar.Value * 1024;
SetStateSize();
@ -273,8 +277,9 @@ namespace BizHawk.Client.EmuHawk
}
else
{
LargeStateUpDown.Value = (sender as TrackBar).Value;
LargeStateUpDown.Value = ((TrackBar)sender).Value;
}
_mediumStateSize = MediumStateTrackbar.Value * 1024;
_largeStateSize = LargeStateTrackbar.Value * 1024;
SetStateSize();
@ -289,8 +294,9 @@ namespace BizHawk.Client.EmuHawk
}
else
{
LargeStateTrackbar.Value = (int)(sender as NumericUpDown).Value;
LargeStateTrackbar.Value = (int)((NumericUpDown)sender).Value;
}
_mediumStateSize = MediumStateTrackbar.Value * 1024;
_largeStateSize = LargeStateTrackbar.Value * 1024;
SetStateSize();
@ -298,48 +304,48 @@ namespace BizHawk.Client.EmuHawk
private void CalculateEstimates()
{
long avg_state_size;
long avgStateSize;
if (UseDeltaCompression.Checked || _stateSize == 0)
{
if (Global.Rewinder.Count > 0)
{
avg_state_size = Global.Rewinder.Size / Global.Rewinder.Count;
avgStateSize = Global.Rewinder.Size / Global.Rewinder.Count;
}
else
{
avg_state_size = _stateSize;
avgStateSize = _stateSize;
}
}
else
{
avg_state_size = _stateSize;
avgStateSize = _stateSize;
}
var buffer_size = (long)(BufferSizeUpDown.Value);
buffer_size *= 1024 * 1024;
var est_frames = buffer_size / avg_state_size;
var bufferSize = (long)BufferSizeUpDown.Value;
bufferSize *= 1024 * 1024;
var estFrames = bufferSize / avgStateSize;
long est_frequency = 0;
long estFrequency = 0;
switch (_stateSizeCategory)
{
case 1:
est_frequency = (long)SmallSavestateNumeric.Value;
estFrequency = (long)SmallSavestateNumeric.Value;
break;
case 2:
est_frequency = (long)MediumSavestateNumeric.Value;
estFrequency = (long)MediumSavestateNumeric.Value;
break;
case 3:
est_frequency = (long)LargeSavestateNumeric.Value;
estFrequency = (long)LargeSavestateNumeric.Value;
break;
}
long est_total_frames = est_frames * est_frequency;
double minutes = est_total_frames / 60 / 60;
AverageStoredStateSizeLabel.Text = FormatKB(avg_state_size);
ApproxFramesLabel.Text = String.Format("{0:n0}", est_frames) + " frames";
EstTimeLabel.Text = String.Format("{0:n}", minutes) + " minutes";
long estTotalFrames = estFrames * estFrequency;
double minutes = estTotalFrames / 60 / 60;
AverageStoredStateSizeLabel.Text = FormatKB(avgStateSize);
ApproxFramesLabel.Text = $"{estFrames:n0}" + " frames";
EstTimeLabel.Text = $"{minutes:n}" + " minutes";
}
private void BufferSizeUpDown_ValueChanged(object sender, EventArgs e)
@ -367,18 +373,18 @@ namespace BizHawk.Client.EmuHawk
CalculateEstimates();
}
private void nudCompression_ValueChanged(object sender, EventArgs e)
private void NudCompression_ValueChanged(object sender, EventArgs e)
{
trackBarCompression.Value = (int)(sender as NumericUpDown).Value;
trackBarCompression.Value = (int)((NumericUpDown)sender).Value;
}
private void trackBarCompression_ValueChanged(object sender, EventArgs e)
private void TrackBarCompression_ValueChanged(object sender, EventArgs e)
{
//TODO - make a UserControl which is trackbar and NUD combined
nudCompression.Value = (sender as TrackBar).Value;
// TODO - make a UserControl which is trackbar and NUD combined
nudCompression.Value = ((TrackBar)sender).Value;
}
private void btnResetCompression_Click(object sender, EventArgs e)
private void BtnResetCompression_Click(object sender, EventArgs e)
{
nudCompression.Value = Config.DefaultSaveStateCompressionLevelNormal;
}

View File

@ -45,7 +45,7 @@
this.OK.TabIndex = 0;
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

@ -51,7 +51,7 @@
this.btnOk.TabIndex = 0;
this.btnOk.Text = "OK";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
this.btnOk.Click += new System.EventHandler(this.BtnOk_Click);
//
// btnCancel
//
@ -63,7 +63,7 @@
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
this.btnCancel.Click += new System.EventHandler(this.BtnCancel_Click);
//
// rbCompatibility
//
@ -108,7 +108,7 @@
this.rbAccuracy.TabStop = true;
this.rbAccuracy.Text = "Accuracy (only to fix bugs in Compatibility!)";
this.rbAccuracy.UseVisualStyleBackColor = true;
this.rbAccuracy.CheckedChanged += new System.EventHandler(this.rbAccuracy_CheckedChanged);
this.rbAccuracy.CheckedChanged += new System.EventHandler(this.RbAccuracy_CheckedChanged);
//
// rbPerformance
//
@ -130,7 +130,7 @@
this.cbDoubleSize.TabIndex = 6;
this.cbDoubleSize.Text = "Always Double-Size Framebuffer";
this.cbDoubleSize.UseVisualStyleBackColor = true;
this.cbDoubleSize.CheckedChanged += new System.EventHandler(this.cbDoubleSize_CheckedChanged);
this.cbDoubleSize.CheckedChanged += new System.EventHandler(this.CbDoubleSize_CheckedChanged);
//
// lblDoubleSize
//
@ -151,7 +151,7 @@
this.cbForceDeterminism.TabIndex = 8;
this.cbForceDeterminism.Text = "Force Determinism";
this.cbForceDeterminism.UseVisualStyleBackColor = true;
this.cbForceDeterminism.CheckedChanged += new System.EventHandler(this.cbForceDeterminism_CheckedChanged);
this.cbForceDeterminism.CheckedChanged += new System.EventHandler(this.CbForceDeterminism_CheckedChanged);
//
// label3
//

View File

@ -41,7 +41,7 @@ namespace BizHawk.Client.EmuHawk
_programmaticallyChangingValue = false;
}
private void OK_Click(object sender, EventArgs e)
private void Ok_Click(object sender, EventArgs e)
{
if (rbOutputMethodDirectSound.Checked && (int)BufferSizeNumeric.Value < 60)
{
@ -62,12 +62,13 @@ namespace BizHawk.Client.EmuHawk
Global.Config.SoundVolumeRWFF = tbRWFF.Value;
Global.Config.SoundDevice = (string)listBoxSoundDevices.SelectedItem ?? "<default>";
GlobalWin.Sound.StopSound();
if (Global.Config.SoundOutputMethod != oldOutputMethod ||
Global.Config.SoundDevice != oldDevice)
if (Global.Config.SoundOutputMethod != oldOutputMethod
|| Global.Config.SoundDevice != oldDevice)
{
GlobalWin.Sound.Dispose();
GlobalWin.Sound = new Sound(GlobalWin.MainForm.Handle);
}
GlobalWin.Sound.StartSound();
GlobalWin.OSD.AddMessage("Sound settings saved");
DialogResult = DialogResult.OK;
@ -102,16 +103,20 @@ namespace BizHawk.Client.EmuHawk
private void OutputMethodRadioButtons_CheckedChanged(object sender, EventArgs e)
{
if (!((RadioButton)sender).Checked) return;
if (!((RadioButton)sender).Checked)
{
return;
}
PopulateDeviceList();
}
private void trackBar1_Scroll(object sender, EventArgs e)
private void TrackBar1_Scroll(object sender, EventArgs e)
{
nudNormal.Value = tbNormal.Value;
}
private void tbRWFF_Scroll(object sender, EventArgs e)
private void TbRwff_Scroll(object sender, EventArgs e)
{
nudRWFF.Value = tbRWFF.Value;
}
@ -122,7 +127,9 @@ namespace BizHawk.Client.EmuHawk
// If the user is changing the volume, automatically turn on/off sound accordingly
if (!_programmaticallyChangingValue)
{
cbEnableNormal.Checked = tbNormal.Value != 0;
}
}
private void UpdateSoundDialog()
@ -131,11 +138,9 @@ namespace BizHawk.Client.EmuHawk
grpSoundVol.Enabled = cbEnableMaster.Checked;
}
private void UpdateSoundDialog(object sender, EventArgs e)
{
UpdateSoundDialog();
}
}
}