public static byte[] GenerateQRData(PK7 pk7, int box = 0, int slot = 0, int num_copies = 1) { if (box > 31) { box = 31; } if (slot > 29) { slot = 29; } if (box < 0) { box = 0; } if (slot < 0) { slot = 0; } if (num_copies < 0) { num_copies = 1; } byte[] data = new byte[0x1A2]; BitConverter.GetBytes(0x454B4F50).CopyTo(data, 0); // POKE magic data[0x4] = 0xFF; // QR Type BitConverter.GetBytes(box).CopyTo(data, 0x8); BitConverter.GetBytes(slot).CopyTo(data, 0xC); BitConverter.GetBytes(num_copies).CopyTo(data, 0x10); // No need to check max num_copies, payload parser handles it on-console. pk7.EncryptedPartyData.CopyTo(data, 0x30); // Copy in pokemon data GetRawQR(pk7.Species, pk7.AltForm, pk7.IsShiny, pk7.Gender).CopyTo(data, 0x140); BitConverter.GetBytes(Checksums.CRC16(data, 0, 0x1A0)).CopyTo(data, 0x1A0); return(data); }
protected override ushort GetChecksum(byte[] data) => Checksums.CRC16(data, Offset, Length);