From 23e4eed70d04c88d2282fef3ff75dcc90fc09460 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 19 Jun 2011 02:21:17 +0000 Subject: [PATCH] tweak game database hashing to be less upsetting --- BizHawk.Emulation/Database/Database.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BizHawk.Emulation/Database/Database.cs b/BizHawk.Emulation/Database/Database.cs index e1ebc665cc..c90d472d82 100644 --- a/BizHawk.Emulation/Database/Database.cs +++ b/BizHawk.Emulation/Database/Database.cs @@ -55,12 +55,8 @@ namespace BizHawk public static GameInfo CheckDatabase(string hash) { GameInfo ret = null; - if (!db.TryGetValue(hash, out ret)) - { - //try removing hash type identifier - hash = RemoveHashType(hash); - db.TryGetValue(hash, out ret); - } + hash = RemoveHashType(hash); + db.TryGetValue(hash, out ret); return ret; } @@ -117,6 +113,10 @@ namespace BizHawk if (db.TryGetValue(hash, out ret)) return ret; + hash = Util.BytesToHexString(System.Security.Cryptography.SHA1.Create().ComputeHash(RomData)); + if (db.TryGetValue(hash, out ret)) + return ret; + hash = Util.BytesToHexString(System.Security.Cryptography.MD5.Create().ComputeHash(RomData)); if (db.TryGetValue(hash, out ret)) return ret;