rip out libretro hack from CoreComm, making it a param on LoadRom isn't great but better

This commit is contained in:
adelikat 2020-03-14 15:43:17 -05:00
parent fc0e0840e0
commit 190118d7c4
4 changed files with 8 additions and 12 deletions

View File

@ -242,7 +242,7 @@ namespace BizHawk.Client.Common
return discs;
}
public bool LoadRom(string path, CoreComm nextComm, bool forceAccurateCore = false,
public bool LoadRom(string path, CoreComm nextComm, string launchLibretroCore, bool forceAccurateCore = false,
int recursiveCount = 0) // forceAccurateCore is currently just for Quicknes vs Neshawk but could be used for other situations
{
if (recursiveCount > 1) // hack to stop recursive calls from endlessly rerunning if we can't load it
@ -295,9 +295,9 @@ namespace BizHawk.Client.Common
// must be done before LoadNoGame (which triggers retro_init and the paths to be consumed by the core)
// game name == name of core
string codePathPart = Path.GetFileNameWithoutExtension(nextComm.LaunchLibretroCore);
string codePathPart = Path.GetFileNameWithoutExtension(launchLibretroCore);
Global.Game = game = new GameInfo { Name = codePathPart, System = "Libretro" };
var retro = new LibretroCore(nextComm, game, nextComm.LaunchLibretroCore);
var retro = new LibretroCore(nextComm, game, launchLibretroCore);
nextEmulator = retro;
if (retro.Description.SupportsNoGame && string.IsNullOrEmpty(path))
@ -1183,7 +1183,7 @@ namespace BizHawk.Client.Common
DoMessageCallback("Unable to use quicknes, using NESHawk instead");
}
return LoadRom(path, nextComm, true, recursiveCount + 1);
return LoadRom(path, nextComm, launchLibretroCore, true, recursiveCount + 1);
}
if (ex is MissingFirmwareException)
@ -1196,7 +1196,7 @@ namespace BizHawk.Client.Common
// To avoid catch-22, disable SGB mode
Global.Config.GbAsSgb = false;
DoMessageCallback("Failed to load a GB rom in SGB mode. Disabling SGB Mode.");
return LoadRom(path, nextComm, false, recursiveCount + 1);
return LoadRom(path, nextComm, launchLibretroCore, false, recursiveCount + 1);
}
// handle exceptions thrown by the new detected systems that BizHawk does not have cores for

View File

@ -3604,8 +3604,7 @@ namespace BizHawk.Client.EmuHawk
ioaRetro.CorePath = Config.LibretroCore;
}
nextComm.LaunchLibretroCore = ioaRetro.CorePath;
if (nextComm.LaunchLibretroCore == null)
if (ioaRetro.CorePath == null)
{
throw new InvalidOperationException("Can't load a file via Libretro until a core is specified");
}
@ -3619,7 +3618,7 @@ namespace BizHawk.Client.EmuHawk
}
CoreFileProvider.SyncCoreCommInputSignals(nextComm);
var result = loader.LoadRom(path, nextComm);
var result = loader.LoadRom(path, nextComm, ioaRetro?.CorePath);
// we need to replace the path in the OpenAdvanced with the canonical one the user chose.
// It can't be done until loader.LoadRom happens (for CanonicalFullPath)

View File

@ -133,7 +133,7 @@ namespace BizHawk.Client.EmuHawk
bool result;
try
{
result = _ldr.LoadRom(f, _comm);
result = _ldr.LoadRom(f, _comm, null);
}
catch (Exception e)
{

View File

@ -32,9 +32,6 @@ namespace BizHawk.Emulation.Common
public int NominalWidth { get; set; } = 640;
public int NominalHeight { get; set; } = 480;
// I know we want to get rid of CoreComm, but while it's still here, I'll use it for this
public string LaunchLibretroCore { get; set; }
/// <summary>
/// Gets a message to show. reasonably annoying (dialog box), shouldn't be used most of the time
/// </summary>