From b99a3831e9db2b4be2b72f36ee79d67b98766581 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Fri, 23 Aug 2024 16:51:40 +1000 Subject: [PATCH] Change return type of `BootGodDb.Identify` to `IReadOnlyList` --- .../Consoles/Nintendo/NES/BootGodDB.cs | 6 +++--- .../Consoles/Nintendo/NES/NES.BoardSystem.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/BootGodDB.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/BootGodDB.cs index b314e592b2..10d759d04a 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/BootGodDB.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/BootGodDB.cs @@ -150,15 +150,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES } //end xmlreader loop } - public static List Identify(string sha1) + public static IReadOnlyList Identify(string sha1) { #if BIZHAWKBUILD_GAMEDB_ALWAYS_MISS _ = sha1; - return new(capacity: 0); + return Array.Empty(); #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(); #endif } } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.BoardSystem.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.BoardSystem.cs index 756da13f86..052a4fabb1 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.BoardSystem.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NES.BoardSystem.cs @@ -141,7 +141,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES { foreach (var hash in hash_sha1) { - List 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];