diff --git a/UAssetAPI/ExportTypes/FunctionExport.cs b/UAssetAPI/ExportTypes/FunctionExport.cs index d460c50f..f1fd1d86 100644 --- a/UAssetAPI/ExportTypes/FunctionExport.cs +++ b/UAssetAPI/ExportTypes/FunctionExport.cs @@ -1,6 +1,7 @@ using System.IO; -using UAssetAPI.UnrealTypes; +using System.Reflection.PortableExecutable; using UAssetAPI.ExportTypes; +using UAssetAPI.UnrealTypes; namespace UAssetAPI.ExportTypes { @@ -9,7 +10,11 @@ namespace UAssetAPI.ExportTypes /// public class FunctionExport : StructExport { - public EFunctionFlags FunctionFlags; + public EFunctionFlags FunctionFlags; + public short RepOffset; + public FPackageIndex EventGraphFunction; + public int EventGraphCallOffset; + public FunctionExport(Export super) : base(super) { Asset = super.Asset; @@ -30,14 +35,43 @@ public override void Read(AssetBinaryReader reader, int nextStarting) { base.Read(reader, nextStarting); FunctionFlags = (EFunctionFlags)reader.ReadUInt32(); - // TODO + + if (FunctionFlags.HasFlag(EFunctionFlags.FUNC_Net)) + { + RepOffset = reader.ReadInt16(); + } + else + { + RepOffset = 0; + } + + if (reader.Asset.ObjectVersion >= ObjectVersion.VER_UE4_SERIALIZE_BLUEPRINT_EVENTGRAPH_FASTCALLS_IN_UFUNCTION) + { + EventGraphFunction = new(reader.ReadInt32()); + EventGraphCallOffset = reader.ReadInt32(); + } + else + { + EventGraphFunction = null; + EventGraphCallOffset = 0; + } } public override void Write(AssetBinaryWriter writer) { base.Write(writer); writer.Write((uint)FunctionFlags); - // TODO - } + + if (FunctionFlags.HasFlag(EFunctionFlags.FUNC_Net)) + { + writer.Write(RepOffset); + } + + if (writer.Asset.ObjectVersion >= ObjectVersion.VER_UE4_SERIALIZE_BLUEPRINT_EVENTGRAPH_FASTCALLS_IN_UFUNCTION) + { + writer.Write(EventGraphFunction.Index); + writer.Write(EventGraphCallOffset); + } + } } } diff --git a/UAssetAPI/PropertyTypes/Objects/PropertyData.cs b/UAssetAPI/PropertyTypes/Objects/PropertyData.cs index 0a85ec3d..f2e1cf28 100644 --- a/UAssetAPI/PropertyTypes/Objects/PropertyData.cs +++ b/UAssetAPI/PropertyTypes/Objects/PropertyData.cs @@ -96,7 +96,7 @@ public void Initialize(AncestryInfo ancestors, FName dad, FName modulePath = nul public void SetAsParent(FName dad, FName modulePath = null) { - if (dad != null) Ancestors.Add(string.IsNullOrEmpty(modulePath?.Value?.Value) ? dad : FName.DefineDummy(null, modulePath.Value.Value + "." + dad.Value.Value)); + if (dad?.Value != null) Ancestors.Add(string.IsNullOrEmpty(modulePath?.Value?.Value) ? dad : FName.DefineDummy(null, modulePath.Value.Value + "." + dad.Value.Value)); } }