Parsing fixes.

This commit is contained in:
Razmoth
2022-10-08 20:29:25 +04:00
parent 68952f0e17
commit 2edba3a4c6
8 changed files with 25 additions and 31 deletions

View File

@@ -588,7 +588,7 @@ namespace AssetStudio
}
public PPtrKeyframe(float time, PPtr<Object> script)
{
time = time;
this.time = time;
value = script;
}

View File

@@ -588,10 +588,10 @@ namespace AssetStudio
var m_Controller = new ControllerConstant(reader);
int tosSize = reader.ReadInt32();
var m_TOS = new KeyValuePair<uint, string>[tosSize];
var m_TOS = new Dictionary<uint, string>(tosSize);
for (int i = 0; i < tosSize; i++)
{
m_TOS[i] = new KeyValuePair<uint, string>(reader.ReadUInt32(), reader.ReadAlignedString());
m_TOS.Add(reader.ReadUInt32(), reader.ReadAlignedString());
}
int numClips = reader.ReadInt32();

View File

@@ -65,14 +65,12 @@ namespace AssetStudio
}
if (reader.Game.Name == "CB1" || reader.Game.Name == "CB2")
{
reader.AlignStream();
IsStreamedScenessetBundle = reader.ReadBoolean();
reader.AlignStream();
PathFlags = reader.ReadInt32();
}
else if (reader.Game.Name == "CB3")
{
reader.AlignStream();
IsStreamedScenessetBundle = reader.ReadBoolean();
reader.AlignStream();
ExplicitDataLayout = reader.ReadInt32();
@@ -80,7 +78,6 @@ namespace AssetStudio
}
else if (reader.Game.Name == "GI")
{
reader.AlignStream();
IsStreamedScenessetBundle = reader.ReadBoolean();
reader.AlignStream();
ExplicitDataLayout = reader.ReadInt32();

View File

@@ -287,7 +287,7 @@ namespace AssetStudio
{
public uint m_AvatarSize;
public AvatarConstant m_Avatar;
public KeyValuePair<uint, string>[] m_TOS;
public Dictionary<uint, string> m_TOS;
public Avatar(ObjectReader reader) : base(reader)
{
@@ -295,10 +295,10 @@ namespace AssetStudio
m_Avatar = new AvatarConstant(reader);
int numTOS = reader.ReadInt32();
m_TOS = new KeyValuePair<uint, string>[numTOS];
m_TOS = new Dictionary<uint, string>(numTOS);
for (int i = 0; i < numTOS; i++)
{
m_TOS[i] = new KeyValuePair<uint, string>(reader.ReadUInt32(), reader.ReadAlignedString());
m_TOS.Add(reader.ReadUInt32(), reader.ReadAlignedString());
}
//HumanDescription m_HumanDescription 2019 and up
@@ -306,7 +306,8 @@ namespace AssetStudio
public string FindBonePath(uint hash)
{
return m_TOS.FirstOrDefault(pair => pair.Key == hash).Value;
m_TOS.TryGetValue(hash, out string path);
return path;
}
}
}

View File

@@ -21,19 +21,19 @@ namespace AssetStudio
public static bool Exportable;
public int Count;
public KeyValuePair<string, Index>[] AssetMap;
public Dictionary<string, Index> AssetMap;
public Dictionary<long, string> Names = new Dictionary<long, string>();
public IndexObject(ObjectReader reader) : base(reader)
{
Count = reader.ReadInt32();
AssetMap = new KeyValuePair<string, Index>[Count];
AssetMap = new Dictionary<string, Index>(Count);
for (int i = 0; i < Count; i++)
{
var key = reader.ReadAlignedString();
var value = new Index(reader);
AssetMap[i] = new KeyValuePair<string, Index>(key, value);
AssetMap.Add(key, value);
if (value.Object.m_FileID == 0)
Names.Add(value.Object.m_PathID, key);

View File

@@ -704,29 +704,25 @@ namespace AssetStudio
var m_CompressLevelTexCoordinates = reader.ReadInt32();
}
if (version[0] > 2018 || (version[0] == 2018 && version[1] >= 2)) //2018.2 and up
if (reader.Game.Name == "GI" || reader.Game.Name == "CB1" || reader.Game.Name == "CB2" || reader.Game.Name == "CB3"
|| version[0] > 2018 || (version[0] == 2018 && version[1] >= 2)) //2018.2 and up
{
var m_MeshMetrics = new float[2];
m_MeshMetrics[0] = reader.ReadSingle();
m_MeshMetrics[1] = reader.ReadSingle();
}
if (reader.Game.Name == "GI" || reader.Game.Name == "CB2" || reader.Game.Name == "CB3")
if (reader.Game.Name == "GI" || reader.Game.Name == "CB1" || reader.Game.Name == "CB2" || reader.Game.Name == "CB3")
{
var m_MetricsDirty = reader.ReadBoolean();
reader.AlignStream();
var m_CloseMeshDynamicCompression = reader.ReadInt32();
reader.AlignStream();
var m_IsStreamingMesh = reader.ReadInt32();
reader.AlignStream();
}
if (reader.Game.Name == "CB1")
{
var m_MetricsDirty = reader.ReadBoolean();
reader.AlignStream();
var m_CloseMeshDynamicCompression = reader.ReadInt32();
var m_CloseMeshDynamicCompression = reader.ReadBoolean();
reader.AlignStream();
if (reader.Game.Name != "CB1")
{
var m_IsStreamingMesh = reader.ReadBoolean();
reader.AlignStream();
}
}
if (version[0] > 2018 || (version[0] == 2018 && version[1] >= 3)) //2018.3 and up

View File

@@ -24,7 +24,7 @@ namespace AssetStudio
public PPtr<Material>[] m_Materials;
public StaticBatchInfo m_StaticBatchInfo;
public uint[] m_SubsetIndices;
public bool isNewHeader = false;
private bool isNewHeader = false;
protected Renderer(ObjectReader reader) : base(reader)
{
if (version[0] < 5) //5.0 down
@@ -77,10 +77,10 @@ namespace AssetStudio
var m_IsTerrainTessInfo = reader.ReadByte();
if (isNewHeader)
{
var m_AllowPerMaterialProp = reader.ReadByte();
var m_IsHQDynamicAOOccluder = reader.ReadByte();
var m_UseVertexLightInForward = reader.ReadByte();
var m_CombineSubMeshInGeoPass = reader.ReadByte();
var m_AllowPerMaterialProp = reader.ReadByte();
var m_IsHQDynamicAOOccluder = reader.ReadByte();
}
}
}

View File

@@ -429,7 +429,7 @@ namespace AssetStudio
if ((version[0] == 2020 && version[1] > 3) ||
(version[0] == 2020 && version[1] == 3 && version[2] >= 2) || //2020.3.2f1 and up
(version[0] == 2021 && version[1] > 1) ||
(version[0] == 2021 && version[1] == 1 && version[2] >= 1)) //2021.1.1f1 and up
(version[0] == 2021 && version[1] == 1 && version[2] >= 4)) //2021.1.4f1 and up
{
m_IsPartialCB = reader.ReadBoolean();
reader.AlignStream();
@@ -705,7 +705,7 @@ namespace AssetStudio
if ((version[0] == 2020 && version[1] > 3) ||
(version[0] == 2020 && version[1] == 3 && version[2] >= 2) || //2020.3.2f1 and up
(version[0] == 2021 && version[1] > 1) ||
(version[0] == 2021 && version[1] == 1 && version[2] >= 4)) //2021.1.4f1 and up
(version[0] == 2021 && version[1] == 1 && version[2] >= 1)) //2021.1.4f1 and up
{
m_CommonParameters = new SerializedProgramParameters(reader);
}