Make amiibo mii work in miiEdit
This commit is contained in:
parent
3c96c341d2
commit
cb1d477e1f
@ -1,4 +1,5 @@
|
||||
using Ryujinx.HLE.HOS.Services.Mii.Types;
|
||||
using Ryujinx.HLE.HOS.Services.Nfc.Nfp;
|
||||
using Ryujinx.HLE.HOS.Services.Settings;
|
||||
using System;
|
||||
|
||||
@ -154,6 +155,10 @@ namespace Ryujinx.HLE.HOS.Services.Mii.StaticService
|
||||
|
||||
protected override ResultCode AddOrReplace(StoreData storeData)
|
||||
{
|
||||
if (VirtualAmiibo.VirtualAmiiboBinFile != null)
|
||||
{
|
||||
storeData = VirtualAmiibo.VirtualAmiiboBinFile.StoreData;
|
||||
}
|
||||
if (!_isSystem)
|
||||
{
|
||||
return ResultCode.PermissionDenied;
|
||||
|
@ -335,6 +335,70 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
|
||||
MoleY = storeData.CoreData.MoleY;
|
||||
Reserved = 0;
|
||||
}
|
||||
public static StoreData BuildFromCharInfo(UtilityImpl utilImpl, CharInfo charInfo)
|
||||
{
|
||||
StoreData result = new()
|
||||
{
|
||||
CoreData = new CoreData
|
||||
{
|
||||
Nickname = charInfo.Nickname,
|
||||
FontRegion = charInfo.FontRegion,
|
||||
FavoriteColor = charInfo.FavoriteColor,
|
||||
Gender = charInfo.Gender,
|
||||
Height = charInfo.Height,
|
||||
Build = charInfo.Build,
|
||||
Type = charInfo.Type,
|
||||
RegionMove = charInfo.RegionMove,
|
||||
FacelineType = charInfo.FacelineType,
|
||||
FacelineColor = charInfo.FacelineColor,
|
||||
FacelineWrinkle = charInfo.FacelineWrinkle,
|
||||
FacelineMake = charInfo.FacelineMake,
|
||||
HairType = charInfo.HairType,
|
||||
HairColor = charInfo.HairColor,
|
||||
HairFlip = charInfo.HairFlip,
|
||||
EyeType = charInfo.EyeType,
|
||||
EyeColor = charInfo.EyeColor,
|
||||
EyeScale = charInfo.EyeScale,
|
||||
EyeAspect = charInfo.EyeAspect,
|
||||
EyeRotate = charInfo.EyeRotate,
|
||||
EyeX = charInfo.EyeX,
|
||||
EyeY = charInfo.EyeY,
|
||||
EyebrowType = charInfo.EyebrowType,
|
||||
EyebrowColor = charInfo.EyebrowColor,
|
||||
EyebrowScale = charInfo.EyebrowScale,
|
||||
EyebrowAspect = charInfo.EyebrowAspect,
|
||||
EyebrowRotate = charInfo.EyebrowRotate,
|
||||
EyebrowX = charInfo.EyebrowX,
|
||||
EyebrowY = charInfo.EyebrowY,
|
||||
NoseType = charInfo.NoseType,
|
||||
NoseScale = charInfo.NoseScale,
|
||||
NoseY = charInfo.NoseY,
|
||||
MouthType = charInfo.MouthType,
|
||||
MouthColor = charInfo.MouthColor,
|
||||
MouthScale = charInfo.MouthScale,
|
||||
MouthAspect = charInfo.MouthAspect,
|
||||
MouthY = charInfo.MouthY,
|
||||
BeardColor = charInfo.BeardColor,
|
||||
BeardType = charInfo.BeardType,
|
||||
MustacheType = charInfo.MustacheType,
|
||||
MustacheScale = charInfo.MustacheScale,
|
||||
MustacheY = charInfo.MustacheY,
|
||||
GlassType = charInfo.GlassType,
|
||||
GlassColor = charInfo.GlassColor,
|
||||
GlassScale = charInfo.GlassScale,
|
||||
GlassY = charInfo.GlassY,
|
||||
MoleType = charInfo.MoleType,
|
||||
MoleScale = charInfo.MoleScale,
|
||||
MoleX = charInfo.MoleX,
|
||||
MoleY = charInfo.MoleY
|
||||
}
|
||||
};
|
||||
|
||||
result.UpdateCreateID(utilImpl);
|
||||
result.UpdateCrc();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public readonly void SetSource(Source source)
|
||||
{
|
||||
|
@ -30,6 +30,11 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
|
||||
DeviceCrc = CalculateDeviceCrc();
|
||||
}
|
||||
|
||||
public void UpdateCreateID(UtilityImpl impl)
|
||||
{
|
||||
_createId = impl.MakeCreateId();
|
||||
}
|
||||
|
||||
public void UpdateCrc()
|
||||
{
|
||||
UpdateDataCrc();
|
||||
|
@ -1,3 +1,5 @@
|
||||
using Humanizer;
|
||||
using Ryujinx.HLE.HOS.Services.Mii;
|
||||
using Ryujinx.HLE.HOS.Services.Mii.Types;
|
||||
using System;
|
||||
using System.Text;
|
||||
@ -7,7 +9,6 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption
|
||||
internal class CharInfoBin
|
||||
{
|
||||
public byte MiiVersion { get; private set; }
|
||||
public byte[] CreateID { get; private set; }
|
||||
public bool AllowCopying { get; private set; }
|
||||
public bool ProfanityFlag { get; private set; }
|
||||
public int RegionLock { get; private set; }
|
||||
@ -84,8 +85,6 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption
|
||||
mii.ProfanityFlag = (flags1 & 0x2) != 0;
|
||||
mii.RegionLock = (flags1 >> 2) & 0x3;
|
||||
mii.CharacterSet = (flags1 >> 4) & 0x3;
|
||||
// add the first 0x10 bytes to the create id
|
||||
mii.CreateID = data[0x0..0x10];
|
||||
byte position = data[0x2];
|
||||
mii.PageIndex = position & 0xF;
|
||||
mii.SlotIndex = (position >> 4) & 0xF;
|
||||
@ -201,10 +200,9 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption
|
||||
return Encoding.Unicode.GetString(data, offset, length * 2);
|
||||
}
|
||||
|
||||
public CharInfo ConvertToCharInfo(CharInfo Info)
|
||||
public CharInfo ConvertToCharInfo(UtilityImpl utilImpl, CharInfo Info)
|
||||
{
|
||||
//UInt128 CreateId = BitConverter.ToUInt128(CreateID, 0);
|
||||
//Info.CreateId = new CreateId(CreateId);
|
||||
Info.CreateId = utilImpl.MakeCreateId();
|
||||
Info.Nickname = Nickname.FromString(MiiName);
|
||||
Info.FavoriteColor = (byte)FavoriteColor;
|
||||
Info.Gender = IsMale ? Gender.Male : Gender.Female;
|
||||
|
@ -18,6 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption
|
||||
public int WriteCounter { get; set; }
|
||||
public DateTime LastWriteDate { get; set; }
|
||||
public byte[] TagUuid { get; set; }
|
||||
internal StoreData StoreData { get; set; }
|
||||
|
||||
internal RegisterInfo GetRegisterInfo(ITickSource tickSource)
|
||||
{
|
||||
@ -33,8 +34,9 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption
|
||||
UtilityImpl utilityImpl = new UtilityImpl(tickSource);
|
||||
CharInfo Info = new();
|
||||
Info.SetFromStoreData(StoreData.BuildDefault(utilityImpl, 0));
|
||||
CharInfo charInfo = charInfoBin.ConvertToCharInfo(Info);
|
||||
CharInfo charInfo = charInfoBin.ConvertToCharInfo(utilityImpl,Info);
|
||||
info.MiiCharInfo = charInfo;
|
||||
StoreData = CharInfo.BuildFromCharInfo(utilityImpl, charInfo);
|
||||
return info;
|
||||
}
|
||||
public void UpdateApplicationArea(byte[] applicationAreaData)
|
||||
|
Loading…
x
Reference in New Issue
Block a user