예제 #1
0
파일: HKX.cs 프로젝트: FloorBelow/dstools
            public void Read(HKX hkx, HKXSection section, BinaryReaderEx br, uint size, HKXVariation variation)
            {
                SectionOffset = (uint)br.Position;
                Bytes         = br.ReadBytes((int)size);
                DataSize      = size;

                // Resolve references where this object is a source
                var localSources = FindLocalFixupSources(section);

                LocalReferences = new List <HKXLocalReference>();
                foreach (var src in localSources)
                {
                    if (src.Reference == null)
                    {
                        var reference = new HKXLocalReference();
                        reference.Section           = section;
                        reference.SourceLocalOffset = src.Src - SectionOffset;
                        reference.SourceObject      = this;
                        section.LocalReferences.Add(reference);
                        src.Reference = reference;
                    }
                    else
                    {
                        var reference = src.Reference;
                        reference.SourceLocalOffset = src.Src - SectionOffset;
                        reference.SourceObject      = this;
                    }
                    LocalReferences.Add(src.Reference);
                }

                // Resolve references where this object is a global source
                var globalSources = FindGlobalFixupSources(section);

                GlobalReferences = new List <HKXGlobalReference>();
                foreach (var src in globalSources)
                {
                    if (src.Reference == null)
                    {
                        var reference = new HKXGlobalReference();
                        reference.SrcSection        = section;
                        reference.SourceLocalOffset = src.Src - SectionOffset;
                        reference.SourceObject      = this;
                        section.GlobalReferences.Add(reference);
                        src.Reference = reference;
                    }
                    else
                    {
                        var reference = src.Reference;
                        reference.SrcSection        = section;
                        reference.SourceLocalOffset = src.Src - SectionOffset;
                        reference.SourceObject      = this;
                        section.GlobalReferences.Add(reference);
                    }
                    GlobalReferences.Add(src.Reference);
                }

                ResolveDestinations(hkx, section);
            }
예제 #2
0
            public override void Read(HKX hkx, HKXSection section, BinaryReaderEx br, HKXVariation variation)
            {
                SectionOffset = (uint)br.Position;

                br.AssertUInt64(0);
                br.AssertUInt64(0);
                Unk10 = br.ReadByte();
                Unk11 = br.ReadByte();
                Unk12 = br.ReadByte();
                Unk13 = br.ReadByte();
                Unk14 = br.ReadInt32();
                br.AssertUInt64(0);
                br.AssertUInt64(0);
                if (variation == HKXVariation.HKXDS3)
                {
                    br.AssertUInt64(0);
                }
                br.AssertUInt32(0xFFFFFFFF);
                br.AssertUInt32(0);

                // A seemingly empty array
                br.AssertUInt64(0);
                br.AssertUInt32(0);
                br.AssertUInt32(0x80000000);

                // A seemingly empty array
                br.AssertUInt64(0);
                br.AssertUInt32(0);
                br.AssertUInt32(0x80000000);

                br.AssertUInt32(0xFFFFFFFF);
                br.AssertUInt32(0);

                MeshShapeData = ResolveGlobalReference(hkx, section, br);

                Unk68 = new HKArray <HKUInt>(hkx, section, this, br, variation);
                Unk78 = br.ReadInt32();
                br.AssertUInt32(0);

                Unk80 = new HKArray <HKUInt>(hkx, section, this, br, variation);
                Unk90 = br.ReadInt32();
                br.AssertUInt32(0);

                br.AssertUInt64(0);

                CustomParam = ResolveGlobalReference(hkx, section, br);

                UnkA8 = new HKArray <HKUInt>(hkx, section, this, br, variation);
                if (variation == HKXVariation.HKXDS3)
                {
                    br.AssertUInt64(0);
                }

                DataSize = (uint)br.Position - SectionOffset;
                ResolveDestinations(hkx, section);
            }
예제 #3
0
파일: HKX.cs 프로젝트: FloorBelow/dstools
            // Finds and resolves a global reference
            internal HKXGlobalReference ResolveGlobalReference(HKXSection section, uint offset)
            {
                GlobalFixup gu = ResolveGlobalFixup(section, offset);

                if (gu != null)
                {
                    var reference = new HKXGlobalReference();
                    reference.SourceObject      = this;
                    reference.SourceLocalOffset = offset;
                    reference.SrcSection        = section;
                    section.GlobalReferences.Add(reference);
                    gu.Reference = reference;
                    return(reference);
                }
                return(null);
            }
예제 #4
0
파일: HKX.cs 프로젝트: FloorBelow/dstools
            // Find all references to this object and link them
            internal void ResolveDestinations(HKX hkx, HKXSection section)
            {
                var localDestinations = FindLocalFixupDestinations(section);

                foreach (var dest in localDestinations)
                {
                    if (dest.Reference == null)
                    {
                        var reference = new HKXLocalReference();
                        reference.Section         = section;
                        reference.DestLocalOffset = dest.Dst - SectionOffset;
                        reference.DestObject      = this;
                        section.LocalReferences.Add(reference);
                        dest.Reference = reference;
                    }
                    else
                    {
                        var reference = dest.Reference;
                        reference.DestLocalOffset = dest.Dst - SectionOffset;
                        reference.DestObject      = this;
                    }
                }

                var globalDestinations = FindGlobalFixupDestinations(hkx, section);

                foreach (var dest in globalDestinations)
                {
                    if (dest.Reference == null)
                    {
                        var reference = new HKXGlobalReference();
                        reference.DestSection     = section;
                        reference.DestLocalOffset = dest.Dst - SectionOffset;
                        reference.DestObject      = this;
                        dest.Reference            = reference;
                    }
                    else
                    {
                        var reference = dest.Reference;
                        reference.DestSection     = section;
                        reference.DestLocalOffset = dest.Dst - SectionOffset;
                        reference.DestObject      = this;
                    }
                }
            }
예제 #5
0
 public override void Read(HKX hkx, HKXSection section, HKXObject source, BinaryReaderEx br, HKXVariation variation)
 {
     // Just get what we are interested in
     //AssertPointer(hkx, br);
     ShapeReference = source.ResolveGlobalReference(hkx, section, br);
     br.ReadUInt32();
     br.ReadUInt32();
     br.ReadUInt16();
     br.ReadUInt16();
     br.ReadUInt32();
     br.ReadUInt32();
     br.ReadUInt32();
     AssertPointer(hkx, br);
     br.ReadUInt64();
     Position.Read(hkx, section, source, br, variation);
     Orientation.Read(hkx, section, source, br, variation);
     br.ReadUInt64();
     AssertPointer(hkx, br);
 }