use globals a bit less
This commit is contained in:
parent
08ee1c8170
commit
29cddca49a
|
@ -966,13 +966,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (e is RomLoader.RomErrorArgs args)
|
||||
{
|
||||
using var configForm = new FirmwaresConfig(true, args.RomPath);
|
||||
using var configForm = new FirmwaresConfig(this, true, args.RomPath);
|
||||
var result = configForm.ShowDialog();
|
||||
args.Retry = result == DialogResult.Retry;
|
||||
}
|
||||
else
|
||||
{
|
||||
using var configForm = new FirmwaresConfig();
|
||||
using var configForm = new FirmwaresConfig(this);
|
||||
configForm.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
@ -988,7 +988,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void PathsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var form = new PathConfig(Config);
|
||||
using var form = new PathConfig(this, Config);
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public partial class FirmwaresConfig : Form
|
||||
{
|
||||
private readonly MainForm _mainForm;
|
||||
|
||||
// friendlier names than the system Ids
|
||||
// Redundant with SystemLookup? Not so fast. That datadrives things. This is one step abstracted. Don't be such a smart guy. Keep this redundant list up to date.
|
||||
private static readonly Dictionary<string, string> SystemGroupNames = new Dictionary<string, string>
|
||||
|
@ -89,8 +91,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
private string _currSelectorDir;
|
||||
private readonly ListViewSorter _listViewSorter;
|
||||
|
||||
public FirmwaresConfig(bool retryLoadRom = false, string reloadRomPath = null)
|
||||
public FirmwaresConfig(MainForm mainForm, bool retryLoadRom = false, string reloadRomPath = null)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
InitializeComponent();
|
||||
|
||||
// prep ImageList for ListView with 3 item states for {idUnsure, idMissing, idOk}
|
||||
|
@ -567,7 +570,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
using var pathConfig = new PathConfig(Global.Config);
|
||||
using var pathConfig = new PathConfig(_mainForm, Global.Config);
|
||||
pathConfig.ShowDialog(this);
|
||||
RefreshBasePath();
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public partial class PathConfig : Form
|
||||
{
|
||||
private readonly Config _config;
|
||||
private readonly MainForm _mainForm;
|
||||
|
||||
// All path text boxes should do some kind of error checking
|
||||
// Config path under base, config will default to %exe%
|
||||
|
@ -40,8 +41,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
"..\\",
|
||||
};
|
||||
|
||||
public PathConfig(Config config)
|
||||
public PathConfig(MainForm mainForm, Config config)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
_config = config;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
@ -176,7 +178,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
using var f = new FirmwaresConfig { TargetSystem = "Global" };
|
||||
using var f = new FirmwaresConfig(_mainForm) { TargetSystem = "Global" };
|
||||
f.ShowDialog(this);
|
||||
};
|
||||
|
||||
|
@ -324,14 +326,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
SaveSettings();
|
||||
|
||||
PathManager.RefreshTempPath();
|
||||
|
||||
GlobalWin.OSD.AddMessage("Path settings saved");
|
||||
_mainForm.AddOnScreenMessage("Path settings saved");
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Path config aborted");
|
||||
_mainForm.AddOnScreenMessage("Path config aborted");
|
||||
Close();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue