From cd7d907c0dd1196359cb395d828ca825749a96f8 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 14 Mar 2020 14:02:19 -0500 Subject: [PATCH] get rid of CoreFileProvider SubFileDirectory --- BizHawk.Client.Common/CoreFileProvider.cs | 9 +-------- BizHawk.Client.Common/RomLoader.cs | 9 ++++----- BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs | 2 -- .../Consoles/Nintendo/SNES/LibsnesCore.cs | 2 +- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/BizHawk.Client.Common/CoreFileProvider.cs b/BizHawk.Client.Common/CoreFileProvider.cs index eda4027bd8..ab9a5397e6 100644 --- a/BizHawk.Client.Common/CoreFileProvider.cs +++ b/BizHawk.Client.Common/CoreFileProvider.cs @@ -7,7 +7,6 @@ namespace BizHawk.Client.Common { public class CoreFileProvider : ICoreFileProvider { - public string SubfileDirectory { get; set; } public FirmwareManager FirmwareManager { get; set; } private readonly Action _showWarning; @@ -118,13 +117,7 @@ namespace BizHawk.Client.Common // this should go away now public static void SyncCoreCommInputSignals(CoreComm target) { - string superhack = null; - if (target.CoreFileProvider is CoreFileProvider) - { - superhack = ((CoreFileProvider)target.CoreFileProvider).SubfileDirectory; - } - - var cfp = new CoreFileProvider(target.ShowMessage) { SubfileDirectory = superhack }; + var cfp = new CoreFileProvider(target.ShowMessage); target.CoreFileProvider = cfp; cfp.FirmwareManager = Global.FirmwareManager; } diff --git a/BizHawk.Client.Common/RomLoader.cs b/BizHawk.Client.Common/RomLoader.cs index ddfc4e5c14..00f83d6785 100644 --- a/BizHawk.Client.Common/RomLoader.cs +++ b/BizHawk.Client.Common/RomLoader.cs @@ -867,14 +867,13 @@ namespace BizHawk.Client.Common { // need to get rid of this hack at some point rom = new RomGame(file); - nextComm.CoreFileProvider.SubfileDirectory = Path.GetDirectoryName(path.Replace("|", "")); // Dirty hack to get around archive filenames (since we are just getting the directory path, it is safe to mangle the filename - byte[] romData = null; + var basePath = Path.GetDirectoryName(path.Replace("|", "")); // Dirty hack to get around archive filenames (since we are just getting the directory path, it is safe to mangle the filename byte[] xmlData = rom.FileData; game = rom.GameInfo; game.System = "SNES"; - var snes = new LibsnesCore(game, romData, xmlData, nextComm.CoreFileProvider.SubfileDirectory, nextComm, GetCoreSettings(), GetCoreSyncSettings()); + var snes = new LibsnesCore(game, null, xmlData, basePath, nextComm, GetCoreSettings(), GetCoreSyncSettings()); nextEmulator = snes; } catch @@ -997,10 +996,10 @@ namespace BizHawk.Client.Common else { // need to get rid of this hack at some point - nextComm.CoreFileProvider.SubfileDirectory = Path.GetDirectoryName(path.Replace("|", "")); // Dirty hack to get around archive filenames (since we are just getting the directory path, it is safe to mangle the filename + var basePath = Path.GetDirectoryName(path.Replace("|", "")); // Dirty hack to get around archive filenames (since we are just getting the directory path, it is safe to mangle the filename var romData = isXml ? null : rom.FileData; var xmlData = isXml ? rom.FileData : null; - var snes = new LibsnesCore(game, romData, xmlData, nextComm.CoreFileProvider.SubfileDirectory, nextComm, GetCoreSettings(), GetCoreSyncSettings()); + var snes = new LibsnesCore(game, romData, xmlData, basePath, nextComm, GetCoreSettings(), GetCoreSyncSettings()); nextEmulator = snes; } diff --git a/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs b/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs index 90e4099c6d..a444872991 100644 --- a/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs +++ b/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs @@ -7,8 +7,6 @@ namespace BizHawk.Emulation.Common /// public interface ICoreFileProvider { - string SubfileDirectory { get; set; } - /// /// produces a path that contains emulation related DLL and exe files /// diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs index 9de2e98561..8eca16c836 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -14,7 +14,7 @@ using BizHawk.Emulation.Cores.Components.W65816; // TODO // libsnes needs to be modified to support multiple instances - THIS IS NECESSARY - or else loading one game and then another breaks things // edit - this is a lot of work -// wrap dll code around some kind of library-accessing interface so that it doesnt malfunction if the dll is unavailablecd +// wrap dll code around some kind of library-accessing interface so that it doesn't malfunction if the dll is unavailable namespace BizHawk.Emulation.Cores.Nintendo.SNES { [Core(