示例#1
0
 private protected override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteByte(MaxNum);
     bw.WriteSByte(GenType);
     bw.WriteInt16(LimitNum);
     bw.WriteInt16(MinGenNum);
     bw.WriteInt16(MaxGenNum);
     bw.WriteSingle(MinInterval);
     bw.WriteSingle(MaxInterval);
     bw.WriteByte(InitialSpawnCount);
     bw.WriteByte(0);
     bw.WriteByte(0);
     bw.WriteByte(0);
     bw.WriteSingle(UnkT14);
     bw.WriteSingle(UnkT18);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32s(SpawnPointIndices);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32s(SpawnPartIndices);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
 }
示例#2
0
 internal override void WriteSpecific(BinaryWriterEx bw)
 {
     bw.WriteInt16(MaxNum);
     bw.WriteInt16(LimitNum);
     bw.WriteInt16(MinGenNum);
     bw.WriteInt16(MaxGenNum);
     bw.WriteSingle(MinInterval);
     bw.WriteSingle(MaxInterval);
     bw.WriteInt32(SessionCondition);
     bw.WriteSingle(UnkT14);
     bw.WriteSingle(UnkT18);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32s(spawnPointIndices);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32s(spawnPartIndices);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
 }
示例#3
0
        /// <summary>
        /// Serializes file data to a stream.
        /// </summary>
        protected override void Write(BinaryWriterEx bw)
        {
            var offsetIndex        = new List <int>();
            var memberOffsetsIndex = new SortedDictionary <int, List <int> >();

            bw.BigEndian = BigEndian;
            bw.WriteASCII("ACB\0");
            bw.WriteByte(2);
            bw.WriteByte(1);
            bw.WriteByte(0);
            bw.WriteByte(0);
            bw.WriteInt32(Assets.Count);
            bw.ReserveInt32("OffsetIndexOffset");

            for (int i = 0; i < Assets.Count; i++)
            {
                offsetIndex.Add((int)bw.Position);
                bw.ReserveInt32($"AssetOffset{i}");
            }

            for (int i = 0; i < Assets.Count; i++)
            {
                bw.FillInt32($"AssetOffset{i}", (int)bw.Position);
                Assets[i].Write(bw, i, offsetIndex, memberOffsetsIndex);
            }

            for (int i = 0; i < Assets.Count; i++)
            {
                if (Assets[i] is Asset.Model model)
                {
                    model.WriteMembers(bw, i, offsetIndex, memberOffsetsIndex);
                }
            }

            for (int i = 0; i < Assets.Count; i++)
            {
                Assets[i].WritePaths(bw, i);
            }

            for (int i = 0; i < Assets.Count; i++)
            {
                if (Assets[i] is Asset.Model model && model.Members != null)
                {
                    for (int j = 0; j < model.Members.Count; j++)
                    {
                        model.Members[j].WriteText(bw, i, j);
                    }
                }
            }

            bw.Pad(4);
            bw.FillInt32("OffsetIndexOffset", (int)bw.Position);
            bw.WriteInt32s(offsetIndex);
            foreach (List <int> offsets in memberOffsetsIndex.Values)
            {
                bw.WriteInt32s(offsets);
            }
        }
示例#4
0
 internal override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteInt32(UnkT00);
     bw.WriteInt32s(UnkT04);
     bw.WriteInt32s(UnkT24);
     bw.WriteInt16(UnkT44);
     bw.WriteInt16(UnkT46);
     bw.WriteInt32(UnkT48);
     bw.WriteNull(0x34, false);
 }
示例#5
0
 internal override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteInt32(UnkT00);
     bw.WriteInt32s(EnemyIndices);
     bw.WriteInt32s(TalkIDs);
     bw.WriteInt16(UnkT44);
     bw.WriteInt16(UnkT46);
     bw.WriteInt32(UnkT48);
     bw.WritePattern(0x34, 0x00);
 }
示例#6
0
 internal void WriteSection11s(BinaryWriterEx bw, int index, ref int section11Count)
 {
     if (Section11s1.Count == 0 && Section11s2.Count == 0)
     {
         bw.FillInt32($"Section6Section11sOffset[{index}]", 0);
     }
     else
     {
         bw.FillInt32($"Section6Section11sOffset[{index}]", (int)bw.Position);
         bw.WriteInt32s(Section11s1);
         bw.WriteInt32s(Section11s2);
         section11Count += Section11s1.Count + Section11s2.Count;
     }
 }
示例#7
0
 internal override void Write(BinaryWriterEx bw, int id)
 {
     base.Write(bw, id);
     bw.WriteInt16(MaxNum);
     bw.WriteInt16(LimitNum);
     bw.WriteInt16(MinGenNum);
     bw.WriteInt16(MaxGenNum);
     bw.WriteSingle(MinInterval);
     bw.WriteSingle(MaxInterval);
     bw.WriteInt32(InitialSpawnCount);
     bw.WritePattern(0x1C, 0x00);
     bw.WriteInt32s(SpawnPointIndices);
     bw.WriteInt32s(SpawnPartIndices);
     bw.WritePattern(0x40, 0x00);
 }
示例#8
0
 internal override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteInt32(SoundType);
     bw.WriteInt32(SoundID);
     bw.WriteInt32s(ChildRegionIndices);
     bw.WriteInt32(UnkT48);
 }
示例#9
0
 internal override void WriteSpecific(BinaryWriterEx bw, long start)
 {
     bw.FillInt64("TypeDataOffset", bw.Position - start);
     bw.WriteUInt32((uint)SoundType);
     bw.WriteInt32(SoundID);
     bw.WriteInt32s(ChildRegionIndices);
 }
示例#10
0
        /// <summary>
        /// Write a DDS file from this header object and given pixel data.
        /// </summary>
        public byte[] Write(byte[] pixelData)
        {
            var 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);
            bw.WriteInt32s(dwReserved1);
            ddspf.Write(bw);
            bw.WriteUInt32((uint)dwCaps);
            bw.WriteUInt32((uint)dwCaps2);
            bw.WriteInt32(dwCaps3);
            bw.WriteInt32(dwCaps4);
            bw.WriteInt32(dwReserved2);

            if (ddspf.dwFourCC == "DX10")
            {
                header10.Write(bw);
            }

            bw.WriteBytes(pixelData);
            return(bw.FinishBytes());
        }
示例#11
0
        /// <summary>
        /// Serializes file data to a stream.
        /// </summary>
        protected override void Write(BinaryWriterEx bw)
        {
            bw.BigEndian = BigEndian;
            bw.WriteInt32(1);
            bw.WriteInt32(Unk04);
            bw.WriteInt32(Nodes.Count);
            bw.ReserveInt32("NodesOffset");
            bw.WriteInt32(Edges.Count);
            bw.ReserveInt32("EdgesOffset");
            bw.WriteInt32(Unk18);
            bw.WriteInt32(Unk1C);

            var edgeIndicesAOffsets = new long[Edges.Count];
            var edgeIndicesBOffsets = new long[Edges.Count];

            for (int i = 0; i < Edges.Count; i++)
            {
                edgeIndicesAOffsets[i] = bw.Position;
                bw.WriteInt32s(Edges[i].UnkIndicesA);
                edgeIndicesBOffsets[i] = bw.Position;
                bw.WriteInt32s(Edges[i].UnkIndicesB);
            }

            var nodeNodeIndicesOffsets = new long[Nodes.Count];
            var nodeEdgeIndicesOffsets = new long[Nodes.Count];

            for (int i = 0; i < Nodes.Count; i++)
            {
                Node node = Nodes[i];
                nodeNodeIndicesOffsets[i] = node.ConnectedNodeIndices.Count == 0 ? 0 : bw.Position;
                bw.WriteInt32s(node.ConnectedNodeIndices);
                nodeEdgeIndicesOffsets[i] = node.ConnectedEdgeIndices.Count == 0 ? 0 : bw.Position;
                bw.WriteInt32s(node.ConnectedEdgeIndices);
            }

            bw.FillInt32("EdgesOffset", (int)bw.Position);
            for (int i = 0; i < Edges.Count; i++)
            {
                Edges[i].Write(bw, edgeIndicesAOffsets[i], edgeIndicesBOffsets[i]);
            }

            bw.FillInt32("NodesOffset", (int)bw.Position);
            for (int i = 0; i < Nodes.Count; i++)
            {
                Nodes[i].Write(bw, nodeNodeIndicesOffsets[i], nodeEdgeIndicesOffsets[i]);
            }
        }
示例#12
0
 internal override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteInt16(MaxNum);
     bw.WriteInt16(LimitNum);
     bw.WriteInt16(MinGenNum);
     bw.WriteInt16(MaxGenNum);
     bw.WriteSingle(MinInterval);
     bw.WriteSingle(MaxInterval);
     bw.WriteInt32(SessionCondition);
     bw.WriteSingle(UnkT14);
     bw.WriteSingle(UnkT18);
     bw.WriteNull(0x14, false);
     bw.WriteInt32s(SpawnRegionIndices);
     bw.WriteNull(0x10, false);
     bw.WriteInt32s(SpawnPartIndices);
     bw.WriteNull(0x20, false);
 }
示例#13
0
 internal override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteInt32(PlatoonIDScriptActive);
     bw.WriteInt32(State);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32s(GroupPartIndices);
 }
示例#14
0
 internal override void WriteSpecific(BinaryWriterEx bw)
 {
     bw.WriteInt32(UnkT00);
     bw.WriteInt32(UnkT04);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32s(groupPartsIndices);
 }
示例#15
0
 internal override void WriteSpecific(BinaryWriterEx bw)
 {
     bw.WriteInt32(PlatoonIDScriptActivate);
     bw.WriteInt32(State);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32s(groupPartsIndices);
 }
示例#16
0
 internal void WriteNameRefs(BinaryWriterEx bw, int version, int index)
 {
     if (version >= 4)
     {
         bw.FillInt32($"NameRefOffset{index}", (int)bw.Position);
         bw.WriteInt32s(NameReferenceIDs);
     }
 }
示例#17
0
 private protected override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteInt32(PlatoonIDScriptActivate);
     bw.WriteInt32(State);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32s(GroupPartsIndices);
 }
示例#18
0
            internal void Write(BinaryWriterEx bw)
            {
                long start = bw.Position;

                bw.ReserveInt64("NameOffset");
                bw.WriteInt32(BonusType);
                bw.WriteInt32(ID);
                bw.WriteUInt32((uint)Type);
                bw.WriteVector3(Position);
                bw.WriteVector3(Rotation);
                bw.WriteInt32(Unk2);

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

                bw.WriteInt32(-1);
                bw.WriteUInt32(UnkFlags);

                bw.ReserveInt64("TypeDataOffset");
                bw.ReserveInt64("EntityIDOffset");
                bw.ReserveInt64("BonusDataOffset");

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

                bw.FillInt64("BaseDataOffset1", bw.Position - start);
                bw.WriteInt32(Unk3);

                bw.FillInt64("BaseDataOffset2", bw.Position - start);
                bw.WriteInt32(Unk4);
                bw.Pad(8);

                WriteSpecific(bw, start);

                bw.FillInt64("EntityIDOffset", bw.Position - start);
                bw.WriteInt32(EventEntityID1);
                bw.WriteInt32(EventEntityID2);

                if (BonusData == null || BonusType == 20)
                {
                    bw.FillInt64("BonusDataOffset", 0);
                }
                else
                {
                    bw.FillInt64("BonusDataOffset", bw.Position - start);
                }

                if (BonusData != null)
                {
                    bw.WriteInt32s(BonusData);
                }
                bw.Pad(8);
            }
示例#19
0
 internal void WriteValues(BinaryWriterEx bw, GPGame game, int index, int unk3ValueIDsOffset)
 {
     if (ValueIDs.Count == 0)
     {
         bw.FillInt32($"Unk3ValueIDsOffset{index}", 0);
     }
     else
     {
         bw.FillInt32($"Unk3ValueIDsOffset{index}", (int)bw.Position - unk3ValueIDsOffset);
         bw.WriteInt32s(ValueIDs);
     }
 }
示例#20
0
 internal void WriteBoneIndices(BinaryWriterEx bw, int index, int boneIndicesStart)
 {
     if (BoneIndices.Count == 0)
     {
         // Just a weird case for byte-perfect writing
         bw.FillInt32($"MeshBoneIndices{index}", boneIndicesStart);
     }
     else
     {
         bw.FillInt32($"MeshBoneIndices{index}", (int)bw.Position);
         bw.WriteInt32s(BoneIndices);
     }
 }
示例#21
0
 internal void WriteVertices(BinaryWriterEx bw, int indexSize, int index, int dataStart)
 {
     bw.FillInt32($"FaceSetVertices{index}", (int)bw.Position - dataStart);
     if (indexSize == 16)
     {
         foreach (int i in Indices)
         {
             bw.WriteUInt16((ushort)i);
         }
     }
     else if (indexSize == 32)
     {
         bw.WriteInt32s(Indices);
     }
 }
示例#22
0
 internal void WriteVertices(BinaryWriterEx bw, int indexSize, int index, int dataStart)
 {
     bw.FillInt32($"FaceSetVertices{index}", (int)bw.Position - dataStart);
     if (indexSize == 16)
     {
         for (int i = 0; i < IndicesCount; i++)
         {
             bw.WriteUInt16((ushort)Indices[i]);
         }
     }
     else if (indexSize == 32)
     {
         bw.WriteInt32s(Indices);
     }
 }
示例#23
0
 internal void WriteVertices(BinaryWriterEx bw, int indexSize, int index, int dataStart)
 {
     bw.FillInt32($"FaceSetVertices{index}", (int)bw.Position - dataStart);
     if (indexSize == 16)
     {
         foreach (int i in Indices)
         {
             bw.WriteUInt16((ushort)i);
         }
     }
     else if (indexSize == 32)
     {
         bw.WriteInt32s(Indices);
     }
     else
     {
         throw new NotImplementedException($"Unsupported index size: {indexSize}");
     }
 }
示例#24
0
        /// <summary>
        /// Serializes file data to a stream.
        /// </summary>
        protected override void Write(BinaryWriterEx bw)
        {
            bw.BigEndian = BigEndian;
            bw.WriteInt32(2);
            bw.WriteInt32(Unk04);
            bw.WriteInt32(Rooms.Count);
            bw.ReserveInt32("RoomsOffset");

            var indicesOffsets = new long[Rooms.Count];

            for (int i = 0; i < Rooms.Count; i++)
            {
                indicesOffsets[i] = bw.Position;
                bw.WriteInt32s(Rooms[i].ConnectedRoomIndices);
            }

            bw.FillInt32("RoomsOffset", (int)bw.Position);
            for (int i = 0; i < Rooms.Count; i++)
            {
                Rooms[i].Write(bw, indicesOffsets[i]);
            }
        }
示例#25
0
            internal void Write(BinaryWriterEx bw, int version, int index)
            {
                bw.WriteVector3(Position);
                bw.WriteSingle(1);
                bw.WriteVector3(Rotation);
                bw.WriteInt32(0);
                bw.WriteVector3(Scale);
                bw.WriteInt32(0);
                bw.WriteInt32(NameID);
                bw.WriteInt32(ModelID);
                bw.WriteInt32(Unk38);
                bw.WriteInt32(0);
                bw.WriteInt32(VertexCount);
                bw.WriteInt32(NameReferenceIDs.Count);
                bw.WriteInt16(MapNodesIndex);
                bw.WriteInt16((short)MapNodes.Count);
                bw.WriteInt32(Unk4C ? 1 : 0);

                if (version < 4)
                {
                    if (NameReferenceIDs.Count > 16)
                    {
                        throw new InvalidDataException("Name reference count should not exceed 16 in DS3/BB.");
                    }
                    bw.WriteInt32s(NameReferenceIDs);
                    for (int i = 0; i < 16 - NameReferenceIDs.Count; i++)
                    {
                        bw.WriteInt32(-1);
                    }
                }
                else
                {
                    bw.ReserveInt32($"NameRefOffset{index}");
                    bw.WriteInt32(0);
                    bw.WriteInt32(0);
                    bw.WriteInt32(0);
                }
            }
示例#26
0
 private protected override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteByte(HitFilterID);
     bw.WriteByte(SoundSpaceType);
     bw.WriteInt16(EnvLightMapSpotIndex);
     bw.WriteSingle(ReflectPlaneHeight);
     bw.WriteUInt32s(NvmGroups);
     bw.WriteInt32s(VagrantEntityIDs);
     bw.WriteInt16(MapNameID);
     bw.WriteBoolean(DisableStart);
     bw.WriteByte(UnkT27);
     bw.WriteInt32(DisableBonfireEntityID);
     bw.WriteInt32(-1);
     bw.WriteInt32(-1);
     bw.WriteInt32(-1);
     bw.WriteInt32(PlayRegionID);
     bw.WriteInt16(LockCamParamID1);
     bw.WriteInt16(LockCamParamID2);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
 }
示例#27
0
 internal override void Write(BinaryWriterEx bw, int id)
 {
     base.Write(bw, id);
     bw.WriteByte(HitFilterID);
     bw.WriteByte(SoundSpaceType);
     bw.WriteInt16(EnvLightMapSpotIndex);
     bw.WriteSingle(ReflectPlaneHeight);
     bw.WriteUInt32s(NvmGroups);
     bw.WriteInt32s(VagrantEntityIDs);
     bw.WriteInt16(MapNameID);
     bw.WriteInt16(DisableStart);
     bw.WriteInt32(DisableBonfireEntityID);
     bw.WriteInt32(-1);
     bw.WriteInt32(-1);
     bw.WriteInt32(-1);
     bw.WriteInt32(PlayRegionID);
     bw.WriteInt16(LockCamParamID1);
     bw.WriteInt16(LockCamParamID2);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
     bw.WriteInt32(0);
 }
示例#28
0
        protected override void Write(BinaryWriterEx bw)
        {
            bw.WriteASCII("FXR\0");
            bw.WriteInt16(0);
            bw.WriteUInt16((ushort)Version);
            bw.WriteInt32(1);
            bw.WriteInt32(ID);
            bw.ReserveInt32("Section1Offset");
            bw.WriteInt32(1);
            bw.ReserveInt32("Section2Offset");
            bw.WriteInt32(Section1Tree.Section2s.Count);
            bw.ReserveInt32("Section3Offset");
            bw.ReserveInt32("Section3Count");
            bw.ReserveInt32("Section4Offset");
            bw.ReserveInt32("Section4Count");
            bw.ReserveInt32("Section5Offset");
            bw.ReserveInt32("Section5Count");
            bw.ReserveInt32("Section6Offset");
            bw.ReserveInt32("Section6Count");
            bw.ReserveInt32("Section7Offset");
            bw.ReserveInt32("Section7Count");
            bw.ReserveInt32("Section8Offset");
            bw.ReserveInt32("Section8Count");
            bw.ReserveInt32("Section9Offset");
            bw.ReserveInt32("Section9Count");
            bw.ReserveInt32("Section10Offset");
            bw.ReserveInt32("Section10Count");
            bw.ReserveInt32("Section11Offset");
            bw.ReserveInt32("Section11Count");
            bw.WriteInt32(1);
            bw.WriteInt32(0);

            if (Version == FXRVersion.Sekiro)
            {
                bw.ReserveInt32("Section12Offset");
                bw.WriteInt32(Section12s.Count);
                bw.ReserveInt32("Section13Offset");
                bw.WriteInt32(Section13s.Count);
                bw.ReserveInt32("Section14Offset");
                bw.WriteInt32(0);
                bw.WriteInt32(0);
                bw.WriteInt32(0);
            }

            bw.FillInt32("Section1Offset", (int)bw.Position);
            Section1Tree.Write(bw);
            bw.Pad(0x10);

            bw.FillInt32("Section2Offset", (int)bw.Position);
            Section1Tree.WriteSection2s(bw);
            bw.Pad(0x10);

            bw.FillInt32("Section3Offset", (int)bw.Position);
            List <Section2> section2s = Section1Tree.Section2s;
            var             section3s = new List <Section3>();

            for (int i = 0; i < section2s.Count; i++)
            {
                section2s[i].WriteSection3s(bw, i, section3s);
            }
            bw.FillInt32("Section3Count", section3s.Count);
            bw.Pad(0x10);

            bw.FillInt32("Section4Offset", (int)bw.Position);
            var section4s = new List <Section4>();

            Section4Tree.Write(bw, section4s);
            Section4Tree.WriteSection4s(bw, section4s);
            bw.FillInt32("Section4Count", section4s.Count);
            bw.Pad(0x10);

            bw.FillInt32("Section5Offset", (int)bw.Position);
            int section5Count = 0;

            for (int i = 0; i < section4s.Count; i++)
            {
                section4s[i].WriteSection5s(bw, i, ref section5Count);
            }
            bw.FillInt32("Section5Count", section5Count);
            bw.Pad(0x10);

            bw.FillInt32("Section6Offset", (int)bw.Position);
            section5Count = 0;
            var section6s = new List <FFXDrawEntityHost>();

            for (int i = 0; i < section4s.Count; i++)
            {
                section4s[i].WriteSection6s(bw, i, ref section5Count, section6s);
            }
            bw.FillInt32("Section6Count", section6s.Count);
            bw.Pad(0x10);

            bw.FillInt32("Section7Offset", (int)bw.Position);
            var section7s = new List <FFXProperty>();

            for (int i = 0; i < section6s.Count; i++)
            {
                section6s[i].WriteSection7s(bw, i, section7s);
            }
            bw.FillInt32("Section7Count", section7s.Count);
            bw.Pad(0x10);

            bw.FillInt32("Section8Offset", (int)bw.Position);
            var section8s = new List <Section8>();

            for (int i = 0; i < section7s.Count; i++)
            {
                section7s[i].WriteSection8s(bw, i, section8s);
            }
            bw.FillInt32("Section8Count", section8s.Count);
            bw.Pad(0x10);

            bw.FillInt32("Section9Offset", (int)bw.Position);
            var section9s = new List <Section9>();

            for (int i = 0; i < section8s.Count; i++)
            {
                section8s[i].WriteSection9s(bw, i, section9s);
            }
            bw.FillInt32("Section9Count", section9s.Count);
            bw.Pad(0x10);

            bw.FillInt32("Section10Offset", (int)bw.Position);
            var section10s = new List <Section10>();

            for (int i = 0; i < section6s.Count; i++)
            {
                section6s[i].WriteSection10s(bw, i, section10s);
            }
            bw.FillInt32("Section10Count", section10s.Count);
            bw.Pad(0x10);

            bw.FillInt32("Section11Offset", (int)bw.Position);
            int section11Count = 0;

            for (int i = 0; i < section3s.Count; i++)
            {
                section3s[i].WriteSection11s(bw, i, ref section11Count);
            }
            for (int i = 0; i < section6s.Count; i++)
            {
                section6s[i].WriteSection11s(bw, i, ref section11Count);
            }
            for (int i = 0; i < section7s.Count; i++)
            {
                section7s[i].WriteSection11s(bw, i, ref section11Count);
            }
            for (int i = 0; i < section8s.Count; i++)
            {
                section8s[i].WriteSection11s(bw, i, ref section11Count);
            }
            for (int i = 0; i < section9s.Count; i++)
            {
                section9s[i].WriteSection11s(bw, i, ref section11Count);
            }
            for (int i = 0; i < section10s.Count; i++)
            {
                section10s[i].WriteSection11s(bw, i, ref section11Count);
            }
            bw.FillInt32("Section11Count", section11Count);
            bw.Pad(0x10);

            if (Version == FXRVersion.Sekiro)
            {
                bw.FillInt32("Section12Offset", (int)bw.Position);
                bw.WriteInt32s(Section12s);
                bw.Pad(0x10);

                bw.FillInt32("Section13Offset", (int)bw.Position);
                bw.WriteInt32s(Section13s);
                bw.Pad(0x10);

                bw.FillInt32("Section14Offset", (int)bw.Position);
            }
        }
示例#29
0
        protected override void Write(BinaryWriterEx bw)
        {
            bw.BigEndian  = BigEndian;
            bw.VarintLong = Version == NGPVersion.Scholar;

            bw.WriteASCII("NVG2");
            bw.WriteUInt16((ushort)Version);
            bw.WriteInt16(0);
            bw.WriteInt32(Meshes.Count);
            bw.WriteInt32(StructAs.Count);
            bw.WriteInt32(StructBs.Count);
            bw.WriteInt32(StructCs.Count);
            bw.WriteInt32(StructDs.Count);
            bw.WriteInt32(Unk1C);
            bw.ReserveVarint("OffsetA");
            bw.ReserveVarint("OffsetB");
            bw.ReserveVarint("OffsetC");
            bw.ReserveVarint("OffsetD");
            for (int i = 0; i < Meshes.Count; i++)
            {
                bw.ReserveVarint($"MeshOffset{i}");
            }

            void writeMeshes()
            {
                for (int i = 0; i < Meshes.Count; i++)
                {
                    bw.Pad(bw.VarintSize);
                    bw.FillVarint($"MeshOffset{i}", bw.Position);
                    Meshes[i].Write(bw, Version);
                }
            }

            if (Version == NGPVersion.Vanilla)
            {
                writeMeshes();
            }

            bw.Pad(bw.VarintSize);
            bw.FillVarint("OffsetA", bw.Position);
            foreach (StructA structA in StructAs)
            {
                structA.Write(bw);
            }

            bw.Pad(bw.VarintSize);
            bw.FillVarint("OffsetB", bw.Position);
            foreach (StructB structB in StructBs)
            {
                structB.Write(bw);
            }

            bw.Pad(bw.VarintSize);
            bw.FillVarint("OffsetC", bw.Position);
            bw.WriteInt32s(StructCs);

            bw.Pad(bw.VarintSize);
            bw.FillVarint("OffsetD", bw.Position);
            bw.WriteInt16s(StructDs);

            if (Version == NGPVersion.Scholar)
            {
                writeMeshes();
            }
        }
示例#30
0
 internal override void WriteTypeData(BinaryWriterEx bw)
 {
     bw.WriteInt32s(Event21PartIndices);
 }