Beispiel #1
0
        protected string DecompileProperties()
        {
            if (Properties == null || Properties.Count == 0)
            {
                return(UDecompilingState.Tabs + "// This object has no properties!\r\n");
            }

            string output = String.Empty;

            //#if DEBUG
            //output += UDecompilingState.Tabs + "// Object Offset:" + UnrealMethods.FlagToString( (uint)ExportTable.SerialOffset ) + "\r\n";
            //#endif

            for (int i = 0; i < Properties.Count; ++i)
            {
                string propOutput = Properties[i].Decompile();

                // This is the first element of a static array
                if (i + 1 < Properties.Count &&
                    Properties[i + 1].Name == Properties[i].Name &&
                    Properties[i].ArrayIndex <= 0 &&
                    Properties[i + 1].ArrayIndex > 0)
                {
                    propOutput = propOutput.Insert(Properties[i].Name.Length, "[0]");
                }

                // FORMAT: 'DEBUG[TAB /* 0xPOSITION */] TABS propertyOutput + NEWLINE
                output += UDecompilingState.Tabs +
#if DEBUG_POSITIONS
                          "/*" + UnrealMethods.FlagToString((uint)Properties[i]._BeginOffset) + "*/\t" +
#endif
                          propOutput + "\r\n";
            }
            return(output);
        }
Beispiel #2
0
        protected override void InitNodes(TreeNode node)
        {
            _ParentNode = AddSectionNode(node, typeof(UStruct).Name);
            if (IsPureStruct())
            {
                var sFlagsNode = AddTextNode(_ParentNode, "Struct Flags:" + UnrealMethods.FlagToString(StructFlags));
                sFlagsNode.ToolTipText = UnrealMethods.FlagsListToString(UnrealMethods.FlagsToList(typeof(Flags.StructFlags), StructFlags));
            }

            AddTextNode(_ParentNode, "Script Size:" + DataScriptSize);
            base.InitNodes(_ParentNode);
        }
        protected override void InitNodes(TreeNode node)
        {
            _ParentNode = AddSectionNode(node, typeof(UState).Name);

            if (GetType() == typeof(UState))
            {
                var stateFlagsNode = AddTextNode(_ParentNode, "State Flags:" + UnrealMethods.FlagToString(_StateFlags));
                stateFlagsNode.ToolTipText = UnrealMethods.FlagsListToString(UnrealMethods.FlagsToList(typeof(Flags.StateFlags), _StateFlags));
            }

            base.InitNodes(_ParentNode);
        }
        protected virtual void InitNodes(TreeNode node)
        {
            _ParentNode = AddSectionNode(node, typeof(UObject).Name);
            var flagNode = AddTextNode(_ParentNode, "ObjectFlags:" + UnrealMethods.FlagToString(_ObjectFlags));

            flagNode.ToolTipText = UnrealMethods.FlagsListToString(
                UnrealMethods.FlagsToList(typeof(Flags.ObjectFlagsLO), typeof(Flags.ObjectFlagsHO), _ObjectFlags)
                );

            AddTextNode(_ParentNode, "Size:" + ExportTable.SerialSize);
            AddTextNode(_ParentNode, "Offset:" + ExportTable.SerialOffset);
        }
        protected override void InitNodes(TreeNode node)
        {
            _ParentNode = AddSectionNode(node, typeof(UClass).Name);
            AddSimpleObjectNode(_ParentNode, Within, "Within", Within != null ? Within.GetImageName() : "");

            var classFlagsNode = AddTextNode(_ParentNode, "Class Flags:" + UnrealMethods.FlagToString(ClassFlags));

            classFlagsNode.ToolTipText = UnrealMethods.FlagsListToString(
                UnrealMethods.FlagsToList(typeof(Flags.ClassFlags), ClassFlags)
                );

            base.InitNodes(_ParentNode);
        }
        protected override void InitNodes(TreeNode node)
        {
            node.ToolTipText = FormatHeader();
            _ParentNode      = AddSectionNode(node, typeof(UFunction).Name);

            var funcFlagsNode = AddTextNode(_ParentNode, "FunctionFlags:" + UnrealMethods.FlagToString(FunctionFlags));

            funcFlagsNode.ToolTipText = UnrealMethods.FlagsListToString(UnrealMethods.FlagsToList(typeof(Flags.FunctionFlags), FunctionFlags));

            if (RepOffset > 0)
            {
                AddTextNode(_ParentNode, "Replication Offset:" + RepOffset);
            }
            base.InitNodes(_ParentNode);
        }
Beispiel #7
0
        protected override void InitNodes(TreeNode node)
        {
            _ParentNode = AddSectionNode(node, typeof(UProperty).Name);
            var propertyFlagsNode = AddTextNode(_ParentNode,
                                                "Property Flags:" + UnrealMethods.FlagToString(PropertyFlags)
                                                );

            propertyFlagsNode.ToolTipText = UnrealMethods.FlagsListToString(UnrealMethods.FlagsToList(
                                                                                typeof(Flags.PropertyFlagsLO),
                                                                                typeof(Flags.PropertyFlagsHO), PropertyFlags)
                                                                            );

            if (RepOffset > 0)
            {
                AddTextNode(_ParentNode, "Replication Offset:" + RepOffset);
            }
            base.InitNodes(_ParentNode);
        }
        public string FormatFlags()
        {
            ulong copyFlags = PropertyFlags;
            var   output    = string.Empty;

            if (PropertyFlags == 0)
            {
                return(FormatAccess());
            }

            if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.NeedCtorLink) != 0)
            {
                copyFlags &= ~(ulong)Flags.PropertyFlagsLO.NeedCtorLink;
            }

            if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.EditorData) != 0)
            {
                copyFlags &= ~(ulong)Flags.PropertyFlagsLO.EditorData;
            }

            if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.Net) != 0)
            {
                copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Net;
            }

            if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.New) != 0)
            {
                copyFlags &= ~(ulong)Flags.PropertyFlagsLO.New;
            }

            if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.OnDemand) != 0)
            {
                copyFlags &= ~(ulong)Flags.PropertyFlagsLO.OnDemand;
            }

            // Decompiling of this flag is put elsewhere.
            if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.Editable) != 0)
            {
                copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Editable;
            }

            if (HasPropertyFlag(Flags.PropertyFlagsLO.Component))
            {
                copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Component;
            }

            if (Package.Version > 300 && (PropertyFlags & (ulong)Flags.PropertyFlagsLO.Init) != 0)
            {
                output += "init ";
            }

            /** Flags that are valid as parameters only */
            if (Outer is UFunction && (PropertyFlags & (ulong)Flags.PropertyFlagsLO.Parm) != 0)
            {
                copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Parm;
                // Possible since UE3
                if (Package.Version > 300)
                {
                    if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.Const) != 0)
                    {
                        output    += "const ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Const;
                    }
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.CoerceParm) != 0)
                {
                    output    += "coerce ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.CoerceParm;
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.OptionalParm) != 0)
                {
                    output    += "optional ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.OptionalParm;
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.OutParm) != 0)
                {
                    output    += "out ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.OutParm;
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.SkipParm) != 0)
                {
                    output    += "skip ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.SkipParm;
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.ReturnParm) != 0)
                {
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.ReturnParm;
                }

                // Remove implied flags from GUIComponents
                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.ExportObject) != 0)
                {
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.ExportObject;
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.EditInline) != 0)
                {
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.EditInline;
                }
            }
            else /** Not a function param. */
            {
                output += FormatAccess();

                // UE3 flags
                if (Package.Version > 129)
                {
                    if (HasPropertyFlag(Flags.PropertyFlagsHO.PrivateWrite))
                    {
                        output    += "privatewrite ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.PrivateWrite << 32;
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.ProtectedWrite))
                    {
                        output    += "protectedwrite ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.ProtectedWrite << 32;
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.RepNotify))
                    {
                        output    += "repnotify ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.RepNotify << 32;
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsLO.NoClear))
                    {
                        output    += "noclear ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.NoClear;
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsLO.NoImport))
                    {
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.NoImport;
                        output    += "noimport ";
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsLO.DataBinding))
                    {
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.DataBinding;
                        output    += "databinding ";
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.EditHide))
                    {
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.EditHide << 32;
                        output    += "edithide ";
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.EditTextBox))
                    {
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.EditTextBox << 32;
                        output    += "edittextbox ";
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.Interp))
                    {
                        output    += "interp ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.Interp << 32;
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.NonTransactional))
                    {
                        output    += "nontransactional ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.NonTransactional << 32;
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsLO.DuplicateTransient))
                    {
                        output    += "duplicatetransient ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.DuplicateTransient;

                        // Implies: Export, EditInline
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.EditorOnly))
                    {
                        output    += "editoronly ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.EditorOnly << 32;
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.CrossLevelPassive))
                    {
                        output    += "crosslevelpassive ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.CrossLevelPassive << 32;
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.CrossLevelActive))
                    {
                        output    += "crosslevelactive ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.CrossLevelActive << 32;
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.Archetype))
                    {
                        output    += "archetype ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.Archetype << 32;
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.NotForConsole))
                    {
                        output    += "notforconsole ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.NotForConsole << 32;
                    }

                    if (HasPropertyFlag(Flags.PropertyFlagsHO.RepRetry))
                    {
                        output    += "repretry ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsHO.RepRetry << 32;
                    }

                    // Instanced is only an alias for Export and EditInline.

                    /*if( HasPropertyFlag( Flags.PropertyFlagsLO.Instanced ) )
                     * {
                     *  output += "instanced ";
                     *  copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Instanced;
                     *
                     *  // Implies: Export, EditInline
                     * }*/

                    if (Package.Version > 500 && HasPropertyFlag(Flags.PropertyFlagsLO.SerializeText))
                    {
                        output    += "serializetext ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.SerializeText;
                    }
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.Native) != 0)
                {
                    output    += FormatNative() + " ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Native;
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.Const) != 0)
                {
                    output    += "const ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Const;
                }

                if (Package.Version > 500)
                {
                    if (HasPropertyFlag(Flags.PropertyFlagsLO.EditFixedSize))
                    {
                        output    += "editfixedsize ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.EditFixedSize;
                    }
                }
                else
                {
                    if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.EditConstArray) != 0)
                    {
                        output    += "editconstarray ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.EditConstArray;
                    }
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.EditConst) != 0)
                {
                    output    += "editconst ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.EditConst;
                }

                // Properties flagged with automated, automatically get those flags added by the compiler.
                if (Package.Version == 128 && (PropertyFlags & (ulong)Flags.PropertyFlagsLO.Automated) != 0)
                {
                    output    += "automated ";
                    copyFlags &= ~((ulong)Flags.PropertyFlagsLO.Automated
                                   | (ulong)Flags.PropertyFlagsLO.EditInlineUse
                                   | (ulong)Flags.PropertyFlagsLO.EditInlineNotify
                                   | (ulong)Flags.PropertyFlagsLO.EditInline
                                   | (ulong)Flags.PropertyFlagsLO.NoExport
                                   | (ulong)Flags.PropertyFlagsLO.ExportObject);
                }
                else // Not Automated
                {
                    if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.NoExport) != 0)
                    {
                        output    += "noexport ";
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.NoExport;

                        if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.ExportObject) != 0)
                        {
                            copyFlags &= ~(ulong)Flags.PropertyFlagsLO.ExportObject;
                        }
                    }           // avoid outputing export when noexport is flagged as well!
                    else if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.ExportObject) != 0)
                    {
                        if (!HasPropertyFlag(Flags.PropertyFlagsLO.DuplicateTransient))
                        {
                            output += "export ";
                        }
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.ExportObject;
                    }

                    if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.EditInline) != 0)
                    {
                        if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.EditInlineUse) != 0)
                        {
                            copyFlags &= ~(ulong)Flags.PropertyFlagsLO.EditInlineUse;
                            output    += "editinlineuse ";
                        }
                        else if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.EditInlineNotify) != 0)
                        {
                            copyFlags &= ~(ulong)Flags.PropertyFlagsLO.EditInlineNotify;
                            output    += "editinlinenotify ";
                        }
                        else if (!HasPropertyFlag(Flags.PropertyFlagsLO.DuplicateTransient))
                        {
                            output += "editinline ";
                        }
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.EditInline;
                    }
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.EdFindable) != 0)
                {
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.EdFindable;
                    output    += "edfindable ";
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.Deprecated) != 0)
                {
                    output    += "deprecated ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Deprecated;
                }

                // It is important to check for global before checking config! first
                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.GlobalConfig) != 0)
                {
                    output    += "globalconfig ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.GlobalConfig;
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Config;
                }
                else if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.Config) != 0)
                {
#if XCOM2
                    if (ConfigName != null && !ConfigName.IsNone())
                    {
                        output += "config(" + ConfigName.ToString() + ") ";
                    }
                    else
                    {
#endif
                    output += "config ";
#if XCOM2
                }
#endif
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Config;
                }

                if ((PropertyFlags & (ulong)Flags.PropertyFlagsLO.Localized) != 0)
                {
                    output    += "localized ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Localized;
                }

                if (Package.Version == 128)
                {
                    if (HasPropertyFlag(Flags.PropertyFlagsLO.Cache))
                    {
                        copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Cache;
                        output    += "cache ";
                    }
                }

                if (HasPropertyFlag(Flags.PropertyFlagsLO.Transient))
                {
                    output    += "transient ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Transient;
                }

                if (HasPropertyFlag(Flags.PropertyFlagsLO.Travel))
                {
                    output    += "travel ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Travel;
                }

                if (HasPropertyFlag(Flags.PropertyFlagsLO.Input))
                {
                    output    += "input ";
                    copyFlags &= ~(ulong)Flags.PropertyFlagsLO.Input;
                }
            }
            // Local's may never output any of their implied flags!
            if (!IsParm() && Super != null &&
                String.Compare(Super.GetClassName(), "Function", StringComparison.OrdinalIgnoreCase) == 0)
            {
                return(string.Empty);
            }
            // alright...
            //return "/*" + UnrealMethods.FlagToString( PropertyFlags ) + "*/ " + output;
            return(copyFlags != 0 ? "/*" + UnrealMethods.FlagToString(copyFlags) + "*/ " + output : output);
        }