pass in dependencies to SMS graphics config dialog

This commit is contained in:
adelikat 2019-12-16 17:44:18 -06:00
parent 47dfdb5190
commit 4a509fa410
3 changed files with 20 additions and 15 deletions

View File

@ -1937,8 +1937,11 @@ namespace BizHawk.Client.EmuHawk
private void SMSGraphicsSettingsMenuItem_Click(object sender, EventArgs e)
{
using var form = new SMSGraphicsConfig();
form.ShowDialog();
if (Emulator is SMS sms)
{
using var form = new SmsGraphicsConfig(this, sms.GetSettings().Clone());
form.ShowDialog();
}
}
private void GGGameGenieMenuItem_Click(object sender, EventArgs e)

View File

@ -1,6 +1,6 @@
namespace BizHawk.Client.EmuHawk
{
partial class SMSGraphicsConfig
partial class SmsGraphicsConfig
{
/// <summary>
/// Required designer variable.
@ -105,7 +105,7 @@
this.Controls.Add(this.OK);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SMSGraphicsConfig";
this.Name = "SmsGraphicsConfig";
this.ShowIcon = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;

View File

@ -1,31 +1,33 @@
using System;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Sega.MasterSystem;
namespace BizHawk.Client.EmuHawk
{
public partial class SMSGraphicsConfig : Form
public partial class SmsGraphicsConfig : Form
{
public SMSGraphicsConfig()
private readonly MainForm _mainForm;
private readonly SMS.SMSSettings _settings;
public SmsGraphicsConfig(
MainForm mainForm,
SMS.SMSSettings settings)
{
_mainForm = mainForm;
_settings = settings;
InitializeComponent();
}
private void SMSGraphicsConfig_Load(object sender, EventArgs e)
{
var s = ((SMS)Global.Emulator).GetSettings();
DispOBJ.Checked = s.DispOBJ;
DispBG.Checked = s.DispBG;
DispOBJ.Checked = _settings.DispOBJ;
DispBG.Checked = _settings.DispBG;
}
private void Ok_Click(object sender, EventArgs e)
{
var s = ((SMS)Global.Emulator).GetSettings();
s.DispOBJ = DispOBJ.Checked;
s.DispBG = DispBG.Checked;
GlobalWin.MainForm.PutCoreSettings(s);
_settings.DispOBJ = DispOBJ.Checked;
_settings.DispBG = DispBG.Checked;
_mainForm.PutCoreSettings(_settings);
Close();
}
}