Esempio n. 1
0
 public static BK4 ReadUnshuffle(ReadOnlySpan<byte> data)
 {
     var PID = ReadUInt32BigEndian(data);
     uint sv = ((PID & 0x3E000) >> 0xD) % 24;
     var unshuffled = PokeCrypto.ShuffleArray(data, sv, PokeCrypto.SIZE_4BLOCK);
     var result = new BK4(unshuffled);
     result.RefreshChecksum();
     return result;
 }
Esempio n. 2
0
        public static BK4 ReadUnshuffle(byte[] data)
        {
            var  PID    = BigEndian.ToUInt32(data, 0);
            uint sv     = ((PID & 0x3E000) >> 0xD) % 24;
            var  Data   = PokeCrypto.ShuffleArray(data, sv, PokeCrypto.SIZE_4BLOCK);
            var  result = new BK4(Data);

            result.RefreshChecksum();
            return(result);
        }
Esempio n. 3
0
        public BK4 convertToBK4()
        {
            BK4 bk4 = new BK4();

            TransferPropertiesWithReflection(this, bk4);
            // Fix Non-Reflectable properties
            Array.Copy(Data, 0x78, bk4.Data, 0x78, 6); // Met Info
            // Preserve Trash Bytes
            for (int i = 0; i < 11; i++)               // Nickname
            {
                bk4.Data[0x48 + 2 * i]     = Data[0x48 + 2 * i + 1];
                bk4.Data[0x48 + 2 * i + 1] = Data[0x48 + 2 * i];
            }
            for (int i = 0; i < 8; i++) // OT_Name
            {
                bk4.Data[0x68 + 2 * i]     = Data[0x68 + 2 * i + 1];
                bk4.Data[0x68 + 2 * i + 1] = Data[0x68 + 2 * i];
            }
            bk4.Sanity = 0x4000;
            bk4.RefreshChecksum();
            return(bk4);
        }
Esempio n. 4
0
File: PK4.cs Progetto: kwsch/PKHeX
 public BK4 convertToBK4()
 {
     BK4 bk4 = new BK4();
     TransferPropertiesWithReflection(this, bk4);
     // Fix Non-Reflectable properties
     Array.Copy(Data, 0x78, bk4.Data, 0x78, 6); // Met Info
     // Preserve Trash Bytes
     for (int i = 0; i < 11; i++) // Nickname
     {
         bk4.Data[0x48 + 2*i] = Data[0x48 + 2*i + 1];
         bk4.Data[0x48 + 2*i + 1] = Data[0x48 + 2*i];
     }
     for (int i = 0; i < 8; i++) // OT_Name
     {
         bk4.Data[0x68 + 2*i] = Data[0x68 + 2*i + 1];
         bk4.Data[0x68 + 2*i + 1] = Data[0x68 + 2*i];
     }
     bk4.Sanity = 0x4000;
     bk4.RefreshChecksum();
     return bk4;
 }