From 381921390af49697cb8ee10d1bf80a1a8bacc603 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Fri, 20 Dec 2024 15:41:18 -0600 Subject: [PATCH] UI: Only show Amiibo bin scan menu item if the key file exists --- distribution/misc/macOS.svg | 61 ------------------- .../Nfc/AmiiboDecryption/AmiiboBinReader.cs | 7 +-- .../UI/ViewModels/MainWindowViewModel.cs | 6 ++ .../UI/Views/Main/MainMenuBarView.axaml | 1 + .../UI/Views/Main/MainMenuBarView.axaml.cs | 2 +- 5 files changed, 11 insertions(+), 66 deletions(-) delete mode 100644 distribution/misc/macOS.svg diff --git a/distribution/misc/macOS.svg b/distribution/misc/macOS.svg deleted file mode 100644 index 4bdd453a8..000000000 --- a/distribution/misc/macOS.svg +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs index d0225da8d..a0b8b5414 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs @@ -333,10 +333,9 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption return Path.Combine(AppDataManager.KeysDirPath, "key_retail.bin"); } - public static bool HasKeyRetailBinPath() - { - return File.Exists(GetKeyRetailBinPath()); - } + public static bool HasKeyRetailBinPath => File.Exists(GetKeyRetailBinPath()); + + public static DateTime DateTimeFromTag(ushort value) { try diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index 283f9b9da..f607b71f6 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -127,6 +127,9 @@ namespace Ryujinx.Ava.UI.ViewModels public IEnumerable LastLdnGameData; + // The UI specifically uses a thicker bordered variant of the icon to avoid crunching out the border at lower resolutions. + // For an example of this, download canary 1.2.95, then open the settings menu, and look at the icon in the top-left. + // The border gets reduced to colored pixels in the 4 corners. public static readonly Bitmap IconBitmap = new(Assembly.GetAssembly(typeof(ConfigurationState))!.GetManifestResourceStream("Ryujinx.UI.Common.Resources.Logo_Thiccjinx.png")!); @@ -330,6 +333,9 @@ namespace Ryujinx.Ava.UI.ViewModels OnPropertyChanged(); } } + + public bool CanScanAmiiboBinaries => AmiiboBinReader.HasKeyRetailBinPath; + public bool ShowLoadProgress { get => _showLoadProgress; diff --git a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml index d9690e8ce..be805566e 100644 --- a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml +++ b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml @@ -247,6 +247,7 @@ Click="OpenBinFile" Header="{ext:Locale MenuBarActionsScanAmiiboBin}" Icon="{ext:Icon mdi-cube-scan}" + IsVisible="{Binding CanScanAmiiboBinaries}" IsEnabled="{Binding IsAmiiboBinRequested}" />