prefer ideal firmware over acceptable firmware

see #3974
This commit is contained in:
Morilli 2024-08-18 03:30:31 +02:00
parent fa08002fbf
commit 963b925a1a
1 changed files with 6 additions and 3 deletions

View File

@ -161,9 +161,12 @@ namespace BizHawk.Client.Common
foreach (var fr in FirmwareDatabase.FirmwareRecords)
{
_resolutionDictionary.Remove(fr); // clear previous resolution results
// check each acceptable option for this firmware, looking for the first that's in the reader's file list
var found = FirmwareDatabase.FirmwareOptions.FirstOrNull(fo1 => fo1.ID == fr.ID && fo1.IsAcceptableOrIdeal
&& reader.Dict.ContainsKey(fo1.Hash));
// check each acceptable option for this firmware, looking for the first available sorted by status
var found = FirmwareDatabase.FirmwareOptions
.Where(fo1 => fo1.ID == fr.ID && fo1.IsAcceptableOrIdeal && reader.Dict.ContainsKey(fo1.Hash))
.OrderByDescending(fo => fo.Status)
.Cast<FirmwareOption?>()
.FirstOrDefault();
if (found == null) continue; // didn't find any of them
var fo = found.Value;
// else found one, add it to the dict