From 02d786a0861b957fbd927553ac974dff473e1f4f Mon Sep 17 00:00:00 2001 From: VocalFan <45863583+Mou-Ikkai@users.noreply.github.com> Date: Mon, 15 Nov 2021 18:03:17 -0500 Subject: [PATCH] Nickname! - Init Amiibos with Profile's name! (#2804) * Remove comment from code. * Added needed RegisterInfo for TODO. * Forgot to add two words... * Stop being tired and fixed the one issue. * Removing suggested line from GDKchan. * GDK seems to have been incorrect? * Update Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs Co-authored-by: gdkchan Co-authored-by: gdkchan --- Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs | 4 ++-- Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs index bae48558..54c78452 100644 --- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs +++ b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/NfpManager/INfp.cs @@ -688,7 +688,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp { if (context.Device.System.NfpDevices[i].State == NfpDeviceState.TagMounted) { - RegisterInfo registerInfo = VirtualAmiibo.GetRegisterInfo(context.Device.System.NfpDevices[i].AmiiboId); + RegisterInfo registerInfo = VirtualAmiibo.GetRegisterInfo(context.Device.System.NfpDevices[i].AmiiboId, context.Device.System.AccountManager.LastOpenedUser.Name); context.Memory.Write(outputPosition, registerInfo); @@ -994,4 +994,4 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp return true ? ResultCode.Success : ResultCode.NfcDisabled; } } -} \ No newline at end of file +} diff --git a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs index 2617dfb5..9510ef4c 100644 --- a/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs +++ b/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs @@ -63,7 +63,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp }; } - public static RegisterInfo GetRegisterInfo(string amiiboId) + public static RegisterInfo GetRegisterInfo(string amiiboId, string nickname) { VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId); @@ -72,8 +72,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp charInfo.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0)); - // TODO: Maybe change the "no name" by the player name when user profile will be implemented. - // charInfo.Nickname = Nickname.FromString("Nickname"); + charInfo.Nickname = Nickname.FromString(nickname); RegisterInfo registerInfo = new RegisterInfo() { @@ -85,7 +84,6 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp Reserved1 = new Array64(), Reserved2 = new Array58() }; - Encoding.ASCII.GetBytes("Ryujinx").CopyTo(registerInfo.Nickname.ToSpan()); return registerInfo; @@ -202,4 +200,4 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp File.WriteAllText(filePath, JsonSerializer.Serialize(virtualAmiiboFile)); } } -} \ No newline at end of file +}