Esempio n. 1
0
 public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation)
 {
     // Save new local position for local fixup
     if (Data != null)
     {
         Data.SourceLocalOffset = (uint)bw.Position - SourceObject.SectionOffset - sectionBaseOffset;
     }
     if (hkx.Header.PointerSize == 8)
     {
         bw.WriteUInt64(0); // Pointer placeholder
     }
     else
     {
         bw.WriteUInt32(0);
     }
     bw.WriteUInt32(Size);
     bw.WriteUInt32(Capacity | (((uint)Flags) << 24));
 }
Esempio n. 2
0
 internal void Write(BinaryWriterEx bw, long indicesOffset)
 {
     bw.WriteUInt32(MapID);
     bw.WriteInt32(LocalIndex);
     bw.WriteInt32(ConnectedRoomIndices.Count);
     bw.WriteInt32((int)indicesOffset);
     bw.WriteVector3(BoundingBoxMin);
     bw.WriteVector3(BoundingBoxMax);
 }
 public void WriteHeader(BinaryWriterEx bw, HKX.HKXVariation variation)
 {
     bw.WriteFixStr(SectionTag, 19);
     bw.WriteByte(0xFF);
     bw.ReserveUInt32("absoffset" + SectionID);
     bw.ReserveUInt32("locoffset" + SectionID);
     bw.ReserveUInt32("globoffset" + SectionID);
     bw.ReserveUInt32("virtoffset" + SectionID);
     bw.ReserveUInt32("expoffset" + SectionID);
     bw.ReserveUInt32("impoffset" + SectionID);
     bw.ReserveUInt32("endoffset" + SectionID);
     if (variation == HKX.HKXVariation.HKXBloodBorne || variation == HKX.HKXVariation.HKXDS3)
     {
         bw.WriteUInt32(0xFFFFFFFF);
         bw.WriteUInt32(0xFFFFFFFF);
         bw.WriteUInt32(0xFFFFFFFF);
         bw.WriteUInt32(0xFFFFFFFF);
     }
 }
Esempio n. 4
0
            internal override void Write(BinaryWriterEx bw, int id)
            {
                long start = bw.Position;

                bw.ReserveInt32("NameOffset");
                bw.WriteUInt32((uint)Type);
                bw.WriteInt32(id);
                bw.WriteInt32(ModelIndex);
                bw.ReserveInt32("SibOffset");
                bw.WriteVector3(Position);
                bw.WriteVector3(Rotation);
                bw.WriteVector3(Scale);
                bw.WriteUInt32s(DrawGroups);
                bw.WriteUInt32s(DispGroups);
                bw.ReserveInt32("EntityDataOffset");
                bw.ReserveInt32("TypeDataOffset");
                bw.WriteInt32(0);

                long stringsStart = bw.Position;

                bw.FillInt32("NameOffset", (int)(bw.Position - start));
                bw.WriteShiftJIS(MSB.ReambiguateName(Name), true);
                bw.FillInt32("SibOffset", (int)(bw.Position - start));
                bw.WriteShiftJIS(Placeholder, true);
                bw.Pad(4);
                if (bw.Position - stringsStart < 0x14)
                {
                    bw.WritePattern((int)(0x14 - (bw.Position - stringsStart)), 0x00);
                }

                bw.FillInt32("EntityDataOffset", (int)(bw.Position - start));
                bw.WriteInt32(EntityID);
                bw.WriteByte(LightID);
                bw.WriteByte(FogID);
                bw.WriteByte(ScatterID);
                bw.WriteByte(LensFlareID);
                bw.WriteByte(ShadowID);
                bw.WriteByte(DofID);
                bw.WriteByte(ToneMapID);
                bw.WriteByte(ToneCorrectID);
                bw.WriteByte(LanternID);
                bw.WriteByte(LodParamID);
                bw.WriteByte(0);
                bw.WriteByte(IsShadowSrc);
                bw.WriteByte(IsShadowDest);
                bw.WriteByte(IsShadowOnly);
                bw.WriteByte(DrawByReflectCam);
                bw.WriteByte(DrawOnlyReflectCam);
                bw.WriteByte(UseDepthBiasFloat);
                bw.WriteByte(DisablePointLightEffect);
                bw.WriteByte(0);
                bw.WriteByte(0);

                bw.FillInt32("TypeDataOffset", (int)(bw.Position - start));
            }
Esempio n. 5
0
 // Writes an empty pointer taking into accound the HKX pointer size
 static private void WriteEmptyPointer(HKX hkx, BinaryWriterEx bw)
 {
     if (hkx.Header.PointerSize == 8)
     {
         bw.WriteUInt64(0);
     }
     else
     {
         bw.WriteUInt32(0);
     }
 }
Esempio n. 6
0
 public void WriteWithReferences(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation)
 {
     bw.BigEndian = (hkx.Header.Endian == 0) ? true : false;
     Write(hkx, section, bw, sectionBaseOffset, variation);
     foreach (var reference in LocalReferences)
     {
         if (reference.DestObject == this)
         {
             bw.Position = reference.SourceLocalOffset;
             bw.WriteUInt32(reference.DestLocalOffset);
         }
     }
     foreach (var reference in GlobalReferences)
     {
         if (reference.DestObject == this)
         {
             bw.Position = reference.SourceLocalOffset;
             bw.WriteUInt32(reference.DestLocalOffset);
         }
     }
 }
Esempio n. 7
0
 internal void Write(BinaryWriterEx bw, long indicesOffsetA, long indicesOffsetB)
 {
     bw.WriteInt32(NodeIndexA);
     bw.WriteInt32(UnkIndicesA.Count);
     bw.WriteInt32((int)indicesOffsetA);
     bw.WriteInt32(NodeIndexB);
     bw.WriteInt32(UnkIndicesB.Count);
     bw.WriteInt32((int)indicesOffsetB);
     bw.WriteInt32(MCPRoomIndex);
     bw.WriteUInt32(MapID);
     bw.WriteSingle(Unk20);
 }
Esempio n. 8
0
            internal void WriteData(BinaryWriterEx bw, int i, int j, List <long> eventHeaderOffsets)
            {
                bw.FillInt64($"EventGroupTypeOffset{i}:{j}", bw.Position);
                bw.WriteUInt32((uint)Type);
                bw.WriteInt32(0);
                bw.WriteInt64(0);

                bw.FillInt64($"EventGroupValuesOffset{i}:{j}", bw.Position);
                for (int k = 0; k < Indices.Count; k++)
                {
                    bw.WriteInt32((int)eventHeaderOffsets[Indices[k]]);
                }
                bw.Pad(0x10);
            }
Esempio n. 9
0
        /// <summary>
        /// Compresses data and writes it to a BinaryWriterEx with Zlib wrapper.
        /// </summary>
        public static int WriteZlib(BinaryWriterEx bw, byte formatByte, byte[] input)
        {
            long start = bw.Position;

            bw.WriteByte(0x78);
            bw.WriteByte(formatByte);

            using (var deflateStream = new DeflateStream(bw.Stream, CompressionMode.Compress, true))
            {
                deflateStream.Write(input, 0, input.Length);
            }

            bw.WriteUInt32(Adler32(input));
            return((int)(bw.Position - start));
        }
Esempio n. 10
0
            public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation)
            {
                SectionOffset = (uint)bw.Position - sectionBaseOffset;

                WriteEmptyPointer(hkx, bw);
                WriteEmptyPointer(hkx, bw);

                meshTree.Write(hkx, section, bw, sectionBaseOffset, variation);
                bw.WriteVector4(BoundingBoxMin);
                bw.WriteVector4(BoundingBoxMax);

                bw.WriteUInt32(numPrimitiveKeys);
                bw.WriteUInt32(bitsPerKey);
                bw.WriteUInt32(maxKeyValue);
                bw.WriteUInt32(Unk4C);

                sections.Write(hkx, section, bw, sectionBaseOffset, variation);
                primitives.Write(hkx, section, bw, sectionBaseOffset, variation);
                sharedVerticesIndex.Write(hkx, section, bw, sectionBaseOffset, variation);
                packedVertices.Write(hkx, section, bw, sectionBaseOffset, variation);
                sharedVertices.Write(hkx, section, bw, sectionBaseOffset, variation);
                primitiveDataRuns.Write(hkx, section, bw, sectionBaseOffset, variation);
                bw.WriteUInt64(UnkB0);
                simdTree.Write(hkx, section, bw, sectionBaseOffset, variation);
                bw.WriteUInt64(UnkC8);

                DataSize = (uint)bw.Position - sectionBaseOffset - SectionOffset;
                meshTree.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                sections.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                primitives.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                sharedVerticesIndex.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                packedVertices.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                sharedVertices.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                primitiveDataRuns.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                simdTree.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
            }
Esempio n. 11
0
            public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation)
            {
                SectionOffset = (uint)bw.Position - sectionBaseOffset;

                WriteEmptyPointer(hkx, bw);
                WriteEmptyPointer(hkx, bw);

                CompressedBVH.Write(hkx, section, bw, sectionBaseOffset, variation);
                bw.WriteVector4(BoundingBoxMin);
                bw.WriteVector4(BoundingBoxMax);

                bw.WriteUInt32(Unk40);
                bw.WriteUInt32(Unk44);
                bw.WriteUInt32(Unk48);
                bw.WriteUInt32(Unk4C);

                Chunks.Write(hkx, section, bw, sectionBaseOffset, variation);
                MeshIndices.Write(hkx, section, bw, sectionBaseOffset, variation);
                VertexIndices.Write(hkx, section, bw, sectionBaseOffset, variation);
                SmallVertices.Write(hkx, section, bw, sectionBaseOffset, variation);
                LargeVertices.Write(hkx, section, bw, sectionBaseOffset, variation);
                UnkA0.Write(hkx, section, bw, sectionBaseOffset, variation);
                bw.WriteUInt64(UnkB0);
                UnkB8.Write(hkx, section, bw, sectionBaseOffset, variation);
                bw.WriteUInt64(UnkC8);

                DataSize = (uint)bw.Position - sectionBaseOffset - SectionOffset;
                CompressedBVH.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                Chunks.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                MeshIndices.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                VertexIndices.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                SmallVertices.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                LargeVertices.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                UnkA0.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                UnkB8.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
            }
Esempio n. 12
0
            public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation)
            {
                SectionOffset = (uint)bw.Position - sectionBaseOffset;
                bw.WriteInt64(0);
                bw.WriteInt64(0);
                bw.WriteByte(Unk10);
                bw.WriteByte(Unk11);
                bw.WriteByte(Unk12);
                bw.WriteByte(Unk13);
                bw.WriteInt32(Unk14);
                bw.WriteInt64(0);
                bw.WriteInt64(0);
                if (variation == HKXVariation.HKXDS3)
                {
                    bw.WriteInt64(0);
                }
                bw.WriteUInt32(0xFFFFFFFF);
                bw.WriteInt32(0);

                bw.WriteUInt64(0);
                bw.WriteUInt32(0);
                bw.WriteUInt32(0x80000000);

                bw.WriteUInt64(0);
                bw.WriteUInt32(0);
                bw.WriteUInt32(0x80000000);

                bw.WriteUInt32(0xFFFFFFFF);
                bw.WriteInt32(0);

                MeshShapeData.WritePlaceholder(bw, sectionBaseOffset);

                Unk68.Write(hkx, section, bw, sectionBaseOffset, variation);
                bw.WriteInt32(Unk78);
                bw.WriteInt32(0);

                Unk80.Write(hkx, section, bw, sectionBaseOffset, variation);
                bw.WriteInt32(Unk90);
                bw.WriteInt32(0);

                bw.WriteUInt64(0);

                CustomParam.WritePlaceholder(bw, sectionBaseOffset);

                UnkA8.Write(hkx, section, bw, sectionBaseOffset, variation);
                if (variation == HKXVariation.HKXDS3)
                {
                    bw.WriteInt64(0);
                }

                DataSize = (uint)bw.Position - sectionBaseOffset - SectionOffset;

                Unk68.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                Unk80.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
                UnkA8.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
            }
Esempio n. 13
0
        /// <summary>
        /// Write a DDS file from this header object and given pixel data.
        /// </summary>
        public byte[] Write(byte[] pixelData)
        {
            BinaryWriterEx bw = new BinaryWriterEx(false);

            bw.WriteASCII("DDS ");
            bw.WriteInt32(0x7C);

            bw.WriteUInt32((uint)dwFlags);
            bw.WriteInt32(dwHeight);
            bw.WriteInt32(dwWidth);
            bw.WriteInt32(dwPitchOrLinearSize);
            bw.WriteInt32(dwDepth);
            bw.WriteInt32(dwMipMapCount);

            for (int i = 0; i < 11; i++)
            {
                bw.WriteInt32(0);
            }

            ddspf.Write(bw);
            bw.WriteUInt32((uint)dwCaps);
            bw.WriteUInt32((uint)dwCaps2);

            for (int i = 0; i < 3; i++)
            {
                bw.WriteInt32(0);
            }

            if (ddspf.dwFourCC == PIXELFORMAT.FourCCDX10)
            {
                header10.Write(bw);
            }

            bw.WriteBytes(pixelData);
            return(bw.FinishBytes());
        }
Esempio n. 14
0
            internal override void Write(BinaryWriterEx bw, int index)
            {
                long start = bw.Position;

                bw.ReserveInt64("NameOffset");
                bw.WriteUInt16((ushort)Type);
                bw.WriteInt16((short)index);
                bw.WriteInt32(ModelIndex);
                bw.WriteVector3(Position);
                bw.WriteVector3(Rotation);
                bw.WriteVector3(Scale);
                bw.WriteUInt32s(DrawGroups);
                bw.WriteUInt32(Unk44);
                bw.WriteUInt32(Unk48);
                bw.WriteUInt32(Unk4C);
                bw.WriteUInt32(Unk50);
                bw.WriteUInt32s(DispGroups);
                bw.WriteInt32(Unk64);
                bw.WriteInt32(Unk68);
                bw.WriteInt32(Unk6C);
                bw.ReserveInt64("TypeDataOffset");
                bw.WriteInt64(0);

                long nameStart = bw.Position;

                bw.FillInt64("NameOffset", nameStart - start);
                bw.WriteUTF16(ReambiguateName(Name), true);
                if (bw.Position - nameStart < 0x20)
                {
                    bw.Position += 0x20 - (bw.Position - nameStart);
                }
                bw.Pad(8);

                bw.FillInt64("TypeDataOffset", bw.Position - start);
                WriteTypeData(bw);
            }
Esempio n. 15
0
            internal override void Write(BinaryWriterEx bw, int id)
            {
                long start = bw.Position;

                bw.ReserveInt64("NameOffset");
                bw.WriteInt32(Unk08);
                bw.WriteInt32(Unk0C);
                bw.WriteUInt32((uint)Type);
                bw.WriteInt32(id);
                bw.WritePattern(0x68, 0x00);

                bw.FillInt64("NameOffset", bw.Position - start);
                bw.WriteUTF16(Name, true);
                bw.Pad(8);
            }
Esempio n. 16
0
 internal void WriteHeader(BinaryWriterEx bw, byte format2D, int i)
 {
     if ((format2D & 0x7F) < 4)
     {
         bw.WriteUInt32((uint)ID);
         bw.ReserveUInt32($"RowOffset{i}");
         bw.ReserveUInt32($"NameOffset{i}");
     }
     else
     {
         bw.WriteInt64(ID);
         bw.ReserveInt64($"RowOffset{i}");
         bw.ReserveInt64($"NameOffset{i}");
     }
 }
Esempio n. 17
0
        private void Write(BinaryWriterEx bhdWriter, BinaryWriterEx bdtWriter)
        {
            bhdWriter.WriteASCII("BHF3");
            bhdWriter.WriteFixStr(BHDTimestamp, 8);
            bhdWriter.WriteByte((byte)Format);
            bhdWriter.WriteByte(0);
            bhdWriter.WriteByte(0);
            bhdWriter.WriteByte(0);
            bhdWriter.BigEndian = Binder.ForceBigEndian(Format);

            bhdWriter.WriteInt32(Files.Count);
            bhdWriter.WriteInt32(0);
            bhdWriter.WriteInt32(0);
            bhdWriter.WriteInt32(0);

            bdtWriter.WriteASCII("BDF3");
            bdtWriter.WriteFixStr(BDTTimestamp, 8);
            bdtWriter.WriteInt32(0);

            for (int i = 0; i < Files.Count; i++)
            {
                BinderFile file = Files[i];
                bhdWriter.WriteByte(0x40);
                bhdWriter.WriteByte(0);
                bhdWriter.WriteByte(0);
                bhdWriter.WriteByte(0);

                bhdWriter.WriteInt32(file.Bytes.Length);
                bhdWriter.WriteUInt32((uint)bdtWriter.Position);
                bhdWriter.WriteInt32(i);
                bhdWriter.ReserveUInt32($"FileName{i}");

                if (Binder.HasUncompressedSize(Format))
                {
                    bhdWriter.WriteInt32(file.Bytes.Length);
                }

                bdtWriter.WriteBytes(file.Bytes);
                bdtWriter.Pad(0x10);
            }

            for (int i = 0; i < Files.Count; i++)
            {
                BinderFile file = Files[i];
                bhdWriter.FillUInt32($"FileName{i}", (uint)bhdWriter.Position);
                bhdWriter.WriteShiftJIS(file.Name, true);
            }
        }
            internal void Write(BinaryWriterEx bw, int id)
            {
                long start = bw.Position;

                bw.ReserveInt64("NameOffset");
                bw.WriteInt32(0);
                bw.WriteInt32(id);
                bw.WriteUInt32((uint)Shape.Type);
                bw.WriteVector3(Position);
                bw.WriteVector3(Rotation);
                bw.WriteInt32(Unk2);

                bw.ReserveInt64("BaseDataOffset1");
                bw.ReserveInt64("BaseDataOffset2");


                bw.ReserveInt64("ShapeDataOffset");
                bw.ReserveInt64("BaseDataOffset3");

                bw.FillInt64("NameOffset", bw.Position - start);
                bw.WriteUTF16(ReambiguateName(Name), true);
                bw.Pad(4);

                bw.FillInt64("BaseDataOffset1", bw.Position - start);
                bw.WriteInt16((short)UnkA.Count);
                bw.WriteInt16s(UnkA);
                bw.Pad(4);

                bw.FillInt64("BaseDataOffset2", bw.Position - start);
                bw.WriteInt16((short)UnkB.Count);
                bw.WriteInt16s(UnkB);
                bw.Pad(8);

                if (Shape.HasShapeData)
                {
                    bw.FillInt64("ShapeDataOffset", (int)(bw.Position - start));
                    Shape.WriteShapeData(bw);
                }
                else
                {
                    bw.FillInt64("ShapeDataOffset", 0);
                }

                bw.FillInt64("BaseDataOffset3", bw.Position - start);
                bw.WriteInt32(EntityID);

                bw.Pad(8);
            }
Esempio n. 19
0
            internal void Write(BinaryWriterEx bw, Game game, int bucketIndex, int fileIndex)
            {
                bw.WriteUInt32(FileNameHash);
                bw.WriteInt32(PaddedFileSize);
                bw.WriteInt64(FileOffset);

                if (game >= Game.DarkSouls2)
                {
                    bw.ReserveInt64($"SHAHashOffset{bucketIndex}:{fileIndex}");
                    bw.ReserveInt64($"AESKeyOffset{bucketIndex}:{fileIndex}");
                }

                if (game >= Game.DarkSouls3)
                {
                    bw.WriteInt64(UnpaddedFileSize);
                }
            }
Esempio n. 20
0
            /// <summary>
            /// Packs an enumeration of arg values into a byte array for use in an instruction.
            /// </summary>
            public void PackArgs(IEnumerable <object> args, bool bigEndian = false)
            {
                using (var ms = new MemoryStream())
                {
                    var bw = new BinaryWriterEx(bigEndian, ms);
                    foreach (object arg in args)
                    {
                        switch (arg)
                        {
                        case byte ub:
                            bw.WriteByte(ub); break;

                        case ushort us:
                            bw.Pad(2);
                            bw.WriteUInt16(us); break;

                        case uint ui:
                            bw.Pad(4);
                            bw.WriteUInt32(ui); break;

                        case sbyte sb:
                            bw.WriteSByte(sb); break;

                        case short ss:
                            bw.Pad(2);
                            bw.WriteInt16(ss); break;

                        case int si:
                            bw.Pad(4);
                            bw.WriteInt32(si); break;

                        case float f:
                            bw.Pad(4);
                            bw.WriteSingle(f); break;

                        case long sl:
                            bw.Pad(8);
                            bw.WriteInt64(sl); break;

                        default:
                            throw new NotSupportedException($"Unsupported argument type: {arg.GetType()}");
                        }
                    }
                    ArgData = bw.FinishBytes();
                }
            }
Esempio n. 21
0
                internal void WriteValue(BinaryWriterEx bw, object value)
                {
                    switch (Type)
                    {
                    case ParamType.aob: bw.WriteBytes((byte[])value); break;

                    case ParamType.b: bw.WriteBoolean((bool)value); break;

                    case ParamType.u8:
                    case ParamType.x8:
                        bw.WriteByte(Convert.ToByte(value)); break;

                    case ParamType.s8:
                        bw.WriteSByte(Convert.ToSByte(value)); break;

                    case ParamType.u16:
                    case ParamType.x16:
                        bw.WriteUInt16(Convert.ToUInt16(value)); break;

                    case ParamType.s16:
                        bw.WriteInt16(Convert.ToInt16(value)); break;

                    case ParamType.u32:
                    case ParamType.x32:
                        bw.WriteUInt32(Convert.ToUInt32(value)); break;

                    case ParamType.s32:
                        bw.WriteInt32(Convert.ToInt32(value)); break;

                    case ParamType.u64:
                    case ParamType.x64:
                        bw.WriteUInt64(Convert.ToUInt64(value)); break;

                    case ParamType.s64:
                        bw.WriteInt64(Convert.ToInt64(value)); break;

                    case ParamType.f32:
                        bw.WriteSingle(Convert.ToSingle(value)); break;

                    case ParamType.f64:
                        bw.WriteDouble(Convert.ToDouble(value)); break;

                    default:
                        throw new Exception($"Invalid ParamTemplate ParamType: {Type.ToString()}");
                    }
                }
Esempio n. 22
0
 internal void Write(BinaryWriterEx bw, int customDataIndex, int sequenceIndex, long parentValueOffset)
 {
     bw.WriteInt32(0x1C);
     bw.WriteInt32(Points.Count);
     bw.WriteUInt32((uint)ValueType);
     bw.WriteInt32(PointType);
     bw.WriteInt32(PointType == 1 ? 0x10 : 0x18);
     bw.ReserveInt32($"PointsOffset[{customDataIndex}:{sequenceIndex}]");
     if (ValueType == DataType.Byte)
     {
         bw.WriteInt32((int)parentValueOffset + ValueIndex);
     }
     else if (ValueType == DataType.Float)
     {
         bw.WriteInt32((int)parentValueOffset);
     }
 }
Esempio n. 23
0
            internal void Write(BinaryWriterEx bw, FLVERHeader header, int indexSize, int index)
            {
                bw.WriteUInt32((uint)Flags);
                bw.WriteBoolean(TriangleStrip);
                bw.WriteBoolean(CullBackfaces);
                bw.WriteInt16(Unk06);
                bw.WriteInt32(Indices.Count);
                bw.ReserveInt32($"FaceSetVertices{index}");

                if (header.Version > 0x20005)
                {
                    bw.WriteInt32(Indices.Count * (indexSize / 8));
                    bw.WriteInt32(0);
                    bw.WriteInt32(header.Version >= 0x20013 ? indexSize : 0);
                    bw.WriteInt32(0);
                }
            }
Esempio n. 24
0
 internal void Write(BinaryWriterEx bw)
 {
     bw.WriteInt32(32);
     bw.WriteUInt32((uint)dwFlags);
     // Make sure it's 4 characters
     bw.WriteUInt32(dwFourCC);
     bw.WriteInt32(dwRGBBitCount);
     bw.WriteUInt32(dwRBitMask);
     bw.WriteUInt32(dwGBitMask);
     bw.WriteUInt32(dwBBitMask);
     bw.WriteUInt32(dwABitMask);
 }
Esempio n. 25
0
            public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation)
            {
                SectionOffset = (uint)bw.Position - sectionBaseOffset;
                WriteEmptyPointer(hkx, bw);
                WriteEmptyPointer(hkx, bw);
                WriteEmptyPointer(hkx, bw);
                WriteEmptyPointer(hkx, bw);

                bw.WriteSingle(Unk10);
                bw.WriteSingle(Unk14);
                bw.WriteSingle(Unk18);
                bw.WriteSingle(Unk1C);

                MoppCode.Write(hkx, section, bw, sectionBaseOffset, variation);
                bw.WriteUInt32(0);

                DataSize = (uint)bw.Position - sectionBaseOffset - SectionOffset;
                MoppCode.WriteReferenceData(hkx, section, bw, sectionBaseOffset, variation);
            }
Esempio n. 26
0
            internal void Write(BinaryWriterEx bw, int id)
            {
                long start = bw.Position;

                bw.ReserveInt64("NameOffset");
                bw.WriteUInt32((uint)Type);
                bw.WriteInt32(id);
                bw.ReserveInt64("PlaceholderOffset");
                bw.WriteInt32(InstanceCount);
                bw.WriteInt32(0);
                bw.WriteInt32(0);
                bw.WriteInt32(0);

                bw.FillInt64("NameOffset", bw.Position - start);
                bw.WriteUTF16(ReambiguateName(Name), true);
                bw.FillInt64("PlaceholderOffset", bw.Position - start);
                bw.WriteUTF16(Placeholder, true);
                bw.Pad(8);
            }
Esempio n. 27
0
            internal override void Write(BinaryWriterEx bw, int id)
            {
                long start = bw.Position;

                bw.ReserveInt32("NameOffset");
                bw.WriteUInt32((uint)Type);
                bw.WriteInt32(ID);
                bw.ReserveInt32("SibOffset");
                bw.WriteInt32(InstanceCount);
                bw.WriteInt32(0);
                bw.WriteInt32(0);
                bw.WriteInt32(0);

                bw.FillInt32("NameOffset", (int)(bw.Position - start));
                bw.WriteShiftJIS(ReambiguateName(Name), true);
                bw.FillInt32("SibOffset", (int)(bw.Position - start));
                bw.WriteShiftJIS(Placeholder, true);
                bw.Pad(4);
            }
Esempio n. 28
0
            internal override void Write(BinaryWriterEx bw, int id)
            {
                long start = bw.Position;

                bw.ReserveInt64("NameOffset");
                bw.WriteUInt32((uint)Type);
                bw.WriteInt32(id);
                bw.ReserveInt64("SibOffset");
                bw.WriteInt32(InstanceCount);
                bw.WriteInt32(0);
                bw.WriteInt32(0);
                bw.WriteInt32(0);

                bw.FillInt64("NameOffset", bw.Position - start);
                bw.WriteUTF16(MSB.ReambiguateName(Name), true);

                bw.FillInt64("SibOffset", bw.Position - start);
                bw.WriteUTF16(SibPath, true);
                bw.Pad(8);
            }
Esempio n. 29
0
            internal void Write(BinaryWriterEx bw)
            {
                long start = bw.Position;

                bw.ReserveInt64("NameOffset");
                bw.WriteUInt32((uint)Type);
                bw.WriteInt32(ID);
                bw.ReserveInt64("PlaceholderOffset");
                bw.WriteInt32(InstanceCount);
                bw.WriteInt32(0);
                bw.ReserveInt64("UnkOffset");

                bw.FillInt64("NameOffset", bw.Position - start);
                bw.WriteUTF16(Name, true);
                bw.FillInt64("PlaceholderOffset", bw.Position - start);
                bw.WriteUTF16(Placeholder, true);
                bw.Pad(8);

                WriteSpecific(bw, start);
            }
Esempio n. 30
0
            public override void Write(HKX hkx, HKXSection section, BinaryWriterEx bw, uint sectionBaseOffset, HKXVariation variation)
            {
                CompressedBVH.Write(hkx, section, bw, sectionBaseOffset, variation);
                bw.WriteVector4(BoundingBoxMin);
                bw.WriteVector4(BoundingBoxMax);
                bw.WriteVector3(SmallVertexOffset);
                bw.WriteVector3(SmallVertexScale);
                bw.WriteUInt32(SmallVerticesBase);

                bw.WriteUInt32(((uint)(VertexIndicesIndex) << 8) | (uint)(VertexIndicesLength));
                bw.WriteUInt32(((uint)(ByteIndicesIndex) << 8) | (uint)(ByteIndicesLength));
                bw.WriteUInt32(((uint)(Unk54Index) << 8) | (uint)(Unk54Length));

                bw.WriteUInt32(Unk58);
                bw.WriteUInt32(Unk5C);
            }