diff --git a/Source/SharpNeedle.Bodge/Program.cs b/Source/SharpNeedle.Bodge/Program.cs index 26c87e0..7415245 100644 --- a/Source/SharpNeedle.Bodge/Program.cs +++ b/Source/SharpNeedle.Bodge/Program.cs @@ -1,12 +1,37 @@ // Program for quickly writing temporary things -using SharpNeedle.HedgehogEngine.Mirage; +using SharpNeedle.SonicTeam.DiEvent; -var parameters = new ShaderParameter(); -parameters.Read(@"SurfRide3DTransform.vsparam"); -parameters.AddFloat4Usage("g_Screen_Size", 0xF4); -parameters.Save(); +int a = 0; -foreach (var usage in parameters.AllUsages()) +void WriteUnknownParams(Node node) { - Console.WriteLine($"{usage} : {usage.Type.ToString().ToLower()}"); + if(node.Type == (int)NodeType.Parameter) + { + ParameterData? data = node.Data as ParameterData; + UnknownParam? param = data.Parameter as UnknownParam; + + if (param != null) + { + Console.WriteLine("{0}: {1}", node.Name, param.Type); + + var f = new BinaryWriter(File.Open(string.Format("{0}__param_{1}.bin", a, param.Type), FileMode.Create)); + f.Write(param.Data); + f.Close(); + a += 1; + } + } + + foreach(var c in node.Children) + { + WriteUnknownParams(c); + } } + +Scene dievent = new Scene(); +dievent.Read(@"bo1140.dvscene", GameType.Frontiers); + +Console.OutputEncoding = Encoding.GetEncoding(932); + +WriteUnknownParams(dievent.RootNode); + +dievent.Write("outputtest.dvscene", GameType.ShadowGenerations); \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Node.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Node.cs index 6b68ad7..fc68f1b 100644 --- a/Source/SharpNeedle/SonicTeam/DiEvent/Node.cs +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Node.cs @@ -71,7 +71,7 @@ public void Read(BinaryObjectReader reader, GameType game) case NodeType.CharacterMotion: case NodeType.ModelMotion: - Data = new MotionModelData(reader, game); + Data = new ModelMotionData(reader, game); break; case NodeType.Attachment: diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/NodeData.cs b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData.cs index b7c32d6..e5ead40 100644 --- a/Source/SharpNeedle/SonicTeam/DiEvent/NodeData.cs +++ b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData.cs @@ -7,525 +7,6 @@ public virtual void Read(BinaryObjectReader reader, GameType type) { } public virtual void Write(BinaryObjectWriter writer, GameType game) { } } -public class PathData : BaseNodeData -{ - public Matrix4x4 Transform { get; set; } - public int Field40 { get; set; } - public int Field44 { get; set; } - public int Field48 { get; set; } - public int Field4C { get; set; } - - public PathData() { } - public PathData(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Transform = reader.Read(); - Field40 = reader.Read(); - Field44 = reader.Read(); - Field48 = reader.Read(); - Field4C = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Transform); - writer.Write(Field40); - writer.Write(Field44); - writer.Write(Field48); - writer.Write(Field4C); - } -} - -public class CameraData : BaseNodeData -{ - public int Field00 { get; set; } - public int FrameCount { get; set; } - public int Field08 { get; set; } - public int Field0C { get; set; } - public List FrameTimes { get; set; } = new List(); - public List FrameData { get; set; } = new List(); - - public CameraData() { } - public CameraData(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - FrameCount = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - - if(FrameCount > 0) - { - reader.ReadCollection(FrameCount, FrameTimes); - reader.ReadCollection(FrameCount, FrameData); - } - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(FrameCount); - writer.Write(Field08); - writer.Write(Field0C); - - if (FrameCount > 0) - { - writer.WriteCollection(FrameTimes); - writer.WriteCollection(FrameData); - } - } -} - -public class CameraMotionData : BaseNodeData -{ - public int Field00 { get; set; } - public int Field04 { get; set; } - public int Field08 { get; set; } - public int Field0C { get; set; } - - public CameraMotionData() { } - public CameraMotionData(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - } -} - -public class ModelData : BaseNodeData -{ - public int Field00 { get; set; } - public string ModelName { get; set; } - public string SkeletonName { get; set; } - public string Field84 { get; set; } - - public ModelData() { } - public ModelData(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - ModelName = reader.ReadDiString(64); - SkeletonName = reader.ReadDiString(64); - Field84 = reader.ReadDiString(64); - - reader.Skip(76); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.WriteDiString(ModelName, 64); - writer.WriteDiString(SkeletonName, 64); - writer.WriteDiString(Field84, 64); - - writer.WriteNulls(76); - } -} - -public class MotionModelData : BaseNodeData -{ - public int Field00 { get; set; } - public int Field04 { get; set; } - public int Field08 { get; set; } - public int Field0C { get; set; } - public string Field10 { get; set; } - public float Field18 { get; set; } - - public MotionModelData() { } - public MotionModelData(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.ReadDiString(8); - Field18 = reader.Read(); - - reader.Skip(20); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - writer.WriteDiString(Field10, 8); - writer.Write(Field18); - - writer.WriteNulls(20); - } -} - -public class AttachmentData : BaseNodeData -{ - public int Field00 { get; set; } - public string NodeName { get; set; } - public int Field44 { get; set; } - public int Field48 { get; set; } - public int Field4C { get; set; } - - public AttachmentData() { } - public AttachmentData(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - NodeName = reader.ReadDiString(64); - Field44 = reader.Read(); - Field48 = reader.Read(); - Field4C = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.WriteDiString(NodeName, 64); - writer.Write(Field44); - writer.Write(Field48); - writer.Write(Field4C); - } -} - -public class ParameterData : BaseNodeData -{ - private int UnknownDataSize; - - public float StartTime { get; set; } - public float EndTime { get; set; } - public int Field0C { get; set; } - public int Field10 { get; set; } - public int Field14 { get; set; } - public int Field18 { get; set; } - public int Field1C { get; set; } - public BaseParam Parameter { get; set; } - - public ParameterData() { } - public ParameterData(BinaryObjectReader reader, GameType game, int size) - { - UnknownDataSize = size - 8; - Read(reader, game); - } - - public ParameterData(float startTime, float endTime) - { - StartTime = startTime; - EndTime = endTime; - } - - public ParameterData(float startTime, float endTime, BaseParam parameter) : this(startTime, endTime) - { - Parameter = parameter; - } - - public void ReadFrontiersParameter(BinaryObjectReader reader, int type) - { - switch ((FrontiersParams)type) - { - case FrontiersParams.DepthOfField: - Parameter = new DOFParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.ColorCorrection: - Parameter = new ColorCorrectionParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.CameraExposure: - Parameter = new CameraExposureParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.ShadowResolution: - Parameter = new ShadowResolutionParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.ChromaticAberration: - Parameter = new ChromaAberrationParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.Vignette: - Parameter = new VignetteParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.Fade: - Parameter = new FadeParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.Letterbox: - Parameter = new LetterboxParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.BossName: - Parameter = new BossNameParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.Subtitle: - Parameter = new SubtitleParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.Sound: - Parameter = new SoundParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.Time: - Parameter = new TimeParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.CameraBlur: - Parameter = new CameraBlurParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.GeneralPurposeTrigger: - Parameter = new GeneralTriggerParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.DitherDepth: - Parameter = new DitherDepthParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.QTE: - Parameter = new QTEParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.ASMForcedOverwrite: - Parameter = new ASMOverrideParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.Aura: - Parameter = new AuraParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.TimescaleChange: - Parameter = new TimescaleParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.CyberNoise: - Parameter = new CyberNoiseParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.MovieDisplay: - Parameter = new MovieDisplayParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.Weather: - Parameter = new WeatherParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.TheEndCable: - Parameter = new TheEndCableParam(reader, GameType.Frontiers); - break; - - case FrontiersParams.FinalBossLighting: - Parameter = new FinalBossLightingParam(reader, GameType.Frontiers); - break; - - default: - Parameter = new UnknownParam(reader, UnknownDataSize, type); - break; - } - } - - public void ReadShadowGensParameter(BinaryObjectReader reader, int type) - { - switch ((ShadowGensParams)type) - { - case ShadowGensParams.DepthOfField: - Parameter = new DOFParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.Fade: - Parameter = new FadeParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.BossName: - Parameter = new BossNameParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.Subtitle: - Parameter = new SubtitleParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.Sound: - Parameter = new SoundParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.GeneralPurposeTrigger: - Parameter = new GeneralTriggerParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.QTE: - Parameter = new QTEParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.MovieDisplay: - Parameter = new MovieDisplayParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.TimeStop: - Parameter = new TimeStopParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.TimeStopControl: - Parameter = new TimeStopControlParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.TimeStopObjectBehavior: - Parameter = new TimeStopObjectBehaviorParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.ShadowAfterimage: - Parameter = new ShadowAfterimageParam(reader, GameType.ShadowGenerations); - break; - - case ShadowGensParams.FalloffToggle: - Parameter = new FalloffToggleParam(reader, GameType.ShadowGenerations); - break; - - default: - Parameter = new UnknownParam(reader, UnknownDataSize, type); - break; - } - } - - public void ReadGameSpecificParameter(BinaryObjectReader reader, GameType game, int type) - { - switch(game) - { - case GameType.Frontiers: - ReadFrontiersParameter(reader, type); - break; - - case GameType.ShadowGenerations: - ReadShadowGensParameter(reader, type); - break; - - default: - Parameter = new UnknownParam(reader, UnknownDataSize, type); - break; - } - } - - public override void Read(BinaryObjectReader reader, GameType game) - { - int type = reader.Read(); - StartTime = reader.Read(); - EndTime = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.Read(); - Field14 = reader.Read(); - Field18 = reader.Read(); - Field1C = reader.Read(); - - if(type < 1000) - { - switch ((ParameterType)type) - { - case ParameterType.DrawingOff: - Parameter = new DrawOffParam(reader, GameType.Common); - break; - - case ParameterType.PathAdjust: - Parameter = new PathAdjustParam(reader, GameType.Common); - break; - - case ParameterType.CameraShake: - Parameter = new CameraShakeParam(reader, GameType.Common); - break; - - case ParameterType.CameraShakeLoop: - Parameter = new CameraShakeLoopParam(reader, GameType.Common); - break; - - case ParameterType.Effect: - Parameter = new EffectParam(reader, GameType.Common); - break; - - case ParameterType.CullDisabled: - Parameter = new CullDisabledParam(reader, GameType.Common); - break; - - case ParameterType.UVAnimation: - Parameter = new UVAnimParam(reader, GameType.Common); - break; - - case ParameterType.VisibilityAnimation: - Parameter = new VisibilityAnimParam(reader, GameType.Common); - break; - - case ParameterType.MaterialAnimation: - Parameter = new MaterialAnimParam(reader, GameType.Common); - break; - - case ParameterType.CompositeAnimation: - Parameter = new CompositeAnimParam(reader, GameType.Common); - break; - - case ParameterType.SonicCamera: - Parameter = new SonicCameraParam(reader, GameType.Common); - break; - - case ParameterType.GameCamera: - Parameter = new GameCameraParam(reader, GameType.Common); - break; - - case ParameterType.ControllerVibration: - Parameter = new ControllerVibrationParam(reader, GameType.Common); - break; - - case ParameterType.MaterialParameter: - Parameter = new MaterialParameterParam(reader, GameType.Common); - break; - - default: - Parameter = new UnknownParam(reader, UnknownDataSize, type); - break; - } - } - else - { - ReadGameSpecificParameter(reader, game, type); - } - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - int type = (Parameter == null) ? 0 : Parameter.GetTypeID(game); - - writer.Write(type); - writer.Write(StartTime); - writer.Write(EndTime); - writer.Write(Field0C); - writer.Write(Field10); - writer.Write(Field14); - writer.Write(Field18); - writer.Write(Field1C); - - if (Parameter != null) - writer.WriteObject(Parameter, game); - } -} - public enum NodeType { Root = 0, diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/AttachmentData.cs b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/AttachmentData.cs new file mode 100644 index 0000000..1f95636 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/AttachmentData.cs @@ -0,0 +1,32 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class AttachmentData : BaseNodeData +{ + public int Field00 { get; set; } + public string NodeName { get; set; } + public int Field44 { get; set; } + public int Field48 { get; set; } + public int Field4C { get; set; } + + public AttachmentData() { } + public AttachmentData(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + NodeName = reader.ReadDiString(64); + Field44 = reader.Read(); + Field48 = reader.Read(); + Field4C = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.WriteDiString(NodeName, 64); + writer.Write(Field44); + writer.Write(Field48); + writer.Write(Field4C); + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/CameraData.cs b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/CameraData.cs new file mode 100644 index 0000000..83afba1 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/CameraData.cs @@ -0,0 +1,43 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class CameraData : BaseNodeData +{ + public int Field00 { get; set; } + public int FrameCount { get; set; } + public int Field08 { get; set; } + public int Field0C { get; set; } + public List FrameTimes { get; set; } = new List(); + public List FrameData { get; set; } = new List(); + + public CameraData() { } + public CameraData(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + FrameCount = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + + if (FrameCount > 0) + { + reader.ReadCollection(FrameCount, FrameTimes); + reader.ReadCollection(FrameCount, FrameData); + } + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(FrameCount); + writer.Write(Field08); + writer.Write(Field0C); + + if (FrameCount > 0) + { + writer.WriteCollection(FrameTimes); + writer.WriteCollection(FrameData); + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/CameraMotionData.cs b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/CameraMotionData.cs new file mode 100644 index 0000000..d7fc8c9 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/CameraMotionData.cs @@ -0,0 +1,29 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class CameraMotionData : BaseNodeData +{ + public int Field00 { get; set; } + public int Field04 { get; set; } + public int Field08 { get; set; } + public int Field0C { get; set; } + + public CameraMotionData() { } + public CameraMotionData(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/ModelData.cs b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/ModelData.cs new file mode 100644 index 0000000..f9d7c49 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/ModelData.cs @@ -0,0 +1,33 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class ModelData : BaseNodeData +{ + public int Field00 { get; set; } + public string ModelName { get; set; } + public string SkeletonName { get; set; } + public string Field84 { get; set; } + + public ModelData() { } + public ModelData(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + ModelName = reader.ReadDiString(64); + SkeletonName = reader.ReadDiString(64); + Field84 = reader.ReadDiString(64); + + reader.Skip(76); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.WriteDiString(ModelName, 64); + writer.WriteDiString(SkeletonName, 64); + writer.WriteDiString(Field84, 64); + + writer.WriteNulls(76); + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/ModelMotionData.cs b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/ModelMotionData.cs new file mode 100644 index 0000000..4604071 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/ModelMotionData.cs @@ -0,0 +1,39 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class ModelMotionData : BaseNodeData +{ + public int Field00 { get; set; } + public int Field04 { get; set; } + public int Field08 { get; set; } + public int Field0C { get; set; } + public string Field10 { get; set; } + public float Field18 { get; set; } + + public ModelMotionData() { } + public ModelMotionData(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.ReadDiString(8); + Field18 = reader.Read(); + + reader.Skip(20); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + writer.WriteDiString(Field10, 8); + writer.Write(Field18); + + writer.WriteNulls(20); + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/ParameterData.cs b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/ParameterData.cs new file mode 100644 index 0000000..35eb28e --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/ParameterData.cs @@ -0,0 +1,318 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class ParameterData : BaseNodeData +{ + private int UnknownDataSize; + + public float StartTime { get; set; } + public float EndTime { get; set; } + public int Field0C { get; set; } + public int Field10 { get; set; } + public int Field14 { get; set; } + public int Field18 { get; set; } + public int Field1C { get; set; } + public BaseParam Parameter { get; set; } + + public ParameterData() { } + public ParameterData(BinaryObjectReader reader, GameType game, int size) + { + UnknownDataSize = size - 8; + Read(reader, game); + } + + public ParameterData(float startTime, float endTime) + { + StartTime = startTime; + EndTime = endTime; + } + + public ParameterData(float startTime, float endTime, BaseParam parameter) : this(startTime, endTime) + { + Parameter = parameter; + } + + public void ReadFrontiersParameter(BinaryObjectReader reader, int type) + { + switch ((FrontiersParams)type) + { + case FrontiersParams.DepthOfField: + Parameter = new DOFParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.ColorCorrection: + Parameter = new ColorCorrectionParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.CameraExposure: + Parameter = new CameraExposureParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.ShadowResolution: + Parameter = new ShadowResolutionParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.ChromaticAberration: + Parameter = new ChromaAberrationParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.Vignette: + Parameter = new VignetteParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.Fade: + Parameter = new FadeParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.Letterbox: + Parameter = new LetterboxParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.BossName: + Parameter = new BossNameParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.Subtitle: + Parameter = new SubtitleParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.Sound: + Parameter = new SoundParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.Time: + Parameter = new TimeParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.CameraBlur: + Parameter = new CameraBlurParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.GeneralPurposeTrigger: + Parameter = new GeneralTriggerParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.DitherDepth: + Parameter = new DitherDepthParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.QTE: + Parameter = new QTEParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.ASMForcedOverwrite: + Parameter = new ASMOverrideParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.Aura: + Parameter = new AuraParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.TimescaleChange: + Parameter = new TimescaleParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.CyberNoise: + Parameter = new CyberNoiseParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.MovieDisplay: + Parameter = new MovieDisplayParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.Weather: + Parameter = new WeatherParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.TheEndCable: + Parameter = new TheEndCableParam(reader, GameType.Frontiers); + break; + + case FrontiersParams.FinalBossLighting: + Parameter = new FinalBossLightingParam(reader, GameType.Frontiers); + break; + + default: + Parameter = new UnknownParam(reader, UnknownDataSize, type); + break; + } + } + + public void ReadShadowGensParameter(BinaryObjectReader reader, int type) + { + switch ((ShadowGensParams)type) + { + case ShadowGensParams.DepthOfField: + Parameter = new DOFParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.Fade: + Parameter = new FadeParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.BossName: + Parameter = new BossNameParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.Subtitle: + Parameter = new SubtitleParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.Sound: + Parameter = new SoundParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.GeneralPurposeTrigger: + Parameter = new GeneralTriggerParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.QTE: + Parameter = new QTEParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.MovieDisplay: + Parameter = new MovieDisplayParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.TimeStop: + Parameter = new TimeStopParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.TimeStopControl: + Parameter = new TimeStopControlParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.TimeStopObjectBehavior: + Parameter = new TimeStopObjectBehaviorParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.ShadowAfterimage: + Parameter = new ShadowAfterimageParam(reader, GameType.ShadowGenerations); + break; + + case ShadowGensParams.FalloffToggle: + Parameter = new FalloffToggleParam(reader, GameType.ShadowGenerations); + break; + + default: + Parameter = new UnknownParam(reader, UnknownDataSize, type); + break; + } + } + + public void ReadGameSpecificParameter(BinaryObjectReader reader, GameType game, int type) + { + switch (game) + { + case GameType.Frontiers: + ReadFrontiersParameter(reader, type); + break; + + case GameType.ShadowGenerations: + ReadShadowGensParameter(reader, type); + break; + + default: + Parameter = new UnknownParam(reader, UnknownDataSize, type); + break; + } + } + + public override void Read(BinaryObjectReader reader, GameType game) + { + int type = reader.Read(); + StartTime = reader.Read(); + EndTime = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.Read(); + Field14 = reader.Read(); + Field18 = reader.Read(); + Field1C = reader.Read(); + + if (type < 1000) + { + switch ((ParameterType)type) + { + case ParameterType.DrawingOff: + Parameter = new DrawOffParam(reader, GameType.Common); + break; + + case ParameterType.PathAdjust: + Parameter = new PathAdjustParam(reader, GameType.Common); + break; + + case ParameterType.CameraShake: + Parameter = new CameraShakeParam(reader, GameType.Common); + break; + + case ParameterType.CameraShakeLoop: + Parameter = new CameraShakeLoopParam(reader, GameType.Common); + break; + + case ParameterType.Effect: + Parameter = new EffectParam(reader, GameType.Common); + break; + + case ParameterType.CullDisabled: + Parameter = new CullDisabledParam(reader, GameType.Common); + break; + + case ParameterType.UVAnimation: + Parameter = new UVAnimParam(reader, GameType.Common); + break; + + case ParameterType.VisibilityAnimation: + Parameter = new VisibilityAnimParam(reader, GameType.Common); + break; + + case ParameterType.MaterialAnimation: + Parameter = new MaterialAnimParam(reader, GameType.Common); + break; + + case ParameterType.CompositeAnimation: + Parameter = new CompositeAnimParam(reader, GameType.Common); + break; + + case ParameterType.SonicCamera: + Parameter = new SonicCameraParam(reader, GameType.Common); + break; + + case ParameterType.GameCamera: + Parameter = new GameCameraParam(reader, GameType.Common); + break; + + case ParameterType.ControllerVibration: + Parameter = new ControllerVibrationParam(reader, GameType.Common); + break; + + case ParameterType.MaterialParameter: + Parameter = new MaterialParameterParam(reader, GameType.Common); + break; + + default: + Parameter = new UnknownParam(reader, UnknownDataSize, type); + break; + } + } + else + { + ReadGameSpecificParameter(reader, game, type); + } + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + int type = (Parameter == null) ? 0 : Parameter.GetTypeID(game); + + writer.Write(type); + writer.Write(StartTime); + writer.Write(EndTime); + writer.Write(Field0C); + writer.Write(Field10); + writer.Write(Field14); + writer.Write(Field18); + writer.Write(Field1C); + + if (Parameter != null) + writer.WriteObject(Parameter, game); + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/PathData.cs b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/PathData.cs new file mode 100644 index 0000000..7fcaf26 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/NodeData/PathData.cs @@ -0,0 +1,32 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class PathData : BaseNodeData +{ + public Matrix4x4 Transform { get; set; } + public int Field40 { get; set; } + public int Field44 { get; set; } + public int Field48 { get; set; } + public int Field4C { get; set; } + + public PathData() { } + public PathData(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Transform = reader.Read(); + Field40 = reader.Read(); + Field44 = reader.Read(); + Field48 = reader.Read(); + Field4C = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Transform); + writer.Write(Field40); + writer.Write(Field44); + writer.Write(Field48); + writer.Write(Field4C); + } +} diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameter.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameter.cs index 9e27d2a..cd396fb 100644 --- a/Source/SharpNeedle/SonicTeam/DiEvent/Parameter.cs +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameter.cs @@ -9,1735 +9,22 @@ public virtual void Write(BinaryObjectWriter reader, GameType game) { } public virtual int GetTypeID(GameType game) { return 0; } } -public class UnknownParam : BaseParam -{ - public byte[] Data { get; set; } - public int Size { get; set; } - public int Type { get; set; } - - public UnknownParam() { } - public UnknownParam(BinaryObjectReader reader, int size, int type) - { - Size = size; - Type = type; - Data = new byte[Size * 4]; - - Read(reader, GameType.Common); - } - - public override void Read(BinaryObjectReader reader, GameType game) - { - reader.ReadArray(Size * 4, Data); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.WriteArrayFixedLength(Data, Size * 4); - } - - public override int GetTypeID(GameType game) { return Type; } -} - -// Common parameters - -class DrawOffParam : BaseParam -{ - public int Field00 { get; set; } - public int Field04 { get; set; } - public int Field08 { get; set; } - public int Field0C { get; set; } - - public DrawOffParam() { } - public DrawOffParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.DrawingOff; } -} - -public class PathAdjustParam : BaseParam -{ - public Matrix4x4 LocalTransform { get; set; } - public int Field40 { get; set; } - public int Field44 { get; set; } - public int Field48 { get; set; } - public int Field4C { get; set; } - - public PathAdjustParam() { } - public PathAdjustParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - LocalTransform = reader.Read(); - Field40 = reader.Read(); - Field44 = reader.Read(); - Field48 = reader.Read(); - Field4C = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(LocalTransform); - writer.Write(Field40); - writer.Write(Field44); - writer.Write(Field48); - writer.Write(Field4C); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.PathAdjust; } -} - -public class CameraShakeParam : BaseParam -{ - public int Field00 { get; set; } - public int Field04 { get; set; } - public float Field08 { get; set; } - public float Field0C { get; set; } - public int Field10 { get; set; } - public int Field14 { get; set; } - public int Field18 { get; set; } - public int Field1C { get; set; } - - public CameraShakeParam() { } - public CameraShakeParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.Read(); - Field14 = reader.Read(); - Field18 = reader.Read(); - Field1C = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - writer.Write(Field10); - writer.Write(Field14); - writer.Write(Field18); - writer.Write(Field1C); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.CameraShake; } -} - -public class CameraShakeLoopParam : BaseParam -{ - public int Field00 { get; set; } - public int Field04 { get; set; } - public float Field08 { get; set; } - public float Field0C { get; set; } - public float Field10 { get; set; } - public float Field14 { get; set; } - public float Field18 { get; set; } - public float Field1C { get; set; } - public float[] CurveData { get; set; } = new float[64]; - - public CameraShakeLoopParam() { } - public CameraShakeLoopParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.Read(); - Field14 = reader.Read(); - Field18 = reader.Read(); - Field1C = reader.Read(); - reader.ReadArray(64, CurveData); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - writer.Write(Field10); - writer.Write(Field14); - writer.Write(Field18); - writer.Write(Field1C); - writer.WriteArrayFixedLength(CurveData, 64); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.CameraShakeLoop; } -} - -public class EffectParam : BaseParam -{ - public Matrix4x4 LocalTransform { get; set; } - public int Field40 { get; set; } - public string Name { get; set; } - public int Field84 { get; set; } - public int Field88 { get; set; } - public int Field8C { get; set; } - public int Field90 { get; set; } - public int Field94 { get; set; } - public int Field98 { get; set; } - public int Field9C { get; set; } - public int FieldA0 { get; set; } - public float[] AnimationData { get; set; } = new float[128]; - - public EffectParam() { } - public EffectParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - LocalTransform = reader.Read(); - Field40 = reader.Read(); - Name = reader.ReadDiString(64); - Field84 = reader.Read(); - Field88 = reader.Read(); - Field8C = reader.Read(); - Field90 = reader.Read(); - Field94 = reader.Read(); - Field98 = reader.Read(); - Field9C = reader.Read(); - FieldA0 = reader.Read(); - reader.ReadArray(128, AnimationData); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(LocalTransform); - writer.Write(Field40); - writer.WriteDiString(Name); - writer.Write(Field84); - writer.Write(Field88); - writer.Write(Field8C); - writer.Write(Field90); - writer.Write(Field94); - writer.Write(Field98); - writer.Write(Field9C); - writer.Write(FieldA0); - writer.WriteArrayFixedLength(AnimationData, 128); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.Effect; } -} - -public class CullDisabledParam : BaseParam -{ - public CullDisabledParam() { } - public CullDisabledParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) { } - - public override void Write(BinaryObjectWriter writer, GameType game) { } - - public override int GetTypeID(GameType game) { return (int)ParameterType.CullDisabled; } -} - -public class UVAnimParam : BaseParam -{ - public int Field00 { get; set; } - public string Name { get; set; } - public int Field44 { get; set; } - public float Field48 { get; set; } - public int Field4C { get; set; } - public int Field50 { get; set; } - - public UVAnimParam() { } - public UVAnimParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Name = reader.ReadDiString(64); - Field44 = reader.Read(); - Field48 = reader.Read(); - Field4C = reader.Read(); - Field50 = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.WriteDiString(Name, 64); - writer.Write(Field44); - writer.Write(Field48); - writer.Write(Field4C); - writer.Write(Field50); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.UVAnimation; } -} - -public class VisibilityAnimParam : BaseParam -{ - public int Field00 { get; set; } - public string Name { get; set; } - public int Field44 { get; set; } - public float Field48 { get; set; } - public int Field4C { get; set; } - public int Field50 { get; set; } - - public VisibilityAnimParam() { } - public VisibilityAnimParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Name = reader.ReadDiString(64); - Field44 = reader.Read(); - Field48 = reader.Read(); - Field4C = reader.Read(); - Field50 = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.WriteDiString(Name, 64); - writer.Write(Field44); - writer.Write(Field48); - writer.Write(Field4C); - writer.Write(Field50); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.VisibilityAnimation; } -} - -public class MaterialAnimParam : BaseParam -{ - public int Field00 { get; set; } - public string Name { get; set; } - public int Field44 { get; set; } - public float Field48 { get; set; } - public int Field4C { get; set; } - public int Field50 { get; set; } - - public MaterialAnimParam() { } - public MaterialAnimParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Name = reader.ReadDiString(64); - Field44 = reader.Read(); - Field48 = reader.Read(); - Field4C = reader.Read(); - Field50 = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.WriteDiString(Name, 64); - writer.Write(Field44); - writer.Write(Field48); - writer.Write(Field4C); - writer.Write(Field50); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.MaterialAnimation; } -} - -public class CompositeAnimParam : BaseParam -{ - public int Field00 { get; set; } - public string StateName { get; set; } - public Animation[] Animations { get; set; } = new Animation[16]; - public int ActiveAnimCount { get; set; } - - public CompositeAnimParam() { } - public CompositeAnimParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - StateName = reader.ReadString(StringBinaryFormat.FixedLength, 12); - Animations = reader.ReadObjectArray(16); - ActiveAnimCount = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.WriteString(StringBinaryFormat.FixedLength, StateName, 12); - writer.WriteObjectCollection(Animations); - writer.Write(ActiveAnimCount); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.CompositeAnimation; } - - public class Animation : IBinarySerializable - { - public int Type { get; set; } - public string Name { get; set; } - - public Animation() - { - Type = (int)AnimationType.None; - Name = ""; - } - - public void Read(BinaryObjectReader reader) - { - Type = reader.Read(); - Name = reader.ReadString(StringBinaryFormat.FixedLength, 64); - } - - public void Write(BinaryObjectWriter writer) - { - writer.Write(Type); - writer.WriteString(StringBinaryFormat.FixedLength, Name, 64); - } - } - - public enum AnimationType - { - None = 0, - PXD = 1, - UV = 2, - Visibility = 3, - Material = 4, - } -} - -public class SonicCameraParam : BaseParam -{ - public uint Flags { get; set; } - public uint Field04 { get; set; } - public uint Field08 { get; set; } - public uint Field0C { get; set; } - public Vector3 Field10 { get; set; } - public uint Field1C { get; set; } - public uint Field20 { get; set; } - public uint Field24 { get; set; } - public Vector3 Field28 { get; set; } - public byte[] UnknownData { get; set; } = new byte[268]; - - public SonicCameraParam() { } - public SonicCameraParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Flags = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.Read(); - Field1C = reader.Read(); - Field20 = reader.Read(); - Field24 = reader.Read(); - Field28 = reader.Read(); - reader.ReadArray(268, UnknownData); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Flags); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - writer.Write(Field10); - writer.Write(Field1C); - writer.Write(Field20); - writer.Write(Field24); - writer.Write(Field28); - writer.WriteArrayFixedLength(UnknownData, 268); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.SonicCamera; } -} - -public class GameCameraParam : BaseParam -{ - public int Field00 { get; set; } - public int Field04 { get; set; } - public int Field08 { get; set; } - public int Field0C { get; set; } - public float Field10 { get; set; } - public float Field14 { get; set; } - public float Field18 { get; set; } - public int Field1C { get; set; } - public int Field20 { get; set; } - public int Field24 { get; set; } - public float Field28 { get; set; } - public float Field2C { get; set; } - public float Field30 { get; set; } - public int Field34 { get; set; } - public int Field38 { get; set; } - public int Field3C { get; set; } - public int Field40 { get; set; } - public float Field44 { get; set; } - public int Field48 { get; set; } - public int Field4C { get; set; } - public float NearCullingPlane { get; set; } - public float FarCullingPlane { get; set; } - public float Field58 { get; set; } - public int Field5C { get; set; } - public int Field60 { get; set; } - public int Field64 { get; set; } - - public GameCameraParam() { } - public GameCameraParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.Read(); - Field14 = reader.Read(); - Field18 = reader.Read(); - Field1C = reader.Read(); - Field20 = reader.Read(); - Field24 = reader.Read(); - Field28 = reader.Read(); - Field2C = reader.Read(); - Field30 = reader.Read(); - Field34 = reader.Read(); - Field38 = reader.Read(); - Field3C = reader.Read(); - Field40 = reader.Read(); - Field44 = reader.Read(); - Field48 = reader.Read(); - Field4C = reader.Read(); - NearCullingPlane = reader.Read(); - FarCullingPlane = reader.Read(); - Field58 = reader.Read(); - Field5C = reader.Read(); - Field60 = reader.Read(); - Field64 = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - writer.Write(Field10); - writer.Write(Field14); - writer.Write(Field18); - writer.Write(Field1C); - writer.Write(Field20); - writer.Write(Field24); - writer.Write(Field28); - writer.Write(Field2C); - writer.Write(Field30); - writer.Write(Field34); - writer.Write(Field38); - writer.Write(Field3C); - writer.Write(Field40); - writer.Write(Field44); - writer.Write(Field48); - writer.Write(Field4C); - writer.Write(NearCullingPlane); - writer.Write(FarCullingPlane); - writer.Write(Field58); - writer.Write(Field5C); - writer.Write(Field60); - writer.Write(Field64); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.GameCamera; } -} - -public class ControllerVibrationParam : BaseParam -{ - public int Field00 { get; set; } - public string Group { get; set; } - public string Mode { get; set; } - public uint Field84 { get; set; } - public uint Field88 { get; set; } - public uint Field8C { get; set; } - - public ControllerVibrationParam() { } - public ControllerVibrationParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Group = reader.ReadString(StringBinaryFormat.FixedLength, 64); - Mode = reader.ReadString(StringBinaryFormat.FixedLength, 64); - Field84 = reader.Read(); - Field88 = reader.Read(); - Field8C = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.WriteString(StringBinaryFormat.FixedLength, Group, 64); - writer.WriteString(StringBinaryFormat.FixedLength, Mode, 64); - writer.Write(Field84); - writer.Write(Field88); - writer.Write(Field8C); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.ControllerVibration; } -} - -public class MaterialParameterParam : BaseParam -{ - public string MaterialName { get; set; } - public string ParamName { get; set; } - public uint Type { get; set; } - public uint[] UnknownData { get; set; } = new uint[40]; - - public MaterialParameterParam() { } - public MaterialParameterParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - MaterialName = reader.ReadString(StringBinaryFormat.FixedLength, 64); - ParamName = reader.ReadString(StringBinaryFormat.FixedLength, 64); - Type = reader.Read(); - reader.ReadArray(40, UnknownData); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.WriteString(StringBinaryFormat.FixedLength, MaterialName, 64); - writer.WriteString(StringBinaryFormat.FixedLength, ParamName, 64); - writer.Write(Type); - writer.WriteArrayFixedLength(UnknownData, 40); - } - - public override int GetTypeID(GameType game) { return (int)ParameterType.MaterialParameter; } - - public enum ParamType - { - Float = 3 - } -} - -// Game-specific - -public class DOFParam : BaseParam -{ - public int Field00 { get; set; } - public Endpoint EndpointA { get; set; } = new Endpoint(); - public Endpoint EndpointB { get; set; } = new Endpoint(); - public float Field24 { get; set; } - public float Field28 { get; set; } - public int Field2C { get; set; } - public int Field30 { get; set; } - public float Field34 { get; set; } - public int Field38 { get; set; } - public int Field3C { get; set; } - public int Field40 { get; set; } - public int Field44 { get; set; } - public int Field48 { get; set; } - public int Field4C { get; set; } - public float[] CurveData { get; set; } = new float[32]; - - public DOFParam() { } - public DOFParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - EndpointA = reader.ReadObject(); - EndpointB = reader.ReadObject(); - Field24 = reader.Read(); - Field28 = reader.Read(); - Field2C = reader.Read(); - Field30 = reader.Read(); - Field34 = reader.Read(); - Field38 = reader.Read(); - Field3C = reader.Read(); - Field40 = reader.Read(); - Field44 = reader.Read(); - Field48 = reader.Read(); - Field4C = reader.Read(); - reader.ReadArray(32, CurveData); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.WriteObject(EndpointA); - writer.WriteObject(EndpointB); - writer.Write(Field24); - writer.Write(Field28); - writer.Write(Field2C); - writer.Write(Field30); - writer.Write(Field34); - writer.Write(Field38); - writer.Write(Field3C); - writer.Write(Field40); - writer.Write(Field44); - writer.Write(Field48); - writer.Write(Field4C); - writer.WriteArrayFixedLength(CurveData, 32); - } - - public class Endpoint : IBinarySerializable - { - public float Focus { get; set; } - public float FocusRange { get; set; } - public float Near { get; set; } - public float Far { get; set; } - - public Endpoint() { } - - public Endpoint(BinaryObjectReader reader) - => Read(reader); - - public void Read(BinaryObjectReader reader) - { - Focus = reader.Read(); - FocusRange = reader.Read(); - Near = reader.Read(); - Far = reader.Read(); - } - - public void Write(BinaryObjectWriter writer) - { - writer.Write(Focus); - writer.Write(FocusRange); - writer.Write(Near); - writer.Write(Far); - } - } - - public override int GetTypeID(GameType game) - { - switch(game) - { - case GameType.Frontiers: - return (int)FrontiersParams.DepthOfField; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.DepthOfField; - - default: - return 0; - } - } -} - -public class MovieDisplayParam : BaseParam -{ - public MovieDisplayParam() { } - public MovieDisplayParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public void Read(BinaryObjectReader reader, GameType game) { } - - public void Write(BinaryObjectWriter writer, GameType game) { } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.MovieDisplay; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.MovieDisplay; - - default: - return 0; - } - } -} - -public class FadeParam : BaseParam -{ - Color Color { get; set; } - public float[] CurveData { get; set; } = new float[32]; - - public FadeParam() { } - public FadeParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Color = reader.Read>(); - reader.ReadArray(32, CurveData); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Color); - writer.WriteArrayFixedLength(CurveData, 32); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.Fade; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.Fade; - - default: - return 0; - } - } -} - -public class LetterboxParam : BaseParam -{ - public float[] CurveData { get; set; } = new float[32]; - - public LetterboxParam() { } - public LetterboxParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - reader.ReadArray(32, CurveData); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.WriteArrayFixedLength(CurveData, 32); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.Letterbox; - - default: - return 0; - } - } -} - -public class ChromaAberrationParam : BaseParam -{ - public Endpoint EndpointA { get; set; } = new Endpoint(); - public float Field20 { get; set; } - public Endpoint EndpointB { get; set; } = new Endpoint(); - public float[] CurveData { get; set; } = new float[32]; - - public ChromaAberrationParam() { } - public ChromaAberrationParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - EndpointA = reader.ReadObject(); - Field20 = reader.Read(); - EndpointB = reader.ReadObject(); - - reader.ReadArray(32, CurveData); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.WriteObject(EndpointA); - writer.Write(Field20); - writer.WriteObject(EndpointB); - - writer.WriteArrayFixedLength(CurveData, 32); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.ChromaticAberration; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.ChromaticAberration; - - default: - return 0; - } - } - - public class Endpoint : IBinarySerializable - { - public Color ColorOffset { get; set; } - public float SphereCurve { get; set; } - public Vector2 Scale { get; set; } - public Vector2 Position { get; set; } - - public Endpoint() { } - - public Endpoint(BinaryObjectReader reader) - => Read(reader); - - public void Read(BinaryObjectReader reader) - { - ColorOffset = new Color(reader.Read(), reader.Read(), reader.Read(), 1.0f); - SphereCurve = reader.Read(); - Scale = reader.Read(); - Position = reader.Read(); - } - - public void Write(BinaryObjectWriter writer) - { - writer.Write(new Vector3(ColorOffset.R, ColorOffset.G, ColorOffset.B)); - writer.Write(SphereCurve); - writer.Write(Scale); - writer.Write(Position); - } - } -} - -public class SoundParam : BaseParam -{ - public string CueName { get; set; } - public int Field40 { get; set; } - public int Field44 { get; set; } - - public SoundParam() { } - public SoundParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - CueName = reader.ReadDiString(64); - Field40 = reader.Read(); - Field44 = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.WriteDiString(CueName); - writer.Write(Field40); - writer.Write(Field44); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.Sound; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.Sound; - - default: - return 0; - } - } -} - -public class SubtitleParam : BaseParam -{ - public string CellName { get; set; } - public SubtitleLanguage Language { get; set; } - public int Field14 { get; set; } - public int Field24 { get; set; } - public int Field28 { get; set; } - public string CellName2 { get; set; } - - public SubtitleParam() { } - public SubtitleParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public void Read(BinaryObjectReader reader, GameType game) - { - if(game == GameType.ShadowGenerations) - { - CellName = reader.ReadDiString(32); - Language = (SubtitleLanguage)reader.Read(); - Field14 = reader.Read(); - Field24 = reader.Read(); - Field28 = reader.Read(); - CellName2 = reader.ReadDiString(32); - } - else - { - CellName = reader.ReadDiString(16); - Language = (SubtitleLanguage)reader.Read(); - Field14 = reader.Read(); - } - } - - public void Write(BinaryObjectWriter writer, GameType game) - { - if (game == GameType.ShadowGenerations) - { - writer.WriteDiString(CellName, 32); - writer.Write((int)Language); - writer.Write(Field14); - writer.Write(Field24); - writer.Write(Field28); - writer.WriteDiString(CellName2, 32); - } - else - { - writer.WriteDiString(CellName, 16); - writer.Write((int)Language); - writer.Write(Field14); - } - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.Subtitle; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.Subtitle; - - default: - return 0; - } - } - - public enum SubtitleLanguage - { - English = 0, - French = 1, - Italian = 2, - German = 3, - Spanish = 4, - Polish = 5, - Portuguese = 6, - Russian = 7, - Japanese = 8, - Chinese = 9, - ChineseSimplified = 10, - Korean = 11 - } -} - -public class QTEParam : BaseParam -{ - public int Field00 { get; set; } - public int Field04 { get; set; } - public float Field08 { get; set; } - public float Field0C { get; set; } - public float Field10 { get; set; } - public float Field14 { get; set; } - public float Field18 { get; set; } - public float Field1C { get; set; } - public float Field20 { get; set; } - public int Field24 { get; set; } - public int Field28 { get; set; } - public int Field2C { get; set; } - public int Field30 { get; set; } - public int Field34 { get; set; } - public int Field38 { get; set; } - public int Field3C { get; set; } - public int Field40 { get; set; } - public int Field44 { get; set; } - public int Field48 { get; set; } - public int Field4C { get; set; } - public int Field50 { get; set; } - public int Field54 { get; set; } - public int Field58 { get; set; } - public int Field5C { get; set; } - public int Field60 { get; set; } - public int Field64 { get; set; } - public int Field68 { get; set; } - public int Field6C { get; set; } - public float Field70 { get; set; } - public float Field74 { get; set; } - public float Field78 { get; set; } - public float Field7C { get; set; } - public int[] Field80 { get; set; } = new int[32]; - public string Field100 { get; set; } - public string Field140 { get; set; } - public string Field180 { get; set; } - public uint Field1C0 { get; set; } - - public QTEParam() { } - public QTEParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.Read(); - Field14 = reader.Read(); - Field18 = reader.Read(); - Field1C = reader.Read(); - Field20 = reader.Read(); - Field24 = reader.Read(); - Field28 = reader.Read(); - Field2C = reader.Read(); - Field30 = reader.Read(); - Field34 = reader.Read(); - Field38 = reader.Read(); - Field3C = reader.Read(); - Field40 = reader.Read(); - Field44 = reader.Read(); - Field48 = reader.Read(); - Field4C = reader.Read(); - Field50 = reader.Read(); - Field54 = reader.Read(); - Field58 = reader.Read(); - Field5C = reader.Read(); - Field60 = reader.Read(); - Field64 = reader.Read(); - Field68 = reader.Read(); - Field6C = reader.Read(); - Field70 = reader.Read(); - Field74 = reader.Read(); - Field78 = reader.Read(); - Field7C = reader.Read(); - reader.ReadArray(32, Field80); - - Field100 = reader.ReadString(StringBinaryFormat.FixedLength, 64); - Field140 = reader.ReadString(StringBinaryFormat.FixedLength, 64); - - if (game == GameType.ShadowGenerations) - { - Field180 = reader.ReadString(StringBinaryFormat.FixedLength, 64); - Field1C0 = reader.Read(); - } - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - writer.Write(Field10); - writer.Write(Field14); - writer.Write(Field18); - writer.Write(Field1C); - writer.Write(Field20); - writer.Write(Field24); - writer.Write(Field28); - writer.Write(Field2C); - writer.Write(Field30); - writer.Write(Field34); - writer.Write(Field38); - writer.Write(Field3C); - writer.Write(Field40); - writer.Write(Field44); - writer.Write(Field48); - writer.Write(Field4C); - writer.Write(Field50); - writer.Write(Field54); - writer.Write(Field58); - writer.Write(Field5C); - writer.Write(Field60); - writer.Write(Field64); - writer.Write(Field68); - writer.Write(Field6C); - writer.Write(Field70); - writer.Write(Field74); - writer.Write(Field78); - writer.Write(Field7C); - writer.WriteArrayFixedLength(Field80, 32); - - writer.WriteString(StringBinaryFormat.FixedLength, Field100, 64); - writer.WriteString(StringBinaryFormat.FixedLength, Field140, 64); - - if (game == GameType.ShadowGenerations) - { - writer.WriteString(StringBinaryFormat.FixedLength, Field180, 64); - writer.Write(Field1C0); - } - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.QTE; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.QTE; - - default: - return 0; - } - } -} - -public class TimescaleParam : BaseParam -{ - public int Field00 { get; set; } - public float Scale { get; set; } - public int Field08 { get; set; } - public int Field0C { get; set; } - - public TimescaleParam() { } - public TimescaleParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Scale = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Scale); - writer.Write(Field08); - writer.Write(Field0C); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.TimescaleChange; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.TimescaleChange; - - default: - return 0; - } - } -} - -public class VignetteParam : BaseParam -{ - public int Field00 { get; set; } - public int Field04 { get; set; } - public float Field08 { get; set; } - public float Field0C { get; set; } - public float Field10 { get; set; } - public float Field14 { get; set; } - public float Field18 { get; set; } - public float Field1C { get; set; } - public float Field20 { get; set; } - public int Field24 { get; set; } - public float Field28 { get; set; } - public float Field2C { get; set; } - public float Field30 { get; set; } - public float Field34 { get; set; } - public float Field38 { get; set; } - public float Field3C { get; set; } - public float Field40 { get; set; } - public float Field44 { get; set; } - public float Field48 { get; set; } - public float Field4C { get; set; } - public float Field50 { get; set; } - public float Field54 { get; set; } - public float Field58 { get; set; } - public float Field5C { get; set; } - public float Field60 { get; set; } - public float Field64 { get; set; } - public float Field68 { get; set; } - public float Field6C { get; set; } - public float Field70 { get; set; } - public float Field74 { get; set; } - public float Field78 { get; set; } - public float Field7C { get; set; } - public float Field80 { get; set; } - public float Field84 { get; set; } - public int Field88 { get; set; } - public float Field8C { get; set; } - public float Field90 { get; set; } - public float Field94 { get; set; } - public float Field98 { get; set; } - public float Field9C { get; set; } - public float FieldA0 { get; set; } - public float FieldA4 { get; set; } - public float FieldA8 { get; set; } - public float FieldAC { get; set; } - public float FieldB0 { get; set; } - public float FieldB4 { get; set; } - public float FieldB8 { get; set; } - public float FieldBC { get; set; } - public float FieldC0 { get; set; } - public float FieldC4 { get; set; } - public float[] ValuesTimeline { get; set; } = new float[32]; - - public VignetteParam() { } - public VignetteParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.Read(); - Field14 = reader.Read(); - Field18 = reader.Read(); - Field1C = reader.Read(); - Field20 = reader.Read(); - Field24 = reader.Read(); - Field28 = reader.Read(); - Field2C = reader.Read(); - Field30 = reader.Read(); - Field34 = reader.Read(); - Field38 = reader.Read(); - Field3C = reader.Read(); - Field40 = reader.Read(); - Field44 = reader.Read(); - Field48 = reader.Read(); - Field4C = reader.Read(); - Field50 = reader.Read(); - Field54 = reader.Read(); - Field58 = reader.Read(); - Field5C = reader.Read(); - Field60 = reader.Read(); - Field64 = reader.Read(); - Field68 = reader.Read(); - Field6C = reader.Read(); - Field70 = reader.Read(); - Field74 = reader.Read(); - Field78 = reader.Read(); - Field7C = reader.Read(); - Field80 = reader.Read(); - Field84 = reader.Read(); - Field88 = reader.Read(); - Field8C = reader.Read(); - Field90 = reader.Read(); - Field94 = reader.Read(); - Field98 = reader.Read(); - Field9C = reader.Read(); - FieldA0 = reader.Read(); - FieldA4 = reader.Read(); - FieldA8 = reader.Read(); - FieldAC = reader.Read(); - FieldB0 = reader.Read(); - FieldB4 = reader.Read(); - FieldB8 = reader.Read(); - FieldBC = reader.Read(); - FieldC0 = reader.Read(); - FieldC4 = reader.Read(); - - reader.ReadArray(32, ValuesTimeline); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - writer.Write(Field10); - writer.Write(Field14); - writer.Write(Field18); - writer.Write(Field1C); - writer.Write(Field20); - writer.Write(Field24); - writer.Write(Field28); - writer.Write(Field2C); - writer.Write(Field30); - writer.Write(Field34); - writer.Write(Field38); - writer.Write(Field3C); - writer.Write(Field40); - writer.Write(Field44); - writer.Write(Field48); - writer.Write(Field4C); - writer.Write(Field50); - writer.Write(Field54); - writer.Write(Field58); - writer.Write(Field5C); - writer.Write(Field60); - writer.Write(Field64); - writer.Write(Field68); - writer.Write(Field6C); - writer.Write(Field70); - writer.Write(Field74); - writer.Write(Field78); - writer.Write(Field7C); - writer.Write(Field80); - writer.Write(Field84); - writer.Write(Field88); - writer.Write(Field8C); - writer.Write(Field90); - writer.Write(Field94); - writer.Write(Field98); - writer.Write(Field9C); - writer.Write(FieldA0); - writer.Write(FieldA4); - writer.Write(FieldA8); - writer.Write(FieldAC); - writer.Write(FieldB0); - writer.Write(FieldB4); - writer.Write(FieldB8); - writer.Write(FieldBC); - writer.Write(FieldC0); - writer.Write(FieldC4); - - writer.WriteArrayFixedLength(ValuesTimeline, 32); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.Vignette; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.Vignette; - - default: - return 0; - } - } -} - -public class BossNameParam : BaseParam -{ - public int Field00 { get; set; } - public int NameType { get; set; } - - public BossNameParam() { } - public BossNameParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - NameType = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(NameType); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.BossName; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.BossName; - - default: - return 0; - } - } - - public enum FrontiersNames - { - Giant = 0, - Dragon, - Knight, - Rifle, - TheEnd, - RifleBeast - } - - public enum ShadowGensNames - { - Biolizard = 0, - MetalOverlord, - Mephiles, - DevilDoom, - PerfectBlackDoom - } -} - -public class AuraParam : BaseParam -{ - public int Field00 { get; set; } - public int Field04 { get; set; } - public int Field08 { get; set; } - public int Field0C { get; set; } - public float Field10 { get; set; } - public float Field14 { get; set; } - public float Field18 { get; set; } - public float Field1C { get; set; } - public float Field20 { get; set; } - public int Field24 { get; set; } - public int Field28 { get; set; } - public int Field2C { get; set; } - public int Field30 { get; set; } - public float Field34 { get; set; } - public float Field38 { get; set; } - public float Field3C { get; set; } - public float Field40 { get; set; } - public float Field44 { get; set; } - public int Field48 { get; set; } - public float[] ValuesTimeline { get; set; } = new float[32]; - - public AuraParam() { } - public AuraParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.Read(); - Field14 = reader.Read(); - Field18 = reader.Read(); - Field1C = reader.Read(); - Field20 = reader.Read(); - Field24 = reader.Read(); - Field28 = reader.Read(); - Field2C = reader.Read(); - Field30 = reader.Read(); - Field34 = reader.Read(); - Field38 = reader.Read(); - Field3C = reader.Read(); - Field40 = reader.Read(); - Field44 = reader.Read(); - Field48 = reader.Read(); - reader.ReadArray(32, ValuesTimeline); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - writer.Write(Field10); - writer.Write(Field14); - writer.Write(Field18); - writer.Write(Field1C); - writer.Write(Field20); - writer.Write(Field24); - writer.Write(Field28); - writer.Write(Field2C); - writer.Write(Field30); - writer.Write(Field34); - writer.Write(Field38); - writer.Write(Field3C); - writer.Write(Field40); - writer.Write(Field44); - writer.Write(Field48); - writer.WriteArrayFixedLength(ValuesTimeline, 32); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.Aura; - - case GameType.ShadowGenerations: - return 0; - - default: - return 0; - } - } -} - -public class TheEndCableParam : BaseParam -{ - public int Field00 { get; set; } - public int Field04 { get; set; } - public float[] Field08 { get; set; } = new float[1024]; - - public TheEndCableParam() { } - public TheEndCableParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - reader.ReadArray(1024, Field08); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.WriteArrayFixedLength(Field08, 1024); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.TheEndCable; - - default: - return 0; - } - } -} -public class ASMOverrideParam : BaseParam -{ - public string OverriddenASMName { get; set; } - public string OverridingASMName { get; set; } - - public ASMOverrideParam() { } - public ASMOverrideParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - OverriddenASMName = reader.ReadString(StringBinaryFormat.FixedLength, 64); - OverridingASMName = reader.ReadString(StringBinaryFormat.FixedLength, 64); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.WriteString(StringBinaryFormat.FixedLength, OverriddenASMName, 64); - writer.WriteString(StringBinaryFormat.FixedLength, OverridingASMName, 64); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.ASMForcedOverwrite; - - default: - return 0; - } - } -} - -public class GeneralTriggerParam : BaseParam -{ - public uint Field00 { get; set; } - public string TriggerName { get; set; } - - public GeneralTriggerParam() { } - public GeneralTriggerParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - TriggerName = reader.ReadString(StringBinaryFormat.FixedLength, 64); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.WriteString(StringBinaryFormat.FixedLength, TriggerName, 64); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.GeneralPurposeTrigger; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.GeneralPurposeTrigger; - - default: - return 0; - } - } -} - -public class CameraBlurParam : BaseParam -{ - public uint Field00 { get; set; } - public uint Field04 { get; set; } - public float Field08 { get; set; } - public float[] CurveData { get; set; } = new float[32]; - public uint Flags { get; set; } - - public CameraBlurParam() { } - public CameraBlurParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - reader.ReadArray(32, CurveData); - Flags = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.WriteArrayFixedLength(CurveData, 32); - writer.Write(Flags); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.CameraBlur; - - case GameType.ShadowGenerations: - return (int)ShadowGensParams.CameraBlur; - - default: - return 0; - } - } -} - -public class ShadowResolutionParam : BaseParam +public class LetterboxParam : BaseParam { - public Vector2Int Resolution { get; set; } + public float[] CurveData { get; set; } = new float[32]; - public ShadowResolutionParam() { } - public ShadowResolutionParam(BinaryObjectReader reader, GameType game) + public LetterboxParam() { } + public LetterboxParam(BinaryObjectReader reader, GameType game) => Read(reader, game); - public void Read(BinaryObjectReader reader, GameType game) + public override void Read(BinaryObjectReader reader, GameType game) { - Resolution = reader.Read(); + reader.ReadArray(32, CurveData); } - public void Write(BinaryObjectWriter writer, GameType game) + public override void Write(BinaryObjectWriter writer, GameType game) { - writer.Write(Resolution); + writer.WriteArrayFixedLength(CurveData, 32); } public override int GetTypeID(GameType game) @@ -1745,7 +32,7 @@ public override int GetTypeID(GameType game) switch (game) { case GameType.Frontiers: - return (int)FrontiersParams.ShadowResolution; + return (int)FrontiersParams.Letterbox; default: return 0; @@ -1753,49 +40,25 @@ public override int GetTypeID(GameType game) } } -public class TimeParam : BaseParam +public class ASMOverrideParam : BaseParam { - public uint Field00 { get; set; } - public uint Field04 { get; set; } - public uint Field08 { get; set; } - public uint Field0C { get; set; } - public uint Field10 { get; set; } - public uint Field14 { get; set; } - public uint Field18 { get; set; } - public uint Field1C { get; set; } - public uint Field20 { get; set; } - public float[] DataCurve { get; set; } = new float[32]; + public string OverriddenASMName { get; set; } + public string OverridingASMName { get; set; } - public TimeParam() { } - public TimeParam(BinaryObjectReader reader, GameType game) + public ASMOverrideParam() { } + public ASMOverrideParam(BinaryObjectReader reader, GameType game) => Read(reader, game); public override void Read(BinaryObjectReader reader, GameType game) { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.Read(); - Field14 = reader.Read(); - Field18 = reader.Read(); - Field1C = reader.Read(); - Field20 = reader.Read(); - reader.ReadArray(32, DataCurve); + OverriddenASMName = reader.ReadString(StringBinaryFormat.FixedLength, 64); + OverridingASMName = reader.ReadString(StringBinaryFormat.FixedLength, 64); } public override void Write(BinaryObjectWriter writer, GameType game) { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - writer.Write(Field10); - writer.Write(Field14); - writer.Write(Field18); - writer.Write(Field1C); - writer.Write(Field20); - writer.WriteArrayFixedLength(DataCurve, 32); + writer.WriteString(StringBinaryFormat.FixedLength, OverriddenASMName, 64); + writer.WriteString(StringBinaryFormat.FixedLength, OverridingASMName, 64); } public override int GetTypeID(GameType game) @@ -1803,7 +66,7 @@ public override int GetTypeID(GameType game) switch (game) { case GameType.Frontiers: - return (int)FrontiersParams.Time; + return (int)FrontiersParams.ASMForcedOverwrite; default: return 0; @@ -1811,25 +74,25 @@ public override int GetTypeID(GameType game) } } -public class WeatherParam : BaseParam +public class GeneralTriggerParam : BaseParam { public uint Field00 { get; set; } - public float[] DataCurve { get; set; } = new float[32]; + public string TriggerName { get; set; } - public WeatherParam() { } - public WeatherParam(BinaryObjectReader reader, GameType game) + public GeneralTriggerParam() { } + public GeneralTriggerParam(BinaryObjectReader reader, GameType game) => Read(reader, game); public override void Read(BinaryObjectReader reader, GameType game) { Field00 = reader.Read(); - reader.ReadArray(32, DataCurve); + TriggerName = reader.ReadString(StringBinaryFormat.FixedLength, 64); } public override void Write(BinaryObjectWriter writer, GameType game) { writer.Write(Field00); - writer.WriteArrayFixedLength(DataCurve, 32); + writer.WriteString(StringBinaryFormat.FixedLength, TriggerName, 64); } public override int GetTypeID(GameType game) @@ -1837,7 +100,10 @@ public override int GetTypeID(GameType game) switch (game) { case GameType.Frontiers: - return (int)FrontiersParams.Weather; + return (int)FrontiersParams.GeneralPurposeTrigger; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.GeneralPurposeTrigger; default: return 0; @@ -1868,40 +134,6 @@ public override int GetTypeID(GameType game) } } -public class CyberNoiseParam : BaseParam -{ - public uint Field00 { get; set; } - public float[] CurveData { get; set; } = new float[32]; - - public CyberNoiseParam() { } - public CyberNoiseParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - reader.ReadArray(32, CurveData); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.WriteArrayFixedLength(CurveData, 32); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.CyberNoise; - - default: - return 0; - } - } -} - public class DitherDepthParam : BaseParam { public uint Field00 { get; set; } @@ -1936,318 +168,6 @@ public override int GetTypeID(GameType game) } } -public class CameraExposureParam : BaseParam -{ - public uint Field00 { get; set; } - public float Field04 { get; set; } - public uint Field08 { get; set; } - public uint Field0C { get; set; } - public uint Field10 { get; set; } - public uint Field14 { get; set; } - public uint Field18 { get; set; } - public uint Field1C { get; set; } - public float[] CurveData { get; set; } = new float[32]; - - public CameraExposureParam() { } - public CameraExposureParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.Read(); - Field14 = reader.Read(); - Field18 = reader.Read(); - Field1C = reader.Read(); - reader.ReadArray(32, CurveData); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - writer.Write(Field10); - writer.Write(Field14); - writer.Write(Field18); - writer.Write(Field1C); - writer.WriteArrayFixedLength(CurveData, 32); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.CameraExposure; - - default: - return 0; - } - } -} - -public class ColorCorrectionParam : BaseParam -{ - public uint Field00 { get; set; } - public float Field04 { get; set; } - public float Field08 { get; set; } - public float Field0C { get; set; } - public float Field10 { get; set; } - public uint Field14 { get; set; } - public float Field18 { get; set; } - public uint Field1C { get; set; } - public float[] CurveData { get; set; } = new float[32]; - - public ColorCorrectionParam() { } - public ColorCorrectionParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - Field0C = reader.Read(); - Field10 = reader.Read(); - Field14 = reader.Read(); - Field18 = reader.Read(); - Field1C = reader.Read(); - reader.ReadArray(32, CurveData); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - writer.Write(Field0C); - writer.Write(Field10); - writer.Write(Field14); - writer.Write(Field18); - writer.Write(Field1C); - writer.WriteArrayFixedLength(CurveData, 32); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.Frontiers: - return (int)FrontiersParams.ColorCorrection; - - default: - return 0; - } - } -} - -public class TimeStopParam : BaseParam -{ - public int Field00 { get; set; } - public float Field04 { get; set; } - public float Field08 { get; set; } - - public TimeStopParam() { } - public TimeStopParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Field00 = reader.Read(); - Field04 = reader.Read(); - Field08 = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Field00); - writer.Write(Field04); - writer.Write(Field08); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.ShadowGenerations: - return (int)ShadowGensParams.TimeStop; - - default: - return 0; - } - } - - public enum ParamType - { - Float = 3 - } -} - -public class TimeStopControlParam : BaseParam -{ - public int Behavior { get; set; } - public float Field04 { get; set; } - public float TransitionDuration { get; set; } - - public TimeStopControlParam() { } - public TimeStopControlParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Behavior = reader.Read(); - Field04 = reader.Read(); - TransitionDuration = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Behavior); - writer.Write(Field04); - writer.Write(TransitionDuration); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.ShadowGenerations: - return (int)ShadowGensParams.TimeStopControl; - - default: - return 0; - } - } - - public enum BehaviorMode - { - End = 1, - Begin = 2, - } -} - -public class TimeStopObjectBehaviorParam : BaseParam -{ - public int Mode { get; set; } - - public TimeStopObjectBehaviorParam() { } - public TimeStopObjectBehaviorParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public void Read(BinaryObjectReader reader, GameType game) - { - Mode = reader.Read(); - } - - public void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Mode); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.ShadowGenerations: - return (int)ShadowGensParams.TimeStopObjectBehavior; - - default: - return 0; - } - } -} - -public class FalloffToggleParam : BaseParam -{ - public float Intensity { get; set; } - - public FalloffToggleParam() { } - public FalloffToggleParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public void Read(BinaryObjectReader reader, GameType game) - { - Intensity = reader.Read(); - } - - public void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Intensity); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.ShadowGenerations: - return (int)ShadowGensParams.FalloffToggle; - - default: - return 0; - } - } -} - -public class ShadowAfterimageParam : BaseParam -{ - public Color Color { get; set; } - public int Field10 { get; set; } // Possibly afterimage count? - public int Field14 { get; set; } - public int Field18 { get; set; } - public int Field1C { get; set; } - public int Field20 { get; set; } - public float Field24 { get; set; } - public float Field28 { get; set; } - public int Field2C { get; set; } - - public ShadowAfterimageParam() { } - public ShadowAfterimageParam(BinaryObjectReader reader, GameType game) - => Read(reader, game); - - public override void Read(BinaryObjectReader reader, GameType game) - { - Color = reader.Read>(); - Field10 = reader.Read(); - Field14 = reader.Read(); - Field18 = reader.Read(); - Field1C = reader.Read(); - Field20 = reader.Read(); - Field24 = reader.Read(); - Field28 = reader.Read(); - Field2C = reader.Read(); - } - - public override void Write(BinaryObjectWriter writer, GameType game) - { - writer.Write(Color); - writer.Write(Field10); - writer.Write(Field14); - writer.Write(Field18); - writer.Write(Field1C); - writer.Write(Field20); - writer.Write(Field24); - writer.Write(Field28); - writer.Write(Field2C); - } - - public override int GetTypeID(GameType game) - { - switch (game) - { - case GameType.ShadowGenerations: - return (int)ShadowGensParams.ShadowAfterimage; - - default: - return 0; - } - } -} - // < 1000 values are shared between games, the others are game-specific. public enum ParameterType { diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/AuraParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/AuraParam.cs new file mode 100644 index 0000000..b23f503 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/AuraParam.cs @@ -0,0 +1,92 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class AuraParam : BaseParam +{ + public int Field00 { get; set; } + public int Field04 { get; set; } + public int Field08 { get; set; } + public int Field0C { get; set; } + public float Field10 { get; set; } + public float Field14 { get; set; } + public float Field18 { get; set; } + public float Field1C { get; set; } + public float Field20 { get; set; } + public int Field24 { get; set; } + public int Field28 { get; set; } + public int Field2C { get; set; } + public int Field30 { get; set; } + public float Field34 { get; set; } + public float Field38 { get; set; } + public float Field3C { get; set; } + public float Field40 { get; set; } + public float Field44 { get; set; } + public int Field48 { get; set; } + public float[] ValuesTimeline { get; set; } = new float[32]; + + public AuraParam() { } + public AuraParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.Read(); + Field14 = reader.Read(); + Field18 = reader.Read(); + Field1C = reader.Read(); + Field20 = reader.Read(); + Field24 = reader.Read(); + Field28 = reader.Read(); + Field2C = reader.Read(); + Field30 = reader.Read(); + Field34 = reader.Read(); + Field38 = reader.Read(); + Field3C = reader.Read(); + Field40 = reader.Read(); + Field44 = reader.Read(); + Field48 = reader.Read(); + reader.ReadArray(32, ValuesTimeline); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + writer.Write(Field10); + writer.Write(Field14); + writer.Write(Field18); + writer.Write(Field1C); + writer.Write(Field20); + writer.Write(Field24); + writer.Write(Field28); + writer.Write(Field2C); + writer.Write(Field30); + writer.Write(Field34); + writer.Write(Field38); + writer.Write(Field3C); + writer.Write(Field40); + writer.Write(Field44); + writer.Write(Field48); + writer.WriteArrayFixedLength(ValuesTimeline, 32); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.Aura; + + case GameType.ShadowGenerations: + return 0; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/BossNameParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/BossNameParam.cs new file mode 100644 index 0000000..65df932 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/BossNameParam.cs @@ -0,0 +1,57 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class BossNameParam : BaseParam +{ + public int Field00 { get; set; } + public int NameType { get; set; } + + public BossNameParam() { } + public BossNameParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + NameType = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(NameType); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.BossName; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.BossName; + + default: + return 0; + } + } + + public enum FrontiersNames + { + Giant = 0, + Dragon, + Knight, + Rifle, + TheEnd, + RifleBeast + } + + public enum ShadowGensNames + { + Biolizard = 0, + MetalOverlord, + Mephiles, + DevilDoom, + PerfectBlackDoom + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraBlurParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraBlurParam.cs new file mode 100644 index 0000000..ee1ff0f --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraBlurParam.cs @@ -0,0 +1,47 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class CameraBlurParam : BaseParam +{ + public uint Field00 { get; set; } + public uint Field04 { get; set; } + public float Field08 { get; set; } + public float[] CurveData { get; set; } = new float[32]; + public uint Flags { get; set; } + + public CameraBlurParam() { } + public CameraBlurParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + reader.ReadArray(32, CurveData); + Flags = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.WriteArrayFixedLength(CurveData, 32); + writer.Write(Flags); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.CameraBlur; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.CameraBlur; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraExposureParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraExposureParam.cs new file mode 100644 index 0000000..50bede1 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraExposureParam.cs @@ -0,0 +1,56 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class CameraExposureParam : BaseParam +{ + public uint Field00 { get; set; } + public float Field04 { get; set; } + public uint Field08 { get; set; } + public uint Field0C { get; set; } + public uint Field10 { get; set; } + public uint Field14 { get; set; } + public uint Field18 { get; set; } + public uint Field1C { get; set; } + public float[] CurveData { get; set; } = new float[32]; + + public CameraExposureParam() { } + public CameraExposureParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.Read(); + Field14 = reader.Read(); + Field18 = reader.Read(); + Field1C = reader.Read(); + reader.ReadArray(32, CurveData); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + writer.Write(Field10); + writer.Write(Field14); + writer.Write(Field18); + writer.Write(Field1C); + writer.WriteArrayFixedLength(CurveData, 32); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.CameraExposure; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraShakeLoopParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraShakeLoopParam.cs new file mode 100644 index 0000000..8488171 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraShakeLoopParam.cs @@ -0,0 +1,46 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class CameraShakeLoopParam : BaseParam +{ + public int Field00 { get; set; } + public int Field04 { get; set; } + public float Field08 { get; set; } + public float Field0C { get; set; } + public float Field10 { get; set; } + public float Field14 { get; set; } + public float Field18 { get; set; } + public float Field1C { get; set; } + public float[] CurveData { get; set; } = new float[64]; + + public CameraShakeLoopParam() { } + public CameraShakeLoopParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.Read(); + Field14 = reader.Read(); + Field18 = reader.Read(); + Field1C = reader.Read(); + reader.ReadArray(64, CurveData); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + writer.Write(Field10); + writer.Write(Field14); + writer.Write(Field18); + writer.Write(Field1C); + writer.WriteArrayFixedLength(CurveData, 64); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.CameraShakeLoop; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraShakeParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraShakeParam.cs new file mode 100644 index 0000000..cee345c --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CameraShakeParam.cs @@ -0,0 +1,43 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class CameraShakeParam : BaseParam +{ + public int Field00 { get; set; } + public int Field04 { get; set; } + public float Field08 { get; set; } + public float Field0C { get; set; } + public int Field10 { get; set; } + public int Field14 { get; set; } + public int Field18 { get; set; } + public int Field1C { get; set; } + + public CameraShakeParam() { } + public CameraShakeParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.Read(); + Field14 = reader.Read(); + Field18 = reader.Read(); + Field1C = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + writer.Write(Field10); + writer.Write(Field14); + writer.Write(Field18); + writer.Write(Field1C); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.CameraShake; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ChromaAberrationParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ChromaAberrationParam.cs new file mode 100644 index 0000000..b69aef4 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ChromaAberrationParam.cs @@ -0,0 +1,75 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class ChromaAberrationParam : BaseParam +{ + public Endpoint EndpointA { get; set; } = new Endpoint(); + public float Field20 { get; set; } + public Endpoint EndpointB { get; set; } = new Endpoint(); + public float[] CurveData { get; set; } = new float[32]; + + public ChromaAberrationParam() { } + public ChromaAberrationParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + EndpointA = reader.ReadObject(); + Field20 = reader.Read(); + EndpointB = reader.ReadObject(); + + reader.ReadArray(32, CurveData); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.WriteObject(EndpointA); + writer.Write(Field20); + writer.WriteObject(EndpointB); + + writer.WriteArrayFixedLength(CurveData, 32); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.ChromaticAberration; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.ChromaticAberration; + + default: + return 0; + } + } + + public class Endpoint : IBinarySerializable + { + public Color ColorOffset { get; set; } + public float SphereCurve { get; set; } + public Vector2 Scale { get; set; } + public Vector2 Position { get; set; } + + public Endpoint() { } + + public Endpoint(BinaryObjectReader reader) + => Read(reader); + + public void Read(BinaryObjectReader reader) + { + ColorOffset = new Color(reader.Read(), reader.Read(), reader.Read(), 1.0f); + SphereCurve = reader.Read(); + Scale = reader.Read(); + Position = reader.Read(); + } + + public void Write(BinaryObjectWriter writer) + { + writer.Write(new Vector3(ColorOffset.R, ColorOffset.G, ColorOffset.B)); + writer.Write(SphereCurve); + writer.Write(Scale); + writer.Write(Position); + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ColorCorrectionParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ColorCorrectionParam.cs new file mode 100644 index 0000000..4fe546c --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ColorCorrectionParam.cs @@ -0,0 +1,56 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class ColorCorrectionParam : BaseParam +{ + public uint Field00 { get; set; } + public float Field04 { get; set; } + public float Field08 { get; set; } + public float Field0C { get; set; } + public float Field10 { get; set; } + public uint Field14 { get; set; } + public float Field18 { get; set; } + public uint Field1C { get; set; } + public float[] CurveData { get; set; } = new float[32]; + + public ColorCorrectionParam() { } + public ColorCorrectionParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.Read(); + Field14 = reader.Read(); + Field18 = reader.Read(); + Field1C = reader.Read(); + reader.ReadArray(32, CurveData); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + writer.Write(Field10); + writer.Write(Field14); + writer.Write(Field18); + writer.Write(Field1C); + writer.WriteArrayFixedLength(CurveData, 32); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.ColorCorrection; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CompositeAnimParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CompositeAnimParam.cs new file mode 100644 index 0000000..823df11 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CompositeAnimParam.cs @@ -0,0 +1,64 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class CompositeAnimParam : BaseParam +{ + public int Field00 { get; set; } + public string StateName { get; set; } + public Animation[] Animations { get; set; } = new Animation[16]; + public int ActiveAnimCount { get; set; } + + public CompositeAnimParam() { } + public CompositeAnimParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + StateName = reader.ReadString(StringBinaryFormat.FixedLength, 12); + Animations = reader.ReadObjectArray(16); + ActiveAnimCount = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.WriteString(StringBinaryFormat.FixedLength, StateName, 12); + writer.WriteObjectCollection(Animations); + writer.Write(ActiveAnimCount); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.CompositeAnimation; } + + public class Animation : IBinarySerializable + { + public int Type { get; set; } + public string Name { get; set; } + + public Animation() + { + Type = (int)AnimationType.None; + Name = ""; + } + + public void Read(BinaryObjectReader reader) + { + Type = reader.Read(); + Name = reader.ReadString(StringBinaryFormat.FixedLength, 64); + } + + public void Write(BinaryObjectWriter writer) + { + writer.Write(Type); + writer.WriteString(StringBinaryFormat.FixedLength, Name, 64); + } + } + + public enum AnimationType + { + None = 0, + PXD = 1, + UV = 2, + Visibility = 3, + Material = 4, + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ControllerVibrationParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ControllerVibrationParam.cs new file mode 100644 index 0000000..bbcb8e2 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ControllerVibrationParam.cs @@ -0,0 +1,37 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class ControllerVibrationParam : BaseParam +{ + public int Field00 { get; set; } + public string Group { get; set; } + public string Mode { get; set; } + public uint Field84 { get; set; } + public uint Field88 { get; set; } + public uint Field8C { get; set; } + + public ControllerVibrationParam() { } + public ControllerVibrationParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Group = reader.ReadString(StringBinaryFormat.FixedLength, 64); + Mode = reader.ReadString(StringBinaryFormat.FixedLength, 64); + Field84 = reader.Read(); + Field88 = reader.Read(); + Field8C = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.WriteString(StringBinaryFormat.FixedLength, Group, 64); + writer.WriteString(StringBinaryFormat.FixedLength, Mode, 64); + writer.Write(Field84); + writer.Write(Field88); + writer.Write(Field8C); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.ControllerVibration; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CullDisabledParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CullDisabledParam.cs new file mode 100644 index 0000000..baea6f4 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CullDisabledParam.cs @@ -0,0 +1,14 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class CullDisabledParam : BaseParam +{ + public CullDisabledParam() { } + public CullDisabledParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) { } + + public override void Write(BinaryObjectWriter writer, GameType game) { } + + public override int GetTypeID(GameType game) { return (int)ParameterType.CullDisabled; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CyberNoiseParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CyberNoiseParam.cs new file mode 100644 index 0000000..fad6bf1 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/CyberNoiseParam.cs @@ -0,0 +1,35 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class CyberNoiseParam : BaseParam +{ + public uint Field00 { get; set; } + public float[] CurveData { get; set; } = new float[32]; + + public CyberNoiseParam() { } + public CyberNoiseParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + reader.ReadArray(32, CurveData); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.WriteArrayFixedLength(CurveData, 32); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.CyberNoise; + + default: + return 0; + } + } +} diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/DOFParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/DOFParam.cs new file mode 100644 index 0000000..deffcf1 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/DOFParam.cs @@ -0,0 +1,106 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class DOFParam : BaseParam +{ + public int Field00 { get; set; } + public Endpoint EndpointA { get; set; } = new Endpoint(); + public Endpoint EndpointB { get; set; } = new Endpoint(); + public float Field24 { get; set; } + public float Field28 { get; set; } + public int Field2C { get; set; } + public int Field30 { get; set; } + public float Field34 { get; set; } + public int Field38 { get; set; } + public int Field3C { get; set; } + public int Field40 { get; set; } + public int Field44 { get; set; } + public int Field48 { get; set; } + public int Field4C { get; set; } + public float[] CurveData { get; set; } = new float[32]; + + public DOFParam() { } + public DOFParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + EndpointA = reader.ReadObject(); + EndpointB = reader.ReadObject(); + Field24 = reader.Read(); + Field28 = reader.Read(); + Field2C = reader.Read(); + Field30 = reader.Read(); + Field34 = reader.Read(); + Field38 = reader.Read(); + Field3C = reader.Read(); + Field40 = reader.Read(); + Field44 = reader.Read(); + Field48 = reader.Read(); + Field4C = reader.Read(); + reader.ReadArray(32, CurveData); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.WriteObject(EndpointA); + writer.WriteObject(EndpointB); + writer.Write(Field24); + writer.Write(Field28); + writer.Write(Field2C); + writer.Write(Field30); + writer.Write(Field34); + writer.Write(Field38); + writer.Write(Field3C); + writer.Write(Field40); + writer.Write(Field44); + writer.Write(Field48); + writer.Write(Field4C); + writer.WriteArrayFixedLength(CurveData, 32); + } + + public class Endpoint : IBinarySerializable + { + public float Focus { get; set; } + public float FocusRange { get; set; } + public float Near { get; set; } + public float Far { get; set; } + + public Endpoint() { } + + public Endpoint(BinaryObjectReader reader) + => Read(reader); + + public void Read(BinaryObjectReader reader) + { + Focus = reader.Read(); + FocusRange = reader.Read(); + Near = reader.Read(); + Far = reader.Read(); + } + + public void Write(BinaryObjectWriter writer) + { + writer.Write(Focus); + writer.Write(FocusRange); + writer.Write(Near); + writer.Write(Far); + } + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.DepthOfField; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.DepthOfField; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/DrawOffParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/DrawOffParam.cs new file mode 100644 index 0000000..42c9579 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/DrawOffParam.cs @@ -0,0 +1,31 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +class DrawOffParam : BaseParam +{ + public int Field00 { get; set; } + public int Field04 { get; set; } + public int Field08 { get; set; } + public int Field0C { get; set; } + + public DrawOffParam() { } + public DrawOffParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.DrawingOff; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/EffectParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/EffectParam.cs new file mode 100644 index 0000000..024a790 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/EffectParam.cs @@ -0,0 +1,55 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class EffectParam : BaseParam +{ + public Matrix4x4 LocalTransform { get; set; } + public int Field40 { get; set; } + public string Name { get; set; } + public int Field84 { get; set; } + public int Field88 { get; set; } + public int Field8C { get; set; } + public int Field90 { get; set; } + public int Field94 { get; set; } + public int Field98 { get; set; } + public int Field9C { get; set; } + public int FieldA0 { get; set; } + public float[] AnimationData { get; set; } = new float[128]; + + public EffectParam() { } + public EffectParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + LocalTransform = reader.Read(); + Field40 = reader.Read(); + Name = reader.ReadDiString(64); + Field84 = reader.Read(); + Field88 = reader.Read(); + Field8C = reader.Read(); + Field90 = reader.Read(); + Field94 = reader.Read(); + Field98 = reader.Read(); + Field9C = reader.Read(); + FieldA0 = reader.Read(); + reader.ReadArray(128, AnimationData); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(LocalTransform); + writer.Write(Field40); + writer.WriteDiString(Name); + writer.Write(Field84); + writer.Write(Field88); + writer.Write(Field8C); + writer.Write(Field90); + writer.Write(Field94); + writer.Write(Field98); + writer.Write(Field9C); + writer.Write(FieldA0); + writer.WriteArrayFixedLength(AnimationData, 128); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.Effect; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/FadeParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/FadeParam.cs new file mode 100644 index 0000000..f8e15ec --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/FadeParam.cs @@ -0,0 +1,38 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class FadeParam : BaseParam +{ + Color Color { get; set; } + public float[] CurveData { get; set; } = new float[32]; + + public FadeParam() { } + public FadeParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Color = reader.Read>(); + reader.ReadArray(32, CurveData); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Color); + writer.WriteArrayFixedLength(CurveData, 32); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.Fade; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.Fade; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/FalloffToggleParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/FalloffToggleParam.cs new file mode 100644 index 0000000..25043e7 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/FalloffToggleParam.cs @@ -0,0 +1,32 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class FalloffToggleParam : BaseParam +{ + public float Intensity { get; set; } + + public FalloffToggleParam() { } + public FalloffToggleParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Intensity = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Intensity); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.ShadowGenerations: + return (int)ShadowGensParams.FalloffToggle; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/GameCameraParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/GameCameraParam.cs new file mode 100644 index 0000000..5ec7795 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/GameCameraParam.cs @@ -0,0 +1,97 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class GameCameraParam : BaseParam +{ + public int Field00 { get; set; } + public int Field04 { get; set; } + public int Field08 { get; set; } + public int Field0C { get; set; } + public float Field10 { get; set; } + public float Field14 { get; set; } + public float Field18 { get; set; } + public int Field1C { get; set; } + public int Field20 { get; set; } + public int Field24 { get; set; } + public float Field28 { get; set; } + public float Field2C { get; set; } + public float Field30 { get; set; } + public int Field34 { get; set; } + public int Field38 { get; set; } + public int Field3C { get; set; } + public int Field40 { get; set; } + public float Field44 { get; set; } + public int Field48 { get; set; } + public int Field4C { get; set; } + public float NearCullingPlane { get; set; } + public float FarCullingPlane { get; set; } + public float Field58 { get; set; } + public int Field5C { get; set; } + public int Field60 { get; set; } + public int Field64 { get; set; } + + public GameCameraParam() { } + public GameCameraParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.Read(); + Field14 = reader.Read(); + Field18 = reader.Read(); + Field1C = reader.Read(); + Field20 = reader.Read(); + Field24 = reader.Read(); + Field28 = reader.Read(); + Field2C = reader.Read(); + Field30 = reader.Read(); + Field34 = reader.Read(); + Field38 = reader.Read(); + Field3C = reader.Read(); + Field40 = reader.Read(); + Field44 = reader.Read(); + Field48 = reader.Read(); + Field4C = reader.Read(); + NearCullingPlane = reader.Read(); + FarCullingPlane = reader.Read(); + Field58 = reader.Read(); + Field5C = reader.Read(); + Field60 = reader.Read(); + Field64 = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + writer.Write(Field10); + writer.Write(Field14); + writer.Write(Field18); + writer.Write(Field1C); + writer.Write(Field20); + writer.Write(Field24); + writer.Write(Field28); + writer.Write(Field2C); + writer.Write(Field30); + writer.Write(Field34); + writer.Write(Field38); + writer.Write(Field3C); + writer.Write(Field40); + writer.Write(Field44); + writer.Write(Field48); + writer.Write(Field4C); + writer.Write(NearCullingPlane); + writer.Write(FarCullingPlane); + writer.Write(Field58); + writer.Write(Field5C); + writer.Write(Field60); + writer.Write(Field64); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.GameCamera; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/MaterialAnimParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/MaterialAnimParam.cs new file mode 100644 index 0000000..7bd1057 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/MaterialAnimParam.cs @@ -0,0 +1,37 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class MaterialAnimParam : BaseParam +{ + public int Field00 { get; set; } + public string Name { get; set; } + public int Field44 { get; set; } + public float Field48 { get; set; } + public int Field4C { get; set; } + public int Field50 { get; set; } + + public MaterialAnimParam() { } + public MaterialAnimParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Name = reader.ReadDiString(64); + Field44 = reader.Read(); + Field48 = reader.Read(); + Field4C = reader.Read(); + Field50 = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.WriteDiString(Name, 64); + writer.Write(Field44); + writer.Write(Field48); + writer.Write(Field4C); + writer.Write(Field50); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.MaterialAnimation; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/MaterialParameterParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/MaterialParameterParam.cs new file mode 100644 index 0000000..7fd1dfa --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/MaterialParameterParam.cs @@ -0,0 +1,36 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class MaterialParameterParam : BaseParam +{ + public string MaterialName { get; set; } + public string ParamName { get; set; } + public uint Type { get; set; } + public uint[] UnknownData { get; set; } = new uint[40]; + + public MaterialParameterParam() { } + public MaterialParameterParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + MaterialName = reader.ReadString(StringBinaryFormat.FixedLength, 64); + ParamName = reader.ReadString(StringBinaryFormat.FixedLength, 64); + Type = reader.Read(); + reader.ReadArray(40, UnknownData); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.WriteString(StringBinaryFormat.FixedLength, MaterialName, 64); + writer.WriteString(StringBinaryFormat.FixedLength, ParamName, 64); + writer.Write(Type); + writer.WriteArrayFixedLength(UnknownData, 40); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.MaterialParameter; } + + public enum ParamType + { + Float = 3 + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/MovieDisplayParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/MovieDisplayParam.cs new file mode 100644 index 0000000..dc259cb --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/MovieDisplayParam.cs @@ -0,0 +1,27 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class MovieDisplayParam : BaseParam +{ + public MovieDisplayParam() { } + public MovieDisplayParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) { } + + public override void Write(BinaryObjectWriter writer, GameType game) { } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.MovieDisplay; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.MovieDisplay; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/PathAdjustParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/PathAdjustParam.cs new file mode 100644 index 0000000..4698b92 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/PathAdjustParam.cs @@ -0,0 +1,34 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class PathAdjustParam : BaseParam +{ + public Matrix4x4 LocalTransform { get; set; } + public int Field40 { get; set; } + public int Field44 { get; set; } + public int Field48 { get; set; } + public int Field4C { get; set; } + + public PathAdjustParam() { } + public PathAdjustParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + LocalTransform = reader.Read(); + Field40 = reader.Read(); + Field44 = reader.Read(); + Field48 = reader.Read(); + Field4C = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(LocalTransform); + writer.Write(Field40); + writer.Write(Field44); + writer.Write(Field48); + writer.Write(Field4C); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.PathAdjust; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/QTEParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/QTEParam.cs new file mode 100644 index 0000000..d75d83b --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/QTEParam.cs @@ -0,0 +1,153 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class QTEParam : BaseParam +{ + public int Field00 { get; set; } + public int Field04 { get; set; } + public float Field08 { get; set; } + public float Field0C { get; set; } + public float Field10 { get; set; } + public float Field14 { get; set; } + public float Field18 { get; set; } + public float Field1C { get; set; } + public float Field20 { get; set; } + public int Field24 { get; set; } + public int Field28 { get; set; } + public int Field2C { get; set; } + public int Field30 { get; set; } + public int Field34 { get; set; } + public int Field38 { get; set; } + public int Field3C { get; set; } + public int Field40 { get; set; } + public int Field44 { get; set; } + public int Field48 { get; set; } + public int Field4C { get; set; } + public int Field50 { get; set; } + public int Field54 { get; set; } + public int Field58 { get; set; } + public int Field5C { get; set; } + public int Field60 { get; set; } + public int Field64 { get; set; } + public int Field68 { get; set; } + public int Field6C { get; set; } + public float Field70 { get; set; } + public float Field74 { get; set; } + public float Field78 { get; set; } + public float Field7C { get; set; } + public int[] Field80 { get; set; } = new int[32]; + public string Field100 { get; set; } + public string Field140 { get; set; } + public string Field180 { get; set; } + public uint Field1C0 { get; set; } + + public QTEParam() { } + public QTEParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.Read(); + Field14 = reader.Read(); + Field18 = reader.Read(); + Field1C = reader.Read(); + Field20 = reader.Read(); + Field24 = reader.Read(); + Field28 = reader.Read(); + Field2C = reader.Read(); + Field30 = reader.Read(); + Field34 = reader.Read(); + Field38 = reader.Read(); + Field3C = reader.Read(); + Field40 = reader.Read(); + Field44 = reader.Read(); + Field48 = reader.Read(); + Field4C = reader.Read(); + Field50 = reader.Read(); + Field54 = reader.Read(); + Field58 = reader.Read(); + Field5C = reader.Read(); + Field60 = reader.Read(); + Field64 = reader.Read(); + Field68 = reader.Read(); + Field6C = reader.Read(); + Field70 = reader.Read(); + Field74 = reader.Read(); + Field78 = reader.Read(); + Field7C = reader.Read(); + reader.ReadArray(32, Field80); + + Field100 = reader.ReadString(StringBinaryFormat.FixedLength, 64); + Field140 = reader.ReadString(StringBinaryFormat.FixedLength, 64); + + if (game == GameType.ShadowGenerations) + { + Field180 = reader.ReadString(StringBinaryFormat.FixedLength, 64); + Field1C0 = reader.Read(); + } + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + writer.Write(Field10); + writer.Write(Field14); + writer.Write(Field18); + writer.Write(Field1C); + writer.Write(Field20); + writer.Write(Field24); + writer.Write(Field28); + writer.Write(Field2C); + writer.Write(Field30); + writer.Write(Field34); + writer.Write(Field38); + writer.Write(Field3C); + writer.Write(Field40); + writer.Write(Field44); + writer.Write(Field48); + writer.Write(Field4C); + writer.Write(Field50); + writer.Write(Field54); + writer.Write(Field58); + writer.Write(Field5C); + writer.Write(Field60); + writer.Write(Field64); + writer.Write(Field68); + writer.Write(Field6C); + writer.Write(Field70); + writer.Write(Field74); + writer.Write(Field78); + writer.Write(Field7C); + writer.WriteArrayFixedLength(Field80, 32); + + writer.WriteString(StringBinaryFormat.FixedLength, Field100, 64); + writer.WriteString(StringBinaryFormat.FixedLength, Field140, 64); + + if (game == GameType.ShadowGenerations) + { + writer.WriteString(StringBinaryFormat.FixedLength, Field180, 64); + writer.Write(Field1C0); + } + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.QTE; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.QTE; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ShadowAfterimageParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ShadowAfterimageParam.cs new file mode 100644 index 0000000..780a26b --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ShadowAfterimageParam.cs @@ -0,0 +1,56 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class ShadowAfterimageParam : BaseParam +{ + public Color Color { get; set; } + public int Field10 { get; set; } // Possibly afterimage count? + public int Field14 { get; set; } + public int Field18 { get; set; } + public int Field1C { get; set; } + public int Field20 { get; set; } + public float Field24 { get; set; } + public float Field28 { get; set; } + public int Field2C { get; set; } + + public ShadowAfterimageParam() { } + public ShadowAfterimageParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Color = reader.Read>(); + Field10 = reader.Read(); + Field14 = reader.Read(); + Field18 = reader.Read(); + Field1C = reader.Read(); + Field20 = reader.Read(); + Field24 = reader.Read(); + Field28 = reader.Read(); + Field2C = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Color); + writer.Write(Field10); + writer.Write(Field14); + writer.Write(Field18); + writer.Write(Field1C); + writer.Write(Field20); + writer.Write(Field24); + writer.Write(Field28); + writer.Write(Field2C); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.ShadowGenerations: + return (int)ShadowGensParams.ShadowAfterimage; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ShadowResolutionParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ShadowResolutionParam.cs new file mode 100644 index 0000000..c2da85f --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/ShadowResolutionParam.cs @@ -0,0 +1,32 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class ShadowResolutionParam : BaseParam +{ + public Vector2Int Resolution { get; set; } + + public ShadowResolutionParam() { } + public ShadowResolutionParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Resolution = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Resolution); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.ShadowResolution; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/SonicCameraParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/SonicCameraParam.cs new file mode 100644 index 0000000..434ca2a --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/SonicCameraParam.cs @@ -0,0 +1,49 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class SonicCameraParam : BaseParam +{ + public uint Flags { get; set; } + public uint Field04 { get; set; } + public uint Field08 { get; set; } + public uint Field0C { get; set; } + public Vector3 Field10 { get; set; } + public uint Field1C { get; set; } + public uint Field20 { get; set; } + public uint Field24 { get; set; } + public Vector3 Field28 { get; set; } + public byte[] UnknownData { get; set; } = new byte[268]; + + public SonicCameraParam() { } + public SonicCameraParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Flags = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.Read(); + Field1C = reader.Read(); + Field20 = reader.Read(); + Field24 = reader.Read(); + Field28 = reader.Read(); + reader.ReadArray(268, UnknownData); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Flags); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + writer.Write(Field10); + writer.Write(Field1C); + writer.Write(Field20); + writer.Write(Field24); + writer.Write(Field28); + writer.WriteArrayFixedLength(UnknownData, 268); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.SonicCamera; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/SoundParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/SoundParam.cs new file mode 100644 index 0000000..c16aa76 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/SoundParam.cs @@ -0,0 +1,41 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class SoundParam : BaseParam +{ + public string CueName { get; set; } + public int Field40 { get; set; } + public int Field44 { get; set; } + + public SoundParam() { } + public SoundParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + CueName = reader.ReadDiString(64); + Field40 = reader.Read(); + Field44 = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.WriteDiString(CueName); + writer.Write(Field40); + writer.Write(Field44); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.Sound; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.Sound; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/SubtitleParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/SubtitleParam.cs new file mode 100644 index 0000000..b3d4674 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/SubtitleParam.cs @@ -0,0 +1,84 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class SubtitleParam : BaseParam +{ + public string CellName { get; set; } + public SubtitleLanguage Language { get; set; } + public int Field14 { get; set; } + public int Field24 { get; set; } + public int Field28 { get; set; } + public string CellName2 { get; set; } + + public SubtitleParam() { } + public SubtitleParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + if (game == GameType.ShadowGenerations) + { + CellName = reader.ReadDiString(32); + Language = (SubtitleLanguage)reader.Read(); + Field14 = reader.Read(); + Field24 = reader.Read(); + Field28 = reader.Read(); + CellName2 = reader.ReadDiString(32); + } + else + { + CellName = reader.ReadDiString(16); + Language = (SubtitleLanguage)reader.Read(); + Field14 = reader.Read(); + } + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + if (game == GameType.ShadowGenerations) + { + writer.WriteDiString(CellName, 32); + writer.Write((int)Language); + writer.Write(Field14); + writer.Write(Field24); + writer.Write(Field28); + writer.WriteDiString(CellName2, 32); + } + else + { + writer.WriteDiString(CellName, 16); + writer.Write((int)Language); + writer.Write(Field14); + } + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.Subtitle; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.Subtitle; + + default: + return 0; + } + } + + public enum SubtitleLanguage + { + English = 0, + French = 1, + Italian = 2, + German = 3, + Spanish = 4, + Polish = 5, + Portuguese = 6, + Russian = 7, + Japanese = 8, + Chinese = 9, + ChineseSimplified = 10, + Korean = 11 + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TheEndCableParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TheEndCableParam.cs new file mode 100644 index 0000000..8feb42f --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TheEndCableParam.cs @@ -0,0 +1,38 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class TheEndCableParam : BaseParam +{ + public int Field00 { get; set; } + public int Field04 { get; set; } + public float[] Field08 { get; set; } = new float[1024]; + + public TheEndCableParam() { } + public TheEndCableParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + reader.ReadArray(1024, Field08); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.WriteArrayFixedLength(Field08, 1024); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.TheEndCable; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeParam.cs new file mode 100644 index 0000000..d975939 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeParam.cs @@ -0,0 +1,59 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class TimeParam : BaseParam +{ + public uint Field00 { get; set; } + public uint Field04 { get; set; } + public uint Field08 { get; set; } + public uint Field0C { get; set; } + public uint Field10 { get; set; } + public uint Field14 { get; set; } + public uint Field18 { get; set; } + public uint Field1C { get; set; } + public uint Field20 { get; set; } + public float[] DataCurve { get; set; } = new float[32]; + + public TimeParam() { } + public TimeParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.Read(); + Field14 = reader.Read(); + Field18 = reader.Read(); + Field1C = reader.Read(); + Field20 = reader.Read(); + reader.ReadArray(32, DataCurve); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + writer.Write(Field10); + writer.Write(Field14); + writer.Write(Field18); + writer.Write(Field1C); + writer.Write(Field20); + writer.WriteArrayFixedLength(DataCurve, 32); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.Time; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeStopControlParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeStopControlParam.cs new file mode 100644 index 0000000..f661318 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeStopControlParam.cs @@ -0,0 +1,44 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class TimeStopControlParam : BaseParam +{ + public int Behavior { get; set; } + public float Field04 { get; set; } + public float TransitionDuration { get; set; } + + public TimeStopControlParam() { } + public TimeStopControlParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Behavior = reader.Read(); + Field04 = reader.Read(); + TransitionDuration = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Behavior); + writer.Write(Field04); + writer.Write(TransitionDuration); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.ShadowGenerations: + return (int)ShadowGensParams.TimeStopControl; + + default: + return 0; + } + } + + public enum BehaviorMode + { + End = 1, + Begin = 2, + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeStopObjectBehaviorParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeStopObjectBehaviorParam.cs new file mode 100644 index 0000000..f71fd6e --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeStopObjectBehaviorParam.cs @@ -0,0 +1,32 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class TimeStopObjectBehaviorParam : BaseParam +{ + public int Mode { get; set; } + + public TimeStopObjectBehaviorParam() { } + public TimeStopObjectBehaviorParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Mode = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Mode); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.ShadowGenerations: + return (int)ShadowGensParams.TimeStopObjectBehavior; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeStopParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeStopParam.cs new file mode 100644 index 0000000..c16ff55 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimeStopParam.cs @@ -0,0 +1,38 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class TimeStopParam : BaseParam +{ + public int Field00 { get; set; } + public float Field04 { get; set; } + public float Field08 { get; set; } + + public TimeStopParam() { } + public TimeStopParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.ShadowGenerations: + return (int)ShadowGensParams.TimeStop; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimescaleParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimescaleParam.cs new file mode 100644 index 0000000..b712df4 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/TimescaleParam.cs @@ -0,0 +1,44 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class TimescaleParam : BaseParam +{ + public int Field00 { get; set; } + public float Scale { get; set; } + public int Field08 { get; set; } + public int Field0C { get; set; } + + public TimescaleParam() { } + public TimescaleParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Scale = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Scale); + writer.Write(Field08); + writer.Write(Field0C); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.TimescaleChange; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.TimescaleChange; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/UVAnimParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/UVAnimParam.cs new file mode 100644 index 0000000..543de92 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/UVAnimParam.cs @@ -0,0 +1,37 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class UVAnimParam : BaseParam +{ + public int Field00 { get; set; } + public string Name { get; set; } + public int Field44 { get; set; } + public float Field48 { get; set; } + public int Field4C { get; set; } + public int Field50 { get; set; } + + public UVAnimParam() { } + public UVAnimParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Name = reader.ReadDiString(64); + Field44 = reader.Read(); + Field48 = reader.Read(); + Field4C = reader.Read(); + Field50 = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.WriteDiString(Name, 64); + writer.Write(Field44); + writer.Write(Field48); + writer.Write(Field4C); + writer.Write(Field50); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.UVAnimation; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/UnknownParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/UnknownParam.cs new file mode 100644 index 0000000..265b489 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/UnknownParam.cs @@ -0,0 +1,30 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class UnknownParam : BaseParam +{ + public byte[] Data { get; set; } + public int Size { get; set; } + public int Type { get; set; } + + public UnknownParam() { } + public UnknownParam(BinaryObjectReader reader, int size, int type) + { + Size = size; + Type = type; + Data = new byte[Size * 4]; + + Read(reader, GameType.Common); + } + + public override void Read(BinaryObjectReader reader, GameType game) + { + reader.ReadArray(Size * 4, Data); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.WriteArrayFixedLength(Data, Size * 4); + } + + public override int GetTypeID(GameType game) { return Type; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/VignetteParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/VignetteParam.cs new file mode 100644 index 0000000..675ce48 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/VignetteParam.cs @@ -0,0 +1,187 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class VignetteParam : BaseParam +{ + public int Field00 { get; set; } + public int Field04 { get; set; } + public float Field08 { get; set; } + public float Field0C { get; set; } + public float Field10 { get; set; } + public float Field14 { get; set; } + public float Field18 { get; set; } + public float Field1C { get; set; } + public float Field20 { get; set; } + public int Field24 { get; set; } + public float Field28 { get; set; } + public float Field2C { get; set; } + public float Field30 { get; set; } + public float Field34 { get; set; } + public float Field38 { get; set; } + public float Field3C { get; set; } + public float Field40 { get; set; } + public float Field44 { get; set; } + public float Field48 { get; set; } + public float Field4C { get; set; } + public float Field50 { get; set; } + public float Field54 { get; set; } + public float Field58 { get; set; } + public float Field5C { get; set; } + public float Field60 { get; set; } + public float Field64 { get; set; } + public float Field68 { get; set; } + public float Field6C { get; set; } + public float Field70 { get; set; } + public float Field74 { get; set; } + public float Field78 { get; set; } + public float Field7C { get; set; } + public float Field80 { get; set; } + public float Field84 { get; set; } + public int Field88 { get; set; } + public float Field8C { get; set; } + public float Field90 { get; set; } + public float Field94 { get; set; } + public float Field98 { get; set; } + public float Field9C { get; set; } + public float FieldA0 { get; set; } + public float FieldA4 { get; set; } + public float FieldA8 { get; set; } + public float FieldAC { get; set; } + public float FieldB0 { get; set; } + public float FieldB4 { get; set; } + public float FieldB8 { get; set; } + public float FieldBC { get; set; } + public float FieldC0 { get; set; } + public float FieldC4 { get; set; } + public float[] ValuesTimeline { get; set; } = new float[32]; + + public VignetteParam() { } + public VignetteParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Field04 = reader.Read(); + Field08 = reader.Read(); + Field0C = reader.Read(); + Field10 = reader.Read(); + Field14 = reader.Read(); + Field18 = reader.Read(); + Field1C = reader.Read(); + Field20 = reader.Read(); + Field24 = reader.Read(); + Field28 = reader.Read(); + Field2C = reader.Read(); + Field30 = reader.Read(); + Field34 = reader.Read(); + Field38 = reader.Read(); + Field3C = reader.Read(); + Field40 = reader.Read(); + Field44 = reader.Read(); + Field48 = reader.Read(); + Field4C = reader.Read(); + Field50 = reader.Read(); + Field54 = reader.Read(); + Field58 = reader.Read(); + Field5C = reader.Read(); + Field60 = reader.Read(); + Field64 = reader.Read(); + Field68 = reader.Read(); + Field6C = reader.Read(); + Field70 = reader.Read(); + Field74 = reader.Read(); + Field78 = reader.Read(); + Field7C = reader.Read(); + Field80 = reader.Read(); + Field84 = reader.Read(); + Field88 = reader.Read(); + Field8C = reader.Read(); + Field90 = reader.Read(); + Field94 = reader.Read(); + Field98 = reader.Read(); + Field9C = reader.Read(); + FieldA0 = reader.Read(); + FieldA4 = reader.Read(); + FieldA8 = reader.Read(); + FieldAC = reader.Read(); + FieldB0 = reader.Read(); + FieldB4 = reader.Read(); + FieldB8 = reader.Read(); + FieldBC = reader.Read(); + FieldC0 = reader.Read(); + FieldC4 = reader.Read(); + + reader.ReadArray(32, ValuesTimeline); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.Write(Field04); + writer.Write(Field08); + writer.Write(Field0C); + writer.Write(Field10); + writer.Write(Field14); + writer.Write(Field18); + writer.Write(Field1C); + writer.Write(Field20); + writer.Write(Field24); + writer.Write(Field28); + writer.Write(Field2C); + writer.Write(Field30); + writer.Write(Field34); + writer.Write(Field38); + writer.Write(Field3C); + writer.Write(Field40); + writer.Write(Field44); + writer.Write(Field48); + writer.Write(Field4C); + writer.Write(Field50); + writer.Write(Field54); + writer.Write(Field58); + writer.Write(Field5C); + writer.Write(Field60); + writer.Write(Field64); + writer.Write(Field68); + writer.Write(Field6C); + writer.Write(Field70); + writer.Write(Field74); + writer.Write(Field78); + writer.Write(Field7C); + writer.Write(Field80); + writer.Write(Field84); + writer.Write(Field88); + writer.Write(Field8C); + writer.Write(Field90); + writer.Write(Field94); + writer.Write(Field98); + writer.Write(Field9C); + writer.Write(FieldA0); + writer.Write(FieldA4); + writer.Write(FieldA8); + writer.Write(FieldAC); + writer.Write(FieldB0); + writer.Write(FieldB4); + writer.Write(FieldB8); + writer.Write(FieldBC); + writer.Write(FieldC0); + writer.Write(FieldC4); + + writer.WriteArrayFixedLength(ValuesTimeline, 32); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.Vignette; + + case GameType.ShadowGenerations: + return (int)ShadowGensParams.Vignette; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/VisibilityAnimParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/VisibilityAnimParam.cs new file mode 100644 index 0000000..d4d1866 --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/VisibilityAnimParam.cs @@ -0,0 +1,37 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class VisibilityAnimParam : BaseParam +{ + public int Field00 { get; set; } + public string Name { get; set; } + public int Field44 { get; set; } + public float Field48 { get; set; } + public int Field4C { get; set; } + public int Field50 { get; set; } + + public VisibilityAnimParam() { } + public VisibilityAnimParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + Name = reader.ReadDiString(64); + Field44 = reader.Read(); + Field48 = reader.Read(); + Field4C = reader.Read(); + Field50 = reader.Read(); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.WriteDiString(Name, 64); + writer.Write(Field44); + writer.Write(Field48); + writer.Write(Field4C); + writer.Write(Field50); + } + + public override int GetTypeID(GameType game) { return (int)ParameterType.VisibilityAnimation; } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/WeatherParam.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/WeatherParam.cs new file mode 100644 index 0000000..c46bccb --- /dev/null +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Parameters/WeatherParam.cs @@ -0,0 +1,35 @@ +namespace SharpNeedle.SonicTeam.DiEvent; + +public class WeatherParam : BaseParam +{ + public uint Field00 { get; set; } + public float[] DataCurve { get; set; } = new float[32]; + + public WeatherParam() { } + public WeatherParam(BinaryObjectReader reader, GameType game) + => Read(reader, game); + + public override void Read(BinaryObjectReader reader, GameType game) + { + Field00 = reader.Read(); + reader.ReadArray(32, DataCurve); + } + + public override void Write(BinaryObjectWriter writer, GameType game) + { + writer.Write(Field00); + writer.WriteArrayFixedLength(DataCurve, 32); + } + + public override int GetTypeID(GameType game) + { + switch (game) + { + case GameType.Frontiers: + return (int)FrontiersParams.Weather; + + default: + return 0; + } + } +} \ No newline at end of file diff --git a/Source/SharpNeedle/SonicTeam/DiEvent/Scene.cs b/Source/SharpNeedle/SonicTeam/DiEvent/Scene.cs index 7fee65b..c75bb95 100644 --- a/Source/SharpNeedle/SonicTeam/DiEvent/Scene.cs +++ b/Source/SharpNeedle/SonicTeam/DiEvent/Scene.cs @@ -17,9 +17,10 @@ public class Scene : ResourceBase, IBinarySerializable public float ChainCameraOut { get; set; } int Type { get; set; } int SkipPointTick { get; set; } - public List Resources { get; set; } = new(); + private GameType LastGame { get; set; } = GameType.Common; + public Scene() { // Register encoding provider for Shift-JIS strings @@ -40,11 +41,15 @@ public void Read(IFile file, GameType game) using var reader = new BinaryObjectReader(file.Open(), StreamOwnership.Transfer, Endianness.Little); reader.OffsetBinaryFormat = OffsetBinaryFormat.U32; + LastGame = game; Read(reader, game); } public override void Write(IFile file) - => Write(file, GameType.Common); + => Write(file, LastGame); + + public void Write(string path, GameType game) + => Write(FileSystem.Create(path), game); public void Write(IFile file, GameType game) { @@ -53,6 +58,7 @@ public void Write(IFile file, GameType game) using var writer = new BinaryObjectWriter(file.Open(FileAccess.Write), StreamOwnership.Transfer, Endianness.Little); writer.OffsetBinaryFormat = OffsetBinaryFormat.U32; + LastGame = game; Write(writer, game); } @@ -216,10 +222,10 @@ public void Write(BinaryObjectWriter writer, GameType game) } { - long unknownList4Pos = writer.Position; + long posUnknownList4 = writer.Position; writer.Seek(unknownList4OffsetPos, SeekOrigin.Begin); - writer.Write((int)(unknownList4Pos - posStart)); - writer.Seek(unknownList4Pos, SeekOrigin.Begin); + writer.Write((int)(posUnknownList4 - posStart)); + writer.Seek(posUnknownList4, SeekOrigin.Begin); writer.WriteNulls(16); }