cleanup 3DS firmware handling

seems these methods aren't really supported in citra, so I guess have fun dealing with manually setting firmware files
This commit is contained in:
CasualPokePlayer 2023-07-23 21:22:26 -07:00
parent 18b81a2011
commit 67510f3b56
2 changed files with 8 additions and 45 deletions

View File

@ -165,22 +165,10 @@ namespace BizHawk.Emulation.Common
FirmwareAndOption(SHA1Checksum.Dummy, 251658240 + 64, "NDS", "NAND (CHN)", "DSi_Nand_CHN.bin", "DSi NAND (China)");
FirmwareAndOption(SHA1Checksum.Dummy, 251658240 + 64, "NDS", "NAND (KOR)", "DSi_Nand_KOR.bin", "DSi NAND (Korea)");
FirmwareAndOption("5A3D3D6DF4743E6B50AFE0FC717FA8A12BC888E6", 65536, "3DS", "boot9", "3DS_Boot9.bin", "ARM9 BIOS");
FirmwareAndOption("B9CFA84916A930D272250130D67CEB822141177D", 512, "3DS", "sector0x96", "sector0x96.bin", "Secret Section");
// bleh, undefined hash AND size...
FirmwareAndOption(SHA1Checksum.Dummy, 0, "3DS", "aes_keys", "aes_keys.txt", "AES Keys");
FirmwareAndOption(SHA1Checksum.Dummy, 0, "3DS", "seeddb", "seeddb.bin", "SEEDDB");
Firmware("3DS", "NATIVE_FIRM", "3DS Native Firmware");
// TODO: add the other 26 native firmware versions!!!
var o3ds_nf_v27476 = File("4DBEB23726B1516FE7B4691BA8DB5602FE49CDA0", 984320, "0004013800000002.cia", "3DS Native Firmware (11.3.0-36)");
Option("3DS", "NATIVE_FIRM", in o3ds_nf_v27476, FirmwareOptionStatus.Ideal);
Firmware("3DS", "SAFE_MODE_FIRM", "3DS Safe Mode Firmware");
var o3ds_smf_v432 = File("58732AA986BCC7570AC63A1BB2B6865CC6DE215E", 861440, "0004013800000003.cia", "3DS Safe Mode Firmware (1.0.0-0)");
var o3ds_smf_v5632 = File("0FD265D5CF251E70EAC455C91DAD39447EDEEA57", 861440, "0004013800000003.cia", "3DS Safe Mode Firmware (3.0.0-5)");
Option("3DS", "SAFE_MODE_FIRM", in o3ds_smf_v432);
Option("3DS", "SAFE_MODE_FIRM", in o3ds_smf_v5632, FirmwareOptionStatus.Ideal);
FirmwareAndOption("2C25467FA2FADB73EB3A137072643C65033B0483", 1012992, "3DS", "N3DS_SAFE_MODE_FIRM", "0004013820000003.cia", "New 3DS Safe Mode Firmware");
FirmwareAndOption("E4ED47FAE31693E016B081C6BDA48DA5B70D7CCB", 512, "Lynx", "Boot", "LYNX_boot.img", "Boot Rom");
FirmwareAndOption("5A65B922B562CB1F57DAB51B73151283F0E20C7A", 8192, "INTV", "EROM", "INTV_EROM.bin", "Executive Rom");

View File

@ -88,49 +88,24 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo._3DS
_serviceProvider.Register<IVideoProvider>(_citraVideoProvider);
var boot9 = lp.Comm.CoreFileProvider.GetFirmware(new("3DS", "boot9"));
if (boot9 is not null)
var sysDataDir = Path.Combine(_userPath, "sysdata");
if (!Directory.Exists(sysDataDir))
{
File.WriteAllBytes(Path.Combine(_userPath, "sysdata", "boot9.bin"), boot9);
Directory.CreateDirectory(sysDataDir);
}
var sector0x96 = lp.Comm.CoreFileProvider.GetFirmware(new("3DS", "sector0x96"));
if (sector0x96 is not null)
var aesKeys = lp.Comm.CoreFileProvider.GetFirmware(new("3DS", "aes_keys"));
if (aesKeys is not null)
{
File.WriteAllBytes(Path.Combine(_userPath, "sysdata", "sector0x96.bin"), sector0x96);
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(_userPath, "sysdata", "seeddb.bin"), seeddb);
File.WriteAllBytes(Path.Combine(sysDataDir, "seeddb.bin"), seeddb);
}
void InstallFirmCia(string firmName)
{
var firm = lp.Comm.CoreFileProvider.GetFirmware(new("3DS", firmName));
if (firm is not null)
{
var firmCia = TempFileManager.GetTempFilename(firmName, ".cia", false);
try
{
File.WriteAllBytes(firmCia, firm);
var message = new byte[1024];
_core.Citra_InstallCIA(_context, firmCia, true, message, message.Length);
// InstallCIA returns false as these CIAs should not be executable
Util.DebugWriteLine(Encoding.UTF8.GetString(message).TrimEnd());
}
finally
{
TempFileManager.RenameTempFilenameForDelete(firmCia);
}
}
}
InstallFirmCia("NATIVE_FIRM");
InstallFirmCia("SAFE_MODE_FIRM");
InstallFirmCia("N3DS_SAFE_MODE_FIRM");
var romPath = lp.Roms[0].RomPath;
if (lp.Roms[0].Extension.ToLowerInvariant() == ".cia")
{