public virtual bool ParseCheckpointContent(ChunkArchive ar, string id, string group, string metadata, uint time1, uint time2) { if ((DemoHeader !.HeaderFlags & DemoHeader.ReplayHeaderFlags.HasStreamingFixes) > 0) { long packetOffset = ar.ReadInt64(); } if (DemoHeader !.NetworkVersion >= NetworkVersionHistory.multipleLevels) { int levelForCheckpoint = ar.ReadInt32(); } if (DemoHeader !.NetworkVersion >= NetworkVersionHistory.deletedStartupActors) { string[] deletedNetStartupActors = ar.ReadArray(ar.ReadString); } int valuesCount = ar.ReadInt32(); for (int i = 0; i < valuesCount; i++) { uint guid = ar.ReadIntPacked(); uint outerGuid = ar.ReadIntPacked(); string path = ar.ReadString(); uint checksum = ar.ReadUInt32(); byte flags = ar.ReadByte(); } NetFieldExportGroupMap(ar); ParsePlaybackPacket(ar); // File.WriteAllBytes( "dump.dump", binaryReader.DumpRemainingBytes() ); return(true); }
public virtual bool ParseNetFieldExportGroup(ChunkArchive ar) { string a = ar.ReadString(); uint packedInt = ar.ReadIntPacked(); uint count = ar.ReadIntPacked(); for (int i = 0; i < count; i++) { ar.ReadNetFieldExport(); } return(true); }
/// <summary> /// https://github.com/EpicGames/UnrealEngine/blob/7d9919ac7bfd80b7483012eab342cb427d60e8c9/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp#L2106 /// </summary> /// <param name="reader"></param> /// <returns></returns> public virtual bool ParseExternalData(ChunkArchive reader) { while (true) { uint externalDataBitsCount = reader.ReadIntPacked(); if (externalDataBitsCount == 0) { return(true); } uint netGuid = reader.ReadIntPacked(); reader.ReadBytes((int)(externalDataBitsCount + 7) >> 3); //TODO: We dont do anything with it yet. We burn byte now. } }
public virtual bool ReadPackets(ChunkArchive reader) { uint seenLevelIndex = 0; while (true) { if (HasLevelStreamingFixes()) { seenLevelIndex = reader.ReadIntPacked(); } var result = ParsePacket(reader); switch (result) { case ReadPacketState.Success: return(true); //TO REMOVE continue; case ReadPacketState.End: return(true); case ReadPacketState.Error: return(false); default: throw new InvalidOperationException(); } }//There is more data ? }
/// <summary> /// https://github.com/EpicGames/UnrealEngine/blob/70bc980c6361d9a7d23f6d23ffe322a2d6ef16fb/Engine/Source/Runtime/Engine/Private/PackageMapClient.cpp#L1579 /// </summary> /// <param name="reader"></param> /// <returns></returns> public virtual bool ParseNetExportGUIDs(ChunkArchive reader) { uint guidCount = reader.ReadIntPacked(); for (int i = 0; i < guidCount; i++) { reader.ReadBytes(reader.ReadInt32()); //burn. } return(true); }
public virtual bool ParseNetFieldExports(ChunkArchive reader) { uint exportCount = reader.ReadIntPacked(); for (int i = 0; i < exportCount; i++) { uint pathNameIndex = reader.ReadIntPacked(); uint wasExported = reader.ReadIntPacked(); if (wasExported > 0) { string pathName = reader.ReadString(); uint numExports = reader.ReadIntPacked(); } else { //We does nothing here but Unreal does something } var netExports = reader.ReadNetFieldExport(); } return(true); }
/// <summary> /// Was writed to support how Fortnite store replays. /// This may need to be upgrade to support other games, or some future version of Fortnite. /// </summary> /// <param name="binaryReader"></param> /// <param name="replayDataInfo"></param> /// <returns></returns> public virtual bool ParsePlaybackPacket(ChunkArchive reader) { bool appendPacket = true; bool hasLevelStreamingFixes = true; //TODO: this method int currentLevelIndex = reader.ReadInt32(); //TODO: use replayVersion. HasLevelStreamingFixes float timeSeconds = reader.ReadSingle(); if (float.IsNaN(timeSeconds)) { throw new InvalidDataException(); } ParseExportData(reader); //TODO: use replayVersion. HasLevelStreamingFixes if (HaveLevelStreamingFixes()) { uint streamingLevelscount = reader.ReadIntPacked(); for (int i = 0; i < streamingLevelscount; i++) { string levelName = reader.ReadString(); } } else { throw new NotSupportedException("TODO"); } long skipExternalOffset = 0; if (HaveLevelStreamingFixes()) { skipExternalOffset = reader.ReadInt64(); } else { throw new NotImplementedException(); } ParseExternalData(reader); uint seenLevelIndex = 0; //while( true ) //{ // if( hasLevelStreamingFixes ) // { // seenLevelIndex = reader.ReadIntPacked(); // } // int amount = ParsePacket( reader ); // if( amount == 0 ) break; // if( appendPacket ) continue; //}//There is more data ? return(true); }
/// <summary> /// Was writed to support how Fortnite store replays. /// This may need to be upgrade to support other games, or some future version of Fortnite. /// https://github.com/EpicGames/UnrealEngine/blob/7d9919ac7bfd80b7483012eab342cb427d60e8c9/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp#L2848 /// </summary> /// <param name="binaryReader"></param> /// <param name="replayDataInfo"></param> /// <returns></returns> public virtual bool ParsePlaybackPacket(ChunkArchive reader) { if (DemoHeader !.NetworkVersion >= DemoHeader.NetworkVersionHistory.multipleLevels) { int currentLevelIndex = reader.ReadInt32(); } float timeSeconds = reader.ReadSingle(); if (float.IsNaN(timeSeconds)) { throw new InvalidDataException(); } if (DemoHeader !.NetworkVersion >= DemoHeader.NetworkVersionHistory.levelStreamingFixes) { ParseExportData(reader); } if (HasLevelStreamingFixes()) { uint streamingLevelscount = reader.ReadIntPacked(); for (int i = 0; i < streamingLevelscount; i++) { string levelName = reader.ReadString(); } } else { throw new NotSupportedException("TODO"); } long skipExternalOffset = 0; if (HasLevelStreamingFixes()) { skipExternalOffset = reader.ReadInt64(); } else { throw new NotImplementedException(); } ParseExternalData(reader); return(ReadPackets(reader)); }