From e6644626fceaed218b6a393deb7ee382aa304750 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Wed, 25 Dec 2024 00:06:29 -0600 Subject: [PATCH] UI: Fix negative space savings in XCI trimmer --- .../UI/Helpers/XCITrimmerFileSpaceSavingsConverter.cs | 5 +++-- src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx/UI/Helpers/XCITrimmerFileSpaceSavingsConverter.cs b/src/Ryujinx/UI/Helpers/XCITrimmerFileSpaceSavingsConverter.cs index c6e814e90..14e8e178a 100644 --- a/src/Ryujinx/UI/Helpers/XCITrimmerFileSpaceSavingsConverter.cs +++ b/src/Ryujinx/UI/Helpers/XCITrimmerFileSpaceSavingsConverter.cs @@ -1,6 +1,7 @@ using Avalonia; using Avalonia.Data; using Avalonia.Data.Converters; +using Gommon; using Ryujinx.Ava.Common.Locale; using Ryujinx.UI.Common.Models; using System; @@ -32,11 +33,11 @@ namespace Ryujinx.Ava.UI.Helpers if (app.CurrentSavingsB < app.PotentialSavingsB) { - return LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.TitleXCICanSaveLabel, (app.PotentialSavingsB - app.CurrentSavingsB) / _bytesPerMB); + return LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.TitleXCICanSaveLabel, ((app.PotentialSavingsB - app.CurrentSavingsB) / _bytesPerMB).CoerceAtLeast(0)); } else { - return LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.TitleXCISavingLabel, app.CurrentSavingsB / _bytesPerMB); + return LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.TitleXCISavingLabel, (app.CurrentSavingsB / _bytesPerMB).CoerceAtLeast(0)); } } diff --git a/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs b/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs index 1bca27330..402b182af 100644 --- a/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/XCITrimmerViewModel.cs @@ -364,7 +364,7 @@ namespace Ryujinx.Ava.UI.ViewModels value = _processingApplication.Value with { PercentageProgress = null }; if (value.HasValue) - _displayedXCIFiles.ReplaceWith(value.Value); + _displayedXCIFiles.ReplaceWith(value); _processingApplication = value; OnPropertyChanged();