void ComputeBootGod() { // inefficient, sloppy, etc etc Emulation.Cores.Nintendo.NES.NES.BootGodDB.Initialize(); var chrrom = _memoryDomains["CHR VROM"]; var prgrom = _memoryDomains["PRG ROM"]; var ms = new System.IO.MemoryStream(); for (int i = 0; i < prgrom.Size; i++) { ms.WriteByte(prgrom.PeekByte(i)); } if (chrrom != null) { for (int i = 0; i < chrrom.Size; i++) { ms.WriteByte(chrrom.PeekByte(i)); } } string sha1 = BizHawk.Common.BufferExtensions.BufferExtensions.HashSHA1(ms.ToArray()); Console.WriteLine("Hash for BootGod: {0}", sha1); // Bail out on ROM's known to not be playable by this core if (HashBlackList.Contains(sha1)) { throw new UnsupportedGameException("Game known to not be playable in this core"); } sha1 = "sha1:" + sha1; // huh? var carts = Emulation.Cores.Nintendo.NES.NES.BootGodDB.Instance.Identify(sha1); if (carts.Count > 0) { Console.WriteLine("BootGod entry found: {0}", carts[0].name); switch (carts[0].system) { case "NES-PAL": case "NES-PAL-A": case "NES-PAL-B": case "Dendy": Console.WriteLine("Bad region {0}! Failing over...", carts[0].system); throw new UnsupportedGameException("Unsupported region!"); default: break; } BootGodStatus = RomStatus.GoodDump; BootGodName = carts[0].name; } else { Console.WriteLine("No BootGod entry found."); BootGodStatus = null; BootGodName = null; } }
private void ComputeBootGod() { // inefficient, sloppy, etc etc var chrrom = _memoryDomains["CHR VROM"]; var prgrom = _memoryDomains["PRG ROM"] !; var ms = new MemoryStream(); for (int i = 0; i < prgrom.Size; i++) { ms.WriteByte(prgrom.PeekByte(i)); } if (chrrom != null) { for (int i = 0; i < chrrom.Size; i++) { ms.WriteByte(chrrom.PeekByte(i)); } } var sha1 = SHA1Checksum.ComputeDigestHex(ms.ToArray()); Console.WriteLine("Hash for BootGod: {0}", sha1); // Bail out on ROM's known to not be playable by this core if (HashBlackList.Contains(sha1)) { throw new UnsupportedGameException("Game known to not be playable in this core"); } sha1 = "sha1:" + sha1; // huh? var carts = BootGodDb.Identify(sha1); if (carts.Count > 0) { Console.WriteLine("BootGod entry found: {0}", carts[0].Name); switch (carts[0].System) { case "NES-PAL": case "NES-PAL-A": case "NES-PAL-B": case "Dendy": Console.WriteLine("Bad region {0}! Failing over...", carts[0].System); throw new UnsupportedGameException("Unsupported region!"); } BootGodStatus = RomStatus.GoodDump; BootGodName = carts[0].Name; } else { Console.WriteLine("No BootGod entry found."); BootGodStatus = null; BootGodName = null; } }