From 8a2bc3957a7826b712a2661553a184dd522e8a8d Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Sun, 5 Jan 2025 15:45:01 -0600 Subject: [PATCH] UI: fix: new updates not being autoloaded --- src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs b/src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs index 28b4262f1..bb98003cf 100644 --- a/src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs +++ b/src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs @@ -1,4 +1,5 @@ using DynamicData; +using DynamicData.Kernel; using Gommon; using LibHac; using LibHac.Common; @@ -1069,10 +1070,11 @@ namespace Ryujinx.Ava.Utilities.AppLibrary { if (update == null) return false; - var currentlySelected = TitleUpdates.Items.FindFirst(it => + var currentlySelected = TitleUpdates.Items.FirstOrOptional(it => it.TitleUpdate.TitleIdBase == update.TitleIdBase && it.IsSelected); - var shouldSelect = currentlySelected.Check(curr => curr.TitleUpdate?.Version < update.Version); + var shouldSelect = !currentlySelected.HasValue || + currentlySelected.Value.TitleUpdate.Version < update.Version; _titleUpdates.AddOrUpdate((update, shouldSelect)); @@ -1463,7 +1465,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary TitleUpdatesHelper.LoadTitleUpdatesJson(_virtualFileSystem, application.IdBase); it.AddOrUpdate(savedUpdates); - var selectedUpdate = savedUpdates.FindFirst(update => update.IsSelected); + var selectedUpdate = savedUpdates.FirstOrOptional(update => update.IsSelected); if (TryGetTitleUpdatesFromFile(application.Path, out var bundledUpdates)) { @@ -1475,7 +1477,7 @@ namespace Ryujinx.Ava.Utilities.AppLibrary if (!savedUpdateLookup.Contains(update)) { bool shouldSelect = false; - if (selectedUpdate.Check(su => su.Update?.Version < update.Version)) + if (!selectedUpdate.HasValue || selectedUpdate.Value.Item1.Version < update.Version) { shouldSelect = true; _titleUpdates.AddOrUpdate((selectedUpdate.Value.Update, false));