mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-25 10:37:11 +02:00
Add the Cabinet Applet (#340)
This adds the missing Cabinet Applet, which allows for formatting Amiibos and changing their names.
This commit is contained in:
parent
17483aad24
commit
08b7257be5
24 changed files with 335 additions and 0 deletions
|
@ -7,6 +7,7 @@ using Ryujinx.Ava.UI.Helpers;
|
|||
using Ryujinx.Ava.UI.Windows;
|
||||
using Ryujinx.HLE;
|
||||
using Ryujinx.HLE.HOS.Applets;
|
||||
using Ryujinx.HLE.HOS.Applets.SoftwareKeyboard;
|
||||
using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy.Types;
|
||||
using Ryujinx.HLE.UI;
|
||||
using Ryujinx.UI.Common.Configuration;
|
||||
|
@ -155,6 +156,55 @@ namespace Ryujinx.Ava.UI.Applet
|
|||
return error || okPressed;
|
||||
}
|
||||
|
||||
public bool DisplayCabinetDialog(out string userText)
|
||||
{
|
||||
ManualResetEvent dialogCloseEvent = new(false);
|
||||
bool okPressed = false;
|
||||
string inputText = "My Amiibo";
|
||||
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
_parent.ViewModel.AppHost.NpadManager.BlockInputUpdates();
|
||||
SoftwareKeyboardUIArgs args = new SoftwareKeyboardUIArgs();
|
||||
args.KeyboardMode = KeyboardMode.Default;
|
||||
args.InitialText = "Ryujinx";
|
||||
args.StringLengthMin = 1;
|
||||
args.StringLengthMax = 25;
|
||||
(UserResult result, string userInput) = await SwkbdAppletDialog.ShowInputDialog(LocaleManager.Instance[LocaleKeys.CabinetDialog], args);
|
||||
if (result == UserResult.Ok)
|
||||
{
|
||||
inputText = userInput;
|
||||
okPressed = true;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
dialogCloseEvent.Set();
|
||||
}
|
||||
});
|
||||
dialogCloseEvent.WaitOne();
|
||||
_parent.ViewModel.AppHost.NpadManager.UnblockInputUpdates();
|
||||
userText = inputText;
|
||||
return okPressed;
|
||||
}
|
||||
|
||||
public void DisplayCabinetMessageDialog()
|
||||
{
|
||||
ManualResetEvent dialogCloseEvent = new(false);
|
||||
Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
dialogCloseEvent.Set();
|
||||
await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.CabinetScanDialog],
|
||||
string.Empty,
|
||||
LocaleManager.Instance[LocaleKeys.InputDialogOk],
|
||||
string.Empty,
|
||||
LocaleManager.Instance[LocaleKeys.CabinetTitle]);
|
||||
});
|
||||
dialogCloseEvent.WaitOne();
|
||||
}
|
||||
|
||||
|
||||
public void ExecuteProgram(Switch device, ProgramSpecifyKind kind, ulong value)
|
||||
{
|
||||
device.Configuration.UserChannelPersistence.ExecuteProgram(kind, value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue