diff --git a/BizHawk.Client.Common/CoreFileProvider.cs b/BizHawk.Client.Common/CoreFileProvider.cs index d5926ef9ed..1f1386174f 100644 --- a/BizHawk.Client.Common/CoreFileProvider.cs +++ b/BizHawk.Client.Common/CoreFileProvider.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using BizHawk.Common.PathExtensions; using BizHawk.Emulation.Common; @@ -9,22 +10,31 @@ namespace BizHawk.Client.Common { private readonly FirmwareManager _firmwareManager; private readonly Action _showWarning; + private readonly PathEntryCollection _pathEntries; + private readonly IDictionary _firmwareUserSpecifications; - public CoreFileProvider(Action showWarning, FirmwareManager firmwareManager) + public CoreFileProvider( + Action showWarning, + FirmwareManager firmwareManager, + PathEntryCollection pathEntries, + IDictionary firmwareUserSpecifications) { _showWarning = showWarning; _firmwareManager = firmwareManager; + _pathEntries = pathEntries; + _firmwareManager = firmwareManager; + _firmwareUserSpecifications = firmwareUserSpecifications; } public string DllPath() => PathUtils.GetDllDirectory(); // Poop public string GetRetroSaveRAMDirectory(GameInfo game) - => Global.Config.PathEntries.RetroSaveRamAbsolutePath(game, Global.MovieSession.Movie.IsActive(), Global.MovieSession.Movie.Filename); + => _pathEntries.RetroSaveRamAbsolutePath(game, Global.MovieSession.Movie.IsActive(), Global.MovieSession.Movie.Filename); // Poop public string GetRetroSystemPath(GameInfo game) - => Global.Config.PathEntries.RetroSystemAbsolutePath(game); + => _pathEntries.RetroSystemAbsolutePath(game); private void FirmwareWarn(string sysID, string firmwareID, bool required, string msg = null) { @@ -44,8 +54,8 @@ namespace BizHawk.Client.Common private byte[] GetFirmwareWithPath(string sysId, string firmwareId, bool required, string msg, out string path) { var firmwarePath = _firmwareManager.Request( - Global.Config.PathEntries.FirmwaresPathFragment, - Global.Config.FirmwareUserSpecifications, + _pathEntries.FirmwaresPathFragment, + _firmwareUserSpecifications, sysId, firmwareId); diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index bc6682f166..d0006ca074 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -86,7 +86,11 @@ namespace BizHawk.Client.EmuHawk private CoreComm CreateCoreComm() { - var cfp = new CoreFileProvider(ShowMessageCoreComm, Global.FirmwareManager); + var cfp = new CoreFileProvider( + ShowMessageCoreComm, + Global.FirmwareManager, + Config.PathEntries, + Config.FirmwareUserSpecifications); return new CoreComm(ShowMessageCoreComm, NotifyCoreComm, cfp); } diff --git a/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs b/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs index dfe8d3242b..915b11bd74 100644 --- a/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs +++ b/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs @@ -71,13 +71,12 @@ namespace BizHawk.Client.EmuHawk // scan the current libretro core to see if it can be launched with NoGame,and other stuff try { - //OLD COMMENTS: - ////a stub corecomm. to reinforce that this won't touch the frontend at all! - ////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 cfp = new CoreFileProvider(s => { }, Global.FirmwareManager); - var coreComm = new CoreComm(null, null, cfp); + var cfp = new CoreFileProvider( + Console.WriteLine, + Global.FirmwareManager, + Global.Config.PathEntries, + Global.Config.FirmwareUserSpecifications); + var coreComm = new CoreComm(Console.WriteLine, Console.WriteLine, 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 f69c22b03a..764f1edfed 100644 --- a/BizHawk.Client.EmuHawk/tools/BatchRunner.cs +++ b/BizHawk.Client.EmuHawk/tools/BatchRunner.cs @@ -73,7 +73,7 @@ namespace BizHawk.Client.EmuHawk _ldr = new RomLoader(); _ldr.OnLoadError += OnLoadError; _ldr.ChooseArchive = ChooseArchive; - var cfp = new CoreFileProvider(CommMessage, Global.FirmwareManager); + var cfp = new CoreFileProvider(CommMessage, Global.FirmwareManager, Global.Config.PathEntries, Global.Config.FirmwareUserSpecifications); _comm = new CoreComm(CommMessage, CommMessage, cfp); }