From 6c64b41e9eca148007e4634515c5ac7cfeb97021 Mon Sep 17 00:00:00 2001 From: Razmoth <32140579+Razmoth@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:02:08 +0400 Subject: [PATCH] - [Core] fix parsing issues [ExA] --- AssetStudio/Classes/AnimationClip.cs | 56 +++++++++++++++++++--------- AssetStudio/Classes/Mesh.cs | 7 +++- AssetStudio/Classes/Texture2D.cs | 4 ++ 3 files changed, 49 insertions(+), 18 deletions(-) diff --git a/AssetStudio/Classes/AnimationClip.cs b/AssetStudio/Classes/AnimationClip.cs index 34894a1..2cf6685 100644 --- a/AssetStudio/Classes/AnimationClip.cs +++ b/AssetStudio/Classes/AnimationClip.cs @@ -762,8 +762,8 @@ public HumanPose(ObjectReader reader) if (version[0] > 5 || (version[0] == 5 && version[1] >= 2))//5.2 and up { m_TDoFArray = reader.ReadVector3Array(); - } } + } public static HumanPose ParseGI(ObjectReader reader) { @@ -1118,7 +1118,7 @@ public static DenseClip ParseGI(ObjectReader reader) return denseClip; } } - public class ArkDenseClip : DenseClip + public class ACLDenseClip : DenseClip { public int m_ACLType; public byte[] m_ACLArray; @@ -1130,21 +1130,38 @@ public class ArkDenseClip : DenseClip public uint m_nRotationCurves; public uint m_nEulerCurves; public uint m_nScaleCurves; + public uint m_nGenericCurves; - public ArkDenseClip(ObjectReader reader) : base(reader) + public ACLDenseClip(ObjectReader reader) : base(reader) { m_ACLType = reader.ReadInt32(); - m_ACLArray = reader.ReadUInt8Array(); - reader.AlignStream(); - m_PositionFactor = reader.ReadSingle(); - m_EulerFactor = reader.ReadSingle(); - m_ScaleFactor = reader.ReadSingle(); - m_FloatFactor = reader.ReadSingle(); - m_nPositionCurves = reader.ReadUInt32(); - m_nRotationCurves = reader.ReadUInt32(); - m_nEulerCurves = reader.ReadUInt32(); - m_nScaleCurves = reader.ReadUInt32(); - + if (reader.Game.Type.IsArknightsEndfield()) + { + m_ACLArray = reader.ReadUInt8Array(); + reader.AlignStream(); + m_PositionFactor = reader.ReadSingle(); + m_EulerFactor = reader.ReadSingle(); + m_ScaleFactor = reader.ReadSingle(); + m_FloatFactor = reader.ReadSingle(); + m_nPositionCurves = reader.ReadUInt32(); + m_nRotationCurves = reader.ReadUInt32(); + m_nEulerCurves = reader.ReadUInt32(); + m_nScaleCurves = reader.ReadUInt32(); + } + else if (reader.Game.Type.IsExAstris()) + { + m_nPositionCurves = reader.ReadUInt32(); + m_nRotationCurves = reader.ReadUInt32(); + m_nEulerCurves = reader.ReadUInt32(); + m_nScaleCurves = reader.ReadUInt32(); + m_nGenericCurves = reader.ReadUInt32(); + m_PositionFactor = reader.ReadSingle(); + m_EulerFactor = reader.ReadSingle(); + m_ScaleFactor = reader.ReadSingle(); + m_FloatFactor = reader.ReadSingle(); + m_ACLArray = reader.ReadUInt8Array(); + reader.AlignStream(); + } Process(); } @@ -1181,7 +1198,7 @@ private void Process() { sampleArray.Add(ReadCurve(aclSpan, m_ScaleFactor, ref index)); } - var m_nFloatCurves = m_CurveCount - (m_nPositionCurves + m_nRotationCurves + m_nEulerCurves + m_nScaleCurves); + var m_nFloatCurves = m_CurveCount - (m_nPositionCurves + m_nRotationCurves + m_nEulerCurves + m_nScaleCurves + m_nGenericCurves); for (int j = 0; j < m_nFloatCurves; j++) { sampleArray.Add(ReadCurve(aclSpan, m_FloatFactor, ref index)); @@ -1299,9 +1316,9 @@ public Clip(ObjectReader reader) { var version = reader.version; m_StreamedClip = new StreamedClip(reader); - if (reader.Game.Type.IsArknightsEndfield()) + if (reader.Game.Type.IsArknightsEndfield() || reader.Game.Type.IsExAstris()) { - m_DenseClip = new ArkDenseClip(reader); + m_DenseClip = new ACLDenseClip(reader); } else { @@ -1866,6 +1883,11 @@ public AnimationClip(ObjectReader reader) : base(reader) m_CompressedRotationCurves.Add(new CompressedAnimationCurve(reader)); } + if (reader.Game.Type.IsExAstris()) + { + var m_aclType = reader.ReadInt32(); + } + if (version[0] > 5 || (version[0] == 5 && version[1] >= 3))//5.3 and up { int numEulerCurves = reader.ReadInt32(); diff --git a/AssetStudio/Classes/Mesh.cs b/AssetStudio/Classes/Mesh.cs index 7ab0ba3..d2fb62b 100644 --- a/AssetStudio/Classes/Mesh.cs +++ b/AssetStudio/Classes/Mesh.cs @@ -155,7 +155,7 @@ public VertexData(ObjectReader reader) m_Streams = new List(); for (int i = 0; i < numStreams; i++) { - m_Streams[i] = new StreamInfo(reader); + m_Streams.Add(new StreamInfo(reader)); } if (version[0] < 4) //4.0 down @@ -706,6 +706,11 @@ public Mesh(ObjectReader reader) : base(reader) int m_CollisionVertexCount = reader.ReadInt32(); } + if (reader.Game.Type.IsExAstris()) + { + var m_ColliderType = reader.ReadInt32(); + } + int m_MeshUsageFlags = reader.ReadInt32(); if (version[0] > 2022 || (version[0] == 2022 && version[1] >= 1)) //2022.1 and up diff --git a/AssetStudio/Classes/Texture2D.cs b/AssetStudio/Classes/Texture2D.cs index b4ea00b..3dc23c4 100644 --- a/AssetStudio/Classes/Texture2D.cs +++ b/AssetStudio/Classes/Texture2D.cs @@ -39,6 +39,10 @@ public GLTextureSettings(ObjectReader reader) m_FilterMode = reader.ReadInt32(); m_Aniso = reader.ReadInt32(); m_MipBias = reader.ReadSingle(); + if (reader.Game.Type.IsExAstris()) + { + var m_TextureGroup = reader.ReadInt32(); + } if (version[0] >= 2017)//2017.x and up { m_WrapMode = reader.ReadInt32(); //m_WrapU