Skip to content

Commit

Permalink
fix unversioned props for 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
atenfyr committed Jan 27, 2025
1 parent 5c5122c commit c98ba52
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
15 changes: 13 additions & 2 deletions UAssetAPI/ExportTypes/NormalExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public NormalExport()
public override void Read(AssetBinaryReader reader, int nextStarting = 0)
{
// 5.4-specific problem; unclear why this occurs
if (reader.Asset.ObjectVersionUE5 >= ObjectVersionUE5.PROPERTY_TAG_COMPLETE_TYPE_NAME && !ObjectFlags.HasFlag(EObjectFlags.RF_ClassDefaultObject))
if (reader.Asset.ObjectVersionUE5 > ObjectVersionUE5.DATA_RESOURCES && reader.Asset.ObjectVersionUE5 < ObjectVersionUE5.ASSETREGISTRY_PACKAGEBUILDDEPENDENCIES && !ObjectFlags.HasFlag(EObjectFlags.RF_ClassDefaultObject))
{
int dummy = reader.ReadInt32();
if (dummy != 0) throw new FormatException("Expected 4 null bytes at start of NormalExport; got " + dummy);
Expand Down Expand Up @@ -166,14 +166,25 @@ public override void ResolveAncestries(UAsset asset, AncestryInfo ancestrySoFar)
public override void Write(AssetBinaryWriter writer)
{
// 5.4-specific problem; unclear why this occurs
if (writer.Asset.ObjectVersionUE5 >= ObjectVersionUE5.PROPERTY_TAG_COMPLETE_TYPE_NAME && !ObjectFlags.HasFlag(EObjectFlags.RF_ClassDefaultObject))
if (writer.Asset.ObjectVersionUE5 > ObjectVersionUE5.DATA_RESOURCES && writer.Asset.ObjectVersionUE5 < ObjectVersionUE5.ASSETREGISTRY_PACKAGEBUILDDEPENDENCIES && !ObjectFlags.HasFlag(EObjectFlags.RF_ClassDefaultObject))
{
writer.Write((int)0); // "false" bool?
}

FName parentName = GetClassTypeForAncestry(writer.Asset, out FName parentModulePath);

MainSerializer.GenerateUnversionedHeader(ref Data, parentName, parentModulePath, writer.Asset)?.Write(writer);

if (!writer.Asset.HasUnversionedProperties && writer.Asset.ObjectVersionUE5 >= ObjectVersionUE5.PROPERTY_TAG_EXTENSION_AND_OVERRIDABLE_SERIALIZATION)
{
writer.Write((byte)SerializationControl);

if (SerializationControl.HasFlag(EClassSerializationControlExtension.OverridableSerializationInformation))
{
writer.Write((byte)Operation);
}
}

for (int j = 0; j < Data.Count; j++)
{
PropertyData current = Data[j];
Expand Down
5 changes: 5 additions & 0 deletions UAssetAPI/MainSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ public static PropertyData Read(AssetBinaryReader reader, AncestryInfo ancestry,

leng = reader.ReadInt32();
propertyTagFlags = (EPropertyTagFlags)reader.ReadByte();

if (propertyTagFlags.HasFlag(EPropertyTagFlags.HasArrayIndex))
{
ArrayIndex = reader.ReadInt32();
}
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion UAssetAPI/UnrealTypes/UE4VersionToObjectVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public enum UE4VersionToObjectVersion
VER_UE5_1 = 522,
VER_UE5_2 = 522,
VER_UE5_3 = 522,
VER_UE5_4 = 522
VER_UE5_4 = 522,
VER_UE5_5 = 522
}

public enum UE5VersionToObjectVersion
Expand Down

0 comments on commit c98ba52

Please sign in to comment.