From 7923527e0390a85f43778f6f83ee55c7f907551d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n?= Date: Fri, 9 Jun 2023 21:56:55 +0200 Subject: [PATCH 1/2] adding support for v25.00 --- .../Models/Enums/NetworkVersionHistory.cs | 1 + .../Models/Enums/ReplayVersionHistory.cs | 1 + src/Unreal.Core/ReplayReader.cs | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/src/Unreal.Core/Models/Enums/NetworkVersionHistory.cs b/src/Unreal.Core/Models/Enums/NetworkVersionHistory.cs index be626ba..88fd3cd 100644 --- a/src/Unreal.Core/Models/Enums/NetworkVersionHistory.cs +++ b/src/Unreal.Core/Models/Enums/NetworkVersionHistory.cs @@ -23,6 +23,7 @@ public enum NetworkVersionHistory HISTORY_GUIDCACHE_CHECKSUMS = 16, // Removing guid export checksums from saved data, they are ignored during playback HISTORY_SAVE_PACKAGE_VERSION_UE = 17, // Save engine and licensee package version as well, in case serialization functions need them for compatibility HISTORY_RECORDING_METADATA = 18, // Adding additional record-time information to the header + HISTORY_USE_CUSTOM_VERSION = 19, // Serializing replay and network versions as custom verions going forward HISTORY_NETWORKVERSION_PLUS_ONE, LATEST = HISTORY_NETWORKVERSION_PLUS_ONE - 1, diff --git a/src/Unreal.Core/Models/Enums/ReplayVersionHistory.cs b/src/Unreal.Core/Models/Enums/ReplayVersionHistory.cs index e348ef3..eb3c2ba 100644 --- a/src/Unreal.Core/Models/Enums/ReplayVersionHistory.cs +++ b/src/Unreal.Core/Models/Enums/ReplayVersionHistory.cs @@ -13,6 +13,7 @@ public enum ReplayVersionHistory : uint HISTORY_STREAM_CHUNK_TIMES = 4, HISTORY_FRIENDLY_NAME_ENCODING = 5, HISTORY_ENCRYPTION = 6, + HISTORY_2500 = 7, // TODO, FIND THE NAME OF THIS HISTORY_PLUS_ONE, LATEST = HISTORY_PLUS_ONE - 1 diff --git a/src/Unreal.Core/ReplayReader.cs b/src/Unreal.Core/ReplayReader.cs index 4e257ae..8fbc363 100644 --- a/src/Unreal.Core/ReplayReader.cs +++ b/src/Unreal.Core/ReplayReader.cs @@ -410,7 +410,14 @@ public virtual void ReadReplayHeader(FArchive archive) _logger?.LogError("Header.Version < MIN_NETWORK_DEMO_VERSION. Header.Version: {}, MIN_NETWORK_DEMO_VERSION: {}", header.NetworkVersion, NetworkVersionHistory.HISTORY_EXTRA_VERSION); throw new InvalidReplayException($"Header.Version < MIN_NETWORK_DEMO_VERSION. Header.Version: {header.NetworkVersion}, MIN_NETWORK_DEMO_VERSION: {NetworkVersionHistory.HISTORY_EXTRA_VERSION}"); } + if (header.NetworkVersion >= NetworkVersionHistory.HISTORY_USE_CUSTOM_VERSION) + { + var customVersionCount = archive.ReadInt32(); + // version guid -> 16 bytes + // version -> 4 bytes + archive.SkipBytes(customVersionCount * 20); + } header.NetworkChecksum = archive.ReadUInt32(); header.EngineNetworkVersion = archive.ReadUInt32AsEnum(); @@ -524,7 +531,14 @@ public virtual void ReadReplayInfo(FArchive archive) { _logger?.LogWarning("Found unexpected ReplayVersionHistory: {}", fileVersion); } + if (archive.ReplayVersion == ReplayVersionHistory.HISTORY_2500) + { + var customVersionCount = archive.ReadInt32(); + // version guid -> 16 bytes + // version -> 4 bytes + archive.SkipBytes(customVersionCount * 20); + } var info = new ReplayInfo() { FileVersion = fileVersion, From 9fdd3afef1fc24f1af8648923bf4cf3a3f52e247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kriszti=C3=A1n?= Date: Fri, 9 Jun 2023 22:08:33 +0200 Subject: [PATCH 2/2] small fix --- src/Unreal.Core/ReplayReader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Unreal.Core/ReplayReader.cs b/src/Unreal.Core/ReplayReader.cs index 8fbc363..ae3664f 100644 --- a/src/Unreal.Core/ReplayReader.cs +++ b/src/Unreal.Core/ReplayReader.cs @@ -531,7 +531,7 @@ public virtual void ReadReplayInfo(FArchive archive) { _logger?.LogWarning("Found unexpected ReplayVersionHistory: {}", fileVersion); } - if (archive.ReplayVersion == ReplayVersionHistory.HISTORY_2500) + if (archive.ReplayVersion >= ReplayVersionHistory.HISTORY_2500) { var customVersionCount = archive.ReadInt32();