Encapsulate `LibretroHost` constructor

This commit is contained in:
YoshiRulz 2025-01-05 22:24:29 +10:00 committed by YoshiRulz
parent ddd14d5274
commit 407c26e9d5
1 changed files with 21 additions and 5 deletions

View File

@ -73,7 +73,21 @@ namespace BizHawk.Emulation.Cores.Libretro
}
}
/// <remarks>does not keep a reference to <paramref name="game"/></remarks>
public LibretroHost(CoreComm comm, IGameInfo game, string corePath, bool analysis = false)
: this(
comm,
libretroSystemDir: comm.CoreFileProvider.GetRetroSystemPath(game),
libretroSaveRAMDir: comm.CoreFileProvider.GetRetroSaveRAMDirectory(game),
corePath: corePath,
analysis: analysis) {}
public LibretroHost(
CoreComm comm,
string libretroSystemDir,
string libretroSaveRAMDir,
string corePath,
bool analysis)
{
try
{
@ -95,11 +109,13 @@ namespace BizHawk.Emulation.Cores.Libretro
throw new InvalidOperationException("Unsupported Libretro API version (or major error in interop)");
}
bridge.LibretroBridge_SetDirectories(cbHandler,
comm.CoreFileProvider.GetRetroSystemPath(game),
comm.CoreFileProvider.GetRetroSaveRAMDirectory(game),
Path.GetDirectoryName(corePath),
Path.GetDirectoryName(corePath));
var libretroCoreDir = Path.GetDirectoryName(corePath);
bridge.LibretroBridge_SetDirectories(
cbHandler,
systemDirectory: libretroSystemDir,
saveDirectory: libretroSaveRAMDir,
coreDirectory: libretroCoreDir,
coreAssetsDirectory: libretroCoreDir);
ControllerDefinition = ControllerDef;
_notify = comm.Notify;