diff --git a/s4pi Wrappers/AnimationResources/ClipEvents.cs b/s4pi Wrappers/AnimationResources/ClipEvents.cs index 703b9f2..402d830 100644 --- a/s4pi Wrappers/AnimationResources/ClipEvents.cs +++ b/s4pi Wrappers/AnimationResources/ClipEvents.cs @@ -52,20 +52,81 @@ public String Value { var sb = new StringBuilder(); sb.AppendLine(); - foreach (var item in this) + for (int i = 0; i < this.Count; i++) { - sb.AppendLine(item.Value); + sb.AppendLine("--- ClipEvent[" + i.ToString("X2") + "] ---" + Environment.NewLine + this[i].Value); } sb.AppendLine(); return sb.ToString(); } } - } + } + + public class ClipEventParent : ClipEvent + { + private byte[] data; + + [ElementPriority(4)] + public byte[] Data + { + get { return data; } + set { if (this.data != value) { this.data = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return (uint)this.data.Length; } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventParent) + { + ClipEventParent f = other as ClipEventParent; + return data.SequenceEqual(f.data); + } + else + { + return false; + } + } + + public ClipEventParent(int apiVersion, EventHandler handler) + : this(apiVersion, handler, ClipEventType.PARENT, 52) + { + } + + public ClipEventParent(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) + : base(apiVersion, handler, typeId) + { + this.data = new byte[size - 12]; + } + + public ClipEventParent(int apiVersion, EventHandler handler, ClipEventParent basis) + : base(apiVersion, handler, basis) + { + this.data = new byte[basis.data.Length]; + Array.Copy(basis.data, this.data, basis.data.Length); + } + + protected override void ReadTypeData(Stream ms) + { + var br = new BinaryReader(ms); + br.Read(this.data, 0, this.data.Length); + } + protected override void WriteTypeData(Stream ms) + { + var bw = new BinaryWriter(ms); + ms.Write(this.data, 0, this.data.Length); + } + } + public class ClipEventSound : ClipEvent { private string sound_name; + [ElementPriority(4)] public string SoundName { get { return sound_name; } @@ -93,13 +154,8 @@ protected override bool isEqual(ClipEvent other) public ClipEventSound(int apiVersion, EventHandler handler) : base(apiVersion, handler, ClipEventType.SOUND) { + this.sound_name = ""; } - - public ClipEventSound(int apiVersion, EventHandler handler, ClipEventType typeId, Stream s) - : base(apiVersion, handler, typeId, s) - { - } - public ClipEventSound(int apiVersion, EventHandler handler, ClipEventSound basis) : base(apiVersion, handler, basis) { @@ -121,17 +177,9 @@ protected override void WriteTypeData(Stream ms) public class ClipEventScript : ClipEvent { - private byte[] data; - - public byte[] Data - { - get { return data; } - set { if (this.data != value) { this.data = value; OnElementChanged(); } } - } - protected override uint typeSize { - get { return (uint)this.data.Length; } + get { return 0; } } protected override bool isEqual(ClipEvent other) @@ -139,7 +187,7 @@ protected override bool isEqual(ClipEvent other) if (other is ClipEventScript) { ClipEventScript f = other as ClipEventScript; - return Enumerable.SequenceEqual(this.data, f.data); + return true; } else { @@ -148,58 +196,55 @@ protected override bool isEqual(ClipEvent other) } public ClipEventScript(int apiVersion, EventHandler handler) - : this(apiVersion, handler, 0, 12) + : base(apiVersion, handler, ClipEventType.SCRIPT) { } - public ClipEventScript(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) - : base(apiVersion, handler, typeId) + public ClipEventScript(int apiVersion, EventHandler handler, ClipEventScript basis) + : base(apiVersion, handler, basis) { - this.data = new byte[size - 4 * 3]; } protected override void ReadTypeData(Stream ms) - { - ms.Read(this.data, 0, this.data.Length); + { } protected override void WriteTypeData(Stream ms) - { - ms.Write(this.data, 0, this.data.Length); + { } } public class ClipEventEffect : ClipEvent { - private string slot_name; + private string object_effect_name; private uint actor_name_hash; private uint slot_name_hash; - private byte[] unknown; + private byte[] data; private string effect_name; - [ElementPriority(0)] - public string SlotName + [ElementPriority(4)] + public string ObjectEffectName { - get { return slot_name; } - set { if (this.slot_name != value) { this.slot_name = value; OnElementChanged(); } } + get { return object_effect_name; } + set { if (this.object_effect_name != value) { this.object_effect_name = value; OnElementChanged(); } } } - [ElementPriority(1)] + [ElementPriority(5)] public uint ActorNameHash { get { return actor_name_hash; } set { if (this.actor_name_hash != value) { this.actor_name_hash = value; OnElementChanged(); } } } - [ElementPriority(2)] + [ElementPriority(6)] public uint SlotNameHash { get { return slot_name_hash; } set { if (this.slot_name_hash != value) { this.slot_name_hash = value; OnElementChanged(); } } } - [ElementPriority(3)] - public byte[] UnknownBytes + [ElementPriority(7)] + public byte[] Data { - get { return unknown; } - set { if (this.unknown != value) { this.unknown = value; OnElementChanged(); } } + get { return data; } + set { if (this.data != value) { this.data = value; OnElementChanged(); } } } - [ElementPriority(4)] + [ElementPriority(8)] public string EffectName { get { return effect_name; } @@ -208,7 +253,7 @@ public string EffectName protected override uint typeSize { - get { return (2 * IOExt.FixedStringLength) + 24; } + get { return (uint)((2 * IOExt.FixedStringLength) + 8 + data.Length); } } protected override bool isEqual(ClipEvent other) @@ -216,9 +261,9 @@ protected override bool isEqual(ClipEvent other) if (other is ClipEventEffect) { ClipEventEffect f = other as ClipEventEffect; - return (String.Compare(this.slot_name, f.slot_name) == 0 && String.Compare(this.effect_name, f.effect_name) == 0 && + return (String.Compare(this.object_effect_name, f.object_effect_name) == 0 && String.Compare(this.effect_name, f.effect_name) == 0 && this.actor_name_hash == f.actor_name_hash && this.slot_name_hash == f.slot_name_hash && - Enumerable.SequenceEqual(this.unknown, f.unknown)); + Enumerable.SequenceEqual(this.data, f.data)); } else { @@ -227,51 +272,52 @@ protected override bool isEqual(ClipEvent other) } public ClipEventEffect(int apiVersion, EventHandler handler) - : base(apiVersion, handler, ClipEventType.EFFECT) + : this(apiVersion, handler, ClipEventType.EFFECT, (uint)((2 * IOExt.FixedStringLength) + 24 + 12)) { } - - public ClipEventEffect(int apiVersion, EventHandler handler, ClipEventType typeId, Stream s) - : base(apiVersion, handler, typeId, s) + public ClipEventEffect(int apiVersion, EventHandler handler, ClipEventType typeID, uint size) + : base(apiVersion, handler, typeID) { + this.data = new byte[size - (2 * IOExt.FixedStringLength) - 12 - 8]; + this.effect_name = ""; + this.object_effect_name = ""; } - public ClipEventEffect(int apiVersion, EventHandler handler, ClipEventEffect basis) : base(apiVersion, handler, basis) { - this.unknown = basis.unknown; + this.data = basis.data; this.slot_name_hash = basis.slot_name_hash; this.actor_name_hash = basis.actor_name_hash; this.effect_name = basis.effect_name; - this.slot_name = basis.slot_name; + this.object_effect_name = basis.object_effect_name; } protected override void ReadTypeData(Stream ms) { var br = new BinaryReader(ms); - this.slot_name = br.ReadStringFixed(); + this.object_effect_name = br.ReadStringFixed(); this.actor_name_hash = br.ReadUInt32(); this.slot_name_hash = br.ReadUInt32(); - this.unknown = br.ReadBytes(16); + this.data = br.ReadBytes(this.data.Length); this.effect_name = br.ReadStringFixed(); - } protected override void WriteTypeData(Stream ms) { var bw = new BinaryWriter(ms); - bw.WriteStringFixed(this.slot_name); + bw.WriteStringFixed(this.object_effect_name); bw.Write(this.actor_name_hash); bw.Write(this.slot_name_hash); - bw.Write(this.unknown); + bw.Write(this.data); bw.WriteStringFixed(this.effect_name); } } - public class ClipEventSNAP : ClipEvent + public class ClipEventVisibility : ClipEvent { private byte[] data; + [ElementPriority(4)] public byte[] Data { get { return data; } @@ -285,9 +331,9 @@ protected override uint typeSize protected override bool isEqual(ClipEvent other) { - if (other is ClipEventSNAP) + if (other is ClipEventVisibility) { - ClipEventSNAP f = other as ClipEventSNAP; + ClipEventVisibility f = other as ClipEventVisibility; return Enumerable.SequenceEqual(this.data, f.data); } else @@ -296,14 +342,20 @@ protected override bool isEqual(ClipEvent other) } } - public ClipEventSNAP(int apiVersion, EventHandler handler) - : this(apiVersion, handler, 0, 12) + public ClipEventVisibility(int apiVersion, EventHandler handler) + : this(apiVersion, handler, ClipEventType.VISIBILITY, 12 + 5) { } - public ClipEventSNAP(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) + public ClipEventVisibility(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) : base(apiVersion, handler, typeId) { - this.data = new byte[size - 4 * 3]; + this.data = new byte[size - 12]; + } + public ClipEventVisibility(int apiVersion, EventHandler handler, ClipEventVisibility basis) + : base(apiVersion, handler, basis) + { + this.data = new byte[basis.data.Length]; + Array.Copy(basis.data, this.data, basis.data.Length); } protected override void ReadTypeData(Stream ms) @@ -316,43 +368,35 @@ protected override void WriteTypeData(Stream ms) } } - public class ClipEventDoubleModifierSound : ClipEvent + public class ClipEventStopEffect : ClipEvent { - private string unknown_3; - private uint actor_name; - private uint slot_name; + private uint effectNameHash; + private byte[] data; - [ElementPriority(0)] - public string Unknown3 - { - get { return unknown_3; } - set { if (this.unknown_3 != value) { this.unknown_3 = value; OnElementChanged(); } } - } - [ElementPriority(1)] - public uint ActorNameHash + [ElementPriority(4)] + public uint EffectNameHash { - get { return actor_name; } - set { if (this.actor_name != value) { this.actor_name = value; OnElementChanged(); } } + get { return effectNameHash; } + set { if (this.effectNameHash != value) { this.effectNameHash = value; OnElementChanged(); } } } - [ElementPriority(2)] - public uint SlotNameHash + [ElementPriority(5)] + public byte[] Data { - get { return slot_name; } - set { if (this.slot_name != value) { this.slot_name = value; OnElementChanged(); } } + get { return data; } + set { if (this.data != value) { this.data = value; OnElementChanged(); } } } protected override uint typeSize { - get { return IOExt.FixedStringLength + 8; } + get { return (uint)this.data.Length + 4; } } protected override bool isEqual(ClipEvent other) { - if (other is ClipEventDoubleModifierSound) + if (other is ClipEventStopEffect) { - ClipEventDoubleModifierSound f = other as ClipEventDoubleModifierSound; - return (String.Compare(this.unknown_3, f.unknown_3) == 0 && - this.actor_name == f.actor_name && this.slot_name == f.slot_name); + ClipEventStopEffect f = other as ClipEventStopEffect; + return (this.effectNameHash == f.effectNameHash) & Enumerable.SequenceEqual(this.data, f.data); } else { @@ -360,49 +404,46 @@ protected override bool isEqual(ClipEvent other) } } - public ClipEventDoubleModifierSound(int apiVersion, EventHandler handler) - : base(apiVersion, handler, (ClipEventType)14) + public ClipEventStopEffect(int apiVersion, EventHandler handler) + : this(apiVersion, handler, ClipEventType.STOP_EFFECT, 12 + 4 + 5) { } - - public ClipEventDoubleModifierSound(int apiVersion, EventHandler handler, ClipEventType typeId, Stream s) - : base(apiVersion, handler, typeId, s) + public ClipEventStopEffect(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) + : base(apiVersion, handler, typeId) { + this.data = new byte[size - 12 - 4]; } - - public ClipEventDoubleModifierSound(int apiVersion, EventHandler handler, ClipEventDoubleModifierSound basis) + public ClipEventStopEffect(int apiVersion, EventHandler handler, ClipEventStopEffect basis) : base(apiVersion, handler, basis) { - this.slot_name = basis.slot_name; - this.actor_name = basis.actor_name; - this.unknown_3 = basis.unknown_3; + this.effectNameHash = basis.effectNameHash; + this.data = new byte[basis.data.Length]; + Array.Copy(basis.data, this.data, basis.data.Length); } protected override void ReadTypeData(Stream ms) { var br = new BinaryReader(ms); - this.unknown_3 = br.ReadStringFixed(); - this.actor_name = br.ReadUInt32(); - this.slot_name = br.ReadUInt32(); + this.effectNameHash = br.ReadUInt32(); + ms.Read(this.data, 0, this.data.Length); } - protected override void WriteTypeData(Stream ms) { var bw = new BinaryWriter(ms); - bw.WriteStringFixed(this.unknown_3); - bw.Write(this.actor_name); - bw.Write(this.slot_name); + bw.Write(this.effectNameHash); + ms.Write(this.data, 0, this.data.Length); } } - public class ClipEventCensor : ClipEvent + public class ClipEventBlockTransition : ClipEvent { - private float unknown_3; + private float unknown3; + [ElementPriority(4)] public float Unknown3 { - get { return unknown_3; } - set { if (this.unknown_3 != value) { this.unknown_3 = value; OnElementChanged(); } } + get { return unknown3; } + set { if (this.unknown3 != value) { this.unknown3 = value; OnElementChanged(); } } } protected override uint typeSize @@ -412,10 +453,10 @@ protected override uint typeSize protected override bool isEqual(ClipEvent other) { - if (other is ClipEventCensor) + if (other is ClipEventBlockTransition) { - ClipEventCensor f = other as ClipEventCensor; - return this.unknown_3 == f.unknown_3; + ClipEventBlockTransition f = other as ClipEventBlockTransition; + return this.unknown3 == f.unknown3; } else { @@ -423,40 +464,34 @@ protected override bool isEqual(ClipEvent other) } } - public ClipEventCensor(int apiVersion, EventHandler handler) - : base(apiVersion, handler, (ClipEventType)19) - { - } - - public ClipEventCensor(int apiVersion, EventHandler handler, ClipEventType typeId, Stream s) - : base(apiVersion, handler, typeId, s) + public ClipEventBlockTransition(int apiVersion, EventHandler handler) + : base(apiVersion, handler, ClipEventType.BLOCK_TRANSITION) { } - - public ClipEventCensor(int apiVersion, EventHandler handler, ClipEventCensor basis) + public ClipEventBlockTransition(int apiVersion, EventHandler handler, ClipEventBlockTransition basis) : base(apiVersion, handler, basis) { - this.unknown_3 = basis.unknown_3; + this.unknown3 = basis.unknown3; } protected override void ReadTypeData(Stream ms) { var br = new BinaryReader(ms); - this.unknown_3 = br.ReadSingle(); + this.unknown3 = br.ReadSingle(); } protected override void WriteTypeData(Stream ms) { - var bw = new BinaryWriter(ms); - bw.Write(this.unknown_3); + bw.Write(this.unknown3); } } - public class ClipEventUnknown : ClipEvent + public class ClipEventSNAP : ClipEvent { private byte[] data; + [ElementPriority(4)] public byte[] Data { get { return data; } @@ -470,9 +505,9 @@ protected override uint typeSize protected override bool isEqual(ClipEvent other) { - if (other is ClipEventUnknown) + if (other is ClipEventSNAP) { - ClipEventUnknown f = other as ClipEventUnknown; + ClipEventSNAP f = other as ClipEventSNAP; return Enumerable.SequenceEqual(this.data, f.data); } else @@ -481,14 +516,20 @@ protected override bool isEqual(ClipEvent other) } } - public ClipEventUnknown(int apiVersion, EventHandler handler) - : this(apiVersion, handler, 0, 12) + public ClipEventSNAP(int apiVersion, EventHandler handler) + : this(apiVersion, handler, ClipEventType.SNAP, 12 + 32) { } - public ClipEventUnknown(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) + public ClipEventSNAP(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) : base(apiVersion, handler, typeId) { - this.data = new byte[size - 4 * 3]; + this.data = new byte[size - 12]; + } + public ClipEventSNAP(int apiVersion, EventHandler handler, ClipEventSNAP basis) + : base(apiVersion, handler, basis) + { + this.data = new byte[basis.data.Length]; + Array.Copy(basis.data, this.data, basis.data.Length); } protected override void ReadTypeData(Stream ms) @@ -501,60 +542,997 @@ protected override void WriteTypeData(Stream ms) } } - public abstract class ClipEvent : AHandlerElement, IEquatable + public class ClipEventReaction : ClipEvent { - protected ClipEvent(int apiVersion, EventHandler handler, ClipEventType typeId) - : this(apiVersion, handler, typeId, 0, 0, 0) + private string unknown3; + private string unknown4; + + [ElementPriority(4)] + public string Unknown3 { + get { return unknown3; } + set { if (this.unknown3 != value) { this.unknown3 = value; OnElementChanged(); } } } - - protected ClipEvent(int apiVersion, EventHandler handler, ClipEventType typeId, Stream s) - : this(apiVersion, handler, typeId) + [ElementPriority(5)] + public string Unknown4 { - Parse(s); + get { return unknown4; } + set { if (this.unknown4 != value) { this.unknown4 = value; OnElementChanged(); } } } - protected ClipEvent(int apiVersion, EventHandler handler, ClipEvent basis) - : this(apiVersion, handler, basis.typeId, basis.unknown1, basis.unknown2, basis.timecode) + protected override uint typeSize { + get { return 2 * IOExt.FixedStringLength; } } - protected ClipEvent(int APIversion, EventHandler handler, ClipEventType type, uint unknown1, uint unknown2, float timecode) - : base(APIversion, handler) + protected override bool isEqual(ClipEvent other) { - this.typeId = type; - this.unknown1 = unknown1; - this.unknown2 = unknown2; - this.timecode = timecode; + if (other is ClipEventReaction) + { + ClipEventReaction f = other as ClipEventReaction; + return (String.Compare(this.unknown3, f.unknown3) == 0 && + String.Compare(this.unknown4, f.unknown4) == 0); + } + else + { + return false; + } } - protected ClipEventType typeId; - private uint unknown1; - private uint unknown2; - private float timecode; + public ClipEventReaction(int apiVersion, EventHandler handler) + : base(apiVersion, handler, ClipEventType.REACTION) + { + this.unknown3 = ""; + this.unknown4 = ""; + } + public ClipEventReaction(int apiVersion, EventHandler handler, ClipEventReaction basis) + : base(apiVersion, handler, basis) + { + this.unknown3 = basis.unknown3; + this.unknown4 = basis.unknown4; + } - public string Value + protected override void ReadTypeData(Stream ms) { - get { return ValueBuilder; } + var br = new BinaryReader(ms); + this.unknown3 = br.ReadStringFixed(); + this.unknown4 = br.ReadStringFixed(); } - public ClipEventType TypeId + + protected override void WriteTypeData(Stream ms) { - get { return typeId; } + var bw = new BinaryWriter(ms); + bw.WriteStringFixed(this.unknown3); + bw.WriteStringFixed(this.unknown4); } + } - [ElementPriority(0)] - public uint Unknown1 + public class ClipEventDoubleModifierSound : ClipEvent + { + private string unknown_3; + private uint actor_name; + private uint slot_name; + + [ElementPriority(4)] + public string Unknown3 { - get { return unknown1; } - set { if (this.unknown1 != value) { this.unknown1 = value; OnElementChanged(); } } + get { return unknown_3; } + set { if (this.unknown_3 != value) { this.unknown_3 = value; OnElementChanged(); } } } - [ElementPriority(1)] - public uint Unknown2 + [ElementPriority(5)] + public uint ActorNameHash { - get { return unknown2; } - set { if (this.unknown2 != value) { this.unknown2 = value; OnElementChanged(); } } + get { return actor_name; } + set { if (this.actor_name != value) { this.actor_name = value; OnElementChanged(); } } } - [ElementPriority(2)] + [ElementPriority(6)] + public uint SlotNameHash + { + get { return slot_name; } + set { if (this.slot_name != value) { this.slot_name = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return IOExt.FixedStringLength + 8; } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventDoubleModifierSound) + { + ClipEventDoubleModifierSound f = other as ClipEventDoubleModifierSound; + return (String.Compare(this.unknown_3, f.unknown_3) == 0 && + this.actor_name == f.actor_name && this.slot_name == f.slot_name); + } + else + { + return false; + } + } + + public ClipEventDoubleModifierSound(int apiVersion, EventHandler handler) + : base(apiVersion, handler, ClipEventType.DOUBLE_MODIFIER_SOUND) + { + this.unknown_3 = ""; + } + public ClipEventDoubleModifierSound(int apiVersion, EventHandler handler, ClipEventDoubleModifierSound basis) + : base(apiVersion, handler, basis) + { + this.slot_name = basis.slot_name; + this.actor_name = basis.actor_name; + this.unknown_3 = basis.unknown_3; + } + + protected override void ReadTypeData(Stream ms) + { + var br = new BinaryReader(ms); + this.unknown_3 = br.ReadStringFixed(); + this.actor_name = br.ReadUInt32(); + this.slot_name = br.ReadUInt32(); + } + + protected override void WriteTypeData(Stream ms) + { + var bw = new BinaryWriter(ms); + bw.WriteStringFixed(this.unknown_3); + bw.Write(this.actor_name); + bw.Write(this.slot_name); + } + } + + public class ClipEventDspInterval : ClipEvent + { + private float unknown3; + private string unknown4; + + [ElementPriority(4)] + public float Unknown3 + { + get { return unknown3; } + set { if (this.unknown3 != value) { this.unknown3 = value; OnElementChanged(); } } + } + [ElementPriority(5)] + public string Unknown4 + { + get { return unknown4; } + set { if (this.unknown4 != value) { this.unknown4 = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return IOExt.FixedStringLength + 4; } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventDspInterval) + { + ClipEventDspInterval f = other as ClipEventDspInterval; + return (String.Compare(this.unknown4, f.unknown4) == 0 && + this.unknown3 == f.unknown3); + } + else + { + return false; + } + } + + public ClipEventDspInterval(int apiVersion, EventHandler handler) + : base(apiVersion, handler, ClipEventType.DSP_INTERVAL) + { + this.unknown4 = ""; + } + public ClipEventDspInterval(int apiVersion, EventHandler handler, ClipEventDspInterval basis) + : base(apiVersion, handler, basis) + { + this.unknown3 = basis.unknown3; + this.unknown4 = basis.unknown4; + } + + protected override void ReadTypeData(Stream ms) + { + var br = new BinaryReader(ms); + this.unknown3 = br.ReadSingle(); + this.unknown4 = br.ReadStringFixed(); + } + + protected override void WriteTypeData(Stream ms) + { + var bw = new BinaryWriter(ms); + bw.Write(this.unknown3); + bw.WriteStringFixed(this.unknown4); + } + } + + public class ClipEventMaterialState : ClipEvent + { + private byte[] data; + string unknown3; + + [ElementPriority(4)] + public byte[] Data + { + get { return data; } + set { if (this.data != value) { this.data = value; OnElementChanged(); } } + } + [ElementPriority(5)] + public string Unknown3 + { + get { return unknown3; } + set { if (this.unknown3 != value) { this.unknown3 = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return (uint)(IOExt.FixedStringLength + this.data.Length); } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventMaterialState) + { + ClipEventMaterialState f = other as ClipEventMaterialState; + return Enumerable.SequenceEqual(this.data, f.data) & (String.Compare(this.unknown3, f.unknown3) == 0); + } + else + { + return false; + } + } + + public ClipEventMaterialState(int apiVersion, EventHandler handler) + : this(apiVersion, handler, ClipEventType.MATERIAL_STATE, 12 + IOExt.FixedStringLength + 4) + { + } + public ClipEventMaterialState(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) + : base(apiVersion, handler, typeId) + { + this.data = new byte[size - IOExt.FixedStringLength - 12]; + this.unknown3 = ""; + } + public ClipEventMaterialState(int apiVersion, EventHandler handler, ClipEventMaterialState basis) + : base(apiVersion, handler, basis) + { + this.data = new byte[basis.data.Length]; + Array.Copy(basis.data, this.data, basis.data.Length); + this.unknown3 = basis.unknown3; + } + + protected override void ReadTypeData(Stream ms) + { + ms.Read(this.data, 0, this.data.Length); + var br = new BinaryReader(ms); + this.unknown3 = br.ReadStringFixed(); + } + protected override void WriteTypeData(Stream ms) + { + ms.Write(this.data, 0, this.data.Length); + var bw = new BinaryWriter(ms); + bw.WriteStringFixed(this.unknown3); + } + } + + public class ClipEventFocusCompatibility : ClipEvent + { + private byte[] data; + string unknown3; + + [ElementPriority(4)] + public byte[] Data + { + get { return data; } + set { if (this.data != value) { this.data = value; OnElementChanged(); } } + } + [ElementPriority(5)] + public string Unknown3 + { + get { return unknown3; } + set { if (this.unknown3 != value) { this.unknown3 = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return (uint)(IOExt.FixedStringLength + this.data.Length); } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventFocusCompatibility) + { + ClipEventFocusCompatibility f = other as ClipEventFocusCompatibility; + return Enumerable.SequenceEqual(this.data, f.data) & (String.Compare(this.unknown3, f.unknown3) == 0); + } + else + { + return false; + } + } + + public ClipEventFocusCompatibility(int apiVersion, EventHandler handler) + : this(apiVersion, handler, ClipEventType.FOCUS_COMPATIBILITY, 12 + IOExt.FixedStringLength + 4) + { + } + public ClipEventFocusCompatibility(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) + : base(apiVersion, handler, typeId) + { + this.data = new byte[size - IOExt.FixedStringLength - 12]; + this.unknown3 = ""; + } + public ClipEventFocusCompatibility(int apiVersion, EventHandler handler, ClipEventFocusCompatibility basis) + : base(apiVersion, handler, basis) + { + this.data = new byte[basis.data.Length]; + Array.Copy(basis.data, this.data, basis.data.Length); + this.unknown3 = basis.unknown3; + } + + protected override void ReadTypeData(Stream ms) + { + ms.Read(this.data, 0, this.data.Length); + var br = new BinaryReader(ms); + this.unknown3 = br.ReadStringFixed(); + } + protected override void WriteTypeData(Stream ms) + { + ms.Write(this.data, 0, this.data.Length); + var bw = new BinaryWriter(ms); + bw.WriteStringFixed(this.unknown3); + } + } + + public class ClipEventSuppressLipSync : ClipEvent + { + private float unknown_3; + private byte unknown_4; + + [ElementPriority(4)] + public float Unknown3 + { + get { return unknown_3; } + set { if (this.unknown_3 != value) { this.unknown_3 = value; OnElementChanged(); } } + } + [ElementPriority(5)] + public byte Unknown4 + { + get { return unknown_4; } + set { if (this.unknown_4 != value) { this.unknown_4 = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return 5; } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventSuppressLipSync) + { + ClipEventSuppressLipSync f = other as ClipEventSuppressLipSync; + return this.unknown_3 == f.unknown_3 & this.unknown_4 == f.unknown_4; + } + else + { + return false; + } + } + + public ClipEventSuppressLipSync(int apiVersion, EventHandler handler) + : base(apiVersion, handler, ClipEventType.SUPPRESS_LIP_SYNC) + { + } + public ClipEventSuppressLipSync(int apiVersion, EventHandler handler, ClipEventSuppressLipSync basis) + : base(apiVersion, handler, basis) + { + this.unknown_3 = basis.unknown_3; + this.unknown_4 = basis.unknown_4; + } + + protected override void ReadTypeData(Stream ms) + { + var br = new BinaryReader(ms); + this.unknown_3 = br.ReadSingle(); + this.unknown_4 = br.ReadByte(); + } + + protected override void WriteTypeData(Stream ms) + { + + var bw = new BinaryWriter(ms); + bw.Write(this.unknown_3); + bw.Write(this.unknown_4); + } + } + + public class ClipEventCensor : ClipEvent + { + private float unknown_3; + + [ElementPriority(4)] + public float Unknown3 + { + get { return unknown_3; } + set { if (this.unknown_3 != value) { this.unknown_3 = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return 4; } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventCensor) + { + ClipEventCensor f = other as ClipEventCensor; + return this.unknown_3 == f.unknown_3; + } + else + { + return false; + } + } + + public ClipEventCensor(int apiVersion, EventHandler handler) + : base(apiVersion, handler, ClipEventType.CENSOR) + { + } + public ClipEventCensor(int apiVersion, EventHandler handler, ClipEventCensor basis) + : base(apiVersion, handler, basis) + { + this.unknown_3 = basis.unknown_3; + } + + protected override void ReadTypeData(Stream ms) + { + var br = new BinaryReader(ms); + this.unknown_3 = br.ReadSingle(); + } + + protected override void WriteTypeData(Stream ms) + { + + var bw = new BinaryWriter(ms); + bw.Write(this.unknown_3); + } + } + + public class ClipEventSimulationSoundStart : ClipEvent + { + private byte[] data; + + [ElementPriority(4)] + public byte[] Data + { + get { return data; } + set { if (this.data != value) { this.data = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return (uint)this.data.Length; } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventSimulationSoundStart) + { + ClipEventSimulationSoundStart f = other as ClipEventSimulationSoundStart; + return Enumerable.SequenceEqual(this.data, f.data); + } + else + { + return false; + } + } + + public ClipEventSimulationSoundStart(int apiVersion, EventHandler handler) + : this(apiVersion, handler, ClipEventType.SIMULATION_SOUND_START, 12 + 1) + { + } + public ClipEventSimulationSoundStart(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) + : base(apiVersion, handler, typeId) + { + this.data = new byte[size - 12]; + } + public ClipEventSimulationSoundStart(int apiVersion, EventHandler handler, ClipEventSimulationSoundStart basis) + : base(apiVersion, handler, basis) + { + this.data = new byte[basis.data.Length]; + Array.Copy(basis.data, this.data, basis.data.Length); + } + + protected override void ReadTypeData(Stream ms) + { + ms.Read(this.data, 0, this.data.Length); + } + protected override void WriteTypeData(Stream ms) + { + ms.Write(this.data, 0, this.data.Length); + } + } + + public class ClipEventSimulationSoundStop : ClipEvent + { + private byte[] data; + string unknown3; + + [ElementPriority(4)] + public byte[] Data + { + get { return data; } + set { if (this.data != value) { this.data = value; OnElementChanged(); } } + } + [ElementPriority(5)] + public string Unknown3 + { + get { return unknown3; } + set { if (this.unknown3 != value) { this.unknown3 = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return (uint)(IOExt.FixedStringLength + this.data.Length); } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventSimulationSoundStop) + { + ClipEventSimulationSoundStop f = other as ClipEventSimulationSoundStop; + return Enumerable.SequenceEqual(this.data, f.data) & (String.Compare(this.unknown3, f.unknown3) == 0); + } + else + { + return false; + } + } + + public ClipEventSimulationSoundStop(int apiVersion, EventHandler handler) + : this(apiVersion, handler, ClipEventType.SIMULATION_SOUND_STOP, 12 + IOExt.FixedStringLength + 4) + { + } + public ClipEventSimulationSoundStop(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) + : base(apiVersion, handler, typeId) + { + this.data = new byte[size - IOExt.FixedStringLength - 12]; + this.unknown3 = ""; + } + public ClipEventSimulationSoundStop(int apiVersion, EventHandler handler, ClipEventSimulationSoundStop basis) + : base(apiVersion, handler, basis) + { + this.data = new byte[basis.data.Length]; + Array.Copy(basis.data, this.data, basis.data.Length); + this.unknown3 = basis.unknown3; + } + + protected override void ReadTypeData(Stream ms) + { + ms.Read(this.data, 0, this.data.Length); + var br = new BinaryReader(ms); + this.unknown3 = br.ReadStringFixed(); + } + protected override void WriteTypeData(Stream ms) + { + ms.Write(this.data, 0, this.data.Length); + var bw = new BinaryWriter(ms); + bw.WriteStringFixed(this.unknown3); + } + } + + public class ClipEventEnableFacialOverlay : ClipEvent + { + private byte[] data; + string unknown3; + + [ElementPriority(4)] + public byte[] Data + { + get { return data; } + set { if (this.data != value) { this.data = value; OnElementChanged(); } } + } + [ElementPriority(5)] + public string Unknown3 + { + get { return unknown3; } + set { if (this.unknown3 != value) { this.unknown3 = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return (uint)(IOExt.FixedStringLength + this.data.Length); } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventEnableFacialOverlay) + { + ClipEventEnableFacialOverlay f = other as ClipEventEnableFacialOverlay; + return Enumerable.SequenceEqual(this.data, f.data) & (String.Compare(this.unknown3, f.unknown3) == 0); + } + else + { + return false; + } + } + + public ClipEventEnableFacialOverlay(int apiVersion, EventHandler handler) + : this(apiVersion, handler, ClipEventType.ENABLE_FACIAL_OVERLAY, 12 + IOExt.FixedStringLength + 4) + { + } + public ClipEventEnableFacialOverlay(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) + : base(apiVersion, handler, typeId) + { + this.data = new byte[size - IOExt.FixedStringLength - 12]; + this.unknown3 = ""; + } + public ClipEventEnableFacialOverlay(int apiVersion, EventHandler handler, ClipEventEnableFacialOverlay basis) + : base(apiVersion, handler, basis) + { + this.data = new byte[basis.data.Length]; + Array.Copy(basis.data, this.data, basis.data.Length); + this.unknown3 = basis.unknown3; + } + + protected override void ReadTypeData(Stream ms) + { + ms.Read(this.data, 0, this.data.Length); + var br = new BinaryReader(ms); + this.unknown3 = br.ReadStringFixed(); + } + protected override void WriteTypeData(Stream ms) + { + ms.Write(this.data, 0, this.data.Length); + var bw = new BinaryWriter(ms); + bw.WriteStringFixed(this.unknown3); + } + } + + public class ClipEventFadeObject : ClipEvent + { + private float unknown_3; + + [ElementPriority(4)] + public float Unknown3 + { + get { return unknown_3; } + set { if (this.unknown_3 != value) { this.unknown_3 = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return 4; } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventFadeObject) + { + ClipEventFadeObject f = other as ClipEventFadeObject; + return this.unknown_3 == f.unknown_3; + } + else + { + return false; + } + } + + public ClipEventFadeObject(int apiVersion, EventHandler handler) + : base(apiVersion, handler, ClipEventType.FADE_OBJECT) + { + } + public ClipEventFadeObject(int apiVersion, EventHandler handler, ClipEventFadeObject basis) + : base(apiVersion, handler, basis) + { + this.unknown_3 = basis.unknown_3; + } + + protected override void ReadTypeData(Stream ms) + { + var br = new BinaryReader(ms); + this.unknown_3 = br.ReadSingle(); + } + + protected override void WriteTypeData(Stream ms) + { + + var bw = new BinaryWriter(ms); + bw.Write(this.unknown_3); + } + } + + public class ClipEventThighTargetOffset : ClipEvent + { + private float unknown_3; + + [ElementPriority(4)] + public float Unknown3 + { + get { return unknown_3; } + set { if (this.unknown_3 != value) { this.unknown_3 = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return 4; } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventThighTargetOffset) + { + ClipEventThighTargetOffset f = other as ClipEventThighTargetOffset; + return this.unknown_3 == f.unknown_3; + } + else + { + return false; + } + } + + public ClipEventThighTargetOffset(int apiVersion, EventHandler handler) + : base(apiVersion, handler, ClipEventType.THIGH_TARGET_OFFSET) + { + } + public ClipEventThighTargetOffset(int apiVersion, EventHandler handler, ClipEventThighTargetOffset basis) + : base(apiVersion, handler, basis) + { + this.unknown_3 = basis.unknown_3; + } + + protected override void ReadTypeData(Stream ms) + { + var br = new BinaryReader(ms); + this.unknown_3 = br.ReadSingle(); + } + + protected override void WriteTypeData(Stream ms) + { + + var bw = new BinaryWriter(ms); + bw.Write(this.unknown_3); + } + } + + public class ClipEventUnknown28 : ClipEvent + { + string unknown3; + private byte[] data; + + [ElementPriority(4)] + public string Unknown3 + { + get { return unknown3; } + set { if (this.unknown3 != value) { this.unknown3 = value; OnElementChanged(); } } + } + [ElementPriority(5)] + public byte[] Data + { + get { return data; } + set { if (this.data != value) { this.data = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return (uint)(IOExt.FixedStringLength + this.data.Length); } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventUnknown28) + { + ClipEventUnknown28 f = other as ClipEventUnknown28; + return Enumerable.SequenceEqual(this.data, f.data) & (String.Compare(this.unknown3, f.unknown3) == 0); + } + else + { + return false; + } + } + + public ClipEventUnknown28(int apiVersion, EventHandler handler) + : this(apiVersion, handler, ClipEventType.UNKNOWN28, 12 + IOExt.FixedStringLength + 8) + { + } + public ClipEventUnknown28(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) + : base(apiVersion, handler, typeId) + { + this.unknown3 = ""; + this.data = new byte[size - IOExt.FixedStringLength - 12]; + } + public ClipEventUnknown28(int apiVersion, EventHandler handler, ClipEventUnknown28 basis) + : base(apiVersion, handler, basis) + { + this.data = new byte[basis.data.Length]; + Array.Copy(basis.data, this.data, basis.data.Length); + this.unknown3 = basis.unknown3; + } + + protected override void ReadTypeData(Stream ms) + { + var br = new BinaryReader(ms); + this.unknown3 = br.ReadStringFixed(); + ms.Read(this.data, 0, this.data.Length); + } + protected override void WriteTypeData(Stream ms) + { + var bw = new BinaryWriter(ms); + bw.WriteStringFixed(this.unknown3); + ms.Write(this.data, 0, this.data.Length); + } + } + + public class ClipEventUnknown30 : ClipEvent + { + float[] unknown3; + uint[] unknown4; + + [ElementPriority(4)] + public float[] Unknown3 + { + get { return unknown3; } + set { if (this.unknown3 != value) { this.unknown3 = value; OnElementChanged(); } } + } + [ElementPriority(5)] + public uint[] Unknown4 + { + get { return unknown4; } + set { if (this.unknown4 != value) { this.unknown4 = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return 32; } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventUnknown30) + { + ClipEventUnknown30 f = other as ClipEventUnknown30; + return Enumerable.SequenceEqual(this.unknown3, f.unknown3) & Enumerable.SequenceEqual(this.unknown4, f.unknown4); + } + else + { + return false; + } + } + + public ClipEventUnknown30(int apiVersion, EventHandler handler) + : base(apiVersion, handler, ClipEventType.UNKNOWN30) + { + this.unknown3 = new float[4]; + this.unknown4 = new uint[4]; + } + public ClipEventUnknown30(int apiVersion, EventHandler handler, ClipEventUnknown30 basis) + : base(apiVersion, handler, basis) + { + this.unknown3 = new float[basis.unknown3.Length]; + Array.Copy(basis.unknown3, this.unknown3, basis.unknown3.Length); + this.unknown4 = new uint[basis.unknown4.Length]; + Array.Copy(basis.unknown4, this.unknown4, basis.unknown4.Length); + } + + protected override void ReadTypeData(Stream ms) + { + var br = new BinaryReader(ms); + for (int i = 0; i < 4; i++) this.unknown3[i] = br.ReadSingle(); + for (int i = 0; i < 4; i++) this.unknown4[i] = br.ReadUInt32(); + } + protected override void WriteTypeData(Stream ms) + { + var bw = new BinaryWriter(ms); + for (int i = 0; i < 4; i++) bw.Write(this.unknown3[i]); + for (int i = 0; i < 4; i++) bw.Write(this.unknown4[i]); + } + } + + public class ClipEventUnknown : ClipEvent + { + private List data; + + [ElementPriority(4)] + public List Data + { + get { return data; } + set { if (this.data != value) { this.data = value; OnElementChanged(); } } + } + + protected override uint typeSize + { + get { return (uint)this.data.Count; } + } + + protected override bool isEqual(ClipEvent other) + { + if (other is ClipEventUnknown) + { + ClipEventUnknown f = other as ClipEventUnknown; + return Enumerable.SequenceEqual(this.data, f.data); + } + else + { + return false; + } + } + + public ClipEventUnknown(int apiVersion, EventHandler handler) + : this(apiVersion, handler, 0, 12) + { + } + public ClipEventUnknown(int apiVersion, EventHandler handler, ClipEventType typeId, uint size) + : base(apiVersion, handler, typeId) + { + this.data = new List((int)size - 12); + } + + protected override void ReadTypeData(Stream ms) + { + BinaryReader br = new BinaryReader(ms); + for (int i = 0; i < this.data.Count; i++) this.data[i] = br.ReadByte(); + } + protected override void WriteTypeData(Stream ms) + { + BinaryWriter bw = new BinaryWriter(ms); + for (int i = 0; i < this.data.Count; i++) bw.Write(this.data[i]); + } + } + + public abstract class ClipEvent : AHandlerElement, IEquatable + { + protected ClipEvent(int apiVersion, EventHandler handler, ClipEventType typeId) + : this(apiVersion, handler, typeId, 0, 0, 0) + { + } + + protected ClipEvent(int apiVersion, EventHandler handler, ClipEventType typeId, Stream s) + : this(apiVersion, handler, typeId) + { + Parse(s); + } + + protected ClipEvent(int apiVersion, EventHandler handler, ClipEvent basis) + : this(apiVersion, handler, basis.typeId, basis.unknown1, basis.unknown2, basis.timecode) + { + } + + protected ClipEvent(int APIversion, EventHandler handler, ClipEventType type, uint unknown1, uint unknown2, float timecode) + : base(APIversion, handler) + { + this.typeId = type; + this.unknown1 = unknown1; + this.unknown2 = unknown2; + this.timecode = timecode; + } + + protected ClipEventType typeId; + private uint unknown1; + private uint unknown2; + private float timecode; + + public string Value + { + get { return ValueBuilder; } + } + [ElementPriority(0)] + public ClipEventType TypeId + { + get { return typeId; } + set { if (this.typeId == ClipEventType.INVALID & this.typeId != value) this.typeId = value; OnElementChanged(); } + } + [ElementPriority(1)] + public uint Unknown1 + { + get { return unknown1; } + set { if (this.unknown1 != value) { this.unknown1 = value; OnElementChanged(); } } + } + [ElementPriority(2)] + public uint Unknown2 + { + get { return unknown2; } + set { if (this.unknown2 != value) { this.unknown2 = value; OnElementChanged(); } } + } + [ElementPriority(3)] public float Timecode { get { return timecode; } @@ -609,18 +1587,50 @@ public static ClipEvent Create(ClipEventType typeId, EventHandler handler, uint { switch ((uint)typeId) { + case 1: + return new ClipEventParent(0, handler, typeId, size); case 3: return new ClipEventSound(0, handler); case 4: - return new ClipEventScript(0, handler, typeId, size); + return new ClipEventScript(0, handler); case 5: - return new ClipEventEffect(0, handler); + return new ClipEventEffect(0, handler, typeId, size); + case 6: + return new ClipEventVisibility(0, handler, typeId, size); + case 10: + return new ClipEventStopEffect(0, handler, typeId, size); + case 11: + return new ClipEventBlockTransition(0, handler); case 12: return new ClipEventSNAP(0, handler, typeId, size); + case 13: + return new ClipEventReaction(0, handler); case 14: return new ClipEventDoubleModifierSound(0, handler); + case 15: + return new ClipEventDspInterval(0, handler); + case 16: + return new ClipEventMaterialState(0, handler, typeId, size); + case 17: + return new ClipEventFocusCompatibility(0, handler, typeId, size); + case 18: + return new ClipEventSuppressLipSync(0, handler); case 19: return new ClipEventCensor(0, handler); + case 20: + return new ClipEventSimulationSoundStart(0, handler, typeId, size); + case 21: + return new ClipEventSimulationSoundStop(0, handler, typeId, size); + case 22: + return new ClipEventEnableFacialOverlay(0, handler, typeId, size); + case 23: + return new ClipEventFadeObject(0, handler); + case 25: + return new ClipEventThighTargetOffset(0, handler); + case 28: + return new ClipEventUnknown28(0, handler, typeId, size); + case 30: + return new ClipEventUnknown30(0, handler); default: return new ClipEventUnknown(0, handler, typeId, size); } @@ -653,6 +1663,11 @@ public enum ClipEventType : uint ENABLE_FACIAL_OVERLAY, FADE_OBJECT, DISABLE_OBJECT_HIGHLIGHT, - THIGH_TARGET_OFFSET + THIGH_TARGET_OFFSET, + UNKNOWN26, + UNKNOWN27, + UNKNOWN28, + UNKNOWN29, + UNKNOWN30 } }