Exemplo n.º 1
0
            // Finds and resolves a local reference
            internal HKXLocalReference ResolveLocalReference(HKXSection section, uint offset)
            {
                LocalFixup fu = ResolveLocalFixup(section, offset);

                if (fu != null)
                {
                    var reference = new HKXLocalReference();
                    reference.SourceObject      = this;
                    reference.SourceLocalOffset = offset;
                    reference.Section           = section;
                    section.LocalReferences.Add(reference);
                    fu.Reference = reference;
                    return(reference);
                }
                return(null);
            }
Exemplo n.º 2
0
            public override void Read(HKX hkx, HKXSection section, HKXObject source, BinaryReaderEx br, HKXVariation variation)
            {
                SourceObject = source;

                // Placeholder replaced with data pointer upon load in C++
                uint pointerOffset = (uint)br.Position - source.SectionOffset;

                if (hkx.Header.PointerSize == 8)
                {
                    br.AssertUInt64(0);
                }
                else
                {
                    br.AssertUInt32(0);
                }
                Size = br.ReadUInt32();

                uint capAndFlags = br.ReadUInt32();

                Capacity = capAndFlags & 0x00FFFFFF;
                Flags    = (byte)((capAndFlags & 0xFF000000) >> 24);

                // Resolve pointer to array data
                LocalFixup fu = source.ResolveLocalFixup(section, pointerOffset);

                if (fu != null)
                {
                    Data = new HKXLocalReference();
                    Data.SourceLocalOffset = pointerOffset;
                    Data.SourceObject      = source;
                    Data.DestLocalOffset   = 0;
                    var data = new HKArrayData <T>();
                    br.StepIn(fu.Dst);
                    data.Read(hkx, section, br, variation, Size);
                    Data.DestObject = data;
                    Data.Section    = section;
                    br.StepOut();

                    section.LocalReferences.Add(Data);
                    fu.Reference = Data;
                }
            }