diff --git a/AssetStudio/Classes/AnimationClip.cs b/AssetStudio/Classes/AnimationClip.cs index 16f7a1f..0279b47 100644 --- a/AssetStudio/Classes/AnimationClip.cs +++ b/AssetStudio/Classes/AnimationClip.cs @@ -470,6 +470,7 @@ namespace AssetStudio public string path; public ClassIDType classID; public PPtr script; + public int flags; public FloatCurve(string path, string attribute, ClassIDType classID, PPtr script) { @@ -478,15 +479,22 @@ namespace AssetStudio this.path = path; this.classID = classID; this.script = script; + flags = 0; } public FloatCurve(ObjectReader reader) { + var version = reader.version; + curve = new AnimationCurve(reader, reader.ReadFloat); attribute = reader.ReadAlignedString(); path = reader.ReadAlignedString(); classID = (ClassIDType)reader.ReadInt32(); script = new PPtr(reader); + if (version[0] == 2022 && version[1] >= 2) //2022.2 and up + { + flags = reader.ReadInt32(); + } } public YAMLNode ExportYAML(int[] version) @@ -500,6 +508,7 @@ namespace AssetStudio { node.Add(nameof(script), script.ExportYAML(version)); } + node.Add(nameof(flags), flags); return node; } @@ -555,6 +564,7 @@ namespace AssetStudio public string path; public int classID; public PPtr script; + public int flags; public PPtrCurve(string path, string attribute, ClassIDType classID, PPtr script) { @@ -563,10 +573,13 @@ namespace AssetStudio this.path = path; this.classID = (int)classID; this.script = script; + flags = 0; } public PPtrCurve(ObjectReader reader) { + var version = reader.version; + int numCurves = reader.ReadInt32(); curve = new List(); for (int i = 0; i < numCurves; i++) @@ -578,6 +591,10 @@ namespace AssetStudio path = reader.ReadAlignedString(); classID = reader.ReadInt32(); script = new PPtr(reader); + if (version[0] == 2022 && version[1] >= 2) //2022.2 and up + { + flags = reader.ReadInt32(); + } } public YAMLNode ExportYAML(int[] version) @@ -586,8 +603,9 @@ namespace AssetStudio node.Add(nameof(curve), curve.ExportYAML(version)); node.Add(nameof(attribute), attribute); node.Add(nameof(path), path); - node.Add(nameof(classID), ((int)classID).ToString()); + node.Add(nameof(classID), (classID).ToString()); node.Add(nameof(script), script.ExportYAML(version)); + node.Add(nameof(flags), flags); return node; } @@ -609,6 +627,7 @@ namespace AssetStudio hash = hash * 433 + path.GetHashCode(); hash = hash * 223 + classID.GetHashCode(); hash = hash * 911 + script.GetHashCode(); + hash = hash * 342 + flags.GetHashCode(); } return hash; } diff --git a/AssetStudio/Classes/Shader.cs b/AssetStudio/Classes/Shader.cs index 59aa4b1..75e1b6b 100644 --- a/AssetStudio/Classes/Shader.cs +++ b/AssetStudio/Classes/Shader.cs @@ -713,9 +713,31 @@ namespace AssetStudio } } + public class SerializedPlayerSubProgram + { + public uint m_BlobIndex; + public ushort[] m_KeywordIndices; + public long m_ShaderRequirements; + public ShaderGpuProgramType m_GpuProgramType; + + public SerializedPlayerSubProgram(ObjectReader reader) + { + m_BlobIndex = reader.ReadUInt32(); + + m_KeywordIndices = reader.ReadUInt16Array(); + reader.AlignStream(); + + m_ShaderRequirements = reader.ReadInt64(); + m_GpuProgramType = (ShaderGpuProgramType)reader.ReadSByte(); + reader.AlignStream(); + } + } + public class SerializedProgram { public List m_SubPrograms; + public List> m_PlayerSubPrograms; + public uint[][] m_ParameterBlobIndices; public SerializedProgramParameters m_CommonParameters; public ushort[] m_SerializedKeywordStateMask; @@ -730,6 +752,26 @@ namespace AssetStudio m_SubPrograms.Add(new SerializedSubProgram(reader)); } + if ((version[0] == 2021 && version[1] > 3) || + version[0] == 2021 && version[1] == 3 && version[2] >= 10 || //2021.3.10f1 and up + (version[0] == 2022 && version[1] > 1) || + version[0] == 2022 && version[1] == 1 && version[2] >= 13) //2022.1.13f1 and up + { + int numPlayerSubPrograms = reader.ReadInt32(); + m_PlayerSubPrograms = new List>(); + for (int i = 0; i < numPlayerSubPrograms; i++) + { + m_PlayerSubPrograms.Add(new List()); + int numPlatformPrograms = reader.ReadInt32(); + for (int j = 0; j < numPlatformPrograms; j++) + { + m_PlayerSubPrograms[i].Add(new SerializedPlayerSubProgram(reader)); + } + } + + m_ParameterBlobIndices = reader.ReadUInt32ArrayArray(); + } + if ((version[0] == 2020 && version[1] > 3) || (version[0] == 2020 && version[1] == 3 && version[2] >= 2) || //2020.3.2f1 and up (version[0] > 2021) || @@ -999,6 +1041,7 @@ namespace AssetStudio public uint[][] compressedLengths; public uint[][] decompressedLengths; public byte[] compressedBlob; + public uint[] stageCounts; public override string Name => m_ParsedForm?.m_Name ?? m_Name; @@ -1031,6 +1074,14 @@ namespace AssetStudio } } + if ((version[0] == 2021 && version[1] > 3) || + version[0] == 2021 && version[1] == 3 && version[2] >= 12 || //2021.3.12f1 and up + (version[0] == 2022 && version[1] > 1) || + version[0] == 2022 && version[1] == 1 && version[2] >= 21) //2022.1.21f1 and up + { + stageCounts = reader.ReadUInt32Array(); + } + var m_DependenciesCount = reader.ReadInt32(); for (int i = 0; i < m_DependenciesCount; i++) { diff --git a/AssetStudio/Classes/Texture2D.cs b/AssetStudio/Classes/Texture2D.cs index 87f2d9d..9b8ade2 100644 --- a/AssetStudio/Classes/Texture2D.cs +++ b/AssetStudio/Classes/Texture2D.cs @@ -99,6 +99,10 @@ namespace AssetStudio { var m_IgnoreMasterTextureLimit = reader.ReadBoolean(); } + if (version[0] == 2022 && version[1] >= 2) //2022.2 and up + { + var m_MipmapLimitGroupName = reader.ReadAlignedString(); + } if (version[0] >= 3) //3.0.0 - 5.4 { if (version[0] < 5 || (version[0] == 5 && version[1] <= 4)) diff --git a/AssetStudio/EndianBinaryReader.cs b/AssetStudio/EndianBinaryReader.cs index 74ae4de..94541e6 100644 --- a/AssetStudio/EndianBinaryReader.cs +++ b/AssetStudio/EndianBinaryReader.cs @@ -152,15 +152,15 @@ namespace AssetStudio public string ReadAlignedString() { + var result = ""; var length = ReadInt32(); if (length > 0 && length <= Remaining) { var stringData = ReadBytes(length); - var result = Encoding.UTF8.GetString(stringData); - AlignStream(4); - return result; + result = Encoding.UTF8.GetString(stringData); } - return ""; + AlignStream(); + return result; } public string ReadStringToNull(int maxLength = 32767)