ZXS config dialogs - pass in dependencies
This commit is contained in:
parent
c722a1ef9f
commit
de6979820d
|
@ -2612,40 +2612,55 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ZXSpectrumControllerConfigurationMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var form = new ZxSpectrumJoystickSettings();
|
||||
form.ShowDialog();
|
||||
if (Emulator is ZXSpectrum zxs)
|
||||
{
|
||||
using var form = new ZxSpectrumJoystickSettings(this, zxs.GetSyncSettings().Clone());
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ZXSpectrumCoreEmulationSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var form = new ZxSpectrumCoreEmulationSettings();
|
||||
form.ShowDialog();
|
||||
if (Emulator is ZXSpectrum speccy)
|
||||
{
|
||||
using var form = new ZxSpectrumCoreEmulationSettings(this, speccy.GetSyncSettings().Clone());
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ZXSpectrumNonSyncSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var form = new ZxSpectrumNonSyncSettings();
|
||||
form.ShowDialog();
|
||||
if (Emulator is ZXSpectrum speccy)
|
||||
{
|
||||
using var form = new ZxSpectrumNonSyncSettings(this, speccy.GetSettings().Clone());
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ZXSpectrumAudioSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var form = new ZxSpectrumAudioSettings();
|
||||
form.ShowDialog();
|
||||
if (Emulator is ZXSpectrum speccy)
|
||||
{
|
||||
using var form = new ZxSpectrumAudioSettings(this, speccy.GetSettings().Clone());
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ZXSpectrumPokeMemoryMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var form = new ZxSpectrumPokeMemory();
|
||||
form.ShowDialog();
|
||||
if (Emulator is ZXSpectrum speccy)
|
||||
{
|
||||
using var form = new ZxSpectrumPokeMemory(this, speccy);
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void ZXSpectrumMediaMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
if (Emulator is ZXSpectrum)
|
||||
if (Emulator is ZXSpectrum speccy)
|
||||
{
|
||||
ZXSpectrumTapesSubMenu.Enabled = ((ZXSpectrum)Emulator)._tapeInfo.Count > 0;
|
||||
ZXSpectrumDisksSubMenu.Enabled = ((ZXSpectrum)Emulator)._diskInfo.Count > 0;
|
||||
ZXSpectrumTapesSubMenu.Enabled = speccy._tapeInfo.Count > 0;
|
||||
ZXSpectrumDisksSubMenu.Enabled = speccy._diskInfo.Count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2653,7 +2668,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
ZXSpectrumTapesSubMenu.DropDownItems.Clear();
|
||||
|
||||
List<ToolStripMenuItem> items = new List<ToolStripMenuItem>();
|
||||
var items = new List<ToolStripMenuItem>();
|
||||
|
||||
if (Emulator is ZXSpectrum speccy)
|
||||
{
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class ZxSpectrumAudioSettings : Form
|
||||
{
|
||||
private ZXSpectrum.ZXSpectrumSettings _settings;
|
||||
private readonly MainForm _mainForm;
|
||||
private readonly ZXSpectrum.ZXSpectrumSettings _settings;
|
||||
|
||||
public ZxSpectrumAudioSettings()
|
||||
public ZxSpectrumAudioSettings(
|
||||
MainForm mainForm,
|
||||
ZXSpectrum.ZXSpectrumSettings settings)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
_settings = settings;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void IntvControllerSettings_Load(object sender, EventArgs e)
|
||||
{
|
||||
_settings = ((ZXSpectrum)Global.Emulator).GetSettings().Clone();
|
||||
|
||||
// AY panning config
|
||||
var panTypes = Enum.GetNames(typeof(AY38912.AYPanConfig));
|
||||
foreach (var val in panTypes)
|
||||
|
@ -53,8 +54,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_settings.EarVolume = earVolumetrackBar.Value;
|
||||
_settings.AYVolume = ayVolumetrackBar.Value;
|
||||
|
||||
GlobalWin.MainForm.PutCoreSettings(_settings);
|
||||
|
||||
_mainForm.PutCoreSettings(_settings);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Misc settings aborted");
|
||||
_mainForm.AddOnScreenMessage("Misc settings aborted");
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class ZxSpectrumCoreEmulationSettings : Form
|
||||
{
|
||||
private ZXSpectrum.ZXSpectrumSyncSettings _syncSettings;
|
||||
private readonly MainForm _mainForm;
|
||||
private readonly ZXSpectrum.ZXSpectrumSyncSettings _syncSettings;
|
||||
|
||||
public ZxSpectrumCoreEmulationSettings()
|
||||
public ZxSpectrumCoreEmulationSettings(
|
||||
MainForm mainForm,
|
||||
ZXSpectrum.ZXSpectrumSyncSettings syncSettings)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
_syncSettings = syncSettings;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void IntvControllerSettings_Load(object sender, EventArgs e)
|
||||
{
|
||||
_syncSettings = ((ZXSpectrum)Global.Emulator).GetSyncSettings().Clone();
|
||||
|
||||
// machine selection
|
||||
var machineTypes = Enum.GetNames(typeof(MachineType));
|
||||
foreach (var val in machineTypes)
|
||||
|
@ -59,7 +60,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_syncSettings.DeterministicEmulation = determEmucheckBox1.Checked;
|
||||
_syncSettings.AutoLoadTape = autoLoadcheckBox1.Checked;
|
||||
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
||||
_mainForm.PutCoreSyncSettings(_syncSettings);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
|
@ -73,7 +74,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Core emulator settings aborted");
|
||||
_mainForm.AddOnScreenMessage("Core emulator settings aborted");
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
|
|
@ -1,26 +1,27 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class ZxSpectrumJoystickSettings : Form
|
||||
{
|
||||
private ZXSpectrum.ZXSpectrumSyncSettings _syncSettings;
|
||||
private readonly MainForm _mainForm;
|
||||
private readonly ZXSpectrum.ZXSpectrumSyncSettings _syncSettings;
|
||||
private string[] _possibleControllers;
|
||||
|
||||
public ZxSpectrumJoystickSettings()
|
||||
public ZxSpectrumJoystickSettings(
|
||||
MainForm mainForm,
|
||||
ZXSpectrum.ZXSpectrumSyncSettings syncSettings)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
_syncSettings = syncSettings;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void IntvControllerSettings_Load(object sender, EventArgs e)
|
||||
{
|
||||
_syncSettings = ((ZXSpectrum)Global.Emulator).GetSyncSettings().Clone();
|
||||
|
||||
_possibleControllers = Enum.GetNames(typeof(JoystickType));
|
||||
|
||||
foreach (var val in _possibleControllers)
|
||||
|
@ -99,7 +100,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_syncSettings.JoystickType2 = (JoystickType)Enum.Parse(typeof(JoystickType), Port2ComboBox.SelectedItem.ToString());
|
||||
_syncSettings.JoystickType3 = (JoystickType)Enum.Parse(typeof(JoystickType), Port3ComboBox.SelectedItem.ToString());
|
||||
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
||||
_mainForm.PutCoreSyncSettings(_syncSettings);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
|
@ -118,7 +119,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Joystick settings aborted");
|
||||
_mainForm.AddOnScreenMessage("Joystick settings aborted");
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class ZxSpectrumNonSyncSettings : Form
|
||||
{
|
||||
private ZXSpectrum.ZXSpectrumSettings _settings;
|
||||
private readonly MainForm _mainForm;
|
||||
private readonly ZXSpectrum.ZXSpectrumSettings _settings;
|
||||
private int _bgColor;
|
||||
|
||||
public ZxSpectrumNonSyncSettings()
|
||||
public ZxSpectrumNonSyncSettings(
|
||||
MainForm mainForm,
|
||||
ZXSpectrum.ZXSpectrumSettings settings)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
_settings = settings;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void IntvControllerSettings_Load(object sender, EventArgs e)
|
||||
{
|
||||
_settings = ((ZXSpectrum)Global.Emulator).GetSettings().Clone();
|
||||
|
||||
_bgColor = _settings.BackgroundColor;
|
||||
|
||||
SetBtnColor();
|
||||
|
@ -56,7 +57,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_settings.BackgroundColor = _bgColor;
|
||||
_settings.UseCoreBorderForBackground = checkBoxShowCoreBrdColor.Checked;
|
||||
|
||||
GlobalWin.MainForm.PutCoreSettings(_settings);
|
||||
_mainForm.PutCoreSettings(_settings);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
|
@ -70,7 +71,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("Misc settings aborted");
|
||||
_mainForm.AddOnScreenMessage("Misc settings aborted");
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
|
|
@ -8,18 +8,24 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public partial class ZxSpectrumPokeMemory : Form
|
||||
{
|
||||
public ZxSpectrumPokeMemory()
|
||||
private readonly MainForm _mainForm;
|
||||
private readonly ZXSpectrum _speccy;
|
||||
public ZxSpectrumPokeMemory(
|
||||
MainForm mainForm,
|
||||
ZXSpectrum speccy)
|
||||
{
|
||||
_mainForm = mainForm;
|
||||
_speccy = speccy;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
var speccy = (ZXSpectrum)Global.Emulator;
|
||||
var addr = (ushort)numericUpDownAddress.Value;
|
||||
var val = (byte)numericUpDownByte.Value;
|
||||
|
||||
speccy.PokeMemory(addr, val);
|
||||
_speccy.PokeMemory(addr, val);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
|
@ -27,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("POKE memory aborted");
|
||||
_mainForm.AddOnScreenMessage("POKE memory aborted");
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue