Pass forced core through other paths in RomLoader

fixes c0b6bf61b; not sure if this matters currently (PCE-CD maybe?) but it may
become important if we add more alternate cores
This commit is contained in:
YoshiRulz 2021-01-15 04:33:14 +10:00
parent e65e77e7cd
commit d2fb794340
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 9 additions and 9 deletions

View File

@ -305,7 +305,7 @@ namespace BizHawk.Client.Common
return game;
}
private bool LoadDisc(string path, CoreComm nextComm, HawkFile file, string ext, out IEmulator nextEmulator, out GameInfo game)
private bool LoadDisc(string path, CoreComm nextComm, HawkFile file, string ext, string forcedCoreName, out IEmulator nextEmulator, out GameInfo game)
{
var disc = DiscExtensions.CreateAnyType(path, str => DoLoadErrorCallback(str, "???", LoadErrorType.DiscError));
if (disc == null)
@ -331,11 +331,11 @@ namespace BizHawk.Client.Common
}
},
};
nextEmulator = MakeCoreFromCoreInventory(cip);
nextEmulator = MakeCoreFromCoreInventory(cip, forcedCoreName);
return true;
}
private void LoadM3U(string path, CoreComm nextComm, HawkFile file, out IEmulator nextEmulator, out GameInfo game)
private void LoadM3U(string path, CoreComm nextComm, HawkFile file, string forcedCoreName, out IEmulator nextEmulator, out GameInfo game)
{
M3U_File m3u;
using (var sr = new StreamReader(path))
@ -370,7 +370,7 @@ namespace BizHawk.Client.Common
Game = game,
Discs = discs
};
nextEmulator = MakeCoreFromCoreInventory(cip);
nextEmulator = MakeCoreFromCoreInventory(cip, forcedCoreName);
}
private IEmulator MakeCoreFromCoreInventory(CoreInventoryParameters cip, string forcedCoreName = null)
@ -523,7 +523,7 @@ namespace BizHawk.Client.Common
game = rom.GameInfo;
}
private bool LoadXML(string path, CoreComm nextComm, HawkFile file, out IEmulator nextEmulator, out RomGame rom, out GameInfo game)
private bool LoadXML(string path, CoreComm nextComm, HawkFile file, string forcedCoreName, out IEmulator nextEmulator, out RomGame rom, out GameInfo game)
{
nextEmulator = null;
rom = null;
@ -564,7 +564,7 @@ namespace BizHawk.Client.Common
})
.ToList(),
};
nextEmulator = MakeCoreFromCoreInventory(cip);
nextEmulator = MakeCoreFromCoreInventory(cip, forcedCoreName);
return true;
}
catch (Exception ex)
@ -689,10 +689,10 @@ namespace BizHawk.Client.Common
switch (ext)
{
case ".m3u":
LoadM3U(path, nextComm, file, out nextEmulator, out game);
LoadM3U(path, nextComm, file, forcedCoreName, out nextEmulator, out game);
break;
case ".xml":
if (!LoadXML(path, nextComm, file, out nextEmulator, out rom, out game))
if (!LoadXML(path, nextComm, file, forcedCoreName, out nextEmulator, out rom, out game))
return false;
break;
case ".psf":
@ -704,7 +704,7 @@ namespace BizHawk.Client.Common
{
if (file.IsArchive)
throw new InvalidOperationException("Can't load CD files from archives!");
if (!LoadDisc(path, nextComm, file, ext, out nextEmulator, out game))
if (!LoadDisc(path, nextComm, file, ext, forcedCoreName, out nextEmulator, out game))
return false;
}
else