internal void WriteStrings(BinaryWriterEx bw, FLVERHeader header, int index) { bw.FillInt32($"MaterialName{index}", (int)bw.Position); if (header.Unicode) { bw.WriteUTF16(Name, true); } else { bw.WriteShiftJIS(Name, true); } bw.FillInt32($"MaterialMTD{index}", (int)bw.Position); if (header.Unicode) { bw.WriteUTF16(MTD, true); } else { bw.WriteShiftJIS(MTD, true); } }
internal void Write(BinaryWriterEx bw) { long start = bw.Position; bw.ReserveInt64("NameOffset"); bw.WriteInt32(Unk08); bw.WriteInt32(Unk0C); bw.WriteInt32(Unk10); bw.FillInt64("NameOffset", bw.Position - start); bw.WriteUTF16(Name, true); bw.Pad(8); }
internal void WriteParamHeader(BinaryWriterEx bw, GPGame game, int groupIndex, int paramIndex, int paramHeadersOffset) { bw.FillInt32($"ParamHeaderOffset{groupIndex}:{paramIndex}", (int)bw.Position - paramHeadersOffset); bw.ReserveInt32($"ValuesOffset{groupIndex}:{paramIndex}"); bw.ReserveInt32($"ValueIDsOffset{groupIndex}:{paramIndex}"); bw.WriteByte((byte)Type); bw.WriteByte((byte)Values.Count); bw.WriteByte(0); bw.WriteByte(0); if (game == GPGame.DarkSouls2) { bw.WriteShiftJIS(Name1, true); } else { bw.WriteUTF16(Name1, true); bw.WriteUTF16(Name2, true); } bw.Pad(4); }
internal void Write(BinaryWriterEx bw, int id) { long start = bw.Position; bw.ReserveInt64("NameOffset"); bw.WriteUInt32((uint)Type); bw.WriteInt32(id); bw.WriteUInt32((uint)Shape.Type); bw.WriteVector3(Position); bw.WriteVector3(Rotation); bw.WriteInt32(Unk2); bw.ReserveInt64("BaseDataOffset1"); bw.ReserveInt64("BaseDataOffset2"); bw.WriteInt32(-1); bw.WriteUInt32(MapStudioLayer); bw.ReserveInt64("ShapeDataOffset"); bw.ReserveInt64("BaseDataOffset3"); bw.ReserveInt64("TypeDataOffset"); 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); Shape.Write(bw, start); bw.FillInt64("BaseDataOffset3", bw.Position - start); bw.WriteInt32(ActivationPartIndex); bw.WriteInt32(EventEntityID); if (HasTypeData) { WriteSpecific(bw, start); } else { bw.FillInt64("TypeDataOffset", 0); } bw.Pad(8); }
/// <summary> /// Serializes file data to a stream. /// </summary> protected override void Write(BinaryWriterEx bw) { bw.BigEndian = BigEndian; bw.VarintLong = LongFormat; bw.WriteInt32(1); bw.WriteInt32(0); bw.WriteInt32(Entries.Count); bw.ReserveInt32("StringsLength"); bw.WriteBoolean(BigEndian); bw.WriteByte(0); bw.WriteByte(0); bw.WriteByte(0); bw.WriteInt32(LongFormat ? 0x28 : 0x1C); bw.WritePattern(0x24, 0x00); long stringsStart = bw.Position; var stringOffsets = new List <long>(Entries.Count * 2); foreach (Entry entry in Entries) { long partNameOffset = bw.Position - stringsStart; stringOffsets.Add(partNameOffset); bw.WriteUTF16(entry.PartName, true); bw.PadRelative(stringsStart, 8); // This padding is not consistent, but it's the best I can do long materialNameOffset = bw.Position - stringsStart; stringOffsets.Add(materialNameOffset); bw.WriteUTF16(entry.MaterialName, true); bw.PadRelative(stringsStart, 8); } bw.FillInt32("StringsLength", (int)(bw.Position - stringsStart)); for (int i = 0; i < Entries.Count; i++) { Entries[i].Write(bw, stringOffsets[i * 2], stringOffsets[i * 2 + 1]); } }
internal void Write(BinaryWriterEx bw, int id) { long start = bw.Position; bw.ReserveInt64("NameOffset"); bw.WriteInt32(Unk08); bw.WriteInt32(Unk0C); bw.WriteInt32(4); bw.WriteInt32(id); bw.WriteNull(0x68, false); bw.FillInt64("NameOffset", bw.Position - start); bw.WriteUTF16(Name, true); bw.Pad(8); }
internal void WriteFileName(BinaryWriterEx bw, Format format, bool unicode, int index) { if (HasNames(format)) { bw.FillInt32($"FileNameOffset{index}", (int)bw.Position); if (unicode) { bw.WriteUTF16(Name, true); } else { bw.WriteShiftJIS(Name, true); } } }
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); }
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); }
internal void Write(BinaryWriterEx bw, List <T> entries) { bw.WriteInt32(Unk1); bw.WriteInt32(entries.Count + 1); bw.ReserveInt64("TypeOffset"); for (int i = 0; i < entries.Count; i++) { bw.ReserveInt64($"Offset{i}"); } bw.ReserveInt64("NextOffset"); bw.FillInt64("TypeOffset", bw.Position); bw.WriteUTF16(Type, true); bw.Pad(8); WriteEntries(bw, entries); }
internal override void Write(BinaryWriterEx bw, int index) { long start = bw.Position; bw.ReserveInt64("NameOffset"); bw.WriteInt32(EventID); bw.WriteUInt16((ushort)Type); bw.WriteInt16((short)index); bw.ReserveInt64("TypeDataOffset"); bw.FillInt64("NameOffset", bw.Position - start); bw.WriteUTF16(Name, true); bw.Pad(8); bw.FillInt64("TypeDataOffset", bw.Position - start); WriteTypeData(bw); }
internal override void Write(BinaryWriterEx bw, int id) { long start = bw.Position; bw.ReserveVarint("NameOffset"); bw.WriteByte((byte)Type); bw.WriteByte(0); bw.WriteInt16((short)id); bw.WriteInt16(ModelIndex); bw.WriteInt16(0); bw.WriteVector3(Position); bw.WriteVector3(Rotation); bw.WriteVector3(Scale); bw.WriteUInt32s(DrawGroups); bw.WriteInt32(Unk44); bw.WriteInt32(Unk48); bw.WriteInt32(Unk4C); bw.WriteInt32(Unk50); bw.WriteUInt32s(DispGroups); bw.WriteInt32(Unk64); bw.WriteInt32(0); bw.WriteByte(Unk6C); bw.WriteByte(0); bw.WriteByte(Unk6E); bw.WriteByte(0); bw.ReserveVarint("TypeDataOffset"); if (bw.VarintLong) { bw.WriteInt64(0); } long nameStart = bw.Position; int namePad = bw.VarintLong ? 0x20 : 0x2C; bw.FillVarint("NameOffset", nameStart - start); bw.WriteUTF16(MSB.ReambiguateName(Name), true); if (bw.Position - nameStart < namePad) { bw.Position += namePad - (bw.Position - nameStart); } bw.Pad(bw.VarintSize); bw.FillVarint("TypeDataOffset", bw.Position - start); WriteTypeData(bw); }
internal void WriteAnimFile(BinaryWriterEx bw, int i) { bw.FillInt64($"AnimFileOffset{i}", bw.Position); bw.WriteInt64(AnimFileReference ? 1 : 0); bw.WriteInt64(bw.Position + 8); bw.ReserveInt64("AnimFileNameOffset"); bw.WriteInt32(AnimFileUnk18); bw.WriteInt32(AnimFileUnk20); bw.WriteInt64(0); bw.WriteInt64(0); bw.FillInt64("AnimFileNameOffset", bw.Position); if (AnimFileName != null) { bw.WriteUTF16(AnimFileName, true); bw.Pad(0x10); } }
internal void Write(BinaryWriterEx bw) { long start = bw.Position; bw.ReserveInt64("NameOffset"); bw.WriteInt32(Unk1); bw.WriteInt32(Unk2); bw.WriteInt32(Unk3); bw.WriteInt32(Unk4); for (int i = 0; i < 26; i++) { bw.WriteInt32(0); } bw.FillInt64("NameOffset", bw.Position - start); bw.WriteUTF16(Name, true); bw.Pad(8); }
internal override void Write(BinaryWriterEx bw) { bw.BigEndian = false; bw.WriteInt32(2); bw.WriteInt32(Unk04); bw.WriteInt32(Lights.Count); bw.ReserveInt32("NameSize"); bw.WriteInt32(0); bw.WriteInt32(0xC8); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); long nameStart = bw.Position; var nameOffsets = new List <int>(Lights.Count); foreach (Light entry in Lights) { int nameOffset = (int)(bw.Position - nameStart); nameOffsets.Add(nameOffset); bw.WriteUTF16(entry.Name, true); if (nameOffset % 0x10 != 0) { for (int i = 0; i < 0x10 - (nameOffset % 0x10); i++) { bw.WriteByte(0); } } } bw.FillInt32("NameSize", (int)(bw.Position - nameStart)); for (int i = 0; i < Lights.Count; i++) { Lights[i].Write(bw, nameOffsets[i]); } }
internal void WriteName(BinaryWriterEx bw, int i, byte Unk4) { if (Name == null || Name == "") { bw.FillInt64($"NameOffset{i}", 0); } else { bw.FillInt64($"NameOffset{i}", bw.Position); if (Unk4 == 6) { bw.WriteShiftJIS(Name, true); } else if (Unk4 == 7) { bw.WriteUTF16(Name, true); } } }
internal virtual void Write(BinaryWriterEx bw, List <T> entries) { bw.WriteInt32(Version); if (bw.VarintLong) { bw.WriteInt32(entries.Count + 1); bw.ReserveVarint("ParamNameOffset"); } else { bw.ReserveVarint("ParamNameOffset"); bw.WriteInt32(entries.Count + 1); } for (int i = 0; i < entries.Count; i++) { bw.ReserveVarint($"EntryOffset{i}"); } bw.ReserveVarint("NextParamOffset"); bw.FillVarint("ParamNameOffset", bw.Position); bw.WriteUTF16(Name, true); bw.Pad(bw.VarintSize); int index = 0; Type type = null; for (int i = 0; i < entries.Count; i++) { if (type != entries[i].GetType()) { type = entries[i].GetType(); index = 0; } bw.FillVarint($"EntryOffset{i}", bw.Position); entries[i].Write(bw, index); bw.Pad(bw.VarintSize); index++; } }
internal void Write(BinaryWriterEx bw, List <T> entries) { bw.WriteInt32(Unk00); bw.WriteInt32(entries.Count + 1); bw.ReserveInt64("ParamNameOffset"); for (int i = 0; i < entries.Count; i++) { bw.ReserveInt64($"EntryOffset{i}"); } bw.ReserveInt64("NextParamOffset"); bw.FillInt64("ParamNameOffset", bw.Position); bw.WriteUTF16(Name, true); bw.Pad(8); for (int i = 0; i < entries.Count; i++) { bw.FillInt64($"EntryOffset{i}", bw.Position); entries[i].Write(bw); } }
internal override void Write(BinaryWriterEx bw) { bw.BigEndian = false; bw.WriteInt32(2); bw.WriteInt32(Version); bw.WriteInt32(Lights.Count); bw.ReserveInt32("NamesLength"); bw.WriteInt32(0); bw.WriteInt32(Version == 16 ? 0xE8 : (LongOffsets ? 0xC8 : 0xC0)); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); long namesStart = bw.Position; var nameOffsets = new List <long>(Lights.Count); foreach (Light entry in Lights) { long nameOffset = bw.Position - namesStart; nameOffsets.Add(nameOffset); bw.WriteUTF16(entry.Name, true); if (nameOffset % 0x10 != 0) { bw.WritePattern((int)(0x10 - (nameOffset % 0x10)), 0x00); } } bw.FillInt32("NamesLength", (int)(bw.Position - namesStart)); for (int i = 0; i < Lights.Count; i++) { Lights[i].Write(bw, nameOffsets[i], Version, LongOffsets); } }
internal void WriteData(BinaryWriterEx bw, BTPBVersion version, long dataStart, out long nameOffset, out long probesOffset) { if ((Flags08 & 1) != 0) { nameOffset = bw.Position - dataStart; bw.WriteUTF16(Name, true); if ((bw.Position - dataStart) % 8 != 0) { bw.Position += 8 - (bw.Position - dataStart) % 8; } } else { nameOffset = 0; } probesOffset = bw.Position - dataStart; foreach (Probe probe in Probes) { probe.Write(bw, version); } }
/// <summary> /// Serializes file data to a stream. /// </summary> protected override void Write(BinaryWriterEx bw) { bw.BigEndian = BigEndian; for (int i = 0; i < Globals.Count; i++) { if (LongFormat) { bw.ReserveInt64($"Offset{i}"); } else { bw.ReserveUInt32($"Offset{i}"); } } if (LongFormat) { bw.WriteInt64(0); } else { bw.WriteUInt32(0); } for (int i = 0; i < Globals.Count; i++) { if (LongFormat) { bw.FillInt64($"Offset{i}", bw.Position); bw.WriteUTF16(Globals[i], true); } else { bw.FillUInt32($"Offset{i}", (uint)bw.Position); bw.WriteShiftJIS(Globals[i], true); } } bw.Pad(0x10); }
internal override void Write(BinaryWriterEx bw) { BinaryWriterEx bwData = new BinaryWriterEx(false); bwData.WriteInt32(0); bwData.WriteInt32(Struct1s.Count); bwData.WriteInt32(Struct2s.Count); bwData.WriteInt32(0); foreach (Struct1 struct1 in Struct1s) { struct1.Write(bwData); } bwData.Pad(0x10); foreach (Struct2 struct2 in Struct2s) { struct2.Write(bwData); } bwData.Pad(0x10); bwData.WriteInt16(0); foreach (string str in Strings) { bwData.WriteUTF16(str, true); } bwData.Pad(0x10); byte[] data = bwData.FinishBytes(); bw.WriteASCII("ENFL"); bw.WriteInt32(0x10415); bw.ReserveInt32("CompressedSize"); bw.WriteInt32(data.Length); int compressedSize = Util.WriteZlib(bw, 0xDA, data); bw.FillInt32("CompressedSize", compressedSize); }
internal void Write(BinaryWriterEx bw) { bw.WriteInt32(Unk1); bw.WriteInt32(Entries.Count + 1); bw.ReserveInt64("TypeOffset"); for (int i = 0; i < Entries.Count; i++) { bw.ReserveInt64($"Offset{i}"); } bw.ReserveInt64("NextOffset"); bw.FillInt64("TypeOffset", bw.Position); bw.WriteUTF16(Type, true); bw.Pad(8); for (int i = 0; i < Entries.Count; i++) { bw.FillInt64($"Offset{i}", bw.Position); bw.WriteBytes(Entries[i]); } }
internal override void Write(BinaryWriterEx bw, int id) { long start = bw.Position; bw.ReserveVarint("NameOffset"); bw.WriteInt32(EventID); bw.WriteByte((byte)Type); bw.WriteByte(0); bw.WriteInt16((short)id); bw.ReserveVarint("TypeDataOffset"); if (!bw.VarintLong) { bw.WriteInt32(0); bw.WriteInt32(0); } bw.FillVarint("NameOffset", bw.Position - start); bw.WriteUTF16(Name, true); bw.Pad(bw.VarintSize); bw.FillVarint("TypeDataOffset", bw.Position - start); WriteTypeData(bw); }
internal void Write(BinaryWriterEx bw) { long start = bw.Position; bw.ReserveInt64("NameOffset"); bw.WriteInt32(0); bw.WriteInt32(ID); bw.WriteUInt32((uint)Type); bw.WriteVector3(Position); bw.WriteVector3(Rotation); bw.WriteInt32(Unk2); bw.ReserveInt64("BaseDataOffset1"); bw.ReserveInt64("BaseDataOffset2"); bw.ReserveInt64("TypeDataOffset"); bw.ReserveInt64("BaseDataOffset3"); bw.FillInt64("NameOffset", bw.Position - start); bw.WriteUTF16(Name, true); bw.Pad(4); 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("BaseDataOffset3", bw.Position - start); bw.WriteInt32(EventEntityID); bw.Pad(8); }
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.WriteInt32(Unk44); bw.WriteInt32(Unk48); bw.WriteInt32(Unk4C); bw.WriteInt32(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(MSB.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); }
internal void WriteName(BinaryWriterEx bw, int index, long stringsOffset) { bw.FillVarint($"Event{index}NameOffset", bw.Position - stringsOffset); bw.WriteUTF16(Name, true); }
internal override void Write(BinaryWriterEx bw) { if (layout == null) { throw new InvalidOperationException("Params cannot be written without a layout."); } Rows.Sort((r1, r2) => r1.ID.CompareTo(r2.ID)); bw.BigEndian = false; bw.ReserveInt32("NameOffset"); bw.WriteInt16(0); bw.WriteInt16(Unk1); bw.WriteInt16(Unk2); bw.WriteUInt16((ushort)Rows.Count); if (FixStrID) { bw.WriteFixStr(ID, 0x20); } else { bw.WriteInt32(0); bw.ReserveInt32("IDOffset"); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); } bw.WriteByte(0); bw.WriteByte(Unk3); bw.WriteByte(Unk4); bw.WriteByte(0); bw.ReserveInt64("DataStart"); bw.WriteInt32(0); bw.WriteInt32(0); for (int i = 0; i < Rows.Count; i++) { Rows[i].WriteHeader(bw, i); } bw.FillInt64("DataStart", bw.Position); for (int i = 0; i < Rows.Count; i++) { Rows[i].WriteCells(bw, i, layout); } bw.FillInt32("NameOffset", (int)bw.Position); if (FixStrID) { if (Unk4 == 6) { bw.WriteShiftJIS(Name, true); } else if (Unk4 == 7) { bw.WriteUTF16(Name, true); } } else { bw.WriteShiftJIS(Name, true); bw.FillInt32("IDOffset", (int)bw.Position); bw.WriteASCII(ID, true); } for (int i = 0; i < Rows.Count; i++) { Rows[i].WriteName(bw, i, Unk4); } }
internal override void Write(BinaryWriterEx bw) { bw.WriteASCII("TAE "); bw.WriteByte(0); bw.WriteByte(0); bw.WriteByte(0); bw.WriteByte(0xFF); bw.WriteInt32(0x1000C); bw.ReserveInt32("FileSize"); bw.WriteInt64(0x40); bw.WriteInt64(1); bw.WriteInt64(0x50); bw.WriteInt64(0x80); bw.WriteInt64(Unk30); bw.WriteInt64(0); bw.WriteBytes(Flags); bw.WriteInt64(1); bw.WriteInt32(ID); bw.WriteInt32(Animations.Count); bw.ReserveInt64("AnimsOffset"); bw.ReserveInt64("AnimGroupsOffset"); bw.WriteInt64(0xA0); bw.WriteInt64(Animations.Count); bw.ReserveInt64("FirstAnimOffset"); bw.WriteInt64(1); bw.WriteInt64(0x90); bw.WriteInt32(ID); bw.WriteInt32(ID); bw.WriteInt64(0x50); bw.WriteInt64(0); bw.WriteInt64(0xB0); bw.ReserveInt64("SkeletonName"); bw.ReserveInt64("SibName"); bw.WriteInt64(0); bw.WriteInt64(0); bw.FillInt64("SkeletonName", bw.Position); bw.WriteUTF16(SkeletonName, true); bw.Pad(0x10); bw.FillInt64("SibName", bw.Position); bw.WriteUTF16(SibName, true); bw.Pad(0x10); Animations.Sort((a1, a2) => a1.ID.CompareTo(a2.ID)); bw.FillInt64("AnimsOffset", bw.Position); var animOffsets = new List <long>(Animations.Count); for (int i = 0; i < Animations.Count; i++) { animOffsets.Add(bw.Position); Animations[i].WriteHeader(bw, i); } bw.FillInt64("AnimGroupsOffset", bw.Position); bw.ReserveInt64("AnimGroupsCount"); bw.ReserveInt64("AnimGroupsOffset"); int groupCount = 0; long groupStart = bw.Position; for (int i = 0; i < Animations.Count; i++) { int firstIndex = i; bw.WriteInt32((int)Animations[i].ID); while (i < Animations.Count - 1 && Animations[i + 1].ID == Animations[i].ID + 1) { i++; } bw.WriteInt32((int)Animations[i].ID); bw.WriteInt64(animOffsets[firstIndex]); groupCount++; } bw.FillInt64("AnimGroupsCount", groupCount); if (groupCount == 0) { bw.FillInt64("AnimGroupsOffset", 0); } else { bw.FillInt64("AnimGroupsOffset", groupStart); } bw.FillInt64("FirstAnimOffset", bw.Position); for (int i = 0; i < Animations.Count; i++) { Animations[i].WriteBody(bw, i); } for (int i = 0; i < Animations.Count; i++) { Animations[i].WriteAnimFile(bw, i); long timeStart = bw.Position; Animations[i].WriteTimes(bw, i); var eventHeaderOffsets = Animations[i].WriteEventHeaders(bw, i, timeStart); Animations[i].WriteEventData(bw, i); Animations[i].WriteEventGroupHeaders(bw, i); Animations[i].WriteEventGroupData(bw, i, eventHeaderOffsets); } bw.FillInt32("FileSize", (int)bw.Position); }
internal void Write(BinaryWriterEx bw) { long start = bw.Position; bw.ReserveInt64("NameOffset"); bw.WriteUInt32((uint)Type); bw.WriteInt32(ID); bw.WriteInt32(modelIndex); bw.WriteInt32(0); bw.ReserveInt64("PlaceholderOffset"); bw.WriteVector3(Position); bw.WriteVector3(Rotation); bw.WriteVector3(Scale); bw.WriteUInt32(DrawGroup1); bw.WriteUInt32(DrawGroup2); bw.WriteUInt32(DrawGroup3); bw.WriteUInt32(DrawGroup4); bw.WriteUInt32(DispGroup1); bw.WriteUInt32(DispGroup2); bw.WriteUInt32(DispGroup3); bw.WriteUInt32(DispGroup4); bw.WriteInt32(UnkF01); bw.WriteInt32(UnkF02); bw.WriteInt32(UnkF03); bw.WriteInt32(UnkF04); bw.WriteInt32(UnkF05); bw.WriteInt32(UnkF06); bw.WriteInt32(UnkF07); bw.WriteInt32(UnkF08); bw.WriteInt32(UnkF09); bw.WriteInt32(UnkF10); bw.WriteInt32(UnkF11); bw.WriteInt32(UnkF12); bw.WriteInt32(UnkF13); bw.WriteInt32(UnkF14); bw.WriteInt32(UnkF15); bw.WriteInt32(UnkF16); bw.WriteInt32(UnkF17); bw.WriteInt32(UnkF18); bw.WriteInt32(0); bw.ReserveInt64("BaseDataOffset"); bw.ReserveInt64("TypeDataOffset"); bw.ReserveInt64("UnkOffset1"); bw.ReserveInt64("UnkOffset2"); bw.FillInt64("NameOffset", bw.Position - start); bw.WriteUTF16(Name, true); if (Placeholder == null) { bw.FillInt64("PlaceholderOffset", 0); } else { bw.FillInt64("PlaceholderOffset", bw.Position - start); bw.WriteUTF16(Placeholder, true); } bw.Pad(8); bw.FillInt64("BaseDataOffset", bw.Position - start); bw.WriteInt32(EventEntityID); bw.WriteSByte(LightID); bw.WriteSByte(FogID); bw.WriteSByte(ScatterID); bw.WriteSByte(LensFlareID); bw.WriteInt32(0); bw.WriteSByte(LanternID); bw.WriteSByte(LodParamID); bw.WriteSByte(UnkB0E); bw.WriteBoolean(IsShadowDest); bw.WriteBoolean(IsShadowOnly); bw.WriteBoolean(DrawByReflectCam); bw.WriteBoolean(DrawOnlyReflectCam); bw.WriteBoolean(UseDepthBiasFloat); bw.WriteBoolean(DisablePointLightEffect); bw.WriteByte(UnkB15); bw.WriteByte(UnkB16); bw.WriteByte(UnkB17); bw.WriteInt32(UnkB18); bw.WriteInt32(UnkB1C); bw.WriteInt32(UnkB20); bw.WriteInt32(UnkB24); bw.WriteInt32(UnkB28); bw.WriteInt32(-1); bw.WriteInt32(UnkB30); bw.WriteInt32(UnkB34); bw.WriteInt32(UnkB38); bw.WriteInt32(0); bw.FillInt64("TypeDataOffset", bw.Position - start); if (UnkOffset1Delta == 0) { bw.FillInt64("UnkOffset1", 0); } else { bw.FillInt64("UnkOffset1", bw.Position - start + UnkOffset1Delta); } if (UnkOffset2Delta == 0) { bw.FillInt64("UnkOffset2", 0); } else { bw.FillInt64("UnkOffset2", bw.Position - start + UnkOffset2Delta); } WriteSpecific(bw); }