From bbd64fd5f06db51cbcdbbe5aa33f40bd3ffb093e Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Sun, 19 Jan 2025 19:40:49 -0600 Subject: [PATCH] misc: chore: Cleanup AppletMetadata usage --- src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs | 1 - src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs | 12 ++++++------ src/Ryujinx/Utilities/AppletMetadata.cs | 4 ++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index 17b9ea98c..f88ed65d0 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -38,7 +38,6 @@ using Ryujinx.HLE.HOS.Services.Account.Acc; using Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption; using Ryujinx.HLE.UI; using Ryujinx.Input.HLE; -using Silk.NET.Vulkan; using SkiaSharp; using System; using System.Collections.Generic; diff --git a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs index 61dbf3a43..521460012 100644 --- a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs +++ b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs @@ -144,14 +144,14 @@ namespace Ryujinx.Ava.UI.Views.Main ViewModel.LoadConfigurableHotKeys(); } - public static readonly AppletMetadata MiiApplet = new("miiEdit", 0x0100000000001009); - + public AppletMetadata MiiApplet => new(ViewModel.ContentManager, "miiEdit", 0x0100000000001009); + public async Task OpenMiiApplet() { - if (MiiApplet.CanStart(ViewModel.ContentManager, out var appData, out var nacpData)) - { - await ViewModel.LoadApplication(appData, ViewModel.IsFullScreen || ViewModel.StartGamesInFullscreen, nacpData); - } + if (!MiiApplet.CanStart(out var appData, out var nacpData)) + return; + + await ViewModel.LoadApplication(appData, ViewModel.IsFullScreen || ViewModel.StartGamesInFullscreen, nacpData); } public async Task OpenCheatManagerForCurrentApp() diff --git a/src/Ryujinx/Utilities/AppletMetadata.cs b/src/Ryujinx/Utilities/AppletMetadata.cs index 42c23ee12..a165487a3 100644 --- a/src/Ryujinx/Utilities/AppletMetadata.cs +++ b/src/Ryujinx/Utilities/AppletMetadata.cs @@ -54,5 +54,9 @@ namespace Ryujinx.Ava.Utilities appControl = new BlitStruct(0); return false; } + + public bool CanStart(out ApplicationData appData, + out BlitStruct appControl) + => CanStart(null, out appData, out appControl); } }