0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-22 19:15:47 +00:00

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

This feature adds a way to change the Amiibo's nickname inside Smash and
other places where it's used, so it’s not always "Ryujinx." However, I
did not add a GUI or create the Cabinet applet that would allow users to
change this. So you will have to go to system/amiibo and find your
amiibo id to change it.
This commit is contained in:
Jacobwasbeast 2024-11-09 21:18:50 -06:00 committed by GitHub
parent a7b58df3fe
commit b17e4f79fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -8,6 +8,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager
public uint FileVersion { get; set; } public uint FileVersion { get; set; }
public byte[] TagUuid { get; set; } public byte[] TagUuid { get; set; }
public string AmiiboId { get; set; } public string AmiiboId { get; set; }
public string NickName { get; set; }
public DateTime FirstWriteDate { get; set; } public DateTime FirstWriteDate { get; set; }
public DateTime LastWriteDate { get; set; } public DateTime LastWriteDate { get; set; }
public ushort WriteCounter { get; set; } public ushort WriteCounter { get; set; }

View file

@ -64,16 +64,17 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
}; };
} }
public static RegisterInfo GetRegisterInfo(ITickSource tickSource, string amiiboId, string nickname) public static RegisterInfo GetRegisterInfo(ITickSource tickSource, string amiiboId, string userName)
{ {
VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId); VirtualAmiiboFile amiiboFile = LoadAmiiboFile(amiiboId);
string nickname = amiiboFile.NickName ?? "Ryujinx";
UtilityImpl utilityImpl = new(tickSource); UtilityImpl utilityImpl = new(tickSource);
CharInfo charInfo = new(); CharInfo charInfo = new();
charInfo.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0)); 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() RegisterInfo registerInfo = new()
{ {
@ -85,7 +86,9 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
Reserved1 = new Array64<byte>(), Reserved1 = new Array64<byte>(),
Reserved2 = new Array58<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());
return registerInfo; return registerInfo;
} }