encore: fix aes_keys.txt / seeddb.bin not being properly picked up by the core

This commit is contained in:
CasualPokePlayer 2024-03-08 19:12:54 -08:00
parent 32b6f7d937
commit 59176ca2d3
1 changed files with 20 additions and 18 deletions

View File

@ -64,6 +64,26 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
_userPath = lp.Comm.CoreFileProvider.GetUserPath(SystemId, temp: DeterministicEmulation && _syncSettings.TempUserFolder) + Path.DirectorySeparatorChar;
_userPath = _userPath.Replace('\\', '/'); // Encore doesn't like backslashes in the user folder, for whatever reason
// copy firmware over to the user folder
// this must be done before Encore_CreateContext is called!
var sysDataDir = Path.Combine(_userPath, "sysdata");
if (!Directory.Exists(sysDataDir))
{
Directory.CreateDirectory(sysDataDir);
}
var aesKeys = lp.Comm.CoreFileProvider.GetFirmware(new("3DS", "aes_keys"));
if (aesKeys is not null)
{
File.WriteAllBytes(Path.Combine(sysDataDir, "aes_keys.txt"), aesKeys);
}
var seeddb = lp.Comm.CoreFileProvider.GetFirmware(new("3DS", "seeddb"));
if (seeddb is not null)
{
File.WriteAllBytes(Path.Combine(sysDataDir, "seeddb.bin"), seeddb);
}
_configCallbackInterface.GetBoolean = GetBooleanSettingCallback;
_configCallbackInterface.GetInteger = GetIntegerSettingCallback;
_configCallbackInterface.GetFloat = GetFloatSettingCallback;
@ -100,24 +120,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS
_serviceProvider.Register<IVideoProvider>(_encoreVideoProvider);
var sysDataDir = Path.Combine(_userPath, "sysdata");
if (!Directory.Exists(sysDataDir))
{
Directory.CreateDirectory(sysDataDir);
}
var aesKeys = lp.Comm.CoreFileProvider.GetFirmware(new("3DS", "aes_keys"));
if (aesKeys is not null)
{
File.WriteAllBytes(Path.Combine(sysDataDir, "aes_keys.txt"), aesKeys);
}
var seeddb = lp.Comm.CoreFileProvider.GetFirmware(new("3DS", "seeddb"));
if (seeddb is not null)
{
File.WriteAllBytes(Path.Combine(sysDataDir, "seeddb.bin"), seeddb);
}
var romPath = lp.Roms[0].RomPath;
if (lp.Roms[0].Extension.ToLowerInvariant() == ".cia")
{