add to ICoreFileProvider and remove casting to CoreFileProvider shenanigans in RomLoader

This commit is contained in:
adelikat 2020-03-14 12:28:19 -05:00
parent 16781fa212
commit eba20781b4
2 changed files with 6 additions and 4 deletions

View File

@ -867,7 +867,7 @@ namespace BizHawk.Client.Common
{
// need to get rid of this hack at some point
rom = new RomGame(file);
((CoreFileProvider)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
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;
byte[] xmlData = rom.FileData;
@ -963,8 +963,8 @@ namespace BizHawk.Client.Common
// The user picked nothing in the Core picker
break;
case "83P":
var ti83Bios = ((CoreFileProvider)nextComm.CoreFileProvider).GetFirmware("TI83", "Rom", true);
var ti83BiosPath = ((CoreFileProvider)nextComm.CoreFileProvider).GetFirmwarePath("TI83", "Rom", true);
var ti83Bios = nextComm.CoreFileProvider.GetFirmware("TI83", "Rom", true);
var ti83BiosPath = nextComm.CoreFileProvider.GetFirmwarePath("TI83", "Rom", true);
using (var ti83AsHawkFile = new HawkFile(ti83BiosPath))
{
var ti83BiosAsRom = new RomGame(ti83AsHawkFile);
@ -995,7 +995,7 @@ namespace BizHawk.Client.Common
else
{
// need to get rid of this hack at some point
((CoreFileProvider)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
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 romData = isXml ? null : rom.FileData;
var xmlData = isXml ? rom.FileData : null;
var snes = new LibsnesCore(game, romData, xmlData, nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());

View File

@ -7,6 +7,8 @@ namespace BizHawk.Emulation.Common
/// </summary>
public interface ICoreFileProvider
{
string SubfileDirectory { get; set; }
/// <summary>
/// Produces a path to the requested file, expected to be parallel to the running rom. for example: cue+bin files or SFC+PCM (MSU-1 games)
/// </summary>