diff options
author | gdkchan <gab.dark.100@gmail.com> | 2023-01-04 20:01:44 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-05 00:01:44 +0100 |
commit | fc4b7cba2c083b3920f2d74e0cb4b08cf7a5a278 (patch) | |
tree | baa5d9a71ee011ecbaeee9a67e037cb399eb7d0e /Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs | |
parent | 08831eecf77cedd3c4192ebab5a9c485fb15d51e (diff) |
Make PPTC state non-static (#4157)1.1.507
* Make PPTC state non-static
* DiskCacheLoadState can be null
Diffstat (limited to 'Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs')
-rw-r--r-- | Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs b/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs index 878af3f8..953f8562 100644 --- a/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs +++ b/Ryujinx.Ava/UI/ViewModels/MainWindowViewModel.cs @@ -1,4 +1,3 @@ -using ARMeilleure.Translation.PTC; using Avalonia; using Avalonia.Controls; using Avalonia.Input; @@ -18,6 +17,7 @@ using Ryujinx.Ava.UI.Windows; using Ryujinx.Common; using Ryujinx.Common.Configuration; using Ryujinx.Common.Logging; +using Ryujinx.Cpu; using Ryujinx.HLE; using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.HOS; @@ -107,9 +107,6 @@ namespace Ryujinx.Ava.UI.ViewModels { ApplicationLibrary.ApplicationCountUpdated += ApplicationLibrary_ApplicationCountUpdated; ApplicationLibrary.ApplicationAdded += ApplicationLibrary_ApplicationAdded; - - Ptc.PtcStateChanged -= ProgressHandler; - Ptc.PtcStateChanged += ProgressHandler; } public string SearchText @@ -436,7 +433,7 @@ namespace Ryujinx.Ava.UI.ViewModels OnPropertyChanged(); } } - + public bool ShowMenuAndStatusBar { get => _showMenuAndStatusBar; @@ -745,8 +742,14 @@ namespace Ryujinx.Ava.UI.ViewModels } } - public void HandleShaderProgress(Switch emulationContext) + public void SetUiProgressHandlers(Switch emulationContext) { + if (emulationContext.Application.DiskCacheLoadState != null) + { + emulationContext.Application.DiskCacheLoadState.StateChanged -= ProgressHandler; + emulationContext.Application.DiskCacheLoadState.StateChanged += ProgressHandler; + } + emulationContext.Gpu.ShaderCacheStateChanged -= ProgressHandler; emulationContext.Gpu.ShaderCacheStateChanged += ProgressHandler; } @@ -1033,16 +1036,16 @@ namespace Ryujinx.Ava.UI.ViewModels switch (state) { - case PtcLoadingState ptcState: + case LoadState ptcState: CacheLoadStatus = $"{current} / {total}"; switch (ptcState) { - case PtcLoadingState.Start: - case PtcLoadingState.Loading: + case LoadState.Unloaded: + case LoadState.Loading: LoadHeading = LocaleManager.Instance[LocaleKeys.CompilingPPTC]; IsLoadingIndeterminate = false; break; - case PtcLoadingState.Loaded: + case LoadState.Loaded: LoadHeading = string.Format(LocaleManager.Instance[LocaleKeys.LoadingHeading], TitleName); IsLoadingIndeterminate = true; CacheLoadStatus = ""; @@ -1166,7 +1169,7 @@ namespace Ryujinx.Ava.UI.ViewModels DirectoryInfo backupDir = new(Path.Combine(AppDataManager.GamesDirPath, selection.TitleId, "cache", "cpu", "1")); // FIXME: Found a way to reproduce the bold effect on the title name (fork?). - UserResult result = await ContentDialogHelper.CreateConfirmationDialog(LocaleManager.Instance[LocaleKeys.DialogWarning], + UserResult result = await ContentDialogHelper.CreateConfirmationDialog(LocaleManager.Instance[LocaleKeys.DialogWarning], string.Format(LocaleManager.Instance[LocaleKeys.DialogPPTCDeletionMessage], selection.TitleName), LocaleManager.Instance[LocaleKeys.InputDialogYes], LocaleManager.Instance[LocaleKeys.InputDialogNo], |