protected override void Write(BinaryWriterEx bw) { bw.WriteASCII("FXR\0"); bw.WriteInt16((short)0); bw.WriteUInt16((ushort)this.Version); bw.WriteInt32(1); bw.WriteInt32(this.Id); bw.ReserveInt32("Section1Offset"); bw.WriteInt32(1); bw.ReserveInt32("Section2Offset"); bw.WriteInt32(this.RootStateMachine.States.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 (this.Version == Fxr3.FxrVersion.Sekiro) { bw.ReserveInt32("Section12Offset"); bw.WriteInt32(this.Section12S.Count); bw.ReserveInt32("Section13Offset"); bw.WriteInt32(this.Section13S.Count); bw.ReserveInt32("Section14Offset"); bw.WriteInt32(0); bw.WriteInt32(0); bw.WriteInt32(0); } bw.FillInt32("Section1Offset", (int)bw.Position); this.RootStateMachine.Write(bw); bw.Pad(16); bw.FillInt32("Section2Offset", (int)bw.Position); this.RootStateMachine.WriteSection2S(bw); bw.Pad(16); bw.FillInt32("Section3Offset", (int)bw.Position); List <Fxr3.FfxState> states = this.RootStateMachine.States; List <Fxr3.FfxTransition> section3S = new List <Fxr3.FfxTransition>(); for (int index = 0; index < states.Count; ++index) { states[index].WriteSection3S(bw, index, section3S); } bw.FillInt32("Section3Count", section3S.Count); bw.Pad(16); bw.FillInt32("Section4Offset", (int)bw.Position); List <Fxr3.FfxEffectCallA> section4S = new List <Fxr3.FfxEffectCallA>(); this.RootEffectCall.Write(bw, section4S); this.RootEffectCall.WriteSection4S(bw, section4S); bw.FillInt32("Section4Count", section4S.Count); bw.Pad(16); bw.FillInt32("Section5Offset", (int)bw.Position); int section5Count = 0; for (int index = 0; index < section4S.Count; ++index) { section4S[index].WriteSection5S(bw, index, ref section5Count); } bw.FillInt32("Section5Count", section5Count); bw.Pad(16); bw.FillInt32("Section6Offset", (int)bw.Position); section5Count = 0; List <Fxr3.FfxActionCall> section6S = new List <Fxr3.FfxActionCall>(); for (int index = 0; index < section4S.Count; ++index) { section4S[index].WriteSection6S(bw, index, ref section5Count, section6S); } bw.FillInt32("Section6Count", section6S.Count); bw.Pad(16); bw.FillInt32("Section7Offset", (int)bw.Position); List <Fxr3.FfxProperty> section7S = new List <Fxr3.FfxProperty>(); for (int index = 0; index < section6S.Count; ++index) { section6S[index].WriteSection7S(bw, index, section7S); } bw.FillInt32("Section7Count", section7S.Count); bw.Pad(16); bw.FillInt32("Section8Offset", (int)bw.Position); List <Fxr3.Section8> section8S = new List <Fxr3.Section8>(); for (int index = 0; index < section7S.Count; ++index) { section7S[index].WriteSection8S(bw, index, section8S); } bw.FillInt32("Section8Count", section8S.Count); bw.Pad(16); bw.FillInt32("Section9Offset", (int)bw.Position); List <Fxr3.Section9> section9S = new List <Fxr3.Section9>(); for (int index = 0; index < section8S.Count; ++index) { section8S[index].WriteSection9S(bw, index, section9S); } bw.FillInt32("Section9Count", section9S.Count); bw.Pad(16); bw.FillInt32("Section10Offset", (int)bw.Position); List <Fxr3.Section10> section10S = new List <Fxr3.Section10>(); for (int index = 0; index < section6S.Count; ++index) { section6S[index].WriteSection10S(bw, index, section10S); } bw.FillInt32("Section10Count", section10S.Count); bw.Pad(16); bw.FillInt32("Section11Offset", (int)bw.Position); int section11Count = 0; for (int index = 0; index < section3S.Count; ++index) { section3S[index].WriteSection11S(bw, index, ref section11Count); } for (int index = 0; index < section6S.Count; ++index) { section6S[index].WriteSection11S(bw, index, ref section11Count); } for (int index = 0; index < section7S.Count; ++index) { section7S[index].WriteSection11S(bw, index, ref section11Count); } for (int index = 0; index < section8S.Count; ++index) { section8S[index].WriteSection11S(bw, index, ref section11Count); } for (int index = 0; index < section9S.Count; ++index) { section9S[index].WriteSection11S(bw, index, ref section11Count); } for (int index = 0; index < section10S.Count; ++index) { section10S[index].WriteSection11S(bw, index, ref section11Count); } bw.FillInt32("Section11Count", section11Count); bw.Pad(16); if (this.Version != Fxr3.FxrVersion.Sekiro) { return; } bw.FillInt32("Section12Offset", (int)bw.Position); bw.WriteInt32s((IList <int>) this.Section12S); bw.Pad(16); bw.FillInt32("Section13Offset", (int)bw.Position); bw.WriteInt32s((IList <int>) this.Section13S); bw.Pad(16); bw.FillInt32("Section14Offset", (int)bw.Position); }