internal void Write(BinaryWriterEx bw, BTPBVersion version, long nameOffset, long probesOffset) { bw.WriteVarint(nameOffset); bw.WriteInt32(Flags08); bw.WriteInt32(Probes.Count); bw.WriteInt32(Unk10); bw.WriteInt32(Unk14); bw.WriteInt32(Unk18); bw.WriteSingle(Unk1C); bw.WriteSingle(Unk20); bw.WriteSingle(Unk24); bw.WriteVector3(Unk28); bw.WriteVector3(Unk34); bw.WriteVarint(probesOffset); if (version >= BTPBVersion.DarkSouls3) { bw.WriteSingle(Unk48); bw.WriteSingle(Unk4C); bw.WriteSingle(Unk50); bw.WritePattern(0x40, 0x00); bw.WriteByte(Unk94); bw.WriteByte(Unk95); bw.WriteByte(Unk96); bw.WriteByte(0); } }
internal override void Write(BinaryWriterEx bw) { bool bigEndian = Format == EMEVD.Game.DarkSouls1BE; bool is64Bit = Format >= EMEVD.Game.Bloodborne; bw.WriteASCII("ELD\0"); bw.WriteBoolean(bigEndian); bw.WriteSByte((sbyte)(is64Bit ? -1 : 0)); bw.WriteByte(0); bw.WriteByte(0); bw.BigEndian = bigEndian; bw.VarintLong = is64Bit; bw.WriteInt16(0x65); bw.WriteInt16(0xCC); bw.ReserveInt32("FileSize"); bw.WriteVarint(Events.Count); bw.ReserveVarint("EventsOffset"); bw.WriteVarint(0); bw.ReserveVarint("Offset2"); bw.WriteVarint(0); bw.ReserveVarint("Offset3"); bw.ReserveVarint("StringsLength"); bw.ReserveVarint("StringsOffset"); if (!is64Bit) { bw.WriteInt32(0); bw.WriteInt32(0); } bw.FillVarint("EventsOffset", bw.Position); for (int i = 0; i < Events.Count; i++) { Events[i].Write(bw, Format, i); } bw.FillVarint("Offset2", bw.Position); bw.FillVarint("Offset3", bw.Position); long stringsOffset = bw.Position; bw.FillVarint("StringsOffset", bw.Position); for (int i = 0; i < Events.Count; i++) { Events[i].WriteName(bw, i, stringsOffset); } if ((bw.Position - stringsOffset) % 0x10 > 0) { bw.WritePattern(0x10 - (int)(bw.Position - stringsOffset) % 0x10, 0x00); } bw.FillVarint("StringsLength", bw.Position - stringsOffset); bw.FillInt32("FileSize", (int)bw.Position); }
internal void Write(BinaryWriterEx bw, long partNameOffset, long materialNameOffset) { bw.WriteVarint(partNameOffset); bw.WriteVarint(materialNameOffset); bw.WriteInt32(AtlasID); bw.WriteVector2(UVOffset); bw.WriteVector2(UVScale); if (bw.VarintLong) { bw.WriteInt32(0); } }
internal void Write(BinaryWriterEx bw, Game format, int eventIndex, int instrIndex) { bw.WriteInt32(Bank); bw.WriteInt32(ID); bw.WriteVarint(ArgData.Length); if (format < Game.Scholar) { bw.ReserveInt32($"Event{eventIndex}Instr{instrIndex}ArgsOffset"); } else if (format < Game.Sekiro) { bw.ReserveInt32($"Event{eventIndex}Instr{instrIndex}ArgsOffset"); bw.WriteInt32(0); } else { bw.ReserveInt64($"Event{eventIndex}Instr{instrIndex}ArgsOffset"); } if (format < Game.DarkSouls3) { bw.ReserveInt32($"Event{eventIndex}Instr{instrIndex}LayerOffset"); bw.WriteInt32(0); } else { bw.ReserveInt64($"Event{eventIndex}Instr{instrIndex}LayerOffset"); } }
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); if (bw.VarintLong) { bw.WriteInt32(0); } bw.ReserveVarint("TypeDataOffset"); bw.WriteVarint(0); bw.FillVarint("NameOffset", bw.Position - start); bw.WriteUTF16(MSB.ReambiguateName(Name), true); bw.Pad(bw.VarintSize); if (HasTypeData) { bw.FillVarint("TypeDataOffset", bw.Position - start); WriteTypeData(bw); } else { bw.FillVarint("TypeDataOffset", 0); } }
internal void WriteDisposOffsets(BinaryWriterEx bw, Dictionary <Disposition, long> offsetsByDispos, int cutIndex, int timelineIndex) { bw.FillVarint($"DisposOffsetsOffset[{cutIndex}:{timelineIndex}]", bw.Position); foreach (Disposition dispos in Dispositions) { bw.WriteVarint(offsetsByDispos[dispos]); } }
internal void Write(BinaryWriterEx bw, EMEVD.Game format, int index) { bw.WriteVarint(ID); bw.ReserveVarint($"Event{index}NameOffset"); if (format < EMEVD.Game.Bloodborne) { bw.WriteInt32(0); } }
internal void Write(BinaryWriterEx bw, Game format, int eventIndex) { bw.WriteVarint(ID); bw.WriteVarint(Instructions.Count); bw.ReserveVarint($"Event{eventIndex}InstrsOffset"); bw.WriteVarint(Parameters.Count); if (format < Game.Scholar) { bw.ReserveInt32($"Event{eventIndex}ParamsOffset"); } else if (format < Game.DarkSouls3) { bw.ReserveInt32($"Event{eventIndex}ParamsOffset"); bw.WriteInt32(0); } else { bw.ReserveInt64($"Event{eventIndex}ParamsOffset"); } bw.WriteUInt32((uint)RestBehavior); bw.WriteInt32(0); }
protected override void Write(BinaryWriterEx bw) { bool bigEndian = Format == Game.DarkSouls1BE; bool is64Bit = Format >= Game.Bloodborne; bool unk06 = Format >= Game.DarkSouls3; bool unk07 = Format >= Game.Sekiro; int version = Format < Game.DarkSouls3 ? 0xCC : 0xCD; var layers = new List <uint>(); foreach (Event evt in Events) { foreach (Instruction inst in evt.Instructions) { if (inst.Layer.HasValue && !layers.Contains(inst.Layer.Value)) { layers.Add(inst.Layer.Value); } } } bw.WriteASCII("EVD\0"); bw.WriteBoolean(bigEndian); bw.WriteSByte((sbyte)(is64Bit ? -1 : 0)); bw.WriteBoolean(unk06); bw.WriteSByte((sbyte)(unk07 ? -1 : 0)); bw.BigEndian = bigEndian; bw.VarintLong = is64Bit; bw.WriteInt32(version); bw.ReserveInt32("FileSize"); Offsets offsets = default; bw.WriteVarint(Events.Count); bw.ReserveVarint("EventsOffset"); bw.WriteVarint(Events.Sum(e => e.Instructions.Count)); bw.ReserveVarint("InstructionsOffset"); bw.WriteVarint(0); bw.ReserveVarint("Offset3"); bw.WriteVarint(layers.Count); bw.ReserveVarint("LayersOffset"); bw.WriteVarint(Events.Sum(e => e.Parameters.Count)); bw.ReserveVarint("ParametersOffset"); bw.WriteVarint(LinkedFileOffsets.Count); bw.ReserveVarint("LinkedFilesOffset"); bw.ReserveVarint("ArgumentsLength"); bw.ReserveVarint("ArgumentsOffset"); bw.WriteVarint(StringData.Length); bw.ReserveVarint("StringsOffset"); if (!is64Bit) { bw.WriteInt32(0); } offsets.Events = bw.Position; bw.FillVarint("EventsOffset", bw.Position); for (int i = 0; i < Events.Count; i++) { Events[i].Write(bw, Format, i); } offsets.Instructions = bw.Position; bw.FillVarint("InstructionsOffset", bw.Position); for (int i = 0; i < Events.Count; i++) { Events[i].WriteInstructions(bw, Format, offsets, i); } bw.FillVarint("Offset3", bw.Position); offsets.Layers = bw.Position; bw.FillVarint("LayersOffset", bw.Position); var layerOffsets = new Dictionary <uint, long>(layers.Count); foreach (uint layer in layers) { layerOffsets[layer] = bw.Position - offsets.Layers; Layer.Write(bw, layer); } for (int i = 0; i < Events.Count; i++) { Event evt = Events[i]; for (int j = 0; j < evt.Instructions.Count; j++) { evt.Instructions[j].FillLayerOffset(bw, Format, i, j, layerOffsets); } } offsets.Arguments = bw.Position; bw.FillVarint("ArgumentsOffset", bw.Position); for (int i = 0; i < Events.Count; i++) { Event evt = Events[i]; for (int j = 0; j < evt.Instructions.Count; j++) { evt.Instructions[j].WriteArgs(bw, Format, offsets, i, j); } } if ((bw.Position - offsets.Arguments) % 0x10 > 0) { bw.WritePattern(0x10 - (int)(bw.Position - offsets.Arguments) % 0x10, 0x00); } bw.FillVarint("ArgumentsLength", bw.Position - offsets.Arguments); offsets.Parameters = bw.Position; bw.FillVarint("ParametersOffset", bw.Position); for (int i = 0; i < Events.Count; i++) { Events[i].WriteParameters(bw, Format, offsets, i); } offsets.LinkedFiles = bw.Position; bw.FillVarint("LinkedFilesOffset", bw.Position); foreach (long offset in LinkedFileOffsets) { bw.WriteVarint((int)offset); } offsets.Strings = bw.Position; bw.FillVarint("StringsOffset", bw.Position); bw.WriteBytes(StringData); bw.FillInt32("FileSize", (int)bw.Position); }
private protected override void WriteTypeData(BinaryWriterEx bw) { bw.WriteVarint(0); }