GB config - pass dependencies in
This commit is contained in:
parent
a39cedb366
commit
394641f2af
|
@ -2066,9 +2066,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void GBCoreSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.Emulator is Gameboy)
|
||||
if (Global.Emulator is Gameboy gb)
|
||||
{
|
||||
GBPrefs.DoGBPrefsDialog(this);
|
||||
GBPrefs.DoGBPrefsDialog(this, gb);
|
||||
}
|
||||
else // SameBoy
|
||||
{
|
||||
|
@ -2340,7 +2340,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void DgbSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
DGBPrefs.DoDGBPrefsDialog(this);
|
||||
if (Emulator is GambatteLink gambatte)
|
||||
{
|
||||
DGBPrefs.DoDGBPrefsDialog(this, gambatte);
|
||||
}
|
||||
}
|
||||
|
||||
private void DgbHawkSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -29,9 +29,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private bool SyncSettingsChanged => gbPrefControl1.SyncSettingsChanged || gbPrefControl2.SyncSettingsChanged;
|
||||
|
||||
public static void DoDGBPrefsDialog(IWin32Window owner)
|
||||
public static void DoDGBPrefsDialog(MainForm mainForm, GambatteLink gambatte)
|
||||
{
|
||||
var gambatte = (GambatteLink)Global.Emulator;
|
||||
var s = gambatte.GetSettings();
|
||||
var ss = gambatte.GetSyncSettings();
|
||||
|
||||
|
@ -42,13 +41,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
dlg.gbPrefControl1.ColorGameBoy = emu.IsCGBMode(false);
|
||||
dlg.gbPrefControl2.ColorGameBoy = emu.IsCGBMode(true);
|
||||
|
||||
if (dlg.ShowDialog(owner) == DialogResult.OK)
|
||||
if (dlg.ShowDialog(mainForm) == DialogResult.OK)
|
||||
{
|
||||
dlg.GetSettings(out s, out ss);
|
||||
gambatte.PutSettings(s);
|
||||
if (dlg.SyncSettingsChanged)
|
||||
{
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(ss);
|
||||
mainForm.PutCoreSyncSettings(ss);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -12,22 +10,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static void DoGBPrefsDialog(IWin32Window owner)
|
||||
public static void DoGBPrefsDialog(MainForm mainForm, Gameboy gb)
|
||||
{
|
||||
var gb = (Gameboy)Global.Emulator;
|
||||
var s = gb.GetSettings();
|
||||
var ss = gb.GetSyncSettings();
|
||||
|
||||
using var dlg = new GBPrefs();
|
||||
dlg.gbPrefControl1.PutSettings(s, ss);
|
||||
dlg.gbPrefControl1.ColorGameBoy = gb.IsCGBMode();
|
||||
if (dlg.ShowDialog(owner) == DialogResult.OK)
|
||||
if (dlg.ShowDialog(mainForm) == DialogResult.OK)
|
||||
{
|
||||
dlg.gbPrefControl1.GetSettings(out s, out ss);
|
||||
gb.PutSettings(s);
|
||||
if (dlg.gbPrefControl1.SyncSettingsChanged)
|
||||
{
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(ss);
|
||||
mainForm.PutCoreSyncSettings(ss);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue