0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-22 18:05:46 +00:00

misc: More cleanup changes

This commit is contained in:
Evan Husted 2024-10-16 19:32:18 -05:00
parent 1800ecc1b4
commit a13cf098b4
2 changed files with 18 additions and 27 deletions

View file

@ -6,7 +6,6 @@ using Avalonia.Media;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using Avalonia.Threading; using Avalonia.Threading;
using DynamicData; using DynamicData;
using DynamicData.Alias;
using DynamicData.Binding; using DynamicData.Binding;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using LibHac.Common; using LibHac.Common;
@ -115,12 +114,13 @@ namespace Ryujinx.Ava.UI.ViewModels
public MainWindowViewModel() public MainWindowViewModel()
{ {
Applications = new ObservableCollectionExtended<ApplicationData>(); Applications = [];
Applications.ToObservableChangeSet() Applications.ToObservableChangeSet()
.Filter(Filter) .Filter(Filter)
.Sort(GetComparer()) .Sort(GetComparer())
.Bind(out _appsObservableList).AsObservableList(); .Bind(out _appsObservableList)
.AsObservableList();
_rendererWaitEvent = new AutoResetEvent(false); _rendererWaitEvent = new AutoResetEvent(false);
@ -1114,7 +1114,7 @@ namespace Ryujinx.Ava.UI.ViewModels
private void ProgressHandler<T>(T state, int current, int total) where T : Enum private void ProgressHandler<T>(T state, int current, int total) where T : Enum
{ {
Dispatcher.UIThread.Post((() => Dispatcher.UIThread.Post(() =>
{ {
ProgressMaximum = total; ProgressMaximum = total;
ProgressValue = current; ProgressValue = current;
@ -1160,7 +1160,7 @@ namespace Ryujinx.Ava.UI.ViewModels
default: default:
throw new ArgumentException($"Unknown Progress Handler type {typeof(T)}"); throw new ArgumentException($"Unknown Progress Handler type {typeof(T)}");
} }
})); });
} }
private void PrepareLoadScreen() private void PrepareLoadScreen()
@ -1231,15 +1231,15 @@ namespace Ryujinx.Ava.UI.ViewModels
{ {
Dispatcher.UIThread.InvokeAsync(() => Dispatcher.UIThread.InvokeAsync(() =>
{ {
Application.Current.Styles.TryGetResource(args.VSyncEnabled Application.Current!.Styles.TryGetResource(args.VSyncEnabled
? "VsyncEnabled" ? "VsyncEnabled"
: "VsyncDisabled", : "VsyncDisabled",
Application.Current.ActualThemeVariant, Application.Current.ActualThemeVariant,
out object color); out object color);
if (color is not null) if (color is Color clr)
{ {
VsyncColor = new SolidColorBrush((Color)color); VsyncColor = new SolidColorBrush(clr);
} }
DockedStatusText = args.DockedMode; DockedStatusText = args.DockedMode;
@ -1534,14 +1534,12 @@ namespace Ryujinx.Ava.UI.ViewModels
public async Task LoadDlcFromFolder() public async Task LoadDlcFromFolder()
{ {
await LoadContentFromFolder(LocaleKeys.AutoloadDlcAddedMessage, await LoadContentFromFolder(LocaleKeys.AutoloadDlcAddedMessage, ApplicationLibrary.AutoLoadDownloadableContents);
dirs => ApplicationLibrary.AutoLoadDownloadableContents(dirs));
} }
public async Task LoadTitleUpdatesFromFolder() public async Task LoadTitleUpdatesFromFolder()
{ {
await LoadContentFromFolder(LocaleKeys.AutoloadUpdateAddedMessage, await LoadContentFromFolder(LocaleKeys.AutoloadUpdateAddedMessage, ApplicationLibrary.AutoLoadTitleUpdates);
dirs => ApplicationLibrary.AutoLoadTitleUpdates(dirs));
} }
public async Task OpenFolder() public async Task OpenFolder()
@ -1655,7 +1653,10 @@ namespace Ryujinx.Ava.UI.ViewModels
{ {
version = ContentManager.GetCurrentFirmwareVersion(); version = ContentManager.GetCurrentFirmwareVersion();
} }
catch (Exception) { } catch (Exception)
{
// ignored
}
bool hasApplet = false; bool hasApplet = false;
@ -1752,12 +1753,7 @@ namespace Ryujinx.Ava.UI.ViewModels
string mainMessage = LocaleManager.Instance[LocaleKeys.DialogPerformanceCheckLoggingEnabledMessage]; string mainMessage = LocaleManager.Instance[LocaleKeys.DialogPerformanceCheckLoggingEnabledMessage];
string secondaryMessage = LocaleManager.Instance[LocaleKeys.DialogPerformanceCheckLoggingEnabledConfirmMessage]; string secondaryMessage = LocaleManager.Instance[LocaleKeys.DialogPerformanceCheckLoggingEnabledConfirmMessage];
UserResult result = await ContentDialogHelper.CreateConfirmationDialog( UserResult result = await ContentDialogHelper.CreateLocalizedConfirmationDialog(mainMessage, secondaryMessage);
mainMessage,
secondaryMessage,
LocaleManager.Instance[LocaleKeys.InputDialogYes],
LocaleManager.Instance[LocaleKeys.InputDialogNo],
LocaleManager.Instance[LocaleKeys.RyujinxConfirm]);
if (result == UserResult.Yes) if (result == UserResult.Yes)
{ {
@ -1772,12 +1768,7 @@ namespace Ryujinx.Ava.UI.ViewModels
string mainMessage = LocaleManager.Instance[LocaleKeys.DialogPerformanceCheckShaderDumpEnabledMessage]; string mainMessage = LocaleManager.Instance[LocaleKeys.DialogPerformanceCheckShaderDumpEnabledMessage];
string secondaryMessage = LocaleManager.Instance[LocaleKeys.DialogPerformanceCheckShaderDumpEnabledConfirmMessage]; string secondaryMessage = LocaleManager.Instance[LocaleKeys.DialogPerformanceCheckShaderDumpEnabledConfirmMessage];
UserResult result = await ContentDialogHelper.CreateConfirmationDialog( UserResult result = await ContentDialogHelper.CreateLocalizedConfirmationDialog(mainMessage, secondaryMessage);
mainMessage,
secondaryMessage,
LocaleManager.Instance[LocaleKeys.InputDialogYes],
LocaleManager.Instance[LocaleKeys.InputDialogNo],
LocaleManager.Instance[LocaleKeys.RyujinxConfirm]);
if (result == UserResult.Yes) if (result == UserResult.Yes)
{ {

View file

@ -455,14 +455,14 @@ namespace Ryujinx.Ava.UI.ViewModels
// Graphics // Graphics
GraphicsBackendIndex = (int)config.Graphics.GraphicsBackend.Value; GraphicsBackendIndex = (int)config.Graphics.GraphicsBackend.Value;
// Physical devices are queried asynchronously hence the prefered index config value is loaded in LoadAvailableGpus(). // Physical devices are queried asynchronously hence the preferred index config value is loaded in LoadAvailableGpus().
EnableShaderCache = config.Graphics.EnableShaderCache; EnableShaderCache = config.Graphics.EnableShaderCache;
EnableTextureRecompression = config.Graphics.EnableTextureRecompression; EnableTextureRecompression = config.Graphics.EnableTextureRecompression;
EnableMacroHLE = config.Graphics.EnableMacroHLE; EnableMacroHLE = config.Graphics.EnableMacroHLE;
EnableColorSpacePassthrough = config.Graphics.EnableColorSpacePassthrough; EnableColorSpacePassthrough = config.Graphics.EnableColorSpacePassthrough;
ResolutionScale = config.Graphics.ResScale == -1 ? 4 : config.Graphics.ResScale - 1; ResolutionScale = config.Graphics.ResScale == -1 ? 4 : config.Graphics.ResScale - 1;
CustomResolutionScale = config.Graphics.ResScaleCustom; CustomResolutionScale = config.Graphics.ResScaleCustom;
MaxAnisotropy = config.Graphics.MaxAnisotropy == -1 ? 0 : (int)(MathF.Log2(config.Graphics.MaxAnisotropy)); MaxAnisotropy = config.Graphics.MaxAnisotropy == -1 ? 0 : (int)MathF.Log2(config.Graphics.MaxAnisotropy);
AspectRatio = (int)config.Graphics.AspectRatio.Value; AspectRatio = (int)config.Graphics.AspectRatio.Value;
GraphicsBackendMultithreadingIndex = (int)config.Graphics.BackendThreading.Value; GraphicsBackendMultithreadingIndex = (int)config.Graphics.BackendThreading.Value;
ShaderDumpPath = config.Graphics.ShadersDumpPath; ShaderDumpPath = config.Graphics.ShadersDumpPath;