Пример #1
0
        public Expression DecompileInstanceDelegate() // TODO: check code, seems ok?
        {
            PopByte();
            var name = PCC.GetName(ReadNameRef());

            StartPositions.Pop();
            return(new SymbolReference(null, null, null, "UNSUPPORTED: InstanceDelegate: " + name));
        }
Пример #2
0
        public NameLiteral DecompileNameConst()
        {
            PopByte();

            var value = PCC.GetName(ReadNameRef());

            StartPositions.Pop();
            return(new NameLiteral(value, null, null));
        }
Пример #3
0
        public Expression DecompileDelegateProperty() // TODO: is this proper? Is it even used in ME3?
        {
            PopByte();
            var name = PCC.GetName(ReadNameRef());
            var obj  = ReadObject(); // probably the delegate

            StartPositions.Pop();
            var objName = obj != null ? obj.ObjectName : "None";

            return(new SymbolReference(null, null, null, name + "(" + objName + ")"));
        }
Пример #4
0
        public override bool Deserialize()
        {
            var result = base.Deserialize();

            var nameCount = Data.ReadInt32();

            _NameRefs = new List <NameReference>(nameCount);
            Names     = new List <String>();
            for (int n = 0; n < nameCount; n++)
            {
                _NameRefs.Add(Data.ReadNameRef());
                Names.Add(PCC.GetName(_NameRefs[n]));
            }

            return(result);
        }
Пример #5
0
        private void DecompileLabelTable()
        {
            PopByte();
            var name = ReadNameRef();
            var ofs  = ReadUInt32();

            while (ofs != 0x0000FFFF) // ends with non-ref + max-offset
            {
                var entry = new LabelTableEntry();
                entry.NameRef = name;
                entry.Name    = PCC.GetName(name);
                entry.Offset  = ofs;
                LabelTable.Add(entry);

                name = ReadNameRef();
                ofs  = ReadUInt32();
            }
        }
Пример #6
0
        public override bool Deserialize()
        {
            var result = base.Deserialize();

            var ArrayInfo = Data.ReadInt32();

            ArraySize        = (UInt16)(ArrayInfo & 0x0000FFFFU);
            ArrayElementSize = (UInt16)(ArrayInfo >> 16);

            PropertyFlags = (PropertyFlags)Data.ReadUInt64();
            if (PropertyFlags.HasFlag(PropertyFlags.Net))
            {
                ReplicateOffset = Data.ReadUInt16();
            }

            _CategoryNameRef = Data.ReadNameRef();
            Category         = PCC.GetName(_CategoryNameRef);

            ReplicateOffset = Data.ReadUInt16(); // TODO: verify, see code
            ReplicateIndex  = Data.ReadUInt16();

            return(result);
        }
Пример #7
0
 public override bool Deserialize()
 {
     EnumValue = PCC.GetName(Data.ReadNameRef());
     return(true);
 }
Пример #8
0
 public override bool Deserialize()
 {
     OuterIndex    = Data.ReadIndex();
     DelegateValue = PCC.GetName(Data.ReadNameRef());
     return(true);
 }
Пример #9
0
        public Expression DecompileFunctionCall(bool byName = false, bool withUnknShort = false, bool global = false)
        {
            PopByte();
            String funcName;

            if (byName)
            {
                funcName = PCC.GetName(ReadNameRef());
            }
            else
            {
                var funcObj = ReadObject();
                funcName = funcObj.ObjectName;

                if (funcName == DataContainer.Name && !isInClassContext) // If we're calling ourself, it's a super call
                {
                    var str = "super";

                    var currentClass   = DataContainer.ExportEntry.GetOuterOfType("Class").Object as ME3Class;
                    var funcOuterClass = funcObj.GetOuterOfType("Class").ObjectName;
                    if (currentClass != null && currentClass.SuperField != null && currentClass.SuperField.Name == funcOuterClass)
                    {
                        funcName = str + "." + funcName;
                    }
                    else
                    {
                        funcName = str + "(" + funcOuterClass + ")." + funcName;
                    }
                }
            }

            if (global)
            {
                funcName = "global." + funcName;
            }

            if (withUnknShort)
            {
                ReadInt16(); // TODO: related to unkn65, split out? Possibly jump?
            }
            var parameters = new List <Expression>();

            while (!CurrentIs(StandardByteCodes.EndFunctionParms))
            {
                if (CurrentIs(StandardByteCodes.Nothing))
                {
                    PopByte(); // TODO: is this reasonable? what does it mean?
                    parameters.Add(new SymbolReference(null, null, null, "None"));
                    continue;
                }

                var param = DecompileExpression();
                if (param == null)
                {
                    return(null); // ERROR
                }
                parameters.Add(param);
            }
            PopByte();

            StartPositions.Pop();
            var func = new SymbolReference(null, null, null, funcName);

            return(new FunctionCall(func, parameters, null, null));
        }