mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-22 23:55: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:
parent
a7b58df3fe
commit
b17e4f79fb
2 changed files with 8 additions and 4 deletions
|
@ -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; }
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue