atari7800 settings dialog - set up a pattern of constructor declaring dependencies in the constructor, rather than relying on Global variables. We should be doing this for other dialogs (and in general)
This commit is contained in:
parent
2c66e3043c
commit
92768858f7
|
@ -23,6 +23,7 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
|
||||||
using BizHawk.Emulation.Cores.Computers.AppleII;
|
using BizHawk.Emulation.Cores.Computers.AppleII;
|
||||||
using BizHawk.Client.ApiHawk;
|
using BizHawk.Client.ApiHawk;
|
||||||
using BizHawk.Common;
|
using BizHawk.Common;
|
||||||
|
using BizHawk.Emulation.Cores.Atari.A7800Hawk;
|
||||||
using BizHawk.Emulation.Cores.Computers.Commodore64;
|
using BizHawk.Emulation.Cores.Computers.Commodore64;
|
||||||
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
||||||
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
|
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
|
||||||
|
@ -2038,9 +2039,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void A7800ControllerSettingsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void A7800ControllerSettingsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var form = new A7800ControllerSettings();
|
if (Emulator is A7800Hawk atari7800Hawk)
|
||||||
|
{
|
||||||
|
using var form = new A7800ControllerSettings(this, atari7800Hawk.GetSyncSettings().Clone());
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void A7800FilterSettingsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void A7800FilterSettingsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -727,6 +727,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
|
public void AddOnScreenMessage(string message)
|
||||||
|
{
|
||||||
|
GlobalWin.OSD.AddMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
public void ClearHolds()
|
public void ClearHolds()
|
||||||
{
|
{
|
||||||
Global.StickyXORAdapter.ClearStickies();
|
Global.StickyXORAdapter.ClearStickies();
|
||||||
|
@ -741,7 +746,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public void FlagNeedsReboot()
|
public void FlagNeedsReboot()
|
||||||
{
|
{
|
||||||
RebootStatusBarIcon.Visible = true;
|
RebootStatusBarIcon.Visible = true;
|
||||||
GlobalWin.OSD.AddMessage("Core reboot needed for this setting");
|
AddOnScreenMessage("Core reboot needed for this setting");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -9,17 +9,20 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class A7800ControllerSettings : Form
|
public partial class A7800ControllerSettings : Form
|
||||||
{
|
{
|
||||||
private A7800Hawk.A7800SyncSettings _syncSettings;
|
private readonly MainForm _mainForm;
|
||||||
|
private readonly A7800Hawk.A7800SyncSettings _syncSettings;
|
||||||
|
|
||||||
public A7800ControllerSettings()
|
public A7800ControllerSettings(
|
||||||
|
MainForm mainForm,
|
||||||
|
A7800Hawk.A7800SyncSettings syncSettings)
|
||||||
{
|
{
|
||||||
|
_mainForm = mainForm;
|
||||||
|
_syncSettings = syncSettings;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IntvControllerSettings_Load(object sender, EventArgs e)
|
private void IntvControllerSettings_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_syncSettings = ((A7800Hawk)Global.Emulator).GetSyncSettings().Clone();
|
|
||||||
|
|
||||||
var possibleControllers = A7800HawkControllerDeck.ValidControllerTypes.Select(t => t.Key);
|
var possibleControllers = A7800HawkControllerDeck.ValidControllerTypes.Select(t => t.Key);
|
||||||
|
|
||||||
foreach (var val in possibleControllers)
|
foreach (var val in possibleControllers)
|
||||||
|
@ -43,7 +46,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_syncSettings.Port1 = Port1ComboBox.SelectedItem.ToString();
|
_syncSettings.Port1 = Port1ComboBox.SelectedItem.ToString();
|
||||||
_syncSettings.Port2 = Port2ComboBox.SelectedItem.ToString();
|
_syncSettings.Port2 = Port2ComboBox.SelectedItem.ToString();
|
||||||
|
|
||||||
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
_mainForm.PutCoreSyncSettings(_syncSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
|
@ -52,7 +55,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void CancelBtn_Click(object sender, EventArgs e)
|
private void CancelBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
GlobalWin.OSD.AddMessage("Controller settings aborted");
|
_mainForm.AddOnScreenMessage("Controller settings aborted");
|
||||||
DialogResult = DialogResult.Cancel;
|
DialogResult = DialogResult.Cancel;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue