diff --git a/BizHawk.Client.Common/CoreFileProvider.cs b/BizHawk.Client.Common/CoreFileProvider.cs index f769d63349..6f89c794f2 100644 --- a/BizHawk.Client.Common/CoreFileProvider.cs +++ b/BizHawk.Client.Common/CoreFileProvider.cs @@ -83,11 +83,5 @@ namespace BizHawk.Client.Common return ret; } - - // this should go away now - public static void SyncCoreCommInputSignals(CoreComm target) - { - target.CoreFileProvider = new CoreFileProvider(target.ShowMessage, Global.FirmwareManager); - } } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 0c6155dd51..2305c3ed4e 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -82,7 +82,11 @@ namespace BizHawk.Client.EmuHawk // its.. weird. don't ask. } - private CoreComm CreateCoreComm() => new CoreComm(ShowMessageCoreComm, NotifyCoreComm); + private CoreComm CreateCoreComm() + { + var cfp = new CoreFileProvider(ShowMessageCoreComm, Global.FirmwareManager); + return new CoreComm(ShowMessageCoreComm, NotifyCoreComm, cfp); + } public MainForm(string[] args) { @@ -3613,7 +3617,6 @@ namespace BizHawk.Client.EmuHawk //path = ioa_openrom.Path; } - CoreFileProvider.SyncCoreCommInputSignals(nextComm); var result = loader.LoadRom(path, nextComm, ioaRetro?.CorePath); // we need to replace the path in the OpenAdvanced with the canonical one the user chose. @@ -3639,7 +3642,6 @@ namespace BizHawk.Client.EmuHawk string openAdvancedArgs = $"*{OpenAdvancedSerializer.Serialize(ioa)}"; Emulator = loader.LoadedEmulator; Global.Game = loader.Game; - CoreFileProvider.SyncCoreCommInputSignals(nextComm); InputManager.SyncControls(); if (oaOpenrom != null && Path.GetExtension(oaOpenrom.Path.Replace("|", "")).ToLowerInvariant() == ".xml" && !(Emulator is LibsnesCore)) @@ -3898,7 +3900,6 @@ namespace BizHawk.Client.EmuHawk { CloseGame(clearSram); var coreComm = CreateCoreComm(); - CoreFileProvider.SyncCoreCommInputSignals(coreComm); Emulator = new NullEmulator(); Global.Game = GameInfo.NullInstance; diff --git a/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs b/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs index 2805eab9d7..dfe8d3242b 100644 --- a/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs +++ b/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs @@ -76,8 +76,8 @@ namespace BizHawk.Client.EmuHawk ////LibRetroEmulator should be able to survive having this stub corecomm //NEW COMMENTS: //nope, we need to navigate to the dll path. this was a bad idea anyway. so many dlls get loaded, something to resolve them is needed - var coreComm = new CoreComm(null, null); - CoreFileProvider.SyncCoreCommInputSignals(coreComm); + var cfp = new CoreFileProvider(s => { }, Global.FirmwareManager); + var coreComm = new CoreComm(null, null, cfp); using var retro = new LibretroCore(coreComm, Global.Game, core); btnLibretroLaunchGame.Enabled = true; if (retro.Description.SupportsNoGame) diff --git a/BizHawk.Client.EmuHawk/tools/BatchRunner.cs b/BizHawk.Client.EmuHawk/tools/BatchRunner.cs index a91cec7048..f69c22b03a 100644 --- a/BizHawk.Client.EmuHawk/tools/BatchRunner.cs +++ b/BizHawk.Client.EmuHawk/tools/BatchRunner.cs @@ -73,8 +73,8 @@ namespace BizHawk.Client.EmuHawk _ldr = new RomLoader(); _ldr.OnLoadError += OnLoadError; _ldr.ChooseArchive = ChooseArchive; - _comm = new CoreComm(CommMessage, CommMessage); - CoreFileProvider.SyncCoreCommInputSignals(_comm); + var cfp = new CoreFileProvider(CommMessage, Global.FirmwareManager); + _comm = new CoreComm(CommMessage, CommMessage, cfp); } private void OnLoadError(object sender, RomLoader.RomErrorArgs e) diff --git a/BizHawk.Emulation.Common/CoreComms.cs b/BizHawk.Emulation.Common/CoreComms.cs index 2e03f143f5..9bf71500d2 100644 --- a/BizHawk.Emulation.Common/CoreComms.cs +++ b/BizHawk.Emulation.Common/CoreComms.cs @@ -9,15 +9,19 @@ namespace BizHawk.Emulation.Common /// public class CoreComm { - public CoreComm(Action showMessage, Action notifyMessage) + public CoreComm( + Action showMessage, + Action notifyMessage, + ICoreFileProvider coreFileProvider) { ShowMessage = showMessage; Notify = notifyMessage; + CoreFileProvider = coreFileProvider; } public CoreComm Clone() => (CoreComm)MemberwiseClone(); - public ICoreFileProvider CoreFileProvider { get; set; } + public ICoreFileProvider CoreFileProvider { get; } /// /// Gets a message to show. reasonably annoying (dialog box), shouldn't be used most of the time