diff --git a/src/BizHawk.Client.EmuHawk/AVOut/VideoWriterChooserForm.cs b/src/BizHawk.Client.EmuHawk/AVOut/VideoWriterChooserForm.cs index 23e55ccad8..41979a2377 100644 --- a/src/BizHawk.Client.EmuHawk/AVOut/VideoWriterChooserForm.cs +++ b/src/BizHawk.Client.EmuHawk/AVOut/VideoWriterChooserForm.cs @@ -15,7 +15,7 @@ namespace BizHawk.Client.EmuHawk private readonly int _captureWidth = 640; private readonly int _captureHeight = 480; - private VideoWriterChooserForm(MainForm mainForm, IEmulator emulator, Config config) + private VideoWriterChooserForm(IMainFormForTools mainForm, IEmulator emulator, Config config) { InitializeComponent(); @@ -55,7 +55,7 @@ namespace BizHawk.Client.EmuHawk /// user choice, or null on Cancel\Close\invalid public static IVideoWriter DoVideoWriterChooserDlg( IEnumerable list, - MainForm owner, + IMainFormForTools owner, IEmulator emulator, Config config, out int resizeW, diff --git a/src/BizHawk.Client.EmuHawk/Api/ApiManager.cs b/src/BizHawk.Client.EmuHawk/Api/ApiManager.cs index c9a2b41b6d..3a1806216d 100644 --- a/src/BizHawk.Client.EmuHawk/Api/ApiManager.cs +++ b/src/BizHawk.Client.EmuHawk/Api/ApiManager.cs @@ -12,11 +12,11 @@ namespace BizHawk.Client.EmuHawk { public static class ApiManager { - private static readonly Type[] CtorParamTypesA = { typeof(Action), typeof(DisplayManager), typeof(InputManager), typeof(MainForm) }; + private static readonly Type[] CtorParamTypesA = { typeof(Action), typeof(DisplayManager), typeof(InputManager), typeof(IMainFormForApi) }; private static readonly Type[] CtorParamTypesB = { typeof(Action) }; - private static readonly Type[] CtorParamTypesEmuClientApi = { typeof(Action), typeof(DisplayManager), typeof(InputManager), typeof(MainForm), typeof(Config), typeof(IEmulator), typeof(GameInfo) }; + private static readonly Type[] CtorParamTypesEmuClientApi = { typeof(Action), typeof(DisplayManager), typeof(InputManager), typeof(IMainFormForApi), typeof(Config), typeof(IEmulator), typeof(GameInfo) }; /// TODO do we need to keep references to these because of GC weirdness? --yoshi private static ApiContainer? _container; @@ -24,7 +24,7 @@ namespace BizHawk.Client.EmuHawk private static ApiContainer? _luaContainer; private static ApiContainer Register( - MainForm mainForm, + IMainFormForApi mainForm, IEmulatorServiceProvider serviceProvider, Action logCallback) { @@ -57,7 +57,7 @@ namespace BizHawk.Client.EmuHawk return new ApiContainer(libDict); } - public static IExternalApiProvider Restart(MainForm mainForm, IEmulatorServiceProvider newServiceProvider) + public static IExternalApiProvider Restart(IMainFormForApi mainForm, IEmulatorServiceProvider newServiceProvider) { GlobalWin.ClientApi = null; _container = Register(mainForm, newServiceProvider, Console.WriteLine); @@ -65,7 +65,7 @@ namespace BizHawk.Client.EmuHawk return new BasicApiProvider(_container); } - public static ApiContainer RestartLua(MainForm mainForm, IEmulatorServiceProvider newServiceProvider, Action logCallback) + public static ApiContainer RestartLua(IMainFormForApi mainForm, IEmulatorServiceProvider newServiceProvider, Action logCallback) => _luaContainer = Register(mainForm, newServiceProvider, logCallback); } } diff --git a/src/BizHawk.Client.EmuHawk/Api/Libraries/EmuClientApi.cs b/src/BizHawk.Client.EmuHawk/Api/Libraries/EmuClientApi.cs index d5859c5073..3310d72765 100644 --- a/src/BizHawk.Client.EmuHawk/Api/Libraries/EmuClientApi.cs +++ b/src/BizHawk.Client.EmuHawk/Api/Libraries/EmuClientApi.cs @@ -25,7 +25,7 @@ namespace BizHawk.Client.EmuHawk private readonly InputManager _inputManager; - private readonly MainForm _mainForm; + private readonly IMainFormForApi _mainForm; private readonly Action _logCallback; @@ -85,7 +85,7 @@ namespace BizHawk.Client.EmuHawk public event StateSavedEventHandler StateSaved; - public EmuClientApi(Action logCallback, DisplayManager displayManager, InputManager inputManager, MainForm mainForm, Config config, IEmulator emulator, GameInfo game) + public EmuClientApi(Action logCallback, DisplayManager displayManager, InputManager inputManager, IMainFormForApi mainForm, Config config, IEmulator emulator, GameInfo game) { _config = config; _displayManager = displayManager; diff --git a/src/BizHawk.Client.EmuHawk/Api/Libraries/InputApi.cs b/src/BizHawk.Client.EmuHawk/Api/Libraries/InputApi.cs index bd3f5f5a51..9a48b84bfb 100644 --- a/src/BizHawk.Client.EmuHawk/Api/Libraries/InputApi.cs +++ b/src/BizHawk.Client.EmuHawk/Api/Libraries/InputApi.cs @@ -13,9 +13,9 @@ namespace BizHawk.Client.EmuHawk private readonly InputManager _inputManager; - private readonly MainForm _mainForm; + private readonly IMainFormForApi _mainForm; - public InputApi(Action logCallback, DisplayManager displayManager, InputManager inputManager, MainForm mainForm) + public InputApi(Action logCallback, DisplayManager displayManager, InputManager inputManager, IMainFormForApi mainForm) { _displayManager = displayManager; _inputManager = inputManager; diff --git a/src/BizHawk.Client.EmuHawk/Api/Libraries/SaveStateApi.cs b/src/BizHawk.Client.EmuHawk/Api/Libraries/SaveStateApi.cs index 448c2ef774..6e2665f528 100644 --- a/src/BizHawk.Client.EmuHawk/Api/Libraries/SaveStateApi.cs +++ b/src/BizHawk.Client.EmuHawk/Api/Libraries/SaveStateApi.cs @@ -8,11 +8,11 @@ namespace BizHawk.Client.EmuHawk { public sealed class SaveStateApi : ISaveStateApi { - private readonly MainForm _mainForm; + private readonly IMainFormForApi _mainForm; private readonly Action LogCallback; - public SaveStateApi(Action logCallback, DisplayManager displayManager, InputManager inputManager, MainForm mainForm) + public SaveStateApi(Action logCallback, DisplayManager displayManager, InputManager inputManager, IMainFormForApi mainForm) { LogCallback = logCallback; _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/IEmuHawkMainFormToApi.cs b/src/BizHawk.Client.EmuHawk/IEmuHawkMainFormToApi.cs new file mode 100644 index 0000000000..ad3033c83d --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/IEmuHawkMainFormToApi.cs @@ -0,0 +1,110 @@ +using System.Drawing; + +using BizHawk.Client.Common; +using BizHawk.Emulation.Common; + +namespace BizHawk.Client.EmuHawk +{ + public interface IMainFormForApi + { + /// only referenced from + CheatCollection CheatList { get; } + + /// only referenced from + Point DesktopLocation { get; } + + /// only referenced from + IEmulator Emulator { get; } + + bool EmulatorPaused { get; } + + /// only referenced from + bool InvisibleEmulation { set; } + + /// only referenced from + bool IsSeeking { get; } + + /// only referenced from + bool IsTurboing { get; } + + /// only referenced from + long MouseWheelTracker { get; } + + /// only referenced from + bool PauseAvi { set; } + + /// only referenced from + PresentationPanel PresentationPanel { get; } + + void AddOnScreenMessage(string message); + + /// only referenced from + void ClearHolds(); + + /// only referenced from + void ClickSpeedItem(int num); + + /// only referenced from + void CloseEmulator(int? exitCode = null); + + /// only referenced from + void CloseRom(bool clearSram = false); + + /// only referenced from + void EnableRewind(bool enabled); + + /// only referenced from + bool FlushSaveRAM(bool autosave = false); + + /// only referenced from + void FrameAdvance(); + + void FrameBufferResized(); + + void FrameSkipMessage(); + + /// only referenced from + void LoadQuickSave(string quickSlotName, bool suppressOSD = false); + + /// only referenced from + bool LoadRom(string path, LoadRomArgs args); + + void LoadState(string combine, string name, bool suppressOSD = false); + + /// only referenced from + void PauseEmulator(); + + /// only referenced from + void RebootCore(); + + /// only referenced from + void Render(); + + /// only referenced from + void SaveQuickSave(string quickSlotName, bool fromLua = false, bool suppressOSD = false); + + void SaveState(string path, string userFriendlyStateName, bool fromLua = false, bool suppressOSD = false); + + void SeekFrameAdvance(); + + /// only referenced from + void StepRunLoop_Throttle(); + + /// only referenced from + void TakeScreenshot(); + + /// only referenced from + void TakeScreenshot(string path); + + /// only referenced from + void TakeScreenshotToClipboard(); + + /// only referenced from + void TogglePause(); + + /// only referenced from + void ToggleSound(); + + void UnpauseEmulator(); + } +} diff --git a/src/BizHawk.Client.EmuHawk/IEmuHawkMainFormToConfig.cs b/src/BizHawk.Client.EmuHawk/IEmuHawkMainFormToConfig.cs new file mode 100644 index 0000000000..38c8035b9b --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/IEmuHawkMainFormToConfig.cs @@ -0,0 +1,23 @@ +using System.Windows.Forms; + +using BizHawk.Client.Common; +using BizHawk.Emulation.Common; + +namespace BizHawk.Client.EmuHawk +{ + public interface IMainFormForConfig + { + /// only referenced from + IEmulator Emulator { get; } + + IMovieSession MovieSession { get; } + + void AddOnScreenMessage(string message); + + void PutCoreSettings(object o); + + void PutCoreSyncSettings(object o); + + DialogResult ShowDialogAsChild(Form dialog); + } +} diff --git a/src/BizHawk.Client.EmuHawk/IEmuHawkMainFormToTools.cs b/src/BizHawk.Client.EmuHawk/IEmuHawkMainFormToTools.cs new file mode 100644 index 0000000000..23d46b048d --- /dev/null +++ b/src/BizHawk.Client.EmuHawk/IEmuHawkMainFormToTools.cs @@ -0,0 +1,122 @@ +using System; +using System.Windows.Forms; + +using BizHawk.Bizware.BizwareGL; +using BizHawk.Client.Common; + +namespace BizHawk.Client.EmuHawk +{ + public interface IMainFormForTools + { + CheatCollection CheatList { get; } + + string CurrentlyOpenRom { get; } + + /// only referenced from + LoadRomArgs CurrentlyOpenRomArgs { get; } + + /// only referenced from + bool EmulatorPaused { get; } + + /// only referenced from + bool GameIsClosing { get; } + + /// only referenced from + bool HoldFrameAdvance { set; } + + /// only referenced from + bool InvisibleEmulation { get; set; } + + /// only referenced from + bool IsSeeking { get; } + + /// only referenced from + bool IsTurboing { get; } + + /// only referenced from + MouseEventHandler MainForm_MouseClick { get; } + + /// only referenced from + MouseEventHandler MainForm_MouseMove { get; } + + /// only referenced from + MouseEventHandler MainForm_MouseWheel { get; } + + int? PauseOnFrame { get; set; } + + /// only referenced from + bool PressRewind { set; } + + /// only referenced from + event Action OnPauseChanged; + + void AddOnScreenMessage(string message); + + BitmapBuffer CaptureOSD(); + + /// only referenced from + void DisableRewind(); + + /// only referenced from + void EnableRewind(bool enabled); + + /// only referenced from + bool EnsureCoreIsAccurate(); + + /// only referenced from + void FrameAdvance(); + + /// only referenced from + void FrameBufferResized(); + + /// only referenced from + void LoadQuickSave(string quickSlotName, bool suppressOSD = false); + + /// only referenced from + bool LoadRom(string path, LoadRomArgs args); + + /// only referenced from + BitmapBuffer MakeScreenshotImage(); + + void PauseEmulator(); + + /// only referenced from + void RelinquishControl(IControlMainform master); + + /// only referenced from + void SeekFrameAdvance(); + + void SetMainformMovieInfo(); + + /// only referenced from + void SetWindowText(); + + /// only referenced from + DialogResult ShowDialogAsChild(Form dialog); + + bool StartNewMovie(IMovie movie, bool record); + + /// only referenced from + void TakeBackControl(); + + /// only referenced from + void Throttle(); + + /// only referenced from + void ToggleFullscreen(bool allowSuppress = false); + + /// only referenced from + void TogglePause(); + + void UnpauseEmulator(); + + /// only referenced from + void Unthrottle(); + + /// only referenced from + void UpdateDumpIcon(); + + /// only referenced from + void UpdateStatusSlots(); + } +} diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index c9f035e104..194d51dc76 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -38,7 +38,7 @@ using BizHawk.Emulation.Cores.Consoles.Nintendo.Faust; namespace BizHawk.Client.EmuHawk { - public partial class MainForm : Form + public partial class MainForm : Form, IMainFormForApi, IMainFormForConfig, IMainFormForTools { /// AppliesTo[0] is used as the group label, and Config.PreferredCores[AppliesTo[0]] determines the currently selected option private static readonly IReadOnlyCollection<(string[] AppliesTo, string[] CoreNames)> CoreData = new List<(string[], string[])> { @@ -2129,7 +2129,7 @@ namespace BizHawk.Client.EmuHawk AddOnScreenMessage(message); } - internal void Render() + /*internal*/public void Render() { if (Config.DispSpeedupFeatures == 0) { @@ -2760,7 +2760,7 @@ namespace BizHawk.Client.EmuHawk AddOnScreenMessage($"Config file loaded: {iniPath}"); } - internal void StepRunLoop_Throttle() + /*internal*/public void StepRunLoop_Throttle() { SyncThrottle(); _throttle.signal_frameAdvance = _runloopFrameAdvance; diff --git a/src/BizHawk.Client.EmuHawk/PresentationPanel.cs b/src/BizHawk.Client.EmuHawk/PresentationPanel.cs index ff1213a8b3..09b63f711e 100644 --- a/src/BizHawk.Client.EmuHawk/PresentationPanel.cs +++ b/src/BizHawk.Client.EmuHawk/PresentationPanel.cs @@ -11,10 +11,10 @@ namespace BizHawk.Client.EmuHawk /// public class PresentationPanel { - private readonly MainForm _mainForm; + private readonly IMainFormForTools _mainForm; private readonly Config _config; - public PresentationPanel(MainForm mainForm, Config config, IGL gl) + public PresentationPanel(IMainFormForTools mainForm, Config config, IGL gl) { _mainForm = mainForm; _config = config; diff --git a/src/BizHawk.Client.EmuHawk/config/A7800/A7800ControllerSettings.cs b/src/BizHawk.Client.EmuHawk/config/A7800/A7800ControllerSettings.cs index e2de8f72a6..332338cab2 100644 --- a/src/BizHawk.Client.EmuHawk/config/A7800/A7800ControllerSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/A7800/A7800ControllerSettings.cs @@ -7,11 +7,11 @@ namespace BizHawk.Client.EmuHawk { public partial class A7800ControllerSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly A7800Hawk.A7800SyncSettings _syncSettings; public A7800ControllerSettings( - MainForm mainForm, + IMainFormForConfig mainForm, A7800Hawk.A7800SyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/A7800/A7800FilterSettings.cs b/src/BizHawk.Client.EmuHawk/config/A7800/A7800FilterSettings.cs index d92248fd5b..e1a2753139 100644 --- a/src/BizHawk.Client.EmuHawk/config/A7800/A7800FilterSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/A7800/A7800FilterSettings.cs @@ -7,11 +7,11 @@ namespace BizHawk.Client.EmuHawk { public partial class A7800FilterSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly A7800Hawk.A7800SyncSettings _syncSettings; public A7800FilterSettings( - MainForm mainForm, + IMainFormForConfig mainForm, A7800Hawk.A7800SyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCAudioSettings.cs b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCAudioSettings.cs index 24ed37b15f..87eb709fa3 100644 --- a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCAudioSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCAudioSettings.cs @@ -6,11 +6,11 @@ namespace BizHawk.Client.EmuHawk { public partial class AmstradCpcAudioSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly AmstradCPC.AmstradCPCSettings _settings; public AmstradCpcAudioSettings( - MainForm mainForm, + IMainFormForConfig mainForm, AmstradCPC.AmstradCPCSettings settings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCCoreEmulationSettings.cs b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCCoreEmulationSettings.cs index cdf4036e03..72b79ac102 100644 --- a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCCoreEmulationSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCCoreEmulationSettings.cs @@ -6,10 +6,10 @@ namespace BizHawk.Client.EmuHawk { public partial class AmstradCpcCoreEmulationSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly AmstradCPC.AmstradCPCSyncSettings _syncSettings; - public AmstradCpcCoreEmulationSettings(MainForm mainForm, + public AmstradCpcCoreEmulationSettings(IMainFormForConfig mainForm, AmstradCPC.AmstradCPCSyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCNonSyncSettings.cs b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCNonSyncSettings.cs index fa95583b49..35050f858f 100644 --- a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCNonSyncSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCNonSyncSettings.cs @@ -6,11 +6,11 @@ namespace BizHawk.Client.EmuHawk { public partial class AmstradCpcNonSyncSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly AmstradCPC.AmstradCPCSettings _settings; public AmstradCpcNonSyncSettings( - MainForm mainForm, + IMainFormForConfig mainForm, AmstradCPC.AmstradCPCSettings settings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCPokeMemory.cs b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCPokeMemory.cs index a03711d0cb..4e0f609ca9 100644 --- a/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCPokeMemory.cs +++ b/src/BizHawk.Client.EmuHawk/config/AmstradCPC/AmstradCPCPokeMemory.cs @@ -7,10 +7,10 @@ namespace BizHawk.Client.EmuHawk { public partial class AmstradCpcPokeMemory : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly AmstradCPC _cpc; - public AmstradCpcPokeMemory(MainForm mainForm, AmstradCPC cpc) + public AmstradCpcPokeMemory(IMainFormForConfig mainForm, AmstradCPC cpc) { _mainForm = mainForm; _cpc = cpc; diff --git a/src/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs b/src/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs index cab55d5189..ddf84da6b6 100644 --- a/src/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/ColecoVision/ColecoControllerSettings.cs @@ -7,11 +7,11 @@ namespace BizHawk.Client.EmuHawk { public partial class ColecoControllerSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly ColecoVision.ColecoSyncSettings _syncSettings; public ColecoControllerSettings( - MainForm mainForm, + IMainFormForConfig mainForm, ColecoVision.ColecoSyncSettings settings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs b/src/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs index e2594d37b5..0ed070f0b8 100644 --- a/src/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs @@ -28,7 +28,7 @@ namespace BizHawk.Client.EmuHawk { public partial class FirmwaresConfig : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly Config _config; // friendlier names than the system Ids @@ -94,7 +94,7 @@ namespace BizHawk.Client.EmuHawk private string _currSelectorDir; private readonly ListViewSorter _listViewSorter; - public FirmwaresConfig(MainForm mainForm, Config config, bool retryLoadRom = false, string reloadRomPath = null) + public FirmwaresConfig(IMainFormForConfig mainForm, Config config, bool retryLoadRom = false, string reloadRomPath = null) { _mainForm = mainForm; _config = config; diff --git a/src/BizHawk.Client.EmuHawk/config/GB/DGBPrefs.cs b/src/BizHawk.Client.EmuHawk/config/GB/DGBPrefs.cs index dbd530e344..422f16331c 100644 --- a/src/BizHawk.Client.EmuHawk/config/GB/DGBPrefs.cs +++ b/src/BizHawk.Client.EmuHawk/config/GB/DGBPrefs.cs @@ -29,7 +29,7 @@ namespace BizHawk.Client.EmuHawk private bool SyncSettingsChanged => gbPrefControl1.SyncSettingsChanged || gbPrefControl2.SyncSettingsChanged; - public static void DoDGBPrefsDialog(MainForm mainForm, GambatteLink gambatte) + public static void DoDGBPrefsDialog(IMainFormForConfig mainForm, GambatteLink gambatte) { var s = gambatte.GetSettings(); var ss = gambatte.GetSyncSettings(); diff --git a/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.cs b/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.cs index c20ac682da..6f2a500565 100644 --- a/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.cs +++ b/src/BizHawk.Client.EmuHawk/config/GB/GBPrefs.cs @@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk Icon = Properties.Resources.gambatte_MultiSize; } - public static void DoGBPrefsDialog(MainForm mainForm, Gameboy gb) + public static void DoGBPrefsDialog(IMainFormForConfig mainForm, Gameboy gb) { var s = gb.GetSettings(); var ss = gb.GetSyncSettings(); diff --git a/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs b/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs index 4789eaecdf..b1ca482fd8 100644 --- a/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/GenericCoreConfig.cs @@ -9,13 +9,13 @@ namespace BizHawk.Client.EmuHawk { public partial class GenericCoreConfig : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private object _s; private object _ss; private bool _syncSettingsChanged; private bool _settingsChanged; - private GenericCoreConfig(MainForm mainForm, bool ignoreSettings = false, bool ignoreSyncSettings = false) + private GenericCoreConfig(IMainFormForConfig mainForm, bool ignoreSettings = false, bool ignoreSyncSettings = false) { InitializeComponent(); _mainForm = mainForm; @@ -106,7 +106,7 @@ namespace BizHawk.Client.EmuHawk Close(); } - public static void DoDialog(MainForm owner, string title) + public static void DoDialog(IMainFormForConfig owner, string title) { if (owner.Emulator is Emulation.Cores.Waterbox.NymaCore core) { @@ -131,7 +131,7 @@ namespace BizHawk.Client.EmuHawk } } - public static void DoDialog(MainForm owner, string title, bool hideSettings, bool hideSyncSettings) + public static void DoDialog(IMainFormForConfig owner, string title, bool hideSettings, bool hideSyncSettings) { using var dlg = new GenericCoreConfig(owner, hideSettings, hideSyncSettings) { Text = title }; owner.ShowDialogAsChild(dlg); diff --git a/src/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs b/src/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs index 65d35c97b1..ab39f897c5 100644 --- a/src/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/INTV/IntvControllerSettings.cs @@ -7,11 +7,11 @@ namespace BizHawk.Client.EmuHawk { public partial class IntvControllerSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly Intellivision.IntvSyncSettings _syncSettings; public IntvControllerSettings( - MainForm mainForm, + IMainFormForConfig mainForm, Intellivision.IntvSyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/N64/N64ControllersSetup.cs b/src/BizHawk.Client.EmuHawk/config/N64/N64ControllersSetup.cs index 80c769245a..3c36a46f2e 100644 --- a/src/BizHawk.Client.EmuHawk/config/N64/N64ControllersSetup.cs +++ b/src/BizHawk.Client.EmuHawk/config/N64/N64ControllersSetup.cs @@ -9,7 +9,7 @@ namespace BizHawk.Client.EmuHawk { public partial class N64ControllersSetup : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly N64SyncSettings _syncSettings; private List ControllerSettingControls => Controls @@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk .ToList(); public N64ControllersSetup( - MainForm mainForm, + IMainFormForConfig mainForm, N64SyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs b/src/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs index b315556227..331aebb2d1 100644 --- a/src/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/N64/N64VideoPluginconfig.cs @@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk { public partial class N64VideoPluginConfig : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly Config _config; private readonly IEmulator _emulator; private readonly N64Settings _s; @@ -41,7 +41,7 @@ namespace BizHawk.Client.EmuHawk private bool _programmaticallyChangingPluginComboBox = false; public N64VideoPluginConfig( - MainForm mainForm, + IMainFormForConfig mainForm, Config config, IEmulator emulator) { diff --git a/src/BizHawk.Client.EmuHawk/config/NDS/NDSSettings.cs b/src/BizHawk.Client.EmuHawk/config/NDS/NDSSettings.cs index 5da012e2de..9d5b4a5863 100644 --- a/src/BizHawk.Client.EmuHawk/config/NDS/NDSSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/NDS/NDSSettings.cs @@ -6,11 +6,11 @@ namespace BizHawk.Client.EmuHawk { public partial class NdsSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly MelonDS.MelonSyncSettings _syncSettings; public NdsSettings( - MainForm mainForm, + IMainFormForConfig mainForm, MelonDS.MelonSyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs b/src/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs index c144ec1c7d..72437a820d 100644 --- a/src/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/NES/NESGraphicsConfig.cs @@ -14,13 +14,13 @@ namespace BizHawk.Client.EmuHawk // Allow selection of palette file from archive // Hotkeys for BG & Sprite display toggle // NTSC filter settings? Hue, Tint (This should probably be a client thing, not a nes specific thing?) - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly Config _config; private NES.NESSettings _settings; //private Bitmap _bmp; public NESGraphicsConfig( - MainForm mainForm, + IMainFormForConfig mainForm, Config config, NES.NESSettings settings) { diff --git a/src/BizHawk.Client.EmuHawk/config/NES/NESSyncSettingsForm.cs b/src/BizHawk.Client.EmuHawk/config/NES/NESSyncSettingsForm.cs index 589b3f9df7..2848d7c3fa 100644 --- a/src/BizHawk.Client.EmuHawk/config/NES/NESSyncSettingsForm.cs +++ b/src/BizHawk.Client.EmuHawk/config/NES/NESSyncSettingsForm.cs @@ -9,12 +9,12 @@ namespace BizHawk.Client.EmuHawk { public partial class NESSyncSettingsForm : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly DataTableDictionaryBind _dataTableDictionary; private readonly NES.NESSyncSettings _syncSettings; public NESSyncSettingsForm( - MainForm mainForm, + IMainFormForConfig mainForm, NES.NESSyncSettings syncSettings, bool hasMapperProperties) { diff --git a/src/BizHawk.Client.EmuHawk/config/NES/NESVSSettings.cs b/src/BizHawk.Client.EmuHawk/config/NES/NESVSSettings.cs index 633625debd..a4a260d0a3 100644 --- a/src/BizHawk.Client.EmuHawk/config/NES/NESVSSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/NES/NESVSSettings.cs @@ -6,12 +6,12 @@ namespace BizHawk.Client.EmuHawk { public partial class NesVsSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly NES.NESSyncSettings _settings; public NesVsSettings( - MainForm mainForm, + IMainFormForConfig mainForm, NES.NESSyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs b/src/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs index 82528f5434..32fb3954e2 100644 --- a/src/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/NES/NesControllerSettings.cs @@ -7,11 +7,11 @@ namespace BizHawk.Client.EmuHawk { public partial class NesControllerSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly NES.NESSyncSettings _syncSettings; public NesControllerSettings( - MainForm mainForm, + IMainFormForConfig mainForm, NES.NESSyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/NES/QuickNesConfig.cs b/src/BizHawk.Client.EmuHawk/config/NES/QuickNesConfig.cs index bbbc2cb8d3..82aeb323e2 100644 --- a/src/BizHawk.Client.EmuHawk/config/NES/QuickNesConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/NES/QuickNesConfig.cs @@ -10,12 +10,12 @@ namespace BizHawk.Client.EmuHawk { public partial class QuickNesConfig : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly Config _config; private readonly QuickNES.QuickNESSettings _settings; public QuickNesConfig( - MainForm mainForm, + IMainFormForConfig mainForm, Config config, QuickNES.QuickNESSettings settings) { diff --git a/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.cs b/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.cs index 21bad69e3a..ce12cfcb47 100644 --- a/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/PSX/PSXControllerConfig.cs @@ -7,11 +7,11 @@ namespace BizHawk.Client.EmuHawk { public partial class PSXControllerConfig : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly Octoshock.SyncSettings _syncSettings; public PSXControllerConfig( - MainForm mainForm, + IMainFormForConfig mainForm, Octoshock.SyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs b/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs index fb6eb804ba..5608d62604 100644 --- a/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs +++ b/src/BizHawk.Client.EmuHawk/config/PSX/PSXOptions.cs @@ -13,7 +13,7 @@ namespace BizHawk.Client.EmuHawk private readonly string _lblPixelProText, _lblMednafenText, _lblTweakedMednafenText; private PSXOptions( - MainForm mainForm, + IMainFormForConfig mainForm, Config config, Octoshock.Settings settings, Octoshock.SyncSettings syncSettings, @@ -63,7 +63,7 @@ namespace BizHawk.Client.EmuHawk } private Size _previewVideoSize; - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly Config _config; private readonly OctoshockDll.eVidStandard _previewVideoStandard; private readonly Octoshock.Settings _settings; @@ -76,7 +76,7 @@ namespace BizHawk.Client.EmuHawk MessageBox.Show("Finetuned Display Options will take effect if you OK from PSX Options"); } - public static DialogResult DoSettingsDialog(MainForm mainForm, Config config, Octoshock psx) + public static DialogResult DoSettingsDialog(IMainFormForConfig mainForm, Config config, Octoshock psx) { var s = psx.GetSettings(); var ss = psx.GetSyncSettings(); diff --git a/src/BizHawk.Client.EmuHawk/config/PathConfig.cs b/src/BizHawk.Client.EmuHawk/config/PathConfig.cs index 605bf79ed9..ef8494d198 100644 --- a/src/BizHawk.Client.EmuHawk/config/PathConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/PathConfig.cs @@ -12,7 +12,7 @@ namespace BizHawk.Client.EmuHawk public partial class PathConfig : Form { private readonly Config _config; - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly string _currentSystemId; // All path text boxes should do some kind of error checking @@ -42,7 +42,7 @@ namespace BizHawk.Client.EmuHawk "..\\" }; - public PathConfig(MainForm mainForm, Config config, string currentSystemId) + public PathConfig(IMainFormForConfig mainForm, Config config, string currentSystemId) { _mainForm = mainForm; _config = config; diff --git a/src/BizHawk.Client.EmuHawk/config/ProfileConfig.cs b/src/BizHawk.Client.EmuHawk/config/ProfileConfig.cs index 8a46b696e2..aae64b4fbf 100644 --- a/src/BizHawk.Client.EmuHawk/config/ProfileConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/ProfileConfig.cs @@ -15,12 +15,12 @@ namespace BizHawk.Client.EmuHawk { public partial class ProfileConfig : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly IEmulator _emulator; private readonly Config _config; public ProfileConfig( - MainForm mainForm, + IMainFormForConfig mainForm, IEmulator emulator, Config config) { diff --git a/src/BizHawk.Client.EmuHawk/config/SNES/SNESControllerConfig.cs b/src/BizHawk.Client.EmuHawk/config/SNES/SNESControllerConfig.cs index 7378206947..101eb75968 100644 --- a/src/BizHawk.Client.EmuHawk/config/SNES/SNESControllerConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/SNES/SNESControllerConfig.cs @@ -7,12 +7,12 @@ namespace BizHawk.Client.EmuHawk { public partial class SNESControllerSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly LibsnesCore.SnesSyncSettings _syncSettings; private bool _suppressDropdownChangeEvents; public SNESControllerSettings( - MainForm mainForm, + IMainFormForConfig mainForm, LibsnesCore.SnesSyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs b/src/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs index 4fc4003cd0..dfb370d937 100644 --- a/src/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs +++ b/src/BizHawk.Client.EmuHawk/config/SNES/SNESOptions.cs @@ -14,7 +14,7 @@ namespace BizHawk.Client.EmuHawk private bool _suppressDoubleSize; private bool _userDoubleSizeOption; - public static void DoSettingsDialog(MainForm mainForm, LibsnesCore bsnes) + public static void DoSettingsDialog(IMainFormForConfig mainForm, LibsnesCore bsnes) { var s = bsnes.GetSettings(); var ss = bsnes.GetSyncSettings(); diff --git a/src/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs b/src/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs index ceaa242a66..2acffde891 100644 --- a/src/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/TI83/TI83PaletteConfig.cs @@ -7,11 +7,11 @@ namespace BizHawk.Client.EmuHawk { public partial class TI83PaletteConfig : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly TI83.TI83Settings _settings; public TI83PaletteConfig( - MainForm mainForm, + IMainFormForConfig mainForm, TI83.TI83Settings settings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumAudioSettings.cs b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumAudioSettings.cs index d094806e71..c5d1247afb 100644 --- a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumAudioSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumAudioSettings.cs @@ -6,11 +6,11 @@ namespace BizHawk.Client.EmuHawk { public partial class ZxSpectrumAudioSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly ZXSpectrum.ZXSpectrumSettings _settings; public ZxSpectrumAudioSettings( - MainForm mainForm, + IMainFormForConfig mainForm, ZXSpectrum.ZXSpectrumSettings settings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumCoreEmulationSettings.cs b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumCoreEmulationSettings.cs index 6c34c2e6ae..ad43b0753b 100644 --- a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumCoreEmulationSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumCoreEmulationSettings.cs @@ -6,11 +6,11 @@ namespace BizHawk.Client.EmuHawk { public partial class ZxSpectrumCoreEmulationSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly ZXSpectrum.ZXSpectrumSyncSettings _syncSettings; public ZxSpectrumCoreEmulationSettings( - MainForm mainForm, + IMainFormForConfig mainForm, ZXSpectrum.ZXSpectrumSyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumJoystickSettings.cs b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumJoystickSettings.cs index 12c488b5ed..6682124b7f 100644 --- a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumJoystickSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumJoystickSettings.cs @@ -7,12 +7,12 @@ namespace BizHawk.Client.EmuHawk { public partial class ZxSpectrumJoystickSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly ZXSpectrum.ZXSpectrumSyncSettings _syncSettings; private string[] _possibleControllers; public ZxSpectrumJoystickSettings( - MainForm mainForm, + IMainFormForConfig mainForm, ZXSpectrum.ZXSpectrumSyncSettings syncSettings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs index 94a184877d..534f7aebbc 100644 --- a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs +++ b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumNonSyncSettings.cs @@ -6,12 +6,12 @@ namespace BizHawk.Client.EmuHawk { public partial class ZxSpectrumNonSyncSettings : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly ZXSpectrum.ZXSpectrumSettings _settings; private int _bgColor; public ZxSpectrumNonSyncSettings( - MainForm mainForm, + IMainFormForConfig mainForm, ZXSpectrum.ZXSpectrumSettings settings) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumPokeMemory.cs b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumPokeMemory.cs index 3bb963d5ef..584385d84f 100644 --- a/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumPokeMemory.cs +++ b/src/BizHawk.Client.EmuHawk/config/ZXSpectrum/ZXSpectrumPokeMemory.cs @@ -6,10 +6,10 @@ namespace BizHawk.Client.EmuHawk { public partial class ZxSpectrumPokeMemory : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForConfig _mainForm; private readonly ZXSpectrum _speccy; public ZxSpectrumPokeMemory( - MainForm mainForm, + IMainFormForConfig mainForm, ZXSpectrum speccy) { _mainForm = mainForm; diff --git a/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs b/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs index 0a9484ed07..c1842bbb4b 100644 --- a/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs +++ b/src/BizHawk.Client.EmuHawk/movie/PlayMovie.cs @@ -16,7 +16,7 @@ namespace BizHawk.Client.EmuHawk { public partial class PlayMovie : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForTools _mainForm; private readonly Config _config; private readonly GameInfo _game; private readonly IEmulator _emulator; @@ -31,7 +31,7 @@ namespace BizHawk.Client.EmuHawk private string _sortedDetailsCol; public PlayMovie( - MainForm mainForm, + IMainFormForTools mainForm, Config config, GameInfo game, IEmulator emulator, diff --git a/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs b/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs index 09436d241e..474f89b5da 100644 --- a/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs +++ b/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs @@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk // TODO - Allow relative paths in record TextBox public partial class RecordMovie : Form { - private readonly MainForm _mainForm; + private readonly IMainFormForTools _mainForm; private readonly Config _config; private readonly GameInfo _game; private readonly IEmulator _emulator; @@ -19,7 +19,7 @@ namespace BizHawk.Client.EmuHawk private readonly FirmwareManager _firmwareManager; public RecordMovie( - MainForm mainForm, + IMainFormForTools mainForm, Config config, GameInfo game, IEmulator core, diff --git a/src/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs b/src/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs index 7a6cd403a9..46b3787a3b 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs @@ -12,7 +12,7 @@ namespace BizHawk.Client.EmuHawk { public partial class BreakpointControl : UserControl { - public MainForm MainForm { get; set; } + public IMainFormForTools MainForm { get; set; } public IDebuggable Core { get; set; } public IMemoryCallbackSystem Mcs { get; set; } public GenericDebugger ParentDebugger { get; set; } diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs index 3904386107..1ced36fdae 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/ClientLuaLibrary.cs @@ -24,7 +24,7 @@ namespace BizHawk.Client.EmuHawk [OptionalService] private IVideoProvider VideoProvider { get; set; } - public MainForm MainForm { get; set; } + public IMainFormForApi MainForm { get; set; } public ClientLuaLibrary(Lua lua) : base(lua) { } diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs index c8b169ac8b..deb23c66d4 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs @@ -244,7 +244,7 @@ namespace BizHawk.Client.EmuHawk } var currentScripts = LuaImp?.ScriptList; // Temp fix for now - LuaImp = OSTailoredCode.IsUnixHost ? (LuaLibraries) new UnixLuaLibraries() : new Win32LuaLibraries(MainForm, Emulator.ServiceProvider); + LuaImp = OSTailoredCode.IsUnixHost ? (LuaLibraries) new UnixLuaLibraries() : new Win32LuaLibraries((MainForm) MainForm, Emulator.ServiceProvider); LuaImp.ScriptList.AddRange(currentScripts ?? Enumerable.Empty()); InputBox.AutoCompleteCustomSource.AddRange(LuaImp.Docs.Select(a => $"{a.Library}.{a.Name}").ToArray()); diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/Win32LuaLibraries.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/Win32LuaLibraries.cs index 79deb0e967..fdc0fffde2 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/Win32LuaLibraries.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/Win32LuaLibraries.cs @@ -20,7 +20,7 @@ namespace BizHawk.Client.EmuHawk _lua["keepalives"] = _lua.NewTable(); } - public Win32LuaLibraries(MainForm mainForm, IEmulatorServiceProvider serviceProvider) + public Win32LuaLibraries(IMainFormForApi mainForm, IEmulatorServiceProvider serviceProvider) : this() { LuaWait = new AutoResetEvent(false); diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs index 777608c739..75d52c192f 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs @@ -20,7 +20,7 @@ namespace BizHawk.Client.EmuHawk private ITasMovie Movie => Tastudio.CurrentTasMovie; private ITasBranchCollection Branches => Movie.Branches; - private MainForm MainForm => Tastudio.MainForm; + private IMainFormForTools MainForm => Tastudio.MainForm; private TasBranch _backupBranch; private BranchUndo _branchUndo = BranchUndo.None; diff --git a/src/BizHawk.Client.EmuHawk/tools/ToolFormBase.cs b/src/BizHawk.Client.EmuHawk/tools/ToolFormBase.cs index 572523aeb3..072b21081a 100644 --- a/src/BizHawk.Client.EmuHawk/tools/ToolFormBase.cs +++ b/src/BizHawk.Client.EmuHawk/tools/ToolFormBase.cs @@ -12,7 +12,7 @@ namespace BizHawk.Client.EmuHawk { public ToolManager Tools { get; set; } public Config Config { get; set; } - public MainForm MainForm { get; set; } + public IMainFormForTools MainForm { get; set; } public IMovieSession MovieSession { get; set; } public IGameInfo Game { get; set; } @@ -122,7 +122,7 @@ namespace BizHawk.Client.EmuHawk protected void RefreshFloatingWindowControl(bool floatingWindow) { - Owner = floatingWindow ? null : MainForm; + Owner = floatingWindow ? null : (MainForm) MainForm; } protected bool IsOnScreen(Point topLeft)