/// <summary> /// Load and Parse the Battle Video /// </summary> /// <param name="raw">Byte array containing the entire (decrypted) battle video's data.</param> private void OpenBV(byte[] raw) { Reset(); lastdata = (byte[])raw.Clone(); var bvid = new BV6(raw); var trainers = bvid.PlayerNames; var pkms = bvid.BattlePKMs; var teams = bvid.PlayerTeams; LoadBattleInfo(bvid, trainers); LoadTeamData(pkms, trainers); LoadPreviewPics(pkms, raw); // Move Instructions (0xC00 Max) int instructionLength = BitConverter.ToInt32(raw, 0x210); byte[] instructions = raw.Skip(0x214).Take(instructionLength).ToArray(); byte order = raw[0]; if (order != 0x20) // Switched { BVidUtil.ReorderTeams(order, bvid.Style, teams, trainers); } L_Uploader.Location = (order == 0x20) ? new Point(98, 0) : new Point(9, 61); var parser = new BVidParser(bvid, teams, trainers); RTB_Parse.Lines = parser.Parse(instructions); lastParse = parser; }
public static bool IsValid(byte[] data) { if (BV6.IsValid(data)) { return(true); } if (BV7.IsValid(data)) { return(true); } return(false); }
public static BattleVideo GetVariantBattleVideo(byte[] data) { if (BV6.IsValid(data)) { return(new BV6(data)); } if (BV7.IsValid(data)) { return(new BV7(data)); } return(null); }
public static bool IsValid(ReadOnlySpan <byte> data) { if (BV6.IsValid(data)) { return(true); } if (BV7.IsValid(data)) { return(true); } if (BV3.IsValid(data)) { return(true); } return(false); }
private void LoadBattleInfo(BV6 bvid, IReadOnlyList <string> trainers) { TB_Mode.Text = ((BattleMode)bvid.Mode).ToString(); TB_Style.Text = ((BattleStyle)bvid.Style).ToString(); L_VS.Text = bvid.Style == 4 ? string.Format("{0} && {2} -VS- {1} && {3}", trainers[0], trainers[1], trainers[2], trainers[3]) : $"{trainers[0]} -VS- {trainers[1]}"; rA.Text = bvid.RNGConst1.ToString("X8"); r0.Text = bvid.RNGConst2.ToString("X8"); rM.Text = bvid.RNGSeed1.ToString("X16"); rN.Text = bvid.RNGSeed2.ToString("X16"); u1t.Text = bvid.Debug1; u2t.Text = bvid.Debug2; TB_Recorded.Text = bvid.MatchStamp?.ToString("R") ?? "None"; TB_Uploaded.Text = bvid.UploadStamp?.ToString("R") ?? "None"; }
public BVidParser(BV6 bv, PKM[][] teams, string[] trainers) { bvid = bv; this.teams = teams; this.trainers = trainers; }