Ejemplo n.º 1
0
        public static byte[] Patch(byte[] Data, string UID)
        {
            // ToDo: Fix UID Cast

            byte[] Decrypted_Amiibo;
            if (IsEncrypted(Data))
            {
                Decrypted_Amiibo = Amiibo_Class.Decrypt(Data, Main_Form.AmiiKeys);
            }
            else
            {
                Decrypted_Amiibo = Data;
            }

            byte[] Password_Amiibo = Amiibo_Class.Generate_Password(UID);
            byte[] UID_Long        = NtagHelpers.StringToByteArrayFastest(UID);

            Array.Copy(UID_Long, 0x008, Decrypted_Amiibo, 0x000, 0x001);                        //Put LastChar of Long UID
            Array.Copy(new byte[] { 0x00, 0x00 }, 0x000, Decrypted_Amiibo, 0x002, 0x002);       //Reset Static Lock Bytes
            Array.Copy(UID_Long, 0x000, Decrypted_Amiibo, 0x1D4, 0x008);                        //Modify UID
            Array.Copy(new byte[] { 0x00, 0x00, 0x00 }, 0x000, Decrypted_Amiibo, 0x208, 0x003); //Reset Dynamic Lock Bytes
            Array.Copy(Password_Amiibo, 0x000, Decrypted_Amiibo, 0x214, 0x004);                 //Modify Password
            Array.Copy(new byte[] { 0x80, 0x80 }, 0x000, Decrypted_Amiibo, 0x218, 0x002);       //Reset PACK0 & PACK1

            return(Amiibo_Class.Encrypt(Decrypted_Amiibo, Main_Form.AmiiKeys));
        }