Add feature flag to disable the gamedb
This commit is contained in:
parent
c319bf5fb8
commit
d9331c5a28
|
@ -187,6 +187,10 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
public static GameInfo CheckDatabase(string hash)
|
||||
{
|
||||
#if BIZHAWKBUILD_GAMEDB_ALWAYS_MISS
|
||||
_ = hash;
|
||||
return null;
|
||||
#else
|
||||
_acquire.WaitOne();
|
||||
|
||||
var hashFormatted = FormatHash(hash);
|
||||
|
@ -198,13 +202,16 @@ namespace BizHawk.Emulation.Common
|
|||
}
|
||||
|
||||
return new GameInfo(cgi);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static GameInfo GetGameInfo(byte[] romData, string fileName)
|
||||
{
|
||||
var hashSHA1 = SHA1Checksum.ComputeDigestHex(romData);
|
||||
|
||||
#if !BIZHAWKBUILD_GAMEDB_ALWAYS_MISS
|
||||
_acquire.WaitOne();
|
||||
|
||||
var hashSHA1 = SHA1Checksum.ComputeDigestHex(romData);
|
||||
if (DB.TryGetValue(hashSHA1, out var cgi))
|
||||
{
|
||||
return new GameInfo(cgi);
|
||||
|
@ -221,6 +228,7 @@ namespace BizHawk.Emulation.Common
|
|||
{
|
||||
return new GameInfo(cgi);
|
||||
}
|
||||
#endif
|
||||
|
||||
// rom is not in database. make some best-guesses
|
||||
var game = new GameInfo
|
||||
|
@ -230,7 +238,9 @@ namespace BizHawk.Emulation.Common
|
|||
NotInDatabase = true
|
||||
};
|
||||
|
||||
#if !BIZHAWKBUILD_GAMEDB_ALWAYS_MISS
|
||||
Console.WriteLine($"Game was not in DB. CRC: {hashCRC32} MD5: {hashMD5}");
|
||||
#endif
|
||||
|
||||
var ext = Path.GetExtension(fileName)?.ToUpperInvariant();
|
||||
|
||||
|
|
|
@ -51,11 +51,16 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
|
|||
|
||||
public static bool IsMAMEMachine(string path)
|
||||
{
|
||||
#if BIZHAWKBUILD_GAMEDB_ALWAYS_MISS
|
||||
_ = path;
|
||||
return false;
|
||||
#else
|
||||
if (_acquire == null) throw new InvalidOperationException("MAME Machine DB not initialized. It's a client responsibility because only a client knows where the database is located.");
|
||||
if (HawkFile.PathContainsPipe(path)) return false; // binded archive, can't be a mame zip (note | is not a legal filesystem char, at least on windows)
|
||||
if (Path.GetExtension(path).ToLowerInvariant() is not ".zip" and not ".7z") return false;
|
||||
_acquire.WaitOne();
|
||||
return Instance.MachineDB.Contains(Path.GetFileNameWithoutExtension(path).ToLowerInvariant());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,9 +151,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
|
||||
public static List<CartInfo> Identify(string sha1)
|
||||
{
|
||||
#if BIZHAWKBUILD_GAMEDB_ALWAYS_MISS
|
||||
_ = sha1;
|
||||
return new(capacity: 0);
|
||||
#else
|
||||
if (acquire == null) throw new InvalidOperationException("Bootgod DB not initialized. It's a client responsibility because only a client knows where the database is located.");
|
||||
acquire.WaitOne();
|
||||
return instance._sha1Table[sha1];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue