Pass `ISettingsAdapter` to config dialogs, remove `IMainFormForConfig`

This commit is contained in:
YoshiRulz 2022-05-28 19:38:59 +10:00 committed by James Groom
parent 0366242d0a
commit 20c1fe0f17
32 changed files with 293 additions and 289 deletions

View File

@ -1,17 +0,0 @@
using System;
using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public interface IMainFormForConfig
{
/// <exception cref="InvalidOperationException">loaded emulator is not instance of <typeparamref name="T"/></exception>
ISettingsAdapter GetSettingsAdapterForLoadedCore<T>()
where T : IEmulator;
ISettingsAdapter GetSettingsAdapterFor<T>()
where T : IEmulator;
}
}

View File

@ -1346,15 +1346,15 @@ namespace BizHawk.Client.EmuHawk
Tools.Load<NESMusicRipper>(); Tools.Load<NESMusicRipper>();
} }
private DialogResult OpenNesHawkGraphicsSettingsDialog(NES.NESSettings s) private DialogResult OpenNesHawkGraphicsSettingsDialog(ISettingsAdapter settable)
{ {
using NESGraphicsConfig form = new(Config, this, this, s); using NESGraphicsConfig form = new(Config, this, settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
private DialogResult OpenQuickNesGraphicsSettingsDialog(QuickNES.QuickNESSettings s) private DialogResult OpenQuickNesGraphicsSettingsDialog(ISettingsAdapter settable)
{ {
using QuickNesConfig form = new(this, Config, s); using QuickNesConfig form = new(Config, settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1362,9 +1362,9 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
NES nesHawk => OpenNesHawkGraphicsSettingsDialog(nesHawk.GetSettings().Clone()), NES => OpenNesHawkGraphicsSettingsDialog(GetSettingsAdapterForLoadedCore<NES>()),
SubNESHawk subNESHawk => OpenNesHawkGraphicsSettingsDialog(subNESHawk.GetSettings().Clone()), SubNESHawk => OpenNesHawkGraphicsSettingsDialog(GetSettingsAdapterForLoadedCore<SubNESHawk>()),
QuickNES quickNes => OpenQuickNesGraphicsSettingsDialog(quickNes.GetSettings().Clone()), QuickNES => OpenQuickNesGraphicsSettingsDialog(GetSettingsAdapterForLoadedCore<QuickNES>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
@ -1374,9 +1374,9 @@ namespace BizHawk.Client.EmuHawk
Tools.Load<NESSoundConfig>(); Tools.Load<NESSoundConfig>();
} }
private DialogResult OpenNesHawkVSSettingsDialog(NES.NESSyncSettings ss) private DialogResult OpenNesHawkVSSettingsDialog(ISettingsAdapter settable)
{ {
using NesVsSettings form = new(this, ss); using NesVsSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1384,8 +1384,8 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
NES { IsVS: true } nesHawk => OpenNesHawkVSSettingsDialog(nesHawk.GetSyncSettings().Clone()), NES { IsVS: true } => OpenNesHawkVSSettingsDialog(GetSettingsAdapterForLoadedCore<NES>()),
SubNESHawk { IsVs: true } subNESHawk => OpenNesHawkVSSettingsDialog(subNESHawk.GetSyncSettings().Clone()), SubNESHawk { IsVs: true } => OpenNesHawkVSSettingsDialog(GetSettingsAdapterForLoadedCore<SubNESHawk>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
@ -1438,9 +1438,9 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private DialogResult OpenNesHawkGamepadSettingsDialog(NES.NESSyncSettings ss) private DialogResult OpenNesHawkGamepadSettingsDialog(ISettingsAdapter settable)
{ {
using NesControllerSettings form = new(this, ss); using NesControllerSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1456,16 +1456,16 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
NES nesHawk => OpenNesHawkGamepadSettingsDialog(nesHawk.GetSyncSettings().Clone()), NES => OpenNesHawkGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<NES>()),
SubNESHawk subNESHawk => OpenNesHawkGamepadSettingsDialog(subNESHawk.GetSyncSettings().Clone()), SubNESHawk => OpenNesHawkGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<SubNESHawk>()),
QuickNES => OpenQuickNesGamepadSettingsDialog(), QuickNES => OpenQuickNesGamepadSettingsDialog(),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
private DialogResult OpenNesHawkAdvancedSettingsDialog(NES.NESSyncSettings ss, bool hasMapperProperties) private DialogResult OpenNesHawkAdvancedSettingsDialog(ISettingsAdapter settable, bool hasMapperProperties)
{ {
using NESSyncSettingsForm form = new(this, this, ss, hasMapperProperties: hasMapperProperties); using NESSyncSettingsForm form = new(this, settable, hasMapperProperties: hasMapperProperties);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1473,8 +1473,8 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
NES nesHawk => OpenNesHawkAdvancedSettingsDialog(nesHawk.GetSyncSettings().Clone(), nesHawk.HasMapperProperties), NES nesHawk => OpenNesHawkAdvancedSettingsDialog(GetSettingsAdapterForLoadedCore<NES>(), nesHawk.HasMapperProperties),
SubNESHawk subNESHawk => OpenNesHawkAdvancedSettingsDialog(subNESHawk.GetSyncSettings().Clone(), subNESHawk.HasMapperProperties), SubNESHawk subNESHawk => OpenNesHawkAdvancedSettingsDialog(GetSettingsAdapterForLoadedCore<SubNESHawk>(), subNESHawk.HasMapperProperties),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
@ -1520,9 +1520,9 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private DialogResult OpenTI83PaletteSettingsDialog(TI83Common.TI83CommonSettings s) private DialogResult OpenTI83PaletteSettingsDialog(ISettingsAdapter settable)
{ {
using TI83PaletteConfig form = new(this, s); using TI83PaletteConfig form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1530,8 +1530,8 @@ namespace BizHawk.Client.EmuHawk
{ {
var result = Emulator switch var result = Emulator switch
{ {
Emu83 emu83 => OpenTI83PaletteSettingsDialog(emu83.GetSettings().Clone()), Emu83 => OpenTI83PaletteSettingsDialog(GetSettingsAdapterForLoadedCore<Emu83>()),
TI83 ti83Hawk => OpenTI83PaletteSettingsDialog(ti83Hawk.GetSettings().Clone()), TI83 => OpenTI83PaletteSettingsDialog(GetSettingsAdapterForLoadedCore<TI83>()),
_ => DialogResult.None _ => DialogResult.None
}; };
if (result.IsOk()) AddOnScreenMessage("Palette settings saved"); if (result.IsOk()) AddOnScreenMessage("Palette settings saved");
@ -1544,9 +1544,9 @@ namespace BizHawk.Client.EmuHawk
= MovieSession.Movie.NotActive(); = MovieSession.Movie.NotActive();
} }
private DialogResult OpenA7800HawkGamepadSettingsDialog(A7800Hawk.A7800SyncSettings ss) private DialogResult OpenA7800HawkGamepadSettingsDialog(ISettingsAdapter settable)
{ {
using A7800ControllerSettings form = new(this, ss); using A7800ControllerSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1554,14 +1554,14 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
A7800Hawk a7800Hawk => OpenA7800HawkGamepadSettingsDialog(a7800Hawk.GetSyncSettings().Clone()), A7800Hawk => OpenA7800HawkGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<A7800Hawk>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
private DialogResult OpenA7800HawkFilterSettingsDialog(A7800Hawk.A7800SyncSettings ss) private DialogResult OpenA7800HawkFilterSettingsDialog(ISettingsAdapter settable)
{ {
using A7800FilterSettings form = new(this, ss); using A7800FilterSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1569,13 +1569,13 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
A7800Hawk a7800Hawk => OpenA7800HawkFilterSettingsDialog(a7800Hawk.GetSyncSettings().Clone()), A7800Hawk => OpenA7800HawkFilterSettingsDialog(GetSettingsAdapterForLoadedCore<A7800Hawk>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
private DialogResult OpenGambatteSettingsDialog(Gameboy gambatte) private DialogResult OpenGambatteSettingsDialog(ISettingsAdapter settable, Gameboy gambatte)
=> GBPrefs.DoGBPrefsDialog(Config, this, Game, this, MovieSession, gambatte); => GBPrefs.DoGBPrefsDialog(Config, this, Game, MovieSession, settable, gambatte);
private DialogResult OpenGBHawkSettingsDialog() private DialogResult OpenGBHawkSettingsDialog()
=> OpenGenericCoreConfig("Gameboy Settings"); => OpenGenericCoreConfig("Gameboy Settings");
@ -1587,16 +1587,16 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
Gameboy gambatte => OpenGambatteSettingsDialog(gambatte), Gameboy gambatte => OpenGambatteSettingsDialog(GetSettingsAdapterForLoadedCore<Gameboy>(), gambatte),
GBHawk => OpenGBHawkSettingsDialog(), GBHawk => OpenGBHawkSettingsDialog(),
Sameboy => OpenSameBoySettingsDialog(), Sameboy => OpenSameBoySettingsDialog(),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
private DialogResult OpenSameBoyPaletteSettingsDialog(Sameboy.SameboySettings s) private DialogResult OpenSameBoyPaletteSettingsDialog(ISettingsAdapter settable)
{ {
using SameBoyColorChooserForm form = new(Config, this, Game, this, s); using SameBoyColorChooserForm form = new(Config, this, Game, settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1604,7 +1604,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
Sameboy sameBoy => OpenSameBoyPaletteSettingsDialog(sameBoy.GetSettings().Clone()), Sameboy => OpenSameBoyPaletteSettingsDialog(GetSettingsAdapterForLoadedCore<Sameboy>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
@ -1624,9 +1624,9 @@ namespace BizHawk.Client.EmuHawk
PSXControllerSettingsMenuItem.Enabled = MovieSession.Movie.NotActive(); PSXControllerSettingsMenuItem.Enabled = MovieSession.Movie.NotActive();
} }
private DialogResult OpenOctoshockGamepadSettingsDialog(Octoshock.SyncSettings ss) private DialogResult OpenOctoshockGamepadSettingsDialog(ISettingsAdapter settable)
{ {
using PSXControllerConfig form = new(this, ss); using PSXControllerConfig form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1634,19 +1634,19 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
Octoshock octoshock => OpenOctoshockGamepadSettingsDialog(octoshock.GetSyncSettings().Clone()), Octoshock => OpenOctoshockGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<Octoshock>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
private DialogResult OpenOctoshockSettingsDialog(Octoshock octoshock) private DialogResult OpenOctoshockSettingsDialog(ISettingsAdapter settable, Octoshock octoshock)
=> PSXOptions.DoSettingsDialog(Config, this, this, octoshock); => PSXOptions.DoSettingsDialog(Config, this, settable, octoshock);
private void PsxOptionsMenuItem_Click(object sender, EventArgs e) private void PsxOptionsMenuItem_Click(object sender, EventArgs e)
{ {
var result = Emulator switch var result = Emulator switch
{ {
Octoshock octoshock => OpenOctoshockSettingsDialog(octoshock), Octoshock octoshock => OpenOctoshockSettingsDialog(GetSettingsAdapterForLoadedCore<Octoshock>(), octoshock),
_ => DialogResult.None _ => DialogResult.None
}; };
if (result.IsOk()) FrameBufferResized(); if (result.IsOk()) FrameBufferResized();
@ -1672,15 +1672,15 @@ namespace BizHawk.Client.EmuHawk
SnesGfxDebuggerMenuItem.Enabled = true; SnesGfxDebuggerMenuItem.Enabled = true;
} }
private DialogResult OpenOldBSNESGamepadSettingsDialog(LibsnesCore.SnesSyncSettings ss) private DialogResult OpenOldBSNESGamepadSettingsDialog(ISettingsAdapter settable)
{ {
using SNESControllerSettings form = new(this, ss); using SNESControllerSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
private DialogResult OpenBSNESGamepadSettingsDialog(BsnesCore.SnesSyncSettings ss) private DialogResult OpenBSNESGamepadSettingsDialog(ISettingsAdapter settable)
{ {
using BSNESControllerSettings form = new(this, ss); using BSNESControllerSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1688,8 +1688,8 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
LibsnesCore oldBSNES => OpenOldBSNESGamepadSettingsDialog(oldBSNES.GetSyncSettings().Clone()), LibsnesCore => OpenOldBSNESGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<LibsnesCore>()),
BsnesCore bsnes => OpenBSNESGamepadSettingsDialog(bsnes.GetSyncSettings().Clone()), BsnesCore => OpenBSNESGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<BsnesCore>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
@ -1699,18 +1699,18 @@ namespace BizHawk.Client.EmuHawk
Tools.Load<SNESGraphicsDebugger>(); Tools.Load<SNESGraphicsDebugger>();
} }
private DialogResult OpenOldBSNESSettingsDialog(LibsnesCore bsnes) private DialogResult OpenOldBSNESSettingsDialog(ISettingsAdapter settable, LibsnesCore bsnes)
=> SNESOptions.DoSettingsDialog(this, this, bsnes); => SNESOptions.DoSettingsDialog(this, settable, bsnes);
private DialogResult OpenBSNESSettingsDialog(BsnesCore bsnes) private DialogResult OpenBSNESSettingsDialog(ISettingsAdapter settable, BsnesCore bsnes)
=> BSNESOptions.DoSettingsDialog(this, this, bsnes); => BSNESOptions.DoSettingsDialog(this, settable, bsnes);
private void SnesOptionsMenuItem_Click(object sender, EventArgs e) private void SnesOptionsMenuItem_Click(object sender, EventArgs e)
{ {
_ = Emulator switch _ = Emulator switch
{ {
LibsnesCore oldBSNES => OpenOldBSNESSettingsDialog(oldBSNES), LibsnesCore oldBSNES => OpenOldBSNESSettingsDialog(GetSettingsAdapterForLoadedCore<LibsnesCore>(), oldBSNES),
BsnesCore bsnes => OpenBSNESSettingsDialog(bsnes), BsnesCore bsnes => OpenBSNESSettingsDialog(GetSettingsAdapterForLoadedCore<BsnesCore>(), bsnes),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
@ -1746,9 +1746,9 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private DialogResult OpenColecoHawkGamepadSettingsDialog(ColecoVision.ColecoSyncSettings ss) private DialogResult OpenColecoHawkGamepadSettingsDialog(ISettingsAdapter settable)
{ {
using ColecoControllerSettings form = new(this, ss); using ColecoControllerSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1756,7 +1756,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
ColecoVision colecoHawk => OpenColecoHawkGamepadSettingsDialog(colecoHawk.GetSyncSettings().Clone()), ColecoVision => OpenColecoHawkGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<ColecoVision>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
@ -1777,24 +1777,24 @@ namespace BizHawk.Client.EmuHawk
N64ExpansionSlotMenuItem.Enabled = !((N64)Emulator).IsOverridingUserExpansionSlotSetting; N64ExpansionSlotMenuItem.Enabled = !((N64)Emulator).IsOverridingUserExpansionSlotSetting;
} }
private DialogResult OpenMupen64PlusGraphicsSettingsDialog() private DialogResult OpenMupen64PlusGraphicsSettingsDialog(ISettingsAdapter settable)
{ {
using N64VideoPluginConfig form = new(this); using N64VideoPluginConfig form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
private void N64PluginSettingsMenuItem_Click(object sender, EventArgs e) private void N64PluginSettingsMenuItem_Click(object sender, EventArgs e)
{ {
if (OpenMupen64PlusGraphicsSettingsDialog().IsOk() if (OpenMupen64PlusGraphicsSettingsDialog(GetSettingsAdapterFor<N64>()).IsOk()
&& Emulator is not N64) // If it's loaded, the reboot required message will appear && Emulator is not N64) // If it's loaded, the reboot required message will appear
{ {
AddOnScreenMessage("Plugin settings saved"); AddOnScreenMessage("Plugin settings saved");
} }
} }
private DialogResult OpenMupen64PlusGamepadSettingsDialog(N64SyncSettings ss) private DialogResult OpenMupen64PlusGamepadSettingsDialog(ISettingsAdapter settable)
{ {
using N64ControllersSetup form = new(this, ss); using N64ControllersSetup form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1802,7 +1802,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
N64 mupen64Plus => OpenMupen64PlusGamepadSettingsDialog(mupen64Plus.GetSyncSettings().Clone()), N64 => OpenMupen64PlusGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<N64>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
@ -1831,14 +1831,14 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private DialogResult OpenGambatteLinkSettingsDialog(GambatteLink gambatteLink) private DialogResult OpenGambatteLinkSettingsDialog(ISettingsAdapter settable, GambatteLink gambatteLink)
=> GBLPrefs.DoGBLPrefsDialog(Config, this, Game, this, MovieSession, gambatteLink); => GBLPrefs.DoGBLPrefsDialog(Config, this, Game, MovieSession, settable, gambatteLink);
private void GblSettingsMenuItem_Click(object sender, EventArgs e) private void GblSettingsMenuItem_Click(object sender, EventArgs e)
{ {
_ = Emulator switch _ = Emulator switch
{ {
GambatteLink gambatteLink => OpenGambatteLinkSettingsDialog(gambatteLink), GambatteLink gambatteLink => OpenGambatteLinkSettingsDialog(GetSettingsAdapterForLoadedCore<GambatteLink>(), gambatteLink),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
@ -1949,9 +1949,9 @@ namespace BizHawk.Client.EmuHawk
IntVControllerSettingsMenuItem.Enabled = MovieSession.Movie.NotActive(); IntVControllerSettingsMenuItem.Enabled = MovieSession.Movie.NotActive();
} }
private DialogResult OpenIntelliHawkGamepadSettingsDialog(Intellivision.IntvSyncSettings ss) private DialogResult OpenIntelliHawkGamepadSettingsDialog(ISettingsAdapter settable)
{ {
using IntvControllerSettings form = new(this, ss); using IntvControllerSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1959,14 +1959,14 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
Intellivision intelliHawk => OpenIntelliHawkGamepadSettingsDialog(intelliHawk.GetSyncSettings().Clone()), Intellivision => OpenIntelliHawkGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<Intellivision>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
private DialogResult OpenZXHawkGamepadSettingsDialog(ZXSpectrum.ZXSpectrumSyncSettings ss) private DialogResult OpenZXHawkGamepadSettingsDialog(ISettingsAdapter settable)
{ {
using ZxSpectrumJoystickSettings form = new(this, this, ss); using ZxSpectrumJoystickSettings form = new(this, settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1974,14 +1974,14 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
ZXSpectrum zxHawk => OpenZXHawkGamepadSettingsDialog(zxHawk.GetSyncSettings().Clone()), ZXSpectrum => OpenZXHawkGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<ZXSpectrum>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
private DialogResult OpenZXHawkSyncSettingsDialog(ZXSpectrum.ZXSpectrumSyncSettings ss) private DialogResult OpenZXHawkSyncSettingsDialog(ISettingsAdapter settable)
{ {
using ZxSpectrumCoreEmulationSettings form = new(this, ss); using ZxSpectrumCoreEmulationSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -1989,14 +1989,14 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
ZXSpectrum zxHawk => OpenZXHawkSyncSettingsDialog(zxHawk.GetSyncSettings().Clone()), ZXSpectrum => OpenZXHawkSyncSettingsDialog(GetSettingsAdapterForLoadedCore<ZXSpectrum>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
private DialogResult OpenZXHawkSettingsDialog(ZXSpectrum.ZXSpectrumSettings s) private DialogResult OpenZXHawkSettingsDialog(ISettingsAdapter settable)
{ {
using ZxSpectrumNonSyncSettings form = new(this, s); using ZxSpectrumNonSyncSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -2004,14 +2004,14 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
ZXSpectrum zxHawk => OpenZXHawkSettingsDialog(zxHawk.GetSettings().Clone()), ZXSpectrum => OpenZXHawkSettingsDialog(GetSettingsAdapterForLoadedCore<ZXSpectrum>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
private DialogResult OpenZXHawkAudioSettingsDialog(ZXSpectrum.ZXSpectrumSettings s) private DialogResult OpenZXHawkAudioSettingsDialog(ISettingsAdapter settable)
{ {
using ZxSpectrumAudioSettings form = new(this, s); using ZxSpectrumAudioSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -2019,7 +2019,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
ZXSpectrum zxHawk => OpenZXHawkAudioSettingsDialog(zxHawk.GetSettings().Clone()), ZXSpectrum => OpenZXHawkAudioSettingsDialog(GetSettingsAdapterForLoadedCore<ZXSpectrum>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
@ -2126,9 +2126,9 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private DialogResult OpenCPCHawkSyncSettingsDialog(AmstradCPC.AmstradCPCSyncSettings ss) private DialogResult OpenCPCHawkSyncSettingsDialog(ISettingsAdapter settable)
{ {
using AmstradCpcCoreEmulationSettings form = new(this, ss); using AmstradCpcCoreEmulationSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -2136,14 +2136,14 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
AmstradCPC cpcHawk => OpenCPCHawkSyncSettingsDialog(cpcHawk.GetSyncSettings().Clone()), AmstradCPC => OpenCPCHawkSyncSettingsDialog(GetSettingsAdapterForLoadedCore<AmstradCPC>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
private DialogResult OpenCPCHawkAudioSettingsDialog(AmstradCPC.AmstradCPCSettings s) private DialogResult OpenCPCHawkAudioSettingsDialog(ISettingsAdapter settable)
{ {
using AmstradCpcAudioSettings form = new(this, s); using AmstradCpcAudioSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -2151,7 +2151,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
AmstradCPC cpcHawk => OpenCPCHawkAudioSettingsDialog(cpcHawk.GetSettings().Clone()), AmstradCPC => OpenCPCHawkAudioSettingsDialog(GetSettingsAdapterForLoadedCore<AmstradCPC>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }
@ -2233,9 +2233,9 @@ namespace BizHawk.Client.EmuHawk
AmstradCPCDisksSubMenu.DropDownItems.AddRange(items.ToArray()); AmstradCPCDisksSubMenu.DropDownItems.AddRange(items.ToArray());
} }
private DialogResult OpenCPCHawkSettingsDialog(AmstradCPC.AmstradCPCSettings s) private DialogResult OpenCPCHawkSettingsDialog(ISettingsAdapter settable)
{ {
using AmstradCpcNonSyncSettings form = new(this, s); using AmstradCpcNonSyncSettings form = new(settable);
return this.ShowDialogWithTempMute(form); return this.ShowDialogWithTempMute(form);
} }
@ -2243,7 +2243,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_ = Emulator switch _ = Emulator switch
{ {
AmstradCPC cpcHawk => OpenCPCHawkSettingsDialog(cpcHawk.GetSettings().Clone()), AmstradCPC => OpenCPCHawkSettingsDialog(GetSettingsAdapterForLoadedCore<AmstradCPC>()),
_ => DialogResult.None _ => DialogResult.None
}; };
} }

View File

@ -45,7 +45,7 @@ using BizHawk.Common.CollectionExtensions;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class MainForm : FormBase, IDialogParent, IMainFormForApi, IMainFormForConfig, IMainFormForTools public partial class MainForm : FormBase, IDialogParent, IMainFormForApi, IMainFormForTools
{ {
private void MainForm_Load(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e)
{ {

View File

@ -1,20 +1,21 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Atari.A7800Hawk; using BizHawk.Emulation.Cores.Atari.A7800Hawk;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class A7800ControllerSettings : Form public partial class A7800ControllerSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly A7800Hawk.A7800SyncSettings _syncSettings; private readonly A7800Hawk.A7800SyncSettings _syncSettings;
public A7800ControllerSettings( public A7800ControllerSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
A7800Hawk.A7800SyncSettings syncSettings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (A7800Hawk.A7800SyncSettings) settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -42,7 +43,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();
_mainForm.GetSettingsAdapterForLoadedCore<A7800Hawk>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

@ -1,21 +1,22 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Atari.A7800Hawk; using BizHawk.Emulation.Cores.Atari.A7800Hawk;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class A7800FilterSettings : Form public partial class A7800FilterSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly A7800Hawk.A7800SyncSettings _syncSettings; private readonly A7800Hawk.A7800SyncSettings _syncSettings;
public A7800FilterSettings( public A7800FilterSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
A7800Hawk.A7800SyncSettings syncSettings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (A7800Hawk.A7800SyncSettings) _settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -39,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
if (changed) if (changed)
{ {
_syncSettings.Filter = Port1ComboBox.SelectedItem.ToString(); _syncSettings.Filter = Port1ComboBox.SelectedItem.ToString();
_mainForm.GetSettingsAdapterForLoadedCore<A7800Hawk>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

@ -1,20 +1,21 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Computers.AmstradCPC; using BizHawk.Emulation.Cores.Computers.AmstradCPC;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class AmstradCpcAudioSettings : Form public partial class AmstradCpcAudioSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly AmstradCPC.AmstradCPCSettings _settings; private readonly AmstradCPC.AmstradCPCSettings _settings;
public AmstradCpcAudioSettings( public AmstradCpcAudioSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
AmstradCPC.AmstradCPCSettings settings)
{ {
_mainForm = mainForm; _settable = settable;
_settings = settings; _settings = (AmstradCPC.AmstradCPCSettings) _settable.GetSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
@ -51,7 +52,7 @@ namespace BizHawk.Client.EmuHawk
_settings.TapeVolume = tapeVolumetrackBar.Value; _settings.TapeVolume = tapeVolumetrackBar.Value;
_settings.AYVolume = ayVolumetrackBar.Value; _settings.AYVolume = ayVolumetrackBar.Value;
_mainForm.GetSettingsAdapterForLoadedCore<AmstradCPC>().PutCoreSettings(_settings); _settable.PutCoreSettings(_settings);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();

View File

@ -1,19 +1,21 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Computers.AmstradCPC; using BizHawk.Emulation.Cores.Computers.AmstradCPC;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class AmstradCpcCoreEmulationSettings : Form public partial class AmstradCpcCoreEmulationSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly AmstradCPC.AmstradCPCSyncSettings _syncSettings; private readonly AmstradCPC.AmstradCPCSyncSettings _syncSettings;
public AmstradCpcCoreEmulationSettings(IMainFormForConfig mainForm, public AmstradCpcCoreEmulationSettings(ISettingsAdapter settable)
AmstradCPC.AmstradCPCSyncSettings syncSettings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (AmstradCPC.AmstradCPCSyncSettings) _settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
} }
@ -59,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
_syncSettings.DeterministicEmulation = determEmucheckBox1.Checked; _syncSettings.DeterministicEmulation = determEmucheckBox1.Checked;
_syncSettings.AutoStartStopTape = autoLoadcheckBox1.Checked; _syncSettings.AutoStartStopTape = autoLoadcheckBox1.Checked;
_mainForm.GetSettingsAdapterForLoadedCore<AmstradCPC>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();

View File

@ -1,20 +1,21 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Computers.AmstradCPC; using BizHawk.Emulation.Cores.Computers.AmstradCPC;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class AmstradCpcNonSyncSettings : Form public partial class AmstradCpcNonSyncSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly AmstradCPC.AmstradCPCSettings _settings; private readonly AmstradCPC.AmstradCPCSettings _settings;
public AmstradCpcNonSyncSettings( public AmstradCpcNonSyncSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
AmstradCPC.AmstradCPCSettings settings)
{ {
_mainForm = mainForm; _settable = settable;
_settings = settings; _settings = (AmstradCPC.AmstradCPCSettings) _settable.GetSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -40,7 +41,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_settings.OSDMessageVerbosity = (AmstradCPC.OSDVerbosity)Enum.Parse(typeof(AmstradCPC.OSDVerbosity), osdMessageVerbositycomboBox1.SelectedItem.ToString()); _settings.OSDMessageVerbosity = (AmstradCPC.OSDVerbosity)Enum.Parse(typeof(AmstradCPC.OSDVerbosity), osdMessageVerbositycomboBox1.SelectedItem.ToString());
_mainForm.GetSettingsAdapterForLoadedCore<AmstradCPC>().PutCoreSettings(_settings); _settable.PutCoreSettings(_settings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();

View File

@ -1,20 +1,21 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.ColecoVision; using BizHawk.Emulation.Cores.ColecoVision;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class ColecoControllerSettings : Form public partial class ColecoControllerSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly ColecoVision.ColecoSyncSettings _syncSettings; private readonly ColecoVision.ColecoSyncSettings _syncSettings;
public ColecoControllerSettings( public ColecoControllerSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
ColecoVision.ColecoSyncSettings settings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = settings; _syncSettings = (ColecoVision.ColecoSyncSettings) _settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -42,7 +43,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();
_mainForm.GetSettingsAdapterForLoadedCore<ColecoVision>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

@ -48,12 +48,13 @@ namespace BizHawk.Client.EmuHawk
private bool SyncSettingsChanged => gbPrefControl1.SyncSettingsChanged || gbPrefControl2.SyncSettingsChanged || gbPrefControl3.SyncSettingsChanged || gbPrefControl4.SyncSettingsChanged; private bool SyncSettingsChanged => gbPrefControl1.SyncSettingsChanged || gbPrefControl2.SyncSettingsChanged || gbPrefControl3.SyncSettingsChanged || gbPrefControl4.SyncSettingsChanged;
/// <remarks>TODO only use <paramref name="settable"/></remarks>
public static DialogResult DoGBLPrefsDialog( public static DialogResult DoGBLPrefsDialog(
Config config, Config config,
IDialogParent dialogParent, IDialogParent dialogParent,
IGameInfo game, IGameInfo game,
IMainFormForConfig mainForm,
IMovieSession movieSession, IMovieSession movieSession,
ISettingsAdapter settable,
GambatteLink gambatte) GambatteLink gambatte)
{ {
var s = gambatte.GetSettings(); var s = gambatte.GetSettings();
@ -74,7 +75,7 @@ namespace BizHawk.Client.EmuHawk
gambatte.PutSettings(s); gambatte.PutSettings(s);
if (dlg.SyncSettingsChanged) if (dlg.SyncSettingsChanged)
{ {
mainForm.GetSettingsAdapterForLoadedCore<GambatteLink>().PutCoreSyncSettings(ss); settable.PutCoreSyncSettings(ss);
} }
} }
return result; return result;

View File

@ -17,12 +17,13 @@ namespace BizHawk.Client.EmuHawk
Icon = Properties.Resources.GambatteIcon; Icon = Properties.Resources.GambatteIcon;
} }
/// <remarks>TODO only use <paramref name="settable"/></remarks>
public static DialogResult DoGBPrefsDialog( public static DialogResult DoGBPrefsDialog(
Config config, Config config,
IDialogParent dialogParent, IDialogParent dialogParent,
IGameInfo game, IGameInfo game,
IMainFormForConfig mainForm,
IMovieSession movieSession, IMovieSession movieSession,
ISettingsAdapter settable,
Gameboy gb) Gameboy gb)
{ {
var s = gb.GetSettings(); var s = gb.GetSettings();
@ -38,7 +39,7 @@ namespace BizHawk.Client.EmuHawk
gb.PutSettings(s); gb.PutSettings(s);
if (dlg.gbPrefControl1.SyncSettingsChanged) if (dlg.gbPrefControl1.SyncSettingsChanged)
{ {
mainForm.GetSettingsAdapterForLoadedCore<Gameboy>().PutCoreSyncSettings(ss); settable.PutCoreSyncSettings(ss);
} }
} }
return result; return result;

View File

@ -12,9 +12,11 @@ namespace BizHawk.Client.EmuHawk
{ {
public partial class SameBoyColorChooserForm : Form, IDialogParent public partial class SameBoyColorChooserForm : Form, IDialogParent
{ {
private readonly IMainFormForConfig _mainForm;
private readonly IGameInfo _game; private readonly IGameInfo _game;
private readonly Config _config; private readonly Config _config;
private readonly ISettingsAdapter _settable;
private readonly Sameboy.SameboySettings _settings; private readonly Sameboy.SameboySettings _settings;
public IDialogController DialogController { get; } public IDialogController DialogController { get; }
@ -23,13 +25,12 @@ namespace BizHawk.Client.EmuHawk
Config config, Config config,
IDialogController dialogController, IDialogController dialogController,
IGameInfo game, IGameInfo game,
IMainFormForConfig mainForm, ISettingsAdapter settable)
Sameboy.SameboySettings settings)
{ {
_mainForm = mainForm;
_game = game; _game = game;
_config = config; _config = config;
_settings = settings; _settable = settable;
_settings = (Sameboy.SameboySettings) _settable.GetSettings();
DialogController = dialogController; DialogController = dialogController;
InitializeComponent(); InitializeComponent();
SetAllColors(_settings.GetCustomPalette()); SetAllColors(_settings.GetCustomPalette());
@ -324,7 +325,7 @@ namespace BizHawk.Client.EmuHawk
_settings.SetCustomPalette(colors); _settings.SetCustomPalette(colors);
_mainForm.GetSettingsAdapterForLoadedCore<Sameboy>().PutCoreSettings(_settings); _settable.PutCoreSettings(_settings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();

View File

@ -1,20 +1,21 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Intellivision; using BizHawk.Emulation.Cores.Intellivision;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class IntvControllerSettings : Form public partial class IntvControllerSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly Intellivision.IntvSyncSettings _syncSettings; private readonly Intellivision.IntvSyncSettings _syncSettings;
public IntvControllerSettings( public IntvControllerSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
Intellivision.IntvSyncSettings syncSettings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (Intellivision.IntvSyncSettings) _settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -42,7 +43,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();
_mainForm.GetSettingsAdapterForLoadedCore<Intellivision>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

@ -3,13 +3,15 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.N64; using BizHawk.Emulation.Cores.Nintendo.N64;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class N64ControllersSetup : Form public partial class N64ControllersSetup : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly N64SyncSettings _syncSettings; private readonly N64SyncSettings _syncSettings;
private List<N64ControllerSettingControl> ControllerSettingControls => Controls private List<N64ControllerSettingControl> ControllerSettingControls => Controls
@ -17,12 +19,10 @@ namespace BizHawk.Client.EmuHawk
.OrderBy(n => n.ControllerNumber) .OrderBy(n => n.ControllerNumber)
.ToList(); .ToList();
public N64ControllersSetup( public N64ControllersSetup(ISettingsAdapter settable)
IMainFormForConfig mainForm,
N64SyncSettings syncSettings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (N64SyncSettings) _settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -52,7 +52,7 @@ namespace BizHawk.Client.EmuHawk
_syncSettings.Controllers[c.ControllerNumber - 1].PakType = c.PakType; _syncSettings.Controllers[c.ControllerNumber - 1].PakType = c.PakType;
}); });
_mainForm.GetSettingsAdapterForLoadedCore<N64>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();

View File

@ -4,13 +4,15 @@ using System.Windows.Forms;
using BizHawk.Common.StringExtensions; using BizHawk.Common.StringExtensions;
using BizHawk.Common.ReflectionExtensions; using BizHawk.Common.ReflectionExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.N64; using BizHawk.Emulation.Cores.Nintendo.N64;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class N64VideoPluginConfig : Form public partial class N64VideoPluginConfig : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly N64Settings _s; private readonly N64Settings _s;
private readonly N64SyncSettings _ss; private readonly N64SyncSettings _ss;
@ -37,13 +39,12 @@ namespace BizHawk.Client.EmuHawk
private readonly bool _programmaticallyChangingPluginComboBox = false; private readonly bool _programmaticallyChangingPluginComboBox = false;
public N64VideoPluginConfig(IMainFormForConfig mainForm) public N64VideoPluginConfig(ISettingsAdapter settable)
{ {
_mainForm = mainForm; _settable = settable;
var settable = _mainForm.GetSettingsAdapterFor<N64>(); _s = (N64Settings) _settable.GetSettings();
_s = (N64Settings) settable.GetSettings(); _ss = (N64SyncSettings) _settable.GetSyncSettings();
_ss = (N64SyncSettings) settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.MonitorIcon; Icon = Properties.Resources.MonitorIcon;
@ -102,9 +103,8 @@ namespace BizHawk.Client.EmuHawk
.ToString() .ToString()
.GetEnumFromDescription<N64SyncSettings.RspType>(); .GetEnumFromDescription<N64SyncSettings.RspType>();
var settable = _mainForm.GetSettingsAdapterFor<N64>(); _settable.PutCoreSettings(_s);
settable.PutCoreSettings(_s); _settable.PutCoreSyncSettings(_ss);
settable.PutCoreSyncSettings(_ss);
} }
private void N64VideoPluginConfig_Load(object sender, EventArgs e) private void N64VideoPluginConfig_Load(object sender, EventArgs e)

View File

@ -15,8 +15,10 @@ namespace BizHawk.Client.EmuHawk
// Allow selection of palette file from archive // Allow selection of palette file from archive
// Hotkeys for BG & Sprite display toggle // Hotkeys for BG & Sprite display toggle
// NTSC filter settings? Hue, Tint (This should probably be a client thing, not a nes specific thing?) // NTSC filter settings? Hue, Tint (This should probably be a client thing, not a nes specific thing?)
private readonly IMainFormForConfig _mainForm;
private readonly Config _config; private readonly Config _config;
private readonly ISettingsAdapter _settable;
private NES.NESSettings _settings; private NES.NESSettings _settings;
//private Bitmap _bmp; //private Bitmap _bmp;
@ -25,12 +27,11 @@ namespace BizHawk.Client.EmuHawk
public NESGraphicsConfig( public NESGraphicsConfig(
Config config, Config config,
IDialogController dialogController, IDialogController dialogController,
IMainFormForConfig mainForm, ISettingsAdapter settable)
NES.NESSettings settings)
{ {
_mainForm = mainForm;
_config = config; _config = config;
_settings = settings; _settable = settable;
_settings = (NES.NESSettings) _settable.GetSettings();
DialogController = dialogController; DialogController = dialogController;
InitializeComponent(); InitializeComponent();
} }
@ -153,7 +154,7 @@ namespace BizHawk.Client.EmuHawk
_settings.BackgroundColor &= 0x00FFFFFF; _settings.BackgroundColor &= 0x00FFFFFF;
} }
_mainForm.GetSettingsAdapterForLoadedCore<NES>().PutCoreSettings(_settings); _settable.PutCoreSettings(_settings);
Close(); Close();
} }

View File

@ -5,26 +5,28 @@ using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.NES; using BizHawk.Emulation.Cores.Nintendo.NES;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class NESSyncSettingsForm : Form, IDialogParent public partial class NESSyncSettingsForm : Form, IDialogParent
{ {
private readonly IMainFormForConfig _mainForm;
private readonly DataTableDictionaryBind<string, string> _dataTableDictionary; private readonly DataTableDictionaryBind<string, string> _dataTableDictionary;
private readonly ISettingsAdapter _settable;
private readonly NES.NESSyncSettings _syncSettings; private readonly NES.NESSyncSettings _syncSettings;
public IDialogController DialogController { get; } public IDialogController DialogController { get; }
public NESSyncSettingsForm( public NESSyncSettingsForm(
IDialogController dialogController, IDialogController dialogController,
IMainFormForConfig mainForm, ISettingsAdapter settable,
NES.NESSyncSettings syncSettings,
bool hasMapperProperties) bool hasMapperProperties)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (NES.NESSyncSettings) _settable.GetSyncSettings();
DialogController = dialogController; DialogController = dialogController;
InitializeComponent(); InitializeComponent();
HelpBtn.Image = Properties.Resources.Help; HelpBtn.Image = Properties.Resources.Help;
@ -93,7 +95,7 @@ namespace BizHawk.Client.EmuHawk
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
if (changed) if (changed)
{ {
_mainForm.GetSettingsAdapterForLoadedCore<NES>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
} }
} }

View File

@ -1,21 +1,21 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.NES; using BizHawk.Emulation.Cores.Nintendo.NES;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class NesVsSettings : Form public partial class NesVsSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly NES.NESSyncSettings _settings;
public NesVsSettings( private readonly NES.NESSyncSettings _settings;
IMainFormForConfig mainForm,
NES.NESSyncSettings syncSettings) public NesVsSettings(ISettingsAdapter settable)
{ {
_mainForm = mainForm; _settable = settable;
_settings = syncSettings; _settings = (NES.NESSyncSettings) _settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
} }
@ -42,7 +42,7 @@ namespace BizHawk.Client.EmuHawk
_settings.VSDipswitches.Dip_Switch_7 = Dipswitch7CheckBox.Checked; _settings.VSDipswitches.Dip_Switch_7 = Dipswitch7CheckBox.Checked;
_settings.VSDipswitches.Dip_Switch_8 = Dipswitch8CheckBox.Checked; _settings.VSDipswitches.Dip_Switch_8 = Dipswitch8CheckBox.Checked;
_mainForm.GetSettingsAdapterForLoadedCore<NES>().PutCoreSyncSettings(_settings); _settable.PutCoreSyncSettings(_settings);
Close(); Close();
} }

View File

@ -1,21 +1,22 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.NES; using BizHawk.Emulation.Cores.Nintendo.NES;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class NesControllerSettings : Form public partial class NesControllerSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly NES.NESSyncSettings _syncSettings; private readonly NES.NESSyncSettings _syncSettings;
public NesControllerSettings( public NesControllerSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
NES.NESSyncSettings syncSettings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (NES.NESSyncSettings) _settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
@ -53,7 +54,7 @@ namespace BizHawk.Client.EmuHawk
if (changed) if (changed)
{ {
_mainForm.GetSettingsAdapterForLoadedCore<NES>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

@ -11,18 +11,17 @@ namespace BizHawk.Client.EmuHawk
{ {
public partial class QuickNesConfig : Form public partial class QuickNesConfig : Form
{ {
private readonly IMainFormForConfig _mainForm;
private readonly Config _config; private readonly Config _config;
private readonly ISettingsAdapter _settable;
private readonly QuickNES.QuickNESSettings _settings; private readonly QuickNES.QuickNESSettings _settings;
public QuickNesConfig( public QuickNesConfig(Config config, ISettingsAdapter settable)
IMainFormForConfig mainForm,
Config config,
QuickNES.QuickNESSettings settings)
{ {
_mainForm = mainForm;
_config = config; _config = config;
_settings = settings; _settable = settable;
_settings = (QuickNES.QuickNESSettings) _settable.GetSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.QuickNesIcon; Icon = Properties.Resources.QuickNesIcon;
} }
@ -106,7 +105,7 @@ namespace BizHawk.Client.EmuHawk
private void ButtonOk_Click(object sender, EventArgs e) private void ButtonOk_Click(object sender, EventArgs e)
{ {
_mainForm.GetSettingsAdapterForLoadedCore<QuickNES>().PutCoreSettings(_settings); _settable.PutCoreSettings(_settings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();
} }

View File

@ -1,21 +1,21 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Sony.PSX; using BizHawk.Emulation.Cores.Sony.PSX;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class PSXControllerConfig : Form public partial class PSXControllerConfig : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly Octoshock.SyncSettings _syncSettings; private readonly Octoshock.SyncSettings _syncSettings;
public PSXControllerConfig( public PSXControllerConfig(ISettingsAdapter settable)
IMainFormForConfig mainForm,
Octoshock.SyncSettings syncSettings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (Octoshock.SyncSettings) _settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -141,7 +141,7 @@ namespace BizHawk.Client.EmuHawk
private void BtnOk_Click(object sender, EventArgs e) private void BtnOk_Click(object sender, EventArgs e)
{ {
_syncSettings.FIOConfig = UserConfigFromGui(); _syncSettings.FIOConfig = UserConfigFromGui();
_mainForm.GetSettingsAdapterForLoadedCore<Octoshock>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();

View File

@ -4,6 +4,7 @@ using System.Windows.Forms;
using BizHawk.Emulation.Cores.Sony.PSX; using BizHawk.Emulation.Cores.Sony.PSX;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
@ -12,20 +13,22 @@ namespace BizHawk.Client.EmuHawk
// backups of the labels for string replacing // backups of the labels for string replacing
private readonly string _lblPixelProText, _lblMednafenText, _lblTweakedMednafenText; private readonly string _lblPixelProText, _lblMednafenText, _lblTweakedMednafenText;
private readonly ISettingsAdapter _settable;
public IDialogController DialogController { get; } public IDialogController DialogController { get; }
private PSXOptions( private PSXOptions(
Config config, Config config,
IDialogController dialogController, IDialogController dialogController,
IMainFormForConfig mainForm, ISettingsAdapter settable,
Octoshock.Settings settings, Octoshock.Settings settings,
Octoshock.SyncSettings syncSettings, Octoshock.SyncSettings syncSettings,
OctoshockDll.eVidStandard vidStandard, OctoshockDll.eVidStandard vidStandard,
Size currentVideoSize) Size currentVideoSize)
{ {
InitializeComponent(); InitializeComponent();
_mainForm = mainForm;
_config = config; _config = config;
_settable = settable;
_settings = settings; _settings = settings;
_syncSettings = syncSettings; _syncSettings = syncSettings;
_previewVideoStandard = vidStandard; _previewVideoStandard = vidStandard;
@ -67,7 +70,6 @@ namespace BizHawk.Client.EmuHawk
} }
private Size _previewVideoSize; private Size _previewVideoSize;
private readonly IMainFormForConfig _mainForm;
private readonly Config _config; private readonly Config _config;
private readonly OctoshockDll.eVidStandard _previewVideoStandard; private readonly OctoshockDll.eVidStandard _previewVideoStandard;
private readonly Octoshock.Settings _settings; private readonly Octoshock.Settings _settings;
@ -80,17 +82,18 @@ namespace BizHawk.Client.EmuHawk
DialogController.ShowMessageBox("Finetuned Display Options will take effect if you OK from PSX Options"); DialogController.ShowMessageBox("Finetuned Display Options will take effect if you OK from PSX Options");
} }
/// <remarks>TODO only use <paramref name="settable"/></remarks>
public static DialogResult DoSettingsDialog( public static DialogResult DoSettingsDialog(
Config config, Config config,
IDialogParent dialogParent, IDialogParent dialogParent,
IMainFormForConfig mainForm, ISettingsAdapter settable,
Octoshock psx) Octoshock psx)
{ {
var s = psx.GetSettings(); var s = psx.GetSettings();
var ss = psx.GetSyncSettings(); var ss = psx.GetSyncSettings();
var vid = psx.SystemVidStandard; var vid = psx.SystemVidStandard;
var size = psx.CurrentVideoSize; var size = psx.CurrentVideoSize;
using var dlg = new PSXOptions(config, dialogParent.DialogController, mainForm, s, ss, vid, size); using var dlg = new PSXOptions(config, dialogParent.DialogController, settable, s, ss, vid, size);
return dialogParent.ShowDialogAsChild(dlg); return dialogParent.ShowDialogAsChild(dlg);
} }
@ -131,9 +134,8 @@ namespace BizHawk.Client.EmuHawk
SyncSettingsFromGui(_settings, _syncSettings); SyncSettingsFromGui(_settings, _syncSettings);
_settings.Validate(); _settings.Validate();
var settable = _mainForm.GetSettingsAdapterForLoadedCore<Octoshock>(); _settable.PutCoreSettings(_settings);
settable.PutCoreSettings(_settings); _settable.PutCoreSyncSettings(_syncSettings);
settable.PutCoreSyncSettings(_syncSettings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();

View File

@ -15,11 +15,11 @@ namespace BizHawk.Client.EmuHawk
{ {
public partial class ProfileConfig : Form public partial class ProfileConfig : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly MainForm _mainForm;
private readonly Config _config; private readonly Config _config;
public ProfileConfig(Config config, IMainFormForConfig mainForm) public ProfileConfig(Config config, MainForm mainForm)
{ {
_mainForm = mainForm; _mainForm = mainForm;
_config = config; _config = config;

View File

@ -1,21 +1,21 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.BSNES; using BizHawk.Emulation.Cores.Nintendo.BSNES;
using BizHawk.Emulation.Cores.Nintendo.SNES;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class BSNESControllerSettings : Form public partial class BSNESControllerSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly BsnesCore.SnesSyncSettings _syncSettings; private readonly BsnesCore.SnesSyncSettings _syncSettings;
public BSNESControllerSettings( public BSNESControllerSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
BsnesCore.SnesSyncSettings syncSettings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (BsnesCore.SnesSyncSettings) _settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -41,7 +41,7 @@ namespace BizHawk.Client.EmuHawk
_syncSettings.RightPort = (BsnesApi.BSNES_INPUT_DEVICE) Port2ComboBox.SelectedIndex; _syncSettings.RightPort = (BsnesApi.BSNES_INPUT_DEVICE) Port2ComboBox.SelectedIndex;
_syncSettings.LimitAnalogChangeSensitivity = LimitAnalogChangeCheckBox.Checked; _syncSettings.LimitAnalogChangeSensitivity = LimitAnalogChangeCheckBox.Checked;
_mainForm.GetSettingsAdapterForLoadedCore<BsnesCore>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

@ -2,6 +2,7 @@
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.BSNES; using BizHawk.Emulation.Cores.Nintendo.BSNES;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
@ -13,7 +14,8 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent(); InitializeComponent();
} }
public static DialogResult DoSettingsDialog(IDialogParent dialogParent, IMainFormForConfig mainForm, BsnesCore bsnes) /// <remarks>TODO only use <paramref name="settable"/></remarks>
public static DialogResult DoSettingsDialog(IDialogParent dialogParent, ISettingsAdapter settable, BsnesCore bsnes)
{ {
var s = bsnes.GetSettings(); var s = bsnes.GetSettings();
var ss = bsnes.GetSyncSettings(); var ss = bsnes.GetSyncSettings();
@ -67,7 +69,6 @@ namespace BizHawk.Client.EmuHawk
s.ShowBG4_0 = dlg.ShowBg4_0; s.ShowBG4_0 = dlg.ShowBg4_0;
s.ShowBG4_1 = dlg.ShowBg4_1; s.ShowBG4_1 = dlg.ShowBg4_1;
var settable = mainForm.GetSettingsAdapterForLoadedCore<BsnesCore>();
settable.PutCoreSettings(s); settable.PutCoreSettings(s);
settable.PutCoreSyncSettings(ss); settable.PutCoreSyncSettings(ss);
} }

View File

@ -1,22 +1,22 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.SNES; using BizHawk.Emulation.Cores.Nintendo.SNES;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class SNESControllerSettings : Form public partial class SNESControllerSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly LibsnesCore.SnesSyncSettings _syncSettings; private readonly LibsnesCore.SnesSyncSettings _syncSettings;
private bool _suppressDropdownChangeEvents; private bool _suppressDropdownChangeEvents;
public SNESControllerSettings( public SNESControllerSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
LibsnesCore.SnesSyncSettings syncSettings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (LibsnesCore.SnesSyncSettings) _settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -44,7 +44,7 @@ namespace BizHawk.Client.EmuHawk
_syncSettings.RightPort = (LibsnesControllerDeck.ControllerType)Enum.Parse(typeof(LibsnesControllerDeck.ControllerType), Port2ComboBox.SelectedItem.ToString()); _syncSettings.RightPort = (LibsnesControllerDeck.ControllerType)Enum.Parse(typeof(LibsnesControllerDeck.ControllerType), Port2ComboBox.SelectedItem.ToString());
_syncSettings.LimitAnalogChangeSensitivity = LimitAnalogChangeCheckBox.Checked; _syncSettings.LimitAnalogChangeSensitivity = LimitAnalogChangeCheckBox.Checked;
_mainForm.GetSettingsAdapterForLoadedCore<LibsnesCore>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

@ -2,6 +2,7 @@
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.SNES; using BizHawk.Emulation.Cores.Nintendo.SNES;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
@ -16,7 +17,8 @@ namespace BizHawk.Client.EmuHawk
private bool _suppressDoubleSize; private bool _suppressDoubleSize;
private bool _userDoubleSizeOption; private bool _userDoubleSizeOption;
public static DialogResult DoSettingsDialog(IDialogParent dialogParent, IMainFormForConfig mainForm, LibsnesCore bsnes) /// <remarks>TODO only use <paramref name="settable"/></remarks>
public static DialogResult DoSettingsDialog(IDialogParent dialogParent, ISettingsAdapter settable, LibsnesCore bsnes)
{ {
var s = bsnes.GetSettings(); var s = bsnes.GetSettings();
var ss = bsnes.GetSyncSettings(); var ss = bsnes.GetSyncSettings();
@ -50,7 +52,6 @@ namespace BizHawk.Client.EmuHawk
s.ShowBG3_0 = s.ShowBG3_1 = dlg.ShowBg3; s.ShowBG3_0 = s.ShowBG3_1 = dlg.ShowBg3;
s.ShowBG4_0 = s.ShowBG4_1 = dlg.ShowBg4; s.ShowBG4_0 = s.ShowBG4_1 = dlg.ShowBg4;
var settable = mainForm.GetSettingsAdapterForLoadedCore<LibsnesCore>();
settable.PutCoreSettings(s); settable.PutCoreSettings(s);
settable.PutCoreSyncSettings(ss); settable.PutCoreSyncSettings(ss);
} }

View File

@ -1,21 +1,22 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Calculators.TI83; using BizHawk.Emulation.Cores.Calculators.TI83;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class TI83PaletteConfig : Form public partial class TI83PaletteConfig : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly TI83Common.TI83CommonSettings _settings; private readonly TI83Common.TI83CommonSettings _settings;
public TI83PaletteConfig( public TI83PaletteConfig(ISettingsAdapter settable)
IMainFormForConfig mainForm,
TI83Common.TI83CommonSettings settings)
{ {
_mainForm = mainForm; _settable = settable;
_settings = settings; _settings = (TI83Common.TI83CommonSettings) _settable.GetSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.CalculateIcon; Icon = Properties.Resources.CalculateIcon;
} }
@ -32,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
_settings.BGColor = (uint)BackgroundPanel.BackColor.ToArgb(); _settings.BGColor = (uint)BackgroundPanel.BackColor.ToArgb();
_settings.ForeColor = (uint)ForeGroundPanel.BackColor.ToArgb(); _settings.ForeColor = (uint)ForeGroundPanel.BackColor.ToArgb();
_mainForm.GetSettingsAdapterForLoadedCore<TI83>().PutCoreSettings(_settings); _settable.PutCoreSettings(_settings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();

View File

@ -1,20 +1,21 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum; using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class ZxSpectrumAudioSettings : Form public partial class ZxSpectrumAudioSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly ZXSpectrum.ZXSpectrumSettings _settings; private readonly ZXSpectrum.ZXSpectrumSettings _settings;
public ZxSpectrumAudioSettings( public ZxSpectrumAudioSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
ZXSpectrum.ZXSpectrumSettings settings)
{ {
_mainForm = mainForm; _settable = settable;
_settings = settings; _settings = (ZXSpectrum.ZXSpectrumSettings) _settable.GetSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -55,7 +56,7 @@ namespace BizHawk.Client.EmuHawk
_settings.EarVolume = earVolumetrackBar.Value; _settings.EarVolume = earVolumetrackBar.Value;
_settings.AYVolume = ayVolumetrackBar.Value; _settings.AYVolume = ayVolumetrackBar.Value;
_mainForm.GetSettingsAdapterForLoadedCore<ZXSpectrum>().PutCoreSettings(_settings); _settable.PutCoreSettings(_settings);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();

View File

@ -1,20 +1,21 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum; using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class ZxSpectrumCoreEmulationSettings : Form public partial class ZxSpectrumCoreEmulationSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly ZXSpectrum.ZXSpectrumSyncSettings _syncSettings; private readonly ZXSpectrum.ZXSpectrumSyncSettings _syncSettings;
public ZxSpectrumCoreEmulationSettings( public ZxSpectrumCoreEmulationSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
ZXSpectrum.ZXSpectrumSyncSettings syncSettings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (ZXSpectrum.ZXSpectrumSyncSettings) _settable.GetSyncSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -61,7 +62,7 @@ namespace BizHawk.Client.EmuHawk
_syncSettings.DeterministicEmulation = determEmucheckBox1.Checked; _syncSettings.DeterministicEmulation = determEmucheckBox1.Checked;
_syncSettings.AutoLoadTape = autoLoadcheckBox1.Checked; _syncSettings.AutoLoadTape = autoLoadcheckBox1.Checked;
_mainForm.GetSettingsAdapterForLoadedCore<ZXSpectrum>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();

View File

@ -3,25 +3,24 @@ using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum; using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class ZxSpectrumJoystickSettings : Form, IDialogParent public partial class ZxSpectrumJoystickSettings : Form, IDialogParent
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly ZXSpectrum.ZXSpectrumSyncSettings _syncSettings; private readonly ZXSpectrum.ZXSpectrumSyncSettings _syncSettings;
private string[] _possibleControllers; private string[] _possibleControllers;
public IDialogController DialogController { get; } public IDialogController DialogController { get; }
public ZxSpectrumJoystickSettings( public ZxSpectrumJoystickSettings(IDialogController dialogController, ISettingsAdapter settable)
IDialogController dialogController,
IMainFormForConfig mainForm,
ZXSpectrum.ZXSpectrumSyncSettings syncSettings)
{ {
_mainForm = mainForm; _settable = settable;
_syncSettings = syncSettings; _syncSettings = (ZXSpectrum.ZXSpectrumSyncSettings) _settable.GetSyncSettings();
DialogController = dialogController; DialogController = dialogController;
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
@ -107,7 +106,7 @@ namespace BizHawk.Client.EmuHawk
_syncSettings.JoystickType2 = (JoystickType)Enum.Parse(typeof(JoystickType), Port2ComboBox.SelectedItem.ToString()); _syncSettings.JoystickType2 = (JoystickType)Enum.Parse(typeof(JoystickType), Port2ComboBox.SelectedItem.ToString());
_syncSettings.JoystickType3 = (JoystickType)Enum.Parse(typeof(JoystickType), Port3ComboBox.SelectedItem.ToString()); _syncSettings.JoystickType3 = (JoystickType)Enum.Parse(typeof(JoystickType), Port3ComboBox.SelectedItem.ToString());
_mainForm.GetSettingsAdapterForLoadedCore<ZXSpectrum>().PutCoreSyncSettings(_syncSettings); _settable.PutCoreSyncSettings(_syncSettings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();

View File

@ -1,21 +1,22 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum; using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class ZxSpectrumNonSyncSettings : Form public partial class ZxSpectrumNonSyncSettings : Form
{ {
private readonly IMainFormForConfig _mainForm; private readonly ISettingsAdapter _settable;
private readonly ZXSpectrum.ZXSpectrumSettings _settings; private readonly ZXSpectrum.ZXSpectrumSettings _settings;
private int _bgColor; private int _bgColor;
public ZxSpectrumNonSyncSettings( public ZxSpectrumNonSyncSettings(ISettingsAdapter settable)
IMainFormForConfig mainForm,
ZXSpectrum.ZXSpectrumSettings settings)
{ {
_mainForm = mainForm; _settable = settable;
_settings = settings; _settings = (ZXSpectrum.ZXSpectrumSettings) _settable.GetSettings();
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
} }
@ -58,7 +59,7 @@ namespace BizHawk.Client.EmuHawk
_settings.BackgroundColor = _bgColor; _settings.BackgroundColor = _bgColor;
_settings.UseCoreBorderForBackground = checkBoxShowCoreBrdColor.Checked; _settings.UseCoreBorderForBackground = checkBoxShowCoreBrdColor.Checked;
_mainForm.GetSettingsAdapterForLoadedCore<ZXSpectrum>().PutCoreSettings(_settings); _settable.PutCoreSettings(_settings);
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();