Add the Cabinet Applet #340

Merged
Jacobwasbeast merged 5 commits from feature/cabinet-applet into master 2024-12-03 05:40:02 +00:00
6 changed files with 274 additions and 0 deletions
Showing only changes of commit dbe9656d6f - Show all commits

View File

@ -1,5 +1,6 @@
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Applets.Browser; using Ryujinx.HLE.HOS.Applets.Browser;
using Ryujinx.HLE.HOS.Applets.Cabinet;
using Ryujinx.HLE.HOS.Applets.Dummy; using Ryujinx.HLE.HOS.Applets.Dummy;
using Ryujinx.HLE.HOS.Applets.Error; using Ryujinx.HLE.HOS.Applets.Error;
using Ryujinx.HLE.HOS.Services.Am.AppletAE; using Ryujinx.HLE.HOS.Services.Am.AppletAE;
@ -31,6 +32,8 @@ namespace Ryujinx.HLE.HOS.Applets
case AppletId.MiiEdit: case AppletId.MiiEdit:
Logger.Warning?.Print(LogClass.Application, $"Please use the MiiEdit inside File/Open Applet"); Logger.Warning?.Print(LogClass.Application, $"Please use the MiiEdit inside File/Open Applet");
return new DummyApplet(system); return new DummyApplet(system);
case AppletId.Cabinet:
return new CabinetApplet(system);
} }
Logger.Warning?.Print(LogClass.Application, $"Applet {applet} not implemented!"); Logger.Warning?.Print(LogClass.Application, $"Applet {applet} not implemented!");

View File

@ -0,0 +1,199 @@
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using Ryujinx.Common.Logging;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using Ryujinx.Common.Memory;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using Ryujinx.HLE.HOS.Applets;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using Ryujinx.HLE.HOS.Services.Hid.HidServer;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using Ryujinx.HLE.HOS.Services.Hid;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using Ryujinx.HLE.HOS.Services.Nfc.Nfp;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using System;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using System.IO;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using System.Runtime.CompilerServices;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using System.Runtime.InteropServices;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using System.Text;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
using LibHac;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
namespace Ryujinx.HLE.HOS.Applets.Cabinet
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
internal unsafe class CabinetApplet : IApplet
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
private readonly Horizon _system;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
private AppletSession _normalSession;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public event EventHandler AppletStateChanged;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public CabinetApplet(Horizon system)
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
_system = system;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public ResultCode Start(AppletSession normalSession, AppletSession interactiveSession)
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
_normalSession = normalSession;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
byte[] launchParams = _normalSession.Pop();
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
byte[] startParamBytes = _normalSession.Pop();
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
StartParamForAmiiboSettings startParam = IApplet.ReadStruct<StartParamForAmiiboSettings>(startParamBytes);
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
Logger.Stub?.PrintStub(LogClass.ServiceAm, $"CabinetApplet Start Type: {startParam.Type}");
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
switch (startParam.Type)
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
case 0:
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
StartNicknameAndOwnerSettings(ref startParam);
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
break;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
case 1:
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
case 3:
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
StartFormatter(ref startParam);
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
break;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
default:
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
Logger.Error?.Print(LogClass.ServiceAm, $"Unknown AmiiboSettings type: {startParam.Type}");
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
break;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
// Prepare the response
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
ReturnValueForAmiiboSettings returnValue = new()
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
AmiiboSettingsReturnFlag = (byte)AmiiboSettingsReturnFlag.HasRegisterInfo,
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
DeviceHandle = new DeviceHandle
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
Handle = 0 // Dummy device handle
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
},
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
RegisterInfo = startParam.RegisterInfo
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
};
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
// Push the response
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
_normalSession.Push(BuildResponse(returnValue));
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
AppletStateChanged?.Invoke(this, null);
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
_system.ReturnFocus();
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
return ResultCode.Success;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public ResultCode GetResult()
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
var amiibo = _system.Device.System.NfpDevices[0];
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
_system.Device.System.NfpDevices.Remove(amiibo);
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
return ResultCode.Success;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
private void StartFormatter(ref StartParamForAmiiboSettings startParam)
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
// Initialize RegisterInfo
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
startParam.RegisterInfo = new RegisterInfo();
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
private void StartNicknameAndOwnerSettings(ref StartParamForAmiiboSettings startParam)
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
_system.Device.UIHandler.DisplayCabinetDialog(out string newName);
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
byte[] nameBytes = Encoding.UTF8.GetBytes(newName);
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
Array41<byte> nickName = new Array41<byte>();
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
nameBytes.CopyTo(nickName.AsSpan());
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
startParam.RegisterInfo.Nickname = nickName;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
NfpDevice devicePlayer1 = new()
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
NpadIdType = NpadIdType.Player1,
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
Handle = HidUtils.GetIndexFromNpadIdType(NpadIdType.Player1),
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
State = NfpDeviceState.SearchingForTag,
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
};
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
_system.Device.System.NfpDevices.Add(devicePlayer1);
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
_system.Device.UIHandler.DisplayCabinetMessageDialog();
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
string amiiboId = "";
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
bool scanned = false;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
while (!scanned)
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
for (int i = 0; i < _system.Device.System.NfpDevices.Count; i++)
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
if (_system.Device.System.NfpDevices[i].State == NfpDeviceState.TagFound)
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
amiiboId = _system.Device.System.NfpDevices[i].AmiiboId;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
scanned = true;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
VirtualAmiibo.UpdateNickName(amiiboId, newName);
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
private static byte[] BuildResponse(ReturnValueForAmiiboSettings returnValue)
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
int size = Unsafe.SizeOf<ReturnValueForAmiiboSettings>();
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
byte[] bytes = new byte[size];
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
fixed (byte* bytesPtr = bytes)
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
Unsafe.Write(bytesPtr, returnValue);
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
return bytes;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public static T ReadStruct<T>(byte[] data) where T : unmanaged
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
if (data.Length < Unsafe.SizeOf<T>())
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
throw new ArgumentException("Not enough data to read the struct");
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
fixed (byte* dataPtr = data)
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
return Unsafe.Read<T>(dataPtr);
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
#region Structs
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
[StructLayout(LayoutKind.Sequential, Pack = 1)]
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public unsafe struct TagInfo
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public fixed byte Data[0x58];
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
[StructLayout(LayoutKind.Sequential, Pack = 1)]
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public unsafe struct StartParamForAmiiboSettings
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public byte ZeroValue; // Left at zero by sdknso
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public byte Type;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public byte Flags;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public byte AmiiboSettingsStartParamOffset28;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public ulong AmiiboSettingsStartParam0;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public TagInfo TagInfo; // Only enabled when flags bit 1 is set
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public RegisterInfo RegisterInfo; // Only enabled when flags bit 2 is set
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public fixed byte StartParamExtraData[0x20];
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public fixed byte Reserved[0x24];
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
[StructLayout(LayoutKind.Sequential, Pack = 1)]
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public unsafe struct ReturnValueForAmiiboSettings
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public byte AmiiboSettingsReturnFlag;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
private byte Padding1;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
private byte Padding2;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
private byte Padding3;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public DeviceHandle DeviceHandle;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public TagInfo TagInfo;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public RegisterInfo RegisterInfo;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public fixed byte IgnoredBySdknso[0x24];
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
[StructLayout(LayoutKind.Sequential, Pack = 1)]
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public struct DeviceHandle
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public ulong Handle;
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
public enum AmiiboSettingsReturnFlag : byte
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
{
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
Cancel = 0,
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
HasTagInfo = 2,
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
HasRegisterInfo = 4,
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
HasTagInfoAndRegisterInfo = 6
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
#endregion
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well
}
GreemDev commented 2024-12-03 02:11:15 +00:00 (Migrated from github.com)
Review

string.Empty here as well

`string.Empty` here as well

View File

@ -93,6 +93,13 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
return registerInfo; return registerInfo;
} }
public static void UpdateNickName(string amiiboId, string newNickName)
{
VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
virtualAmiiboFile.NickName = newNickName;
SaveAmiiboFile(virtualAmiiboFile);
}
public static bool OpenApplicationArea(string amiiboId, uint applicationAreaId) public static bool OpenApplicationArea(string amiiboId, uint applicationAreaId)
{ {
VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId); VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);

View File

@ -24,6 +24,18 @@ namespace Ryujinx.HLE.UI
/// <returns>True when OK is pressed, False otherwise.</returns> /// <returns>True when OK is pressed, False otherwise.</returns>
bool DisplayMessageDialog(ControllerAppletUIArgs args); bool DisplayMessageDialog(ControllerAppletUIArgs args);
/// <summary>
/// Displays an Input Dialog box to the user so they can enter the Amiibo's new name
/// </summary>
/// <param name="userText">Text that the user entered. Set to `null` on internal errors</param>
/// <returns>True when OK is pressed, False otherwise. Also returns True on internal errors</returns>
bool DisplayCabinetDialog(out string userText);
/// <summary>
/// Displays a Message Dialog box to the user to notify them to scan the Amiibo.
/// </summary>
void DisplayCabinetMessageDialog();
/// <summary> /// <summary>
/// Tell the UI that we need to transition to another program. /// Tell the UI that we need to transition to another program.
/// </summary> /// </summary>

View File

@ -714,6 +714,9 @@
"Never": "Never", "Never": "Never",
"SwkbdMinCharacters": "Must be at least {0} characters long", "SwkbdMinCharacters": "Must be at least {0} characters long",
"SwkbdMinRangeCharacters": "Must be {0}-{1} characters long", "SwkbdMinRangeCharacters": "Must be {0}-{1} characters long",
"CabinetTitle": "Cabinet Dialog",
"CabinetDialog": "Enter your Amiibo's new name",
"CabinetScanDialog": "Please scan your Amiibo now.",
GreemDev commented 2024-12-03 02:10:41 +00:00 (Migrated from github.com)
Review

Please add these to every locale file in the same location in each

Please add these to every locale file in the same location in each
"SoftwareKeyboard": "Software Keyboard", "SoftwareKeyboard": "Software Keyboard",
"SoftwareKeyboardModeNumeric": "Must be 0-9 or '.' only", "SoftwareKeyboardModeNumeric": "Must be 0-9 or '.' only",
"SoftwareKeyboardModeAlphabet": "Must be non CJK-characters only", "SoftwareKeyboardModeAlphabet": "Must be non CJK-characters only",

View File

@ -7,6 +7,7 @@ using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Ava.UI.Windows; using Ryujinx.Ava.UI.Windows;
using Ryujinx.HLE; using Ryujinx.HLE;
using Ryujinx.HLE.HOS.Applets; using Ryujinx.HLE.HOS.Applets;
using Ryujinx.HLE.HOS.Applets.SoftwareKeyboard;
using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy.Types; using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy.Types;
using Ryujinx.HLE.UI; using Ryujinx.HLE.UI;
using Ryujinx.UI.Common.Configuration; using Ryujinx.UI.Common.Configuration;
@ -155,6 +156,55 @@ namespace Ryujinx.Ava.UI.Applet
return error || okPressed; 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],
"",
LocaleManager.Instance[LocaleKeys.InputDialogOk],
string.Empty,
LocaleManager.Instance[LocaleKeys.CabinetTitle]);
});
dialogCloseEvent.WaitOne();
}
public void ExecuteProgram(Switch device, ProgramSpecifyKind kind, ulong value) public void ExecuteProgram(Switch device, ProgramSpecifyKind kind, ulong value)
{ {
device.Configuration.UserChannelPersistence.ExecuteProgram(kind, value); device.Configuration.UserChannelPersistence.ExecuteProgram(kind, value);