From c1524d8de90ea2df613175cd2019e1bc3e98bf22 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Fri, 27 May 2022 00:45:32 +1000 Subject: [PATCH] Don't expose `MainForm.Emulator` via `IMainFormForConfig` --- src/BizHawk.Client.EmuHawk/IMainFormForConfig.cs | 3 --- src/BizHawk.Client.EmuHawk/MainForm.Events.cs | 2 +- src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs | 6 +++--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/IMainFormForConfig.cs b/src/BizHawk.Client.EmuHawk/IMainFormForConfig.cs index 137bc6d63b..6f1fb32bc6 100644 --- a/src/BizHawk.Client.EmuHawk/IMainFormForConfig.cs +++ b/src/BizHawk.Client.EmuHawk/IMainFormForConfig.cs @@ -7,9 +7,6 @@ namespace BizHawk.Client.EmuHawk { public interface IMainFormForConfig : IDialogParent { - /// only referenced from - IEmulator Emulator { get; } - /// loaded emulator is not instance of SettingsAdapter GetSettingsAdapterForLoadedCore() where T : IEmulator; diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 7ba6562d69..44b88b3c9e 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -1844,7 +1844,7 @@ namespace BizHawk.Client.EmuHawk } private DialogResult OpenGenericCoreConfig(string title) - => GenericCoreConfig.DoDialog(this, title, isMovieActive: MovieSession.Movie.IsActive()); + => GenericCoreConfig.DoDialog(Emulator, this, title, isMovieActive: MovieSession.Movie.IsActive()); private void GenericCoreSettingsMenuItem_Click(object sender, EventArgs e) { diff --git a/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs b/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs index 12fe5cc3fa..716458512a 100644 --- a/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs @@ -73,9 +73,9 @@ namespace BizHawk.Client.EmuHawk Close(); } - public static DialogResult DoDialog(IMainFormForConfig owner, string title, bool isMovieActive) + public static DialogResult DoDialog(IEmulator emulator, IMainFormForConfig owner, string title, bool isMovieActive) { - if (owner.Emulator is Emulation.Cores.Waterbox.NymaCore core) + if (emulator is Emulation.Cores.Waterbox.NymaCore core) { var desc = new Emulation.Cores.Waterbox.NymaTypeDescriptorProvider(core.SettingsInfo); try @@ -91,7 +91,7 @@ namespace BizHawk.Client.EmuHawk TypeDescriptor.RemoveProvider(desc, typeof(Emulation.Cores.Waterbox.NymaCore.NymaSyncSettings)); } } - else if(owner.Emulator is Emulation.Cores.Arcades.MAME.MAME mame) + else if (emulator is Emulation.Cores.Arcades.MAME.MAME mame) { var desc = new Emulation.Cores.Arcades.MAME.MAMETypeDescriptorProvider(mame.CurrentDriverSettings); try