public static void Serialize(this SerializingContainer2 sc, ref FaceFXAnimSet.HNode node) { if (sc.IsLoading) { node = new FaceFXAnimSet.HNode(); } sc.Serialize(ref node.unk1); sc.Serialize(ref node.unk2); sc.SerializeFaceFXString(ref node.Name); sc.Serialize(ref node.unk3); }
public static void Serialize(this SerializingContainer2 sc, ref FaceFXLine line) { int int0 = 0; short short0 = 0; short short1 = 1; if (sc.IsLoading) { line = new FaceFXLine(); } if (sc.Game == MEGame.ME2) { sc.Serialize(ref int0); sc.Serialize(ref short1); } sc.Serialize(ref line.NameIndex); if (sc.Game == MEGame.ME2) { int unk6 = 6; sc.Serialize(ref unk6); } //AnimationNames { int count = line.AnimationNames?.Count ?? 0; sc.Serialize(ref count); int int1 = 1; if (sc.IsLoading) { line.AnimationNames = new List <int>(count); } for (int i = 0; i < count; i++) { if (sc.Game == MEGame.ME2) { sc.Serialize(ref int0); sc.Serialize(ref short1); } if (sc.IsLoading) { int tmp = default; sc.Serialize(ref tmp); line.AnimationNames.Add(tmp); } else { int tmp = line.AnimationNames[i]; sc.Serialize(ref tmp); } if (sc.Game == MEGame.ME2) { sc.Serialize(ref int1); sc.Serialize(ref short0); } else { sc.Serialize(ref int0); } } } sc.Serialize(ref line.Points, Serialize); if (line.Points.Any()) { if (sc.Game == MEGame.ME2) { sc.Serialize(ref short0); } sc.Serialize(ref line.NumKeys, SCExt.Serialize); } else if (sc.IsLoading) { line.NumKeys = Enumerable.Repeat(0, line.AnimationNames.Count).ToList(); } sc.Serialize(ref line.FadeInTime); sc.Serialize(ref line.FadeOutTime); sc.Serialize(ref int0); if (sc.Game == MEGame.ME2) { sc.Serialize(ref short0); sc.Serialize(ref short1); } sc.SerializeFaceFXString(ref line.Path); if (sc.Game == MEGame.ME2) { sc.Serialize(ref short1); } sc.SerializeFaceFXString(ref line.ID); sc.Serialize(ref line.Index); }
protected override void Serialize(SerializingContainer2 sc) { var startPos = sc.ms.Position;//come back here to serialize length at the end int length = 0; sc.Serialize(ref length); #region Header int int0 = 0; int int1 = 1; short short1 = 1; uint FACE = 1162035526U; sc.Serialize(ref FACE); int version = sc.Game switch { MEGame.ME1 => 1710, MEGame.ME2 => 1610, _ => 1731 }; sc.Serialize(ref version); if (sc.Game == MEGame.ME3) { sc.Serialize(ref int0); } else if (sc.Game == MEGame.ME2) { sc.Serialize(ref short1); } string licensee = "Unreal Engine 3 Licensee"; string project = "Unreal Engine 3 Project"; if (sc.IsSaving && sc.Game == MEGame.ME3) { licensee += '\0'; project += '\0'; } sc.SerializeFaceFXString(ref licensee); if (sc.Game == MEGame.ME2) { sc.Serialize(ref short1); } sc.SerializeFaceFXString(ref project); int version2 = sc.Game switch { MEGame.ME1 => 1000, _ => 1100 }; sc.Serialize(ref version2); if (sc.Game == MEGame.ME2) { sc.Serialize(ref int0); } else { sc.Serialize(ref short1); } if (sc.Game != MEGame.ME2) { if (sc.IsSaving && HNodes is null) { FixNodeTable(); } sc.Serialize(ref HNodes, SCExt.Serialize); } if (sc.Game == MEGame.ME2) { int count = Names?.Count ?? 0; sc.Serialize(ref count); int unk = 65536; if (sc.IsLoading) { Names = new List <string>(count); for (int i = 0; i < count; i++) { sc.Serialize(ref unk); string tmp = default; sc.SerializeFaceFXString(ref tmp); Names.Add(tmp); } } else { for (int i = 0; i < count; i++) { sc.Serialize(ref unk); string tmp = Names[i]; sc.SerializeFaceFXString(ref tmp); } } } else { sc.Serialize(ref Names, SCExt.SerializeFaceFXString); } sc.Serialize(ref int0); sc.Serialize(ref int0); sc.Serialize(ref int1); sc.Serialize(ref int0); if (sc.Game == MEGame.ME2) { int int65537 = 65537; int int65536 = 65536; sc.Serialize(ref int65537); sc.Serialize(ref int0); sc.Serialize(ref int65536); sc.Serialize(ref int0); sc.Serialize(ref int0); } #endregion sc.Serialize(ref Lines, SCExt.Serialize); length = (int)(sc.ms.Position - startPos - 4); int zero = 0; sc.Serialize(ref zero); sc.ms.JumpTo(startPos); sc.Serialize(ref length); if (sc.IsLoading) { foreach (var line in Lines) { line.NameAsString = Names[line.NameIndex]; } } }