Prevent annoying waits when using firmware manager with DSi NANDs present
This commit is contained in:
parent
5f6d70ac46
commit
36fae775d4
|
@ -15,6 +15,7 @@ namespace BizHawk.Client.Common
|
||||||
public sealed class FirmwareManager
|
public sealed class FirmwareManager
|
||||||
{
|
{
|
||||||
private static readonly FirmwareID NDS_FIRMWARE = new("NDS", "firmware");
|
private static readonly FirmwareID NDS_FIRMWARE = new("NDS", "firmware");
|
||||||
|
private const int DSI_NAND_LENGTH = 251658240 + 64;
|
||||||
|
|
||||||
public static (byte[] Patched, string ActualHash) PerformPatchInMemory(byte[] @base, in FirmwarePatchOption patchOption)
|
public static (byte[] Patched, string ActualHash) PerformPatchInMemory(byte[] @base, in FirmwarePatchOption patchOption)
|
||||||
{
|
{
|
||||||
|
@ -101,6 +102,15 @@ namespace BizHawk.Client.Common
|
||||||
public RealFirmwareFile Read(FileInfo fi)
|
public RealFirmwareFile Read(FileInfo fi)
|
||||||
{
|
{
|
||||||
using var fs = fi.OpenRead();
|
using var fs = fi.OpenRead();
|
||||||
|
|
||||||
|
// DSi NAND is huge, and the hash is useless (can't use it to identify a good dump)
|
||||||
|
// Not sure how well the system can handle a dummy hash, so let's just hash the nocash footer (which should be unique for each NAND)
|
||||||
|
if (fs.Length == DSI_NAND_LENGTH)
|
||||||
|
{
|
||||||
|
fs.Seek(-64, SeekOrigin.End);
|
||||||
|
// we can let it fall through here, as ReadAllBytes just reads all bytes starting from the stream position :)
|
||||||
|
}
|
||||||
|
|
||||||
var hash = SHA1Checksum.ComputeDigestHex(fs.ReadAllBytes());
|
var hash = SHA1Checksum.ComputeDigestHex(fs.ReadAllBytes());
|
||||||
return _dict![hash] = new RealFirmwareFile(fi, hash);
|
return _dict![hash] = new RealFirmwareFile(fi, hash);
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,12 +158,12 @@ namespace BizHawk.Emulation.Common
|
||||||
FirmwareAndOption(SHA1Checksum.Dummy, 131072, "NDS", "firmwarei", "DSi_Firmware.bin", "DSi Firmware");
|
FirmwareAndOption(SHA1Checksum.Dummy, 131072, "NDS", "firmwarei", "DSi_Firmware.bin", "DSi Firmware");
|
||||||
// options for each region due to region locking of the DSi
|
// options for each region due to region locking of the DSi
|
||||||
// also, the sizes include the "nocash footer" which contains the eMMC CID and CPU/Console ID
|
// also, the sizes include the "nocash footer" which contains the eMMC CID and CPU/Console ID
|
||||||
FirmwareAndOption(SHA1Checksum.Dummy, 251658264 + 40, "NDS", "NAND (JPN)", "DSi_Nand_JPN.bin", "DSi NAND (Japan)");
|
FirmwareAndOption(SHA1Checksum.Dummy, 251658240 + 64, "NDS", "NAND (JPN)", "DSi_Nand_JPN.bin", "DSi NAND (Japan)");
|
||||||
FirmwareAndOption(SHA1Checksum.Dummy, 251658264 + 40, "NDS", "NAND (EUR)", "DSi_Nand_EUR.bin", "DSi NAND (Europe)");
|
FirmwareAndOption(SHA1Checksum.Dummy, 251658240 + 64, "NDS", "NAND (EUR)", "DSi_Nand_EUR.bin", "DSi NAND (Europe)");
|
||||||
FirmwareAndOption(SHA1Checksum.Dummy, 251658264 + 40, "NDS", "NAND (USA)", "DSi_Nand_USA.bin", "DSi NAND (USA)");
|
FirmwareAndOption(SHA1Checksum.Dummy, 251658240 + 64, "NDS", "NAND (USA)", "DSi_Nand_USA.bin", "DSi NAND (USA)");
|
||||||
FirmwareAndOption(SHA1Checksum.Dummy, 251658264 + 40, "NDS", "NAND (AUS)", "DSi_Nand_AUS.bin", "DSi NAND (Australia)");
|
FirmwareAndOption(SHA1Checksum.Dummy, 251658240 + 64, "NDS", "NAND (AUS)", "DSi_Nand_AUS.bin", "DSi NAND (Australia)");
|
||||||
FirmwareAndOption(SHA1Checksum.Dummy, 251658264 + 40, "NDS", "NAND (CHN)", "DSi_Nand_CHN.bin", "DSi NAND (China)");
|
FirmwareAndOption(SHA1Checksum.Dummy, 251658240 + 64, "NDS", "NAND (CHN)", "DSi_Nand_CHN.bin", "DSi NAND (China)");
|
||||||
FirmwareAndOption(SHA1Checksum.Dummy, 251658264 + 40, "NDS", "NAND (KOR)", "DSi_Nand_KOR.bin", "DSi NAND (Korea)");
|
FirmwareAndOption(SHA1Checksum.Dummy, 251658240 + 64, "NDS", "NAND (KOR)", "DSi_Nand_KOR.bin", "DSi NAND (Korea)");
|
||||||
|
|
||||||
FirmwareAndOption("E4ED47FAE31693E016B081C6BDA48DA5B70D7CCB", 512, "Lynx", "Boot", "LYNX_boot.img", "Boot Rom");
|
FirmwareAndOption("E4ED47FAE31693E016B081C6BDA48DA5B70D7CCB", 512, "Lynx", "Boot", "LYNX_boot.img", "Boot Rom");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue