Skip to content

Commit

Permalink
add support for v32 #minor (#60)
Browse files Browse the repository at this point in the history
* Dynamically increase netfieldexport array

* Added CustomExports version

* add support for v32. Fixes #58

* fixup! add support for v32. Fixes #58

---------

Co-authored-by: Zach T <[email protected]>
  • Loading branch information
Shiqan and SL-x-TnT authored Nov 5, 2024
1 parent 990ee2f commit 3e16518
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 3 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Interfaces to support proper DI
- Register types to be parsed with DI

## [2.2.3] - 2024-11-05
### Changed
- add support for Fortnite v32 (see [issue 58](https://github.com/Shiqan/FortniteReplayDecompressor/issues/58)) (by [SL-x-TnT](https://github.com/SL-x-TnT))

## [2.2.2] - 2024-03-31
### Changed
- fix `ParseElimination` (see [issue 55](https://github.com/Shiqan/FortniteReplayDecompressor/issues/55))
Expand All @@ -27,15 +31,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [2.0.8] - 2023-09-10
### Changed
- add support for v26.00
- add support for Fortnite v26

## [2.0.7] - 2023-09-10
### Changed
- add HISTORY_GAMESTATE_REPLCIATED_TIME_AS_DOUBLE (by [chrisai-dev](https://github.com/chrisai-dev))

## [2.0.6] - 2023-06-10
### Changed
- adding support for v25.00
- adding support for Fortnite v25

## [2.0.5] - 2022-12-04
### Changed
Expand Down
3 changes: 3 additions & 0 deletions src/ConsoleReader/ConsoleReader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<ProjectReference Include="..\FortniteReplayReader\FortniteReplayReader.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Replays\chapter5season5.replay">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Replays\collectPickup.replay">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Binary file added src/ConsoleReader/Replays/chapter5season5.replay
Binary file not shown.
2 changes: 1 addition & 1 deletion src/FortniteReplayReader.Test/DecryptBufferTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void DecryptTest()

using var archive = new Unreal.Core.BinaryReader(new MemoryStream(rawData))
{
EngineNetworkVersion = Unreal.Core.Models.Enums.EngineNetworkVersionHistory.LATEST, // 16
EngineNetworkVersion = Unreal.Core.Models.Enums.EngineNetworkVersionHistory.HISTORY_REPLAY_DORMANCY,
};
var reader = new MockReplayReader()
{
Expand Down
5 changes: 5 additions & 0 deletions src/Unreal.Core/Models/DataBunch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ public DataBunch(DataBunch InBunch)
/// </summary>
public bool bPartialInitial { get; set; }

/// <summary>
/// This bunch marks the end of the CustomExports data that needs to be processed immediately (not queued)
/// </summary>
public bool bHasPartialCustomExportsFinalBit { get; set; }

/// <summary>
/// The final bunch of a partial bunch
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions src/Unreal.Core/Models/Enums/EngineNetworkVersionHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public enum EngineNetworkVersionHistory
HISTORY_SUBOBJECT_DESTROY_FLAG = 30, // Bump version to support subobject destruction message flags
HISTORY_GAMESTATE_REPLCIATED_TIME_AS_DOUBLE = 31, // Bump version to support AGameStateBase::ReplicatedWorldTimeSeconds as double instead of float.
HISTORY_CUSTOMVERION = 32, // Bump version to switch to using custom versions
DynamicMontageSerialization = 33, // Bump version to support dynamic montage serialization in the Gameplay Ability System
PredictionKeyBaseNotReplicated = 34, // Bump version to stop FPredictionKey::Base from being replicated (it was unused).
RepMoveOptionalAcceleration = 35, // Bump version to support serialization changes to RepMove for optional Acceleration
CustomExports = 36, // Bump version to support CustomExports (such as NetTokens used for supporting "Dynamic Replication" of GameplayTags -- see FGameplayTag::NetSerialize_Packed) // -----<new versions can be added above this line>-------------------------------------------------

HISTORY_ENGINENETVERSION_PLUS_ONE,
LATEST = HISTORY_ENGINENETVERSION_PLUS_ONE - 1,
Expand Down
15 changes: 15 additions & 0 deletions src/Unreal.Core/ReplayReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,17 @@ public virtual void ReadNetFieldExports(FArchive archive)
};
_netGuidCache.AddToExportGroupMap(pathName, group);
}
else if (numExports > group.NetFieldExportsLength)
{
// Allow our exports to dynamically grow as more are encountered
var oldExports = group.NetFieldExports;

group.NetFieldExports = new NetFieldExport[numExports];
group.NetFieldExportsLength = numExports;

Array.Copy(oldExports, group.NetFieldExports, oldExports.Length);
}

//GuidCache->NetFieldExportGroupPathToIndex.Add(PathName, PathNameIndex);
//GuidCache->NetFieldExportGroupIndexToGroup.Add(PathNameIndex, NetFieldExportGroup);
}
Expand Down Expand Up @@ -1940,6 +1951,9 @@ public virtual void ReceivedPacket(FBitArchive bitReader)
// https://github.com/EpicGames/UnrealEngine/blob/70bc980c6361d9a7d23f6d23ffe322a2d6ef16fb/Engine/Source/Runtime/Engine/Private/NetConnection.cpp#1549
InPacketId++;

// We want to be able to read replays that do not support export extentions.
bool bHasPartialCustomExportsFinalBit = !(bitReader.EngineNetworkVersion < EngineNetworkVersionHistory.CustomExports);

//var rejectedChannels = new Dictionary<uint, uint>();
while (!bitReader.AtEnd())
{
Expand Down Expand Up @@ -2003,6 +2017,7 @@ public virtual void ReceivedPacket(FBitArchive bitReader)
}

bunch.bPartialInitial = bunch.bPartial && bitReader.ReadBit();
bunch.bHasPartialCustomExportsFinalBit = bunch.bPartial && bHasPartialCustomExportsFinalBit ? bitReader.ReadBit() : false;
bunch.bPartialFinal = bunch.bPartial && bitReader.ReadBit();

var chType = ChannelType.None;
Expand Down

0 comments on commit 3e16518

Please sign in to comment.