Clean up dummy/zero checksums

see #3159
This commit is contained in:
YoshiRulz 2022-02-20 23:34:16 +10:00
parent 9092a38a82
commit 296145ba2d
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
5 changed files with 16 additions and 6 deletions

View File

@ -112,7 +112,7 @@ namespace BizHawk.Client.Common
}
else
{
ret.GI.Hash = "0000000000000000000000000000000000000000";
ret.GI.Hash = SHA1Checksum.Zero;
}
return ret;

View File

@ -17,6 +17,8 @@ namespace BizHawk.Common
internal const string PREFIX = "MD5";
public /*static readonly*/const string EmptyFile = "D41D8CD98F00B204E9800998ECF8427E";
#if NET6_0
public static byte[] Compute(ReadOnlySpan<byte> data)
=> MD5.HashData(data);

View File

@ -17,6 +17,12 @@ namespace BizHawk.Common
internal const string PREFIX = "SHA1";
public /*static readonly*/const string Dummy = "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE";
public /*static readonly*/const string EmptyFile = "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709";
public /*static readonly*/const string Zero = "0000000000000000000000000000000000000000";
#if NET6_0
public static byte[] Compute(ReadOnlySpan<byte> data)
=> SHA1.HashData(data);

View File

@ -152,7 +152,7 @@ namespace BizHawk.Emulation.Common
Region = items.Length >= 7 ? items[6] : "",
ForcedCore = items.Length >= 8 ? items[7].ToLowerInvariant() : ""
};
if (game.Hash is "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709" or "D41D8CD98F00B204E9800998ECF8427E")
if (game.Hash is SHA1Checksum.EmptyFile or MD5Checksum.EmptyFile)
{
Console.WriteLine($"WARNING: gamedb {path} contains entry for empty rom as \"{game.Name}\"!");
}

View File

@ -3,6 +3,8 @@
using System.Collections.Generic;
using System.Linq;
using BizHawk.Common;
// ReSharper disable IdentifierTypo
// ReSharper disable InconsistentNaming
// ReSharper disable StringLiteralTypo
@ -114,8 +116,8 @@ namespace BizHawk.Emulation.Common
FirmwareAndOption("24F67BDEA115A2C847C8813A262502EE1607B7DF", 16384, "NDS", "bios7", "NDS_Bios7.bin", "ARM7 BIOS");
FirmwareAndOption("BFAAC75F101C135E32E2AAF541DE6B1BE4C8C62D", 4096, "NDS", "bios9", "NDS_Bios9.bin", "ARM9 BIOS");
FirmwareAndOption("0000000000000000000000000000000000000000", 65536, "NDS", "bios7i", "NDS_Bios7i.bin", "ARM7i BIOS");
FirmwareAndOption("0000000000000000000000000000000000000000", 65536, "NDS", "bios9i", "NDS_Bios9i.bin", "ARM9i BIOS");
FirmwareAndOption(SHA1Checksum.Dummy, 65536, "NDS", "bios7i", "NDS_Bios7i.bin", "ARM7i BIOS");
FirmwareAndOption(SHA1Checksum.Dummy, 65536, "NDS", "bios9i", "NDS_Bios9i.bin", "ARM9i BIOS");
Firmware("NDS", "firmware", "NDS Firmware");
// throwing a ton of hashes from the interwebs
var knownhack1 = File("22A7547DBC302BCBFB4005CFB5A2D426D3F85AC6", 262144, "NDS_Firmware [b1].bin", "NDS Firmware", "known hack", true);
@ -131,8 +133,8 @@ namespace BizHawk.Emulation.Common
Option("NDS", "firmware", in likelygood2);
Option("NDS", "firmware", in likelygood3);
FirmwareAndOption("0000000000000000000000000000000000000000", 131072, "NDS", "firmwarei", "DSi_Firmware.bin", "DSi Firmware");
FirmwareAndOption("0000000000000000000000000000000000000000", 251658304, "NDS", "nand", "DSi_Nand.bin", "DSi NAND");
FirmwareAndOption(SHA1Checksum.Dummy, 131072, "NDS", "firmwarei", "DSi_Firmware.bin", "DSi Firmware");
FirmwareAndOption(SHA1Checksum.Dummy, 251658304, "NDS", "nand", "DSi_Nand.bin", "DSi NAND");
FirmwareAndOption("E4ED47FAE31693E016B081C6BDA48DA5B70D7CCB", 512, "Lynx", "Boot", "LYNX_boot.img", "Boot Rom");