Change return type of `BootGodDb.Identify` to `IReadOnlyList`

This commit is contained in:
YoshiRulz 2024-08-23 16:51:40 +10:00
parent fc446868a7
commit b99a3831e9
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 4 additions and 4 deletions

View File

@ -150,15 +150,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
} //end xmlreader loop
}
public static List<CartInfo> Identify(string sha1)
public static IReadOnlyList<CartInfo> Identify(string sha1)
{
#if BIZHAWKBUILD_GAMEDB_ALWAYS_MISS
_ = sha1;
return new(capacity: 0);
return Array.Empty<CartInfo>();
#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.TryGetValue(sha1, out var l) ? l : new(capacity: 0);
return instance._sha1Table.TryGetValue(sha1, out var l) ? l : Array.Empty<CartInfo>();
#endif
}
}

View File

@ -141,7 +141,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
foreach (var hash in hash_sha1)
{
List<CartInfo> choices = BootGodDb.Identify(hash);
var choices = BootGodDb.Identify(hash);
//pick the first board for this hash arbitrarily. it probably doesn't make a difference
if (choices.Count != 0)
return choices[0];