remove obsolete ICoreFileProvider.PathSubfile(), and instead pass in the neccessary base path the the bsnes core that needs it

This commit is contained in:
adelikat 2020-03-14 13:56:20 -05:00
parent b2066d9a73
commit e655ad3abd
5 changed files with 18 additions and 23 deletions

View File

@ -17,11 +17,6 @@ namespace BizHawk.Client.Common
_showWarning = showWarning;
}
public string PathSubfile(string fname)
{
return Path.Combine(SubfileDirectory ?? "", fname);
}
public string DllPath()
{
return Path.Combine(PathManager.GetExeDirectoryAbsolute(), "dll");

View File

@ -874,7 +874,7 @@ namespace BizHawk.Client.Common
game = rom.GameInfo;
game.System = "SNES";
var snes = new LibsnesCore(game, romData, xmlData, nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
var snes = new LibsnesCore(game, romData, xmlData, nextComm.CoreFileProvider.SubfileDirectory, nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
nextEmulator = snes;
}
catch
@ -1000,7 +1000,7 @@ namespace BizHawk.Client.Common
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>());
var snes = new LibsnesCore(game, romData, xmlData, nextComm.CoreFileProvider.SubfileDirectory, nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
nextEmulator = snes;
}
@ -1060,7 +1060,7 @@ namespace BizHawk.Client.Common
{
game.System = "SNES";
game.AddOption("SGB");
var snes = new LibsnesCore(game, rom.FileData, null, nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
var snes = new LibsnesCore(game, rom.FileData, null, null, nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
nextEmulator = snes;
}
else
@ -1089,7 +1089,7 @@ namespace BizHawk.Client.Common
{
game.System = "SNES";
game.AddOption("SGB");
var snes = new LibsnesCore(game, rom.FileData, null, nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
var snes = new LibsnesCore(game, rom.FileData, null, null, nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
nextEmulator = snes;
}
else

View File

@ -9,12 +9,6 @@ namespace BizHawk.Emulation.Common
{
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>
[Obsolete]
string PathSubfile(string fname);
/// <summary>
/// produces a path that contains emulation related DLL and exe files
/// </summary>

View File

@ -29,8 +29,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
public unsafe partial class LibsnesCore : IEmulator, IVideoProvider, ISaveRam, IStatable, IInputPollable, IRegionable, ICodeDataLogger,
IDebuggable, ISettable<LibsnesCore.SnesSettings, LibsnesCore.SnesSyncSettings>
{
public LibsnesCore(GameInfo game, byte[] romData, byte[] xmlData, CoreComm comm, object settings, object syncSettings)
public LibsnesCore(GameInfo game, byte[] romData, byte[] xmlData, string baseRomPath, CoreComm comm, object settings, object syncSettings)
{
_baseRomPath = baseRomPath;
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
@ -79,10 +80,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
Api.QUERY_set_path_request(snes_path_request);
_scanlineStartCb = new LibsnesApi.snes_scanlineStart_t(snes_scanlineStart);
_tracecb = new LibsnesApi.snes_trace_t(snes_trace);
_scanlineStartCb = snes_scanlineStart;
_tracecb = snes_trace;
_soundcb = new LibsnesApi.snes_audio_sample_t(snes_audio_sample);
_soundcb = snes_audio_sample;
// start up audio resampler
InitAudio();
@ -102,7 +103,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
SystemId = "SNES";
ser.Register<IBoardInfo>(new SGBBoardInfo());
_currLoadParams = new LoadParams()
_currLoadParams = new LoadParams
{
type = LoadParamType.SuperGameBoy,
rom_xml = null,
@ -128,7 +129,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
// so, we have to do that here and pass it in as the romData :/
if (_romxml["cartridge"]?["rom"] != null)
{
romData = File.ReadAllBytes(CoreComm.CoreFileProvider.PathSubfile(_romxml["cartridge"]["rom"].Attributes["name"].Value));
romData = File.ReadAllBytes(PathSubfile(_romxml["cartridge"]["rom"].Attributes["name"].Value));
}
else
{
@ -182,6 +183,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
RefreshPalette();
}
private readonly string _baseRomPath = "";
private string PathSubfile(string fname) => Path.Combine(_baseRomPath, fname);
private readonly GameInfo _game;
private readonly LibsnesControllerDeck _controllerDeck;
private readonly ITraceable _tracer;
@ -255,7 +260,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
var msu1 = _romxml["cartridge"]["msu1"];
if (isMsu1Rom && msu1["rom"]?.Attributes["name"] != null)
{
return CoreComm.CoreFileProvider.PathSubfile(msu1["rom"].Attributes["name"].Value);
return PathSubfile(msu1["rom"].Attributes["name"].Value);
}
if (isMsu1Pcm)
@ -269,7 +274,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
{
if (child.Name == "track" && child.Attributes["number"].Value == wantsTrackString)
{
return CoreComm.CoreFileProvider.PathSubfile(child.Attributes["name"].Value);
return PathSubfile(child.Attributes["name"].Value);
}
}
}

View File

@ -230,6 +230,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bools/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bootable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bootstart/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bootup/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=botting/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Boyee/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bsnes/@EntryIndexedValue">True</s:Boolean>