/// <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)); }