- [Core] Fix parsing for +2022.x.x
This commit is contained in:
@@ -470,6 +470,7 @@ namespace AssetStudio
|
|||||||
public string path;
|
public string path;
|
||||||
public ClassIDType classID;
|
public ClassIDType classID;
|
||||||
public PPtr<MonoScript> script;
|
public PPtr<MonoScript> script;
|
||||||
|
public int flags;
|
||||||
|
|
||||||
public FloatCurve(string path, string attribute, ClassIDType classID, PPtr<MonoScript> script)
|
public FloatCurve(string path, string attribute, ClassIDType classID, PPtr<MonoScript> script)
|
||||||
{
|
{
|
||||||
@@ -478,15 +479,22 @@ namespace AssetStudio
|
|||||||
this.path = path;
|
this.path = path;
|
||||||
this.classID = classID;
|
this.classID = classID;
|
||||||
this.script = script;
|
this.script = script;
|
||||||
|
flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FloatCurve(ObjectReader reader)
|
public FloatCurve(ObjectReader reader)
|
||||||
{
|
{
|
||||||
|
var version = reader.version;
|
||||||
|
|
||||||
curve = new AnimationCurve<Float>(reader, reader.ReadFloat);
|
curve = new AnimationCurve<Float>(reader, reader.ReadFloat);
|
||||||
attribute = reader.ReadAlignedString();
|
attribute = reader.ReadAlignedString();
|
||||||
path = reader.ReadAlignedString();
|
path = reader.ReadAlignedString();
|
||||||
classID = (ClassIDType)reader.ReadInt32();
|
classID = (ClassIDType)reader.ReadInt32();
|
||||||
script = new PPtr<MonoScript>(reader);
|
script = new PPtr<MonoScript>(reader);
|
||||||
|
if (version[0] == 2022 && version[1] >= 2) //2022.2 and up
|
||||||
|
{
|
||||||
|
flags = reader.ReadInt32();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public YAMLNode ExportYAML(int[] version)
|
public YAMLNode ExportYAML(int[] version)
|
||||||
@@ -500,6 +508,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
node.Add(nameof(script), script.ExportYAML(version));
|
node.Add(nameof(script), script.ExportYAML(version));
|
||||||
}
|
}
|
||||||
|
node.Add(nameof(flags), flags);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,6 +564,7 @@ namespace AssetStudio
|
|||||||
public string path;
|
public string path;
|
||||||
public int classID;
|
public int classID;
|
||||||
public PPtr<MonoScript> script;
|
public PPtr<MonoScript> script;
|
||||||
|
public int flags;
|
||||||
|
|
||||||
public PPtrCurve(string path, string attribute, ClassIDType classID, PPtr<MonoScript> script)
|
public PPtrCurve(string path, string attribute, ClassIDType classID, PPtr<MonoScript> script)
|
||||||
{
|
{
|
||||||
@@ -563,10 +573,13 @@ namespace AssetStudio
|
|||||||
this.path = path;
|
this.path = path;
|
||||||
this.classID = (int)classID;
|
this.classID = (int)classID;
|
||||||
this.script = script;
|
this.script = script;
|
||||||
|
flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PPtrCurve(ObjectReader reader)
|
public PPtrCurve(ObjectReader reader)
|
||||||
{
|
{
|
||||||
|
var version = reader.version;
|
||||||
|
|
||||||
int numCurves = reader.ReadInt32();
|
int numCurves = reader.ReadInt32();
|
||||||
curve = new List<PPtrKeyframe>();
|
curve = new List<PPtrKeyframe>();
|
||||||
for (int i = 0; i < numCurves; i++)
|
for (int i = 0; i < numCurves; i++)
|
||||||
@@ -578,6 +591,10 @@ namespace AssetStudio
|
|||||||
path = reader.ReadAlignedString();
|
path = reader.ReadAlignedString();
|
||||||
classID = reader.ReadInt32();
|
classID = reader.ReadInt32();
|
||||||
script = new PPtr<MonoScript>(reader);
|
script = new PPtr<MonoScript>(reader);
|
||||||
|
if (version[0] == 2022 && version[1] >= 2) //2022.2 and up
|
||||||
|
{
|
||||||
|
flags = reader.ReadInt32();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public YAMLNode ExportYAML(int[] version)
|
public YAMLNode ExportYAML(int[] version)
|
||||||
@@ -586,8 +603,9 @@ namespace AssetStudio
|
|||||||
node.Add(nameof(curve), curve.ExportYAML(version));
|
node.Add(nameof(curve), curve.ExportYAML(version));
|
||||||
node.Add(nameof(attribute), attribute);
|
node.Add(nameof(attribute), attribute);
|
||||||
node.Add(nameof(path), path);
|
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(script), script.ExportYAML(version));
|
||||||
|
node.Add(nameof(flags), flags);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,6 +627,7 @@ namespace AssetStudio
|
|||||||
hash = hash * 433 + path.GetHashCode();
|
hash = hash * 433 + path.GetHashCode();
|
||||||
hash = hash * 223 + classID.GetHashCode();
|
hash = hash * 223 + classID.GetHashCode();
|
||||||
hash = hash * 911 + script.GetHashCode();
|
hash = hash * 911 + script.GetHashCode();
|
||||||
|
hash = hash * 342 + flags.GetHashCode();
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 class SerializedProgram
|
||||||
{
|
{
|
||||||
public List<SerializedSubProgram> m_SubPrograms;
|
public List<SerializedSubProgram> m_SubPrograms;
|
||||||
|
public List<List<SerializedPlayerSubProgram>> m_PlayerSubPrograms;
|
||||||
|
public uint[][] m_ParameterBlobIndices;
|
||||||
public SerializedProgramParameters m_CommonParameters;
|
public SerializedProgramParameters m_CommonParameters;
|
||||||
public ushort[] m_SerializedKeywordStateMask;
|
public ushort[] m_SerializedKeywordStateMask;
|
||||||
|
|
||||||
@@ -730,6 +752,26 @@ namespace AssetStudio
|
|||||||
m_SubPrograms.Add(new SerializedSubProgram(reader));
|
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<List<SerializedPlayerSubProgram>>();
|
||||||
|
for (int i = 0; i < numPlayerSubPrograms; i++)
|
||||||
|
{
|
||||||
|
m_PlayerSubPrograms.Add(new List<SerializedPlayerSubProgram>());
|
||||||
|
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) ||
|
if ((version[0] == 2020 && version[1] > 3) ||
|
||||||
(version[0] == 2020 && version[1] == 3 && version[2] >= 2) || //2020.3.2f1 and up
|
(version[0] == 2020 && version[1] == 3 && version[2] >= 2) || //2020.3.2f1 and up
|
||||||
(version[0] > 2021) ||
|
(version[0] > 2021) ||
|
||||||
@@ -999,6 +1041,7 @@ namespace AssetStudio
|
|||||||
public uint[][] compressedLengths;
|
public uint[][] compressedLengths;
|
||||||
public uint[][] decompressedLengths;
|
public uint[][] decompressedLengths;
|
||||||
public byte[] compressedBlob;
|
public byte[] compressedBlob;
|
||||||
|
public uint[] stageCounts;
|
||||||
|
|
||||||
public override string Name => m_ParsedForm?.m_Name ?? m_Name;
|
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();
|
var m_DependenciesCount = reader.ReadInt32();
|
||||||
for (int i = 0; i < m_DependenciesCount; i++)
|
for (int i = 0; i < m_DependenciesCount; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -99,6 +99,10 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
var m_IgnoreMasterTextureLimit = reader.ReadBoolean();
|
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] >= 3) //3.0.0 - 5.4
|
||||||
{
|
{
|
||||||
if (version[0] < 5 || (version[0] == 5 && version[1] <= 4))
|
if (version[0] < 5 || (version[0] == 5 && version[1] <= 4))
|
||||||
|
|||||||
@@ -152,15 +152,15 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public string ReadAlignedString()
|
public string ReadAlignedString()
|
||||||
{
|
{
|
||||||
|
var result = "";
|
||||||
var length = ReadInt32();
|
var length = ReadInt32();
|
||||||
if (length > 0 && length <= Remaining)
|
if (length > 0 && length <= Remaining)
|
||||||
{
|
{
|
||||||
var stringData = ReadBytes(length);
|
var stringData = ReadBytes(length);
|
||||||
var result = Encoding.UTF8.GetString(stringData);
|
result = Encoding.UTF8.GetString(stringData);
|
||||||
AlignStream(4);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
return "";
|
AlignStream();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReadStringToNull(int maxLength = 32767)
|
public string ReadStringToNull(int maxLength = 32767)
|
||||||
|
|||||||
Reference in New Issue
Block a user