diff --git a/src/Core/Classes/Props/UDelegateProperty.cs b/src/Core/Classes/Props/UDelegateProperty.cs index 5b88aa85..dc37b353 100644 --- a/src/Core/Classes/Props/UDelegateProperty.cs +++ b/src/Core/Classes/Props/UDelegateProperty.cs @@ -50,6 +50,14 @@ protected override void Deserialize() } } +#if DNF + public override bool IsCompilerGenerated() + { + // delegate properties are compiler generated in DNF, not part of the source. + return Package.Build == UnrealPackage.GameBuild.BuildName.DNF; + } +#endif + /// public override string GetFriendlyType() { diff --git a/src/Core/Classes/Props/UPointerProperty.cs b/src/Core/Classes/Props/UPointerProperty.cs index 542c4c79..256d4e42 100644 --- a/src/Core/Classes/Props/UPointerProperty.cs +++ b/src/Core/Classes/Props/UPointerProperty.cs @@ -10,6 +10,10 @@ namespace UELib.Core [UnrealRegisterClass] public class UPointerProperty : UProperty { +#if DNF + public UName PointerType; +#endif + /// /// Creates a new instance of the UELib.Core.UPointerProperty class. /// @@ -18,9 +22,25 @@ public UPointerProperty() Type = PropertyType.PointerProperty; } + /// + protected override void Deserialize() + { + base.Deserialize(); +#if DNF + if (Package.Build == UnrealPackage.GameBuild.BuildName.DNF) + { + PointerType = _Buffer.ReadNameReference(); + } +#endif + } + /// public override string GetFriendlyType() { +#if DNF + if (Package.Build == UnrealPackage.GameBuild.BuildName.DNF) + return "pointer(" + PointerType.Name + ")"; +#endif return "pointer"; } } diff --git a/src/Core/Classes/Props/UProperty.cs b/src/Core/Classes/Props/UProperty.cs index b416e317..8a380d07 100644 --- a/src/Core/Classes/Props/UProperty.cs +++ b/src/Core/Classes/Props/UProperty.cs @@ -288,6 +288,11 @@ public bool IsParm() return HasPropertyFlag(PropertyFlagsLO.Parm); } + public virtual bool IsCompilerGenerated() + { + return false; + } + public virtual string GetFriendlyInnerType() { return string.Empty; diff --git a/src/Core/Classes/Props/UPropertyDecompiler.cs b/src/Core/Classes/Props/UPropertyDecompiler.cs index a939f8ee..8a425c11 100644 --- a/src/Core/Classes/Props/UPropertyDecompiler.cs +++ b/src/Core/Classes/Props/UPropertyDecompiler.cs @@ -37,6 +37,10 @@ private string DecompileEditorData() string[] options = EditorDataText.TrimEnd('\n').Split('\n'); string decodedOptions = string.Join(" ", options.Select(PropertyDisplay.FormatLiteral)); +#if DNF + if (Package.Build == UnrealPackage.GameBuild.BuildName.DNF) + return " ?(" + decodedOptions + ")"; +#endif return " " + decodedOptions; } @@ -378,7 +382,12 @@ public string FormatFlags() } else // Not Automated { - if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.NoExport) != 0) + if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.NoExport) != 0 +#if DNF + // 0x00800000 is CPF_Comment in DNF + && Package.Build != UnrealPackage.GameBuild.BuildName.DNF +#endif + ) { output += "noexport "; copyFlags &= ~(ulong)Flags.PropertyFlagsLO.NoExport; @@ -422,6 +431,9 @@ public string FormatFlags() if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.EdFindable) != 0 #if AHIT && Package.Build != UnrealPackage.GameBuild.BuildName.AHIT +#endif +#if DNF + && Package.Build != UnrealPackage.GameBuild.BuildName.DNF #endif ) { @@ -429,7 +441,11 @@ public string FormatFlags() output += "edfindable "; } - if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.Deprecated) != 0) + if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.Deprecated) != 0 +#if DNF + && Package.Build != UnrealPackage.GameBuild.BuildName.DNF +#endif + ) { output += "deprecated "; copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Deprecated; @@ -495,6 +511,12 @@ public string FormatFlags() #if DNF if (Package.Build == UnrealPackage.GameBuild.BuildName.DNF) { + if (HasPropertyFlag(0x20000000)) + { + output += "edfindable "; + copyFlags &= ~(uint)0x20000000; + } + if (HasPropertyFlag(0x1000000)) { output += "nontrans "; diff --git a/src/Core/Classes/UClassDecompiler.cs b/src/Core/Classes/UClassDecompiler.cs index 0ce38567..ce1fe325 100644 --- a/src/Core/Classes/UClassDecompiler.cs +++ b/src/Core/Classes/UClassDecompiler.cs @@ -249,17 +249,29 @@ private string FormatFlags() } } - if ((ClassFlags & (uint)Flags.ClassFlags.EditInlineNew) != 0) +#if DNF + if (Package.Build == UnrealPackage.GameBuild.BuildName.DNF) { - output += "\r\n\teditinlinenew"; + if (HasClassFlag(0x00001000U)) + { + output += "\r\n\tobsolete"; + } } else +#endif { - // Only do if parent had EditInlineNew - var parentClass = (UClass)Super; - if (parentClass != null && (parentClass.ClassFlags & (uint)Flags.ClassFlags.EditInlineNew) != 0) + if ((ClassFlags & (uint)Flags.ClassFlags.EditInlineNew) != 0) + { + output += "\r\n\teditinlinenew"; + } + else { - output += "\r\n\tnoteditinlinenew"; + // Only do if parent had EditInlineNew + var parentClass = (UClass)Super; + if (parentClass != null && (parentClass.ClassFlags & (uint)Flags.ClassFlags.EditInlineNew) != 0) + { + output += "\r\n\tnoteditinlinenew"; + } } } @@ -268,6 +280,25 @@ private string FormatFlags() output += "\r\n\tcollapsecategories"; } +#if DNF + if (Package.Build == UnrealPackage.GameBuild.BuildName.DNF) + { + if (HasClassFlag(0x00004000)) + { + output += "\r\n\teditinlinenew"; + } + else + { + // Only do if parent had EditInlineNew + var parentClass = (UClass)Super; + if (parentClass != null && (parentClass.ClassFlags & 0x00004000) != 0) + { + output += "\r\n\tnoteditinlinenew"; + } + } + } + else +#endif // TODO: Might indicate "Interface" in later versions if (HasClassFlag(Flags.ClassFlags.ExportStructs) && Package.Version < 300) { @@ -281,13 +312,29 @@ private string FormatFlags() if (Extends("Actor")) { - if ((ClassFlags & (uint)Flags.ClassFlags.Placeable) != 0) +#if DNF + if (Package.Build == UnrealPackage.GameBuild.BuildName.DNF) { - output += Package.Version >= PlaceableVersion ? "\r\n\tplaceable" : "\r\n\tusercreate"; + if (HasClassFlag(0x02000)) + { + output += "\r\n\tplaceable"; + } + else + { + output += $"\r\n\tnotplaceable"; + } } else +#endif { - output += Package.Version >= PlaceableVersion ? "\r\n\tnotplaceable" : "\r\n\tnousercreate"; + if ((ClassFlags & (uint)Flags.ClassFlags.Placeable) != 0) + { + output += Package.Version >= PlaceableVersion ? "\r\n\tplaceable" : "\r\n\tusercreate"; + } + else + { + output += Package.Version >= PlaceableVersion ? "\r\n\tnotplaceable" : "\r\n\tnousercreate"; + } } } diff --git a/src/Core/Classes/UFunction.cs b/src/Core/Classes/UFunction.cs index 75cbff07..e7d7e49b 100644 --- a/src/Core/Classes/UFunction.cs +++ b/src/Core/Classes/UFunction.cs @@ -182,6 +182,15 @@ public bool IsPre() return IsOperator() && HasFunctionFlag(Flags.FunctionFlags.PreOperator); } + public bool IsDelegate() + { +#if DNF + if (Package.Build == UnrealPackage.GameBuild.BuildName.DNF) + return HasFunctionFlag(0x400000); +#endif + return HasFunctionFlag(Flags.FunctionFlags.Delegate); + } + public bool HasOptionalParamData() { // FIXME: Deprecate version check, and re-map the function flags using the EngineBranch class approach. diff --git a/src/Core/Classes/UFunctionDecompiler.cs b/src/Core/Classes/UFunctionDecompiler.cs index bb7f2a3c..e01d318a 100644 --- a/src/Core/Classes/UFunctionDecompiler.cs +++ b/src/Core/Classes/UFunctionDecompiler.cs @@ -146,8 +146,11 @@ private string FormatFlags() #if DNF if (Package.Build == UnrealPackage.GameBuild.BuildName.DNF) { - // 0x20000200 unknown specifier - + if (HasFunctionFlag(0x20000000)) + { + output += "devexec "; + } + if (HasFunctionFlag(0x4000000)) { output += "animevent "; @@ -207,7 +210,7 @@ private string FormatFlags() isNormalFunction = false; } - if (HasFunctionFlag(Flags.FunctionFlags.Delegate)) + if (IsDelegate()) { output += "delegate "; isNormalFunction = false; diff --git a/src/Core/Classes/UFunctionNode.cs b/src/Core/Classes/UFunctionNode.cs index 7f3efa48..08b2e9d4 100644 --- a/src/Core/Classes/UFunctionNode.cs +++ b/src/Core/Classes/UFunctionNode.cs @@ -36,7 +36,7 @@ public override string GetImageName() { name = "Event"; } - else if (HasFunctionFlag(Flags.FunctionFlags.Delegate)) + else if (IsDelegate()) { name = "Delegate"; } diff --git a/src/Core/Classes/UStructDecompiler.cs b/src/Core/Classes/UStructDecompiler.cs index 82fbb1ba..e079648e 100644 --- a/src/Core/Classes/UStructDecompiler.cs +++ b/src/Core/Classes/UStructDecompiler.cs @@ -203,6 +203,9 @@ protected string FormatProperties() // Don't use foreach, screws up order. foreach (var property in Variables) { + if (property.IsCompilerGenerated()) + continue; + // Fix for properties within structs output += "\r\n" + property.PreDecompile() +