Exemple #1
0
        public override void OnPopulate()
        {
            VoidPtr dataPtr = dataAddr;
            int     size    = 0;

            for (int i = 0; i < count; i++, dataPtr += size)
            {
                switch (_memberType)
                {
                case hkClassMember.Type.TYPE_STRUCT:
                    new HavokMetaObjectNode(_classNode)
                    .Initialize(this, dataPtr, size = _classNode == null ? 0 : _classNode.Size);
                    break;

                case hkClassMember.Type.TYPE_ENUM:
                case hkClassMember.Type.TYPE_FLAGS:
                    new cmEnumNode()
                    {
                        _enumNode = _enumNode
                    }
                    .Initialize(this, dataPtr, size = (int)_memberFlags & 0x3F);
                    break;

                case hkClassMember.Type.TYPE_ARRAY:
                case hkClassMember.Type.TYPE_HOMOGENEOUSARRAY:
                case hkClassMember.Type.TYPE_INPLACEARRAY:
                case hkClassMember.Type.TYPE_SIMPLEARRAY:
                case hkClassMember.Type.TYPE_FUNCTIONPOINTER:
                case hkClassMember.Type.TYPE_ZERO:
                    Console.WriteLine("This shouldn't happen");
                    break;

                default:
                    ClassMemberInstanceNode instance = HavokMetaObjectNode.TryGetMember(_memberType);
                    if (instance != null)
                    {
                        hkClassMember.Type tempType = _memberType;
                        if (tempType == hkClassMember.Type.TYPE_POINTER)
                        {
                            tempType = hkClassMember.Type.TYPE_STRUCT;     //Pointer to class object
                        }

                        instance._isZero      = false;
                        instance._name        = "Entry" + i;
                        instance._memberType  = tempType;
                        instance._memberFlags = _memberFlags;
                        instance._classNode   = _classNode;
                        instance._enumNode    = _enumNode;

                        instance.Initialize(this, dataPtr, size = instance.GetSize());
                    }

                    break;
                }
            }
        }
Exemple #2
0
        public override void OnPopulate()
        {
            VoidPtr dataPtr = ((bint *)Data)->OffsetAddress;

            switch (_memberType)
            {
            case hkClassMember.Type.TYPE_STRUCT:
                new HavokMetaObjectNode(_classNode)
                .Initialize(this, dataPtr, _classNode.Size);
                break;

            case hkClassMember.Type.TYPE_ENUM:
            case hkClassMember.Type.TYPE_FLAGS:
                new cmEnumNode
                {
                    _enumNode = _enumNode
                }
                .Initialize(this, dataPtr, (int)_memberFlags & 0x3F);
                break;

            case hkClassMember.Type.TYPE_ARRAY:
            case hkClassMember.Type.TYPE_HOMOGENEOUSARRAY:
            case hkClassMember.Type.TYPE_INPLACEARRAY:
            case hkClassMember.Type.TYPE_SIMPLEARRAY:
            case hkClassMember.Type.TYPE_ZERO:
                Console.WriteLine("This shouldn't happen");
                break;

            default:
                ClassMemberInstanceNode instance = HavokMetaObjectNode.TryGetMember(_memberType);
                if (instance != null)
                {
                    instance._isZero      = false;
                    instance._name        = "";
                    instance._memberType  = _memberType;
                    instance._memberFlags = _memberFlags;
                    instance._classNode   = _classNode;
                    instance._enumNode    = _enumNode;

                    instance.Initialize(this, dataPtr, instance.GetSize());
                }

                break;
            }
        }
Exemple #3
0
        public static ClassMemberInstanceNode TryGetMember(hkClassMember.Type type)
        {
            ClassMemberInstanceNode m = null;
            int index = (int)type;

            if (index >= 0 && index < MemberTypes.Length)
            {
                Type t = MemberTypes[index];
                if (t != null)
                {
                    m = Activator.CreateInstance(t) as ClassMemberInstanceNode;
                }
            }

            if (m == null)
            {
                Console.WriteLine("Problem creating class member instance of " + type);
            }

            return(m);
        }
Exemple #4
0
        public override void OnPopulate()
        {
            VoidPtr addr = WorkingUncompressed.Address;

            foreach (hkClassMemberNode member in _memberArray)
            {
                hkClassMember.Type type = member.Type;
                bool zero = type == hkClassMember.Type.TYPE_ZERO;
                if (zero)
                {
                    type = member.SubType;
                }

                hkClassNode     memberClass = null;
                hkClassEnumNode memberEnum  = null;

                if (!string.IsNullOrEmpty(member._class))
                {
                    HavokClassNode c = HavokNode.GetClassNode(member._class);
                    if (c is hkClassNode)
                    {
                        memberClass = c as hkClassNode;
                    }

                    if (memberClass == null)
                    {
                        Console.WriteLine("Could not find " + member._class + " class");
                    }
                }

                if (!string.IsNullOrEmpty(member._enum))
                {
                    //Loop through inheritance starting with the eldest class, added last
                    foreach (hkClassNode c in _classNode._inheritance)
                    {
                        ResourceNode enums = c.FindChild("Enums", false);
                        if (enums != null)
                        {
                            foreach (hkClassEnumNode e in enums.Children)
                            {
                                if (e.Name == member._enum)
                                {
                                    memberEnum = e;
                                    break;
                                }
                            }
                        }
                    }

                    if (memberEnum == null)
                    {
                        Console.WriteLine("Could not find " + member._enum + " enum in " + _classNode.Name + " class");
                    }
                }

                ClassMemberInstanceNode instance = TryGetMember(type);
                if (instance != null)
                {
                    switch (type)
                    {
                    case hkClassMember.Type.TYPE_SIMPLEARRAY:
                    case hkClassMember.Type.TYPE_ARRAY:
                    case hkClassMember.Type.TYPE_INPLACEARRAY:
                    case hkClassMember.Type.TYPE_HOMOGENEOUSARRAY:
                    case hkClassMember.Type.TYPE_POINTER:
                    case hkClassMember.Type.TYPE_FUNCTIONPOINTER:
                        type = member.SubType;
                        break;
                    }

                    instance._isZero      = zero;
                    instance._name        = member._name;
                    instance._memberType  = type;
                    instance._memberFlags = member._flags;
                    instance._classNode   = memberClass;
                    instance._enumNode    = memberEnum;

                    instance.Initialize(this, addr + member._structOffset, instance.GetSize());
                }
            }
        }