Adds the ability to read a amiibo's nickname from the VirtualAmiiboFile #217

Merged
Jacobwasbeast merged 3 commits from feature/nicknamesupport into master 2024-11-10 03:18:50 +00:00
2 changed files with 6 additions and 4 deletions
Showing only changes of commit d3c0600066 - Show all commits

View File

@ -688,7 +688,8 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
{
RegisterInfo registerInfo = VirtualAmiibo.GetRegisterInfo(
context.Device.System.TickSource,
context.Device.System.NfpDevices[i].AmiiboId);
context.Device.System.NfpDevices[i].AmiiboId,
context.Device.System.AccountManager.LastOpenedUser.Name);
context.Memory.Write(outputPosition, registerInfo);

View File

@ -64,7 +64,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
};
}
public static RegisterInfo GetRegisterInfo(ITickSource tickSource, string amiiboId)
public static RegisterInfo GetRegisterInfo(ITickSource tickSource, string amiiboId, string userName)
{
VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId);
string nickname = "Ryujinx";
@ -77,7 +77,8 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
charInfo.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0));
charInfo.Nickname = Nickname.FromString(nickname);
// This is the player's name
charInfo.Nickname = Nickname.FromString(userName);
RegisterInfo registerInfo = new()
{
@ -89,7 +90,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
Reserved1 = new Array64<byte>(),
Reserved2 = new Array58<byte>(),
};
//"Ryujinx"u8.CopyTo(registerInfo.Nickname.AsSpan());
// This is the amiibo's name
byte[] nicknameBytes = System.Text.Encoding.UTF8.GetBytes(nickname);
nicknameBytes.CopyTo(registerInfo.Nickname.AsSpan());