From 5b36a9cf9fc1d098468171e57d9671cc3ee9a9f7 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Sat, 21 Dec 2024 16:59:13 -0600 Subject: [PATCH] chore: small cleanups --- .../HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs | 2 +- .../HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs | 2 +- .../HOS/Services/Nfc/AmiiboDecryption/AmiiboMasterKey.cs | 5 +---- src/Ryujinx.UI.Common/Helper/OpenHelper.cs | 3 +++ src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs | 2 +- src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs index 65638b04e..03063cb53 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs @@ -333,7 +333,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption return Path.Combine(AppDataManager.KeysDirPath, "key_retail.bin"); } - public static bool HasKeyRetailBinPath => File.Exists(GetKeyRetailBinPath()); + public static bool HasAmiiboKeyFile => File.Exists(GetKeyRetailBinPath()); public static DateTime DateTimeFromTag(ushort value) diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs index 7343a40ca..37d587dac 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboDump.cs @@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption private byte[] DeriveKey(AmiiboMasterKey key, bool deriveAes, out byte[] derivedAesKey, out byte[] derivedAesIv) { - List seed = new List(); + List seed = []; // Start with the type string (14 bytes) seed.AddRange(key.TypeString); diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboMasterKey.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboMasterKey.cs index f61f8c84d..940dc4c85 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboMasterKey.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboMasterKey.cs @@ -33,10 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption byte[] dataBin = combinedBin.Take(80).ToArray(); byte[] tagBin = combinedBin.Skip(80).Take(80).ToArray(); - AmiiboMasterKey dataKey = new AmiiboMasterKey(dataBin); - AmiiboMasterKey tagKey = new AmiiboMasterKey(tagBin); - - return (dataKey, tagKey); + return (new AmiiboMasterKey(dataBin), new AmiiboMasterKey(tagBin)); } } } diff --git a/src/Ryujinx.UI.Common/Helper/OpenHelper.cs b/src/Ryujinx.UI.Common/Helper/OpenHelper.cs index 8b0e1f1fd..bf398a355 100644 --- a/src/Ryujinx.UI.Common/Helper/OpenHelper.cs +++ b/src/Ryujinx.UI.Common/Helper/OpenHelper.cs @@ -1,3 +1,4 @@ +using Gommon; using Ryujinx.Common.Logging; using System; using System.Diagnostics; @@ -34,6 +35,8 @@ namespace Ryujinx.UI.Common.Helper } } + public static void OpenFolder(FilePath path) => OpenFolder(path.Path); + public static void LocateFile(string path) { if (File.Exists(path)) diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index f607b71f6..35a1c4a4d 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -334,7 +334,7 @@ namespace Ryujinx.Ava.UI.ViewModels } } - public bool CanScanAmiiboBinaries => AmiiboBinReader.HasKeyRetailBinPath; + public bool CanScanAmiiboBinaries => AmiiboBinReader.HasAmiiboKeyFile; public bool ShowLoadProgress { diff --git a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs index 04c303cd3..fa900be81 100644 --- a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs +++ b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs @@ -178,7 +178,7 @@ namespace Ryujinx.Ava.UI.Views.Main private void ScanBinAmiiboMenuItem_AttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e) { if (sender is MenuItem) - ViewModel.IsAmiiboBinRequested = ViewModel.IsAmiiboRequested && AmiiboBinReader.HasKeyRetailBinPath; + ViewModel.IsAmiiboBinRequested = ViewModel.IsAmiiboRequested && AmiiboBinReader.HasAmiiboKeyFile; } private async void InstallFileTypes_Click(object sender, RoutedEventArgs e)