mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-10-10 08:01:05 +02:00
Adds the ability to read and write to amiibo bin files
This introduces the ability to read and write game data and model information from an Amiibo dump file (BIN format). Note that this functionality requires the presence of a key_retail.bin file. For the option to appear and function in the UI, ensure that the key_retail.bin file is located in the <RyujinxData>/system folder.
This commit is contained in:
committed by
KeatonTheBot
parent
8547285aba
commit
78400132c0
@@ -28,6 +28,7 @@ using Ryujinx.HLE;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
using Ryujinx.HLE.HOS;
|
||||
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||
using Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption;
|
||||
using Ryujinx.HLE.UI;
|
||||
using Ryujinx.Input.HLE;
|
||||
using Ryujinx.Modules;
|
||||
@@ -35,6 +36,7 @@ using Ryujinx.UI.App.Common;
|
||||
using Ryujinx.UI.Common;
|
||||
using Ryujinx.UI.Common.Configuration;
|
||||
using Ryujinx.UI.Common.Helper;
|
||||
using Silk.NET.Vulkan;
|
||||
using SkiaSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -69,6 +71,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
private string _volumeStatusText;
|
||||
private string _gpuStatusText;
|
||||
private bool _isAmiiboRequested;
|
||||
private bool _isAmiiboBinRequested;
|
||||
private bool _isGameRunning;
|
||||
private bool _isFullScreen;
|
||||
private int _progressMaximum;
|
||||
@@ -294,7 +297,16 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public bool IsAmiiboBinRequested
|
||||
{
|
||||
get => _isAmiiboBinRequested && _isGameRunning;
|
||||
set
|
||||
{
|
||||
_isAmiiboBinRequested = value;
|
||||
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public bool ShowLoadProgress
|
||||
{
|
||||
get => _showLoadProgress;
|
||||
@@ -2001,6 +2013,33 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
});
|
||||
}
|
||||
|
||||
public async Task OpenBinFile()
|
||||
{
|
||||
if (!IsAmiiboRequested)
|
||||
return;
|
||||
|
||||
if (AppHost.Device.System.SearchingForAmiibo(out int deviceId))
|
||||
{
|
||||
var result = await StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||
{
|
||||
Title = LocaleManager.Instance[LocaleKeys.OpenFileDialogTitle],
|
||||
AllowMultiple = false,
|
||||
FileTypeFilter = new List<FilePickerFileType>
|
||||
{
|
||||
new(LocaleManager.Instance[LocaleKeys.AllSupportedFormats])
|
||||
{
|
||||
Patterns = new[] { "*.bin" },
|
||||
}
|
||||
}
|
||||
});
|
||||
if (result.Count > 0)
|
||||
{
|
||||
AppHost.Device.System.ScanAmiiboFromBin(result[0].Path.LocalPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ToggleFullscreen()
|
||||
{
|
||||
if (Environment.TickCount64 - LastFullscreenToggle < HotKeyPressDelayMs)
|
||||
|
||||
@@ -171,6 +171,12 @@
|
||||
Click="OpenAmiiboWindow"
|
||||
Header="{locale:Locale MenuBarActionsScanAmiibo}"
|
||||
IsEnabled="{Binding IsAmiiboRequested}" />
|
||||
<MenuItem
|
||||
Name="ScanAmiiboMenuItemFromBin"
|
||||
AttachedToVisualTree="ScanBinAmiiboMenuItem_AttachedToVisualTree"
|
||||
Click="OpenBinFile"
|
||||
Header="{locale:Locale MenuBarActionsScanAmiiboBin}"
|
||||
IsEnabled="{Binding IsAmiiboBinRequested}" />
|
||||
<MenuItem
|
||||
Command="{Binding TakeScreenshot}"
|
||||
Header="{locale:Locale MenuBarFileToolsTakeScreenshot}"
|
||||
|
||||
@@ -10,6 +10,7 @@ using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Ava.UI.Windows;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption;
|
||||
using Ryujinx.Modules;
|
||||
using Ryujinx.UI.App.Common;
|
||||
using Ryujinx.UI.Common;
|
||||
@@ -170,6 +171,9 @@ namespace Ryujinx.Ava.UI.Views.Main
|
||||
}
|
||||
}
|
||||
|
||||
public async void OpenBinFile(object sender, RoutedEventArgs e)
|
||||
=> await ViewModel.OpenBinFile();
|
||||
|
||||
public async void OpenCheatManagerForCurrentApp(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!ViewModel.IsGameRunning)
|
||||
@@ -196,6 +200,12 @@ namespace Ryujinx.Ava.UI.Views.Main
|
||||
}
|
||||
}
|
||||
|
||||
private void ScanBinAmiiboMenuItem_AttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
if (sender is MenuItem)
|
||||
ViewModel.IsAmiiboBinRequested = ViewModel.IsAmiiboRequested && AmiiboBinReader.HasKeyRetailBinPath();
|
||||
}
|
||||
|
||||
private async void InstallFileTypes_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (FileAssociationHelper.Install())
|
||||
|
||||
Reference in New Issue
Block a user