get rid of CoreFileProvider SubFileDirectory

This commit is contained in:
adelikat 2020-03-14 14:02:19 -05:00
parent e655ad3abd
commit cd7d907c0d
4 changed files with 6 additions and 16 deletions

View File

@ -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<string> _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;
}

View File

@ -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<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
var snes = new LibsnesCore(game, null, xmlData, basePath, nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
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<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
var snes = new LibsnesCore(game, romData, xmlData, basePath, nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
nextEmulator = snes;
}

View File

@ -7,8 +7,6 @@ namespace BizHawk.Emulation.Common
/// </summary>
public interface ICoreFileProvider
{
string SubfileDirectory { get; set; }
/// <summary>
/// produces a path that contains emulation related DLL and exe files
/// </summary>

View File

@ -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(