NDS's firmware file contains user settings; these are over-written by sync settings, so we shouldn't allow them to impact the hash
This commit is contained in:
parent
0214f234a8
commit
85e91d722c
|
@ -259,8 +259,13 @@ namespace BizHawk.Client.Common
|
|||
continue;
|
||||
}
|
||||
|
||||
// compute its hash
|
||||
var rff = reader.Read(fi);
|
||||
// compute its hash
|
||||
RealFirmwareFile rff;
|
||||
// NDS's firmware file contains user settings; these are over-written by sync settings, so we shouldn't allow them to impact the hash
|
||||
if (fr.SystemId == "NDS" && fr.FirmwareId == "firmware")
|
||||
rff = reader.Read(new FileInfo(Emulation.Cores.Consoles.Nintendo.NDS.MelonDS.CreateModifiedFirmware(userSpec)));
|
||||
else
|
||||
rff = reader.Read(fi);
|
||||
ri.Size = fi.Length;
|
||||
ri.Hash = rff.Hash;
|
||||
|
||||
|
|
|
@ -44,8 +44,7 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
FirmwareAndOption("24F67BDEA115A2C847C8813A262502EE1607B7DF", 16384, "NDS", "bios7", "bios7.bin", "ARM7 BIOS");
|
||||
FirmwareAndOption("BFAAC75F101C135E32E2AAF541DE6B1BE4C8C62D", 4096, "NDS", "bios9", "bios9.bin", "ARM9 BIOS");
|
||||
// NDS firmware dump contains user settings, so hashes are not expected to match
|
||||
FirmwareAndOption("0000000000000000000000000000000000000000", 262144, "NDS", "firmware", "firmware.bin", "NDS Firmware");
|
||||
FirmwareAndOption("DDDDA2447AE84A77385497D8889516E8BC090418", 262144, "NDS", "firmware", "firmware.bin", "NDS Firmware (note: given hash is with blank user data)");
|
||||
|
||||
FirmwareAndOption("E4ED47FAE31693E016B081C6BDA48DA5B70D7CCB", 512, "Lynx", "Boot", "lynxboot.img", "Boot Rom");
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ using BizHawk.Emulation.Common;
|
|||
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
||||
{
|
||||
[Core("MelonDS", "Arisotura")]
|
||||
unsafe partial class MelonDS : IEmulator
|
||||
unsafe public partial class MelonDS : IEmulator
|
||||
{
|
||||
private BasicServiceProvider _serviceProvider;
|
||||
public IEmulatorServiceProvider ServiceProvider => _serviceProvider;
|
||||
|
@ -139,5 +139,26 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
else
|
||||
File.Delete("melon/firmware.bin");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a modified copy of the given firmware file, with the user settings erased.
|
||||
/// </summary>
|
||||
/// <returns>Returns a path to the new file.</returns>
|
||||
public static string CreateModifiedFirmware(string firmwarePath)
|
||||
{
|
||||
const string newPath = "melon/tohash.bin";
|
||||
byte[] bytes = File.ReadAllBytes(firmwarePath);
|
||||
|
||||
// There are two regions for user settings
|
||||
int settingsLength = getUserSettingsLength();
|
||||
for (int i = bytes.Length - 0x200; i < bytes.Length - 0x200 + settingsLength; i++)
|
||||
bytes[i] = 0xFF;
|
||||
for (int i = bytes.Length - 0x100; i < bytes.Length - 0x100 + settingsLength; i++)
|
||||
bytes[i] = 0xFF;
|
||||
|
||||
|
||||
File.WriteAllBytes(newPath, bytes);
|
||||
return newPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue