public VPak(FArchive Ar) { Id = Ar.Read <ulong>(); Size = Ar.Read <uint>(); ChunkIndices = Ar.ReadArray <uint>(Ar.Read <int>()); Name = Encoding.ASCII.GetString(Ar.ReadBytes(Ar.ReadByte())); }
public HierarchySettings(FArchive Ar) : base(Ar) { var count = Ar.ReadByte(); Types = Ar.ReadArray <EHierarchyParameterType>(count); Values = Ar.ReadArray <float>(count); }
protected virtual string ParsePlayer(FArchive archive) { // TODO player type enum var botIndicator = archive.ReadByte(); if (botIndicator == 0x03) { return("Bot"); } else if (botIndicator == 0x10) { return(archive.ReadFString()); } // 0x11 var size = archive.ReadByte(); return(archive.ReadGUID(size)); }
public PlayerNameData(FArchive archive) { Handle = archive.ReadByte(); Unknown1 = archive.ReadByte(); IsPlayer = archive.ReadBoolean(); EncodedName = archive.ReadFString(); string decodedName = String.Empty; if (IsPlayer) { for (int i = 0; i < EncodedName.Length; i++) { int shift = (EncodedName.Length % 4 * 3 % 8 + 1 + i) * 3 % 8; decodedName += (char)(EncodedName[i] + shift); } DecodedName = decodedName; } else { DecodedName = EncodedName; } }
protected virtual PlayerElimination ParseElimination(FArchive archive, EventInfo info) { try { var elim = new PlayerElimination { Info = info, }; if (archive.EngineNetworkVersion >= EngineNetworkVersionHistory.HISTORY_FAST_ARRAY_DELTA_STRUCT && Major >= 9) { archive.SkipBytes(85); elim.Eliminated = ParsePlayer(archive); elim.Eliminator = ParsePlayer(archive); } else { if (Major <= 4 && Minor < 2) { archive.SkipBytes(12); } else if (Major == 4 && Minor <= 2) { archive.SkipBytes(40); } else { archive.SkipBytes(45); } elim.Eliminated = archive.ReadFString(); elim.Eliminator = archive.ReadFString(); } elim.GunType = archive.ReadByte(); elim.Knocked = archive.ReadUInt32AsBoolean(); elim.Time = info?.StartTime.MillisecondsToTimeStamp(); return(elim); } catch (Exception ex) { _logger?.LogError($"Error while parsing PlayerElimination at timestamp {info.StartTime}"); throw new PlayerEliminationException($"Error while parsing PlayerElimination at timestamp {info.StartTime}", ex); } }
protected virtual void ParsePlayer(FArchive archive, PlayerEliminationInfo info) { info.PlayerType = archive.ReadByteAsEnum <PlayerTypes>(); switch (info.PlayerType) { case PlayerTypes.Bot: break; case PlayerTypes.NamedBot: info.Id = archive.ReadFString(); break; case PlayerTypes.Player: info.Id = archive.ReadGUID(archive.ReadByte()); break; } }
public VHeader(FArchive Ar) { Magic = Ar.Read <uint>(); if (Magic != _MAGIC) { throw new ParserException(Ar, "Invalid manifest magic"); } HeaderSize = Ar.Read <uint>(); ManifestId = Ar.Read <ulong>(); UncompressedSize = Ar.Read <uint>(); CompressedSize = Ar.Read <uint>(); ChunkCount = Ar.Read <uint>(); PakCount = Ar.Read <uint>(); var gameVersionLength = Ar.ReadByte(); GameVersion = gameVersionLength == 0 ? null : Encoding.ASCII.GetString(Ar.ReadBytes(gameVersionLength)); Ar.Position = HeaderSize; }
protected virtual PlayerElimination ParseElimination(FArchive archive, EventInfo info) { try { var elim = new PlayerElimination { Info = info, }; if (archive.EngineNetworkVersion >= EngineNetworkVersionHistory.HISTORY_FAST_ARRAY_DELTA_STRUCT && Major >= 9) { archive.SkipBytes(9); elim.EliminatedInfo = new PlayerEliminationInfo { Unknown1 = new FVector(archive.ReadSingle(), archive.ReadSingle(), archive.ReadSingle()), Location = new FVector(archive.ReadSingle(), archive.ReadSingle(), archive.ReadSingle()), Unknown2 = new FVector(archive.ReadSingle(), archive.ReadSingle(), archive.ReadSingle()), }; archive.ReadSingle(); //? elim.EliminatorInfo = new PlayerEliminationInfo { Unknown1 = new FVector(archive.ReadSingle(), archive.ReadSingle(), archive.ReadSingle()), Location = new FVector(archive.ReadSingle(), archive.ReadSingle(), archive.ReadSingle()), Unknown2 = new FVector(archive.ReadSingle(), archive.ReadSingle(), archive.ReadSingle()), }; ParsePlayer(archive, elim.EliminatedInfo); ParsePlayer(archive, elim.EliminatorInfo); } else { if (Major <= 4 && Minor < 2) { archive.SkipBytes(12); } else if (Major == 4 && Minor <= 2) { archive.SkipBytes(40); } else { archive.SkipBytes(45); } elim.EliminatedInfo = new PlayerEliminationInfo { Id = archive.ReadFString() }; elim.EliminatorInfo = new PlayerEliminationInfo { Id = archive.ReadFString() }; } elim.GunType = archive.ReadByte(); elim.Knocked = archive.ReadUInt32AsBoolean(); elim.Timestamp = info.StartTime; return(elim); } catch (Exception ex) { _logger?.LogError($"Error while parsing PlayerElimination at timestamp {info.StartTime}"); throw new PlayerEliminationException($"Error while parsing PlayerElimination at timestamp {info.StartTime}", ex); } }
public FPakEntry(PakFileReader reader, string path, FArchive Ar) : base(reader) { Path = path; // FPakEntry is duplicated before each stored file, without a filename. So, // remember the serialized size of this structure to avoid recomputation later. var startOffset = Ar.Position; Offset = Ar.Read <long>(); CompressedSize = Ar.Read <long>(); UncompressedSize = Ar.Read <long>(); Size = UncompressedSize; if (reader.Info.Version < PakFile_Version_FNameBasedCompressionMethod) { var legacyCompressionMethod = Ar.Read <ECompressionFlags>(); int compressionMethodIndex; if (legacyCompressionMethod == COMPRESS_None) { compressionMethodIndex = 0; } else if (legacyCompressionMethod == (ECompressionFlags)259) // SOD2 { compressionMethodIndex = 4; } else if (legacyCompressionMethod.HasFlag(COMPRESS_ZLIB)) { compressionMethodIndex = 1; } else if (legacyCompressionMethod.HasFlag(COMPRESS_GZIP)) { compressionMethodIndex = 2; } else if (legacyCompressionMethod.HasFlag(COMPRESS_Custom)) { if (reader.Game == GAME_SeaOfThieves) { compressionMethodIndex = 4; // LZ4 } else { compressionMethodIndex = 3; // Oodle, used by Fortnite Mobile until early 2019 } } else { compressionMethodIndex = -1; //throw new ParserException("Found an unknown compression type in pak file, will need to be supported for legacy files"); } CompressionMethod = compressionMethodIndex == -1 ? CompressionMethod.Unknown : reader.Info.CompressionMethods[compressionMethodIndex]; } else if (reader.Info.Version == PakFile_Version_FNameBasedCompressionMethod && !reader.Info.IsSubVersion) { CompressionMethod = reader.Info.CompressionMethods[Ar.Read <byte>()]; } else { CompressionMethod = reader.Info.CompressionMethods[Ar.Read <int>()]; } if (reader.Info.Version < PakFile_Version_NoTimestamps) { Ar.Position += 8; // Timestamp } Ar.Position += 20; // Hash if (reader.Info.Version >= PakFile_Version_CompressionEncryption) { if (CompressionMethod != CompressionMethod.None) { CompressionBlocks = Ar.ReadArray <FPakCompressedBlock>(); } Flags = (uint)Ar.ReadByte(); CompressionBlockSize = Ar.Read <uint>(); } if (reader.Info.Version >= PakFile_Version_RelativeChunkOffsets) { // Convert relative compressed offsets to absolute for (var i = 0; i < CompressionBlocks.Length; i++) { CompressionBlocks[i].CompressedStart += Offset; CompressionBlocks[i].CompressedEnd += Offset; } } StructSize = (int)(Ar.Position - startOffset); }