- [Core] Fix bug with assets parsing.
This commit is contained in:
@@ -229,7 +229,7 @@ namespace AssetStudio.CLI
|
|||||||
|
|
||||||
#region Face
|
#region Face
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for (var i = 0; i < m_Mesh.m_SubMeshes.Length; i++)
|
for (var i = 0; i < m_Mesh.m_SubMeshes.Count; i++)
|
||||||
{
|
{
|
||||||
sb.AppendLine($"g {m_Mesh.m_Name}_{i}");
|
sb.AppendLine($"g {m_Mesh.m_Name}_{i}");
|
||||||
int indexCount = (int)m_Mesh.m_SubMeshes[i].indexCount;
|
int indexCount = (int)m_Mesh.m_SubMeshes[i].indexCount;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace AssetStudio.CLI
|
|||||||
{
|
{
|
||||||
var bundleFile = new BundleFile(reader, Game);
|
var bundleFile = new BundleFile(reader, Game);
|
||||||
reader.Dispose();
|
reader.Dispose();
|
||||||
if (bundleFile.fileList.Length > 0)
|
if (bundleFile.fileList.Count > 0)
|
||||||
{
|
{
|
||||||
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
||||||
return ExtractStreamFile(extractPath, bundleFile.fileList);
|
return ExtractStreamFile(extractPath, bundleFile.fileList);
|
||||||
@@ -99,7 +99,7 @@ namespace AssetStudio.CLI
|
|||||||
Logger.Info($"Decompressing {reader.FileName} ...");
|
Logger.Info($"Decompressing {reader.FileName} ...");
|
||||||
var webFile = new WebFile(reader);
|
var webFile = new WebFile(reader);
|
||||||
reader.Dispose();
|
reader.Dispose();
|
||||||
if (webFile.fileList.Length > 0)
|
if (webFile.fileList.Count > 0)
|
||||||
{
|
{
|
||||||
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
||||||
return ExtractStreamFile(extractPath, webFile.fileList);
|
return ExtractStreamFile(extractPath, webFile.fileList);
|
||||||
@@ -125,8 +125,8 @@ namespace AssetStudio.CLI
|
|||||||
case FileType.BundleFile:
|
case FileType.BundleFile:
|
||||||
total += ExtractBundleFile(subReader, subSavePath);
|
total += ExtractBundleFile(subReader, subSavePath);
|
||||||
break;
|
break;
|
||||||
case FileType.Mhy0File:
|
case FileType.MhyFile:
|
||||||
total += ExtractMhy0File(subReader, subSavePath);
|
total += ExtractMhyFile(subReader, subSavePath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (stream.Remaining > 0);
|
} while (stream.Remaining > 0);
|
||||||
@@ -154,14 +154,14 @@ namespace AssetStudio.CLI
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int ExtractMhy0File(FileReader reader, string savePath)
|
private static int ExtractMhyFile(FileReader reader, string savePath)
|
||||||
{
|
{
|
||||||
Logger.Info($"Decompressing {reader.FileName} ...");
|
Logger.Info($"Decompressing {reader.FileName} ...");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var mhy0File = new Mhy0File(reader, reader.FullPath, (Mhy0)Game);
|
var mhy0File = new MhyFile(reader, reader.FullPath, (Mhy)Game);
|
||||||
reader.Dispose();
|
reader.Dispose();
|
||||||
if (mhy0File.fileList.Length > 0)
|
if (mhy0File.fileList.Count > 0)
|
||||||
{
|
{
|
||||||
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
||||||
return ExtractStreamFile(extractPath, mhy0File.fileList);
|
return ExtractStreamFile(extractPath, mhy0File.fileList);
|
||||||
@@ -169,12 +169,12 @@ namespace AssetStudio.CLI
|
|||||||
}
|
}
|
||||||
catch (InvalidCastException)
|
catch (InvalidCastException)
|
||||||
{
|
{
|
||||||
Logger.Error($"Game type mismatch, Expected {nameof(Mhy0)} but got {Game.Name} ({Game.GetType().Name}) !!");
|
Logger.Error($"Game type mismatch, Expected {nameof(Mhy)} but got {Game.Name} ({Game.GetType().Name}) !!");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int ExtractStreamFile(string extractPath, StreamFile[] fileList)
|
private static int ExtractStreamFile(string extractPath, List<StreamFile> fileList)
|
||||||
{
|
{
|
||||||
int extractedCount = 0;
|
int extractedCount = 0;
|
||||||
foreach (var file in fileList)
|
foreach (var file in fileList)
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ namespace AssetStudio.GUI
|
|||||||
|
|
||||||
#region Face
|
#region Face
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for (var i = 0; i < m_Mesh.m_SubMeshes.Length; i++)
|
for (var i = 0; i < m_Mesh.m_SubMeshes.Count; i++)
|
||||||
{
|
{
|
||||||
sb.AppendLine($"g {m_Mesh.m_Name}_{i}");
|
sb.AppendLine($"g {m_Mesh.m_Name}_{i}");
|
||||||
int indexCount = (int)m_Mesh.m_SubMeshes[i].indexCount;
|
int indexCount = (int)m_Mesh.m_SubMeshes[i].indexCount;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace AssetStudio.GUI
|
|||||||
{
|
{
|
||||||
var bundleFile = new BundleFile(reader, Game);
|
var bundleFile = new BundleFile(reader, Game);
|
||||||
reader.Dispose();
|
reader.Dispose();
|
||||||
if (bundleFile.fileList.Length > 0)
|
if (bundleFile.fileList.Count > 0)
|
||||||
{
|
{
|
||||||
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
||||||
return ExtractStreamFile(extractPath, bundleFile.fileList);
|
return ExtractStreamFile(extractPath, bundleFile.fileList);
|
||||||
@@ -100,7 +100,7 @@ namespace AssetStudio.GUI
|
|||||||
StatusStripUpdate($"Decompressing {reader.FileName} ...");
|
StatusStripUpdate($"Decompressing {reader.FileName} ...");
|
||||||
var webFile = new WebFile(reader);
|
var webFile = new WebFile(reader);
|
||||||
reader.Dispose();
|
reader.Dispose();
|
||||||
if (webFile.fileList.Length > 0)
|
if (webFile.fileList.Count > 0)
|
||||||
{
|
{
|
||||||
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
||||||
return ExtractStreamFile(extractPath, webFile.fileList);
|
return ExtractStreamFile(extractPath, webFile.fileList);
|
||||||
@@ -126,8 +126,8 @@ namespace AssetStudio.GUI
|
|||||||
case FileType.BundleFile:
|
case FileType.BundleFile:
|
||||||
total += ExtractBundleFile(subReader, subSavePath);
|
total += ExtractBundleFile(subReader, subSavePath);
|
||||||
break;
|
break;
|
||||||
case FileType.Mhy0File:
|
case FileType.MhyFile:
|
||||||
total += ExtractMhy0File(subReader, subSavePath);
|
total += ExtractMhyFile(subReader, subSavePath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (stream.Remaining > 0);
|
} while (stream.Remaining > 0);
|
||||||
@@ -155,14 +155,14 @@ namespace AssetStudio.GUI
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int ExtractMhy0File(FileReader reader, string savePath)
|
private static int ExtractMhyFile(FileReader reader, string savePath)
|
||||||
{
|
{
|
||||||
StatusStripUpdate($"Decompressing {reader.FileName} ...");
|
StatusStripUpdate($"Decompressing {reader.FileName} ...");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var mhy0File = new Mhy0File(reader, reader.FullPath, (Mhy0)Game);
|
var mhy0File = new MhyFile(reader, reader.FullPath, (Mhy)Game);
|
||||||
reader.Dispose();
|
reader.Dispose();
|
||||||
if (mhy0File.fileList.Length > 0)
|
if (mhy0File.fileList.Count > 0)
|
||||||
{
|
{
|
||||||
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
|
||||||
return ExtractStreamFile(extractPath, mhy0File.fileList);
|
return ExtractStreamFile(extractPath, mhy0File.fileList);
|
||||||
@@ -170,12 +170,12 @@ namespace AssetStudio.GUI
|
|||||||
}
|
}
|
||||||
catch (InvalidCastException)
|
catch (InvalidCastException)
|
||||||
{
|
{
|
||||||
Logger.Error($"Game type mismatch, Expected {nameof(Mhy0)} but got {Game.Name} ({Game.GetType().Name}) !!");
|
Logger.Error($"Game type mismatch, Expected {nameof(Mhy)} but got {Game.Name} ({Game.GetType().Name}) !!");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int ExtractStreamFile(string extractPath, StreamFile[] fileList)
|
private static int ExtractStreamFile(string extractPath, List<StreamFile> fileList)
|
||||||
{
|
{
|
||||||
int extractedCount = 0;
|
int extractedCount = 0;
|
||||||
foreach (var file in fileList)
|
foreach (var file in fileList)
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
private ImportedFrame ConvertTransform(Transform trans)
|
private ImportedFrame ConvertTransform(Transform trans)
|
||||||
{
|
{
|
||||||
var frame = new ImportedFrame(trans.m_Children.Length);
|
var frame = new ImportedFrame(trans.m_Children.Count);
|
||||||
transformDictionary.Add(trans, frame);
|
transformDictionary.Add(trans, frame);
|
||||||
trans.m_GameObject.TryGet(out var m_GameObject);
|
trans.m_GameObject.TryGet(out var m_GameObject);
|
||||||
frame.Name = m_GameObject.m_Name;
|
frame.Name = m_GameObject.m_Name;
|
||||||
@@ -308,7 +308,7 @@ namespace AssetStudio
|
|||||||
iMesh.hasColor = mesh.m_Colors?.Length > 0;
|
iMesh.hasColor = mesh.m_Colors?.Length > 0;
|
||||||
|
|
||||||
int firstFace = 0;
|
int firstFace = 0;
|
||||||
for (int i = 0; i < mesh.m_SubMeshes.Length; i++)
|
for (int i = 0; i < mesh.m_SubMeshes.Count; i++)
|
||||||
{
|
{
|
||||||
int numFaces = (int)mesh.m_SubMeshes[i].indexCount / 3;
|
int numFaces = (int)mesh.m_SubMeshes[i].indexCount / 3;
|
||||||
if (subHashSet.Count > 0 && !subHashSet.Contains(i))
|
if (subHashSet.Count > 0 && !subHashSet.Contains(i))
|
||||||
@@ -319,7 +319,7 @@ namespace AssetStudio
|
|||||||
var submesh = mesh.m_SubMeshes[i];
|
var submesh = mesh.m_SubMeshes[i];
|
||||||
var iSubmesh = new ImportedSubmesh();
|
var iSubmesh = new ImportedSubmesh();
|
||||||
Material mat = null;
|
Material mat = null;
|
||||||
if (i - firstSubMesh < meshR.m_Materials.Length)
|
if (i - firstSubMesh < meshR.m_Materials.Count)
|
||||||
{
|
{
|
||||||
if (meshR.m_Materials[i - firstSubMesh].TryGet(out var m_Material))
|
if (meshR.m_Materials[i - firstSubMesh].TryGet(out var m_Material))
|
||||||
{
|
{
|
||||||
@@ -408,7 +408,7 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//BoneInfluence
|
//BoneInfluence
|
||||||
if (mesh.m_Skin?.Length > 0)
|
if (mesh.m_Skin?.Count > 0)
|
||||||
{
|
{
|
||||||
var inf = mesh.m_Skin[j];
|
var inf = mesh.m_Skin[j];
|
||||||
iVertex.BoneIndices = new int[4];
|
iVertex.BoneIndices = new int[4];
|
||||||
@@ -431,16 +431,16 @@ namespace AssetStudio
|
|||||||
* 2 - m_BoneNameHashes
|
* 2 - m_BoneNameHashes
|
||||||
*/
|
*/
|
||||||
var boneType = 0;
|
var boneType = 0;
|
||||||
if (sMesh.m_Bones.Length > 0)
|
if (sMesh.m_Bones.Count > 0)
|
||||||
{
|
{
|
||||||
if (sMesh.m_Bones.Length == mesh.m_BindPose.Length)
|
if (sMesh.m_Bones.Count == mesh.m_BindPose.Length)
|
||||||
{
|
{
|
||||||
var verifiedBoneCount = sMesh.m_Bones.Count(x => x.TryGet(out _));
|
var verifiedBoneCount = sMesh.m_Bones.Count(x => x.TryGet(out _));
|
||||||
if (verifiedBoneCount > 0)
|
if (verifiedBoneCount > 0)
|
||||||
{
|
{
|
||||||
boneType = 1;
|
boneType = 1;
|
||||||
}
|
}
|
||||||
if (verifiedBoneCount != sMesh.m_Bones.Length)
|
if (verifiedBoneCount != sMesh.m_Bones.Count)
|
||||||
{
|
{
|
||||||
//尝试使用m_BoneNameHashes 4.3 and up
|
//尝试使用m_BoneNameHashes 4.3 and up
|
||||||
if (mesh.m_BindPose.Length > 0 && (mesh.m_BindPose.Length == mesh.m_BoneNameHashes?.Length))
|
if (mesh.m_BindPose.Length > 0 && (mesh.m_BindPose.Length == mesh.m_BoneNameHashes?.Length))
|
||||||
@@ -470,7 +470,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
if (boneType == 1)
|
if (boneType == 1)
|
||||||
{
|
{
|
||||||
var boneCount = sMesh.m_Bones.Length;
|
var boneCount = sMesh.m_Bones.Count;
|
||||||
iMesh.BoneList = new List<ImportedBone>(boneCount);
|
iMesh.BoneList = new List<ImportedBone>(boneCount);
|
||||||
for (int i = 0; i < boneCount; i++)
|
for (int i = 0; i < boneCount; i++)
|
||||||
{
|
{
|
||||||
@@ -501,13 +501,13 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Morphs
|
//Morphs
|
||||||
if (mesh.m_Shapes?.channels?.Length > 0)
|
if (mesh.m_Shapes?.channels?.Count > 0)
|
||||||
{
|
{
|
||||||
var morph = new ImportedMorph();
|
var morph = new ImportedMorph();
|
||||||
MorphList.Add(morph);
|
MorphList.Add(morph);
|
||||||
morph.Path = iMesh.Path;
|
morph.Path = iMesh.Path;
|
||||||
morph.Channels = new List<ImportedMorphChannel>(mesh.m_Shapes.channels.Length);
|
morph.Channels = new List<ImportedMorphChannel>(mesh.m_Shapes.channels.Count);
|
||||||
for (int i = 0; i < mesh.m_Shapes.channels.Length; i++)
|
for (int i = 0; i < mesh.m_Shapes.channels.Count; i++)
|
||||||
{
|
{
|
||||||
var channel = new ImportedMorphChannel();
|
var channel = new ImportedMorphChannel();
|
||||||
morph.Channels.Add(channel);
|
morph.Channels.Add(channel);
|
||||||
@@ -534,7 +534,7 @@ namespace AssetStudio
|
|||||||
keyframe.hasTangents = shape.hasTangents;
|
keyframe.hasTangents = shape.hasTangents;
|
||||||
keyframe.VertexList = new List<ImportedMorphVertex>((int)shape.vertexCount);
|
keyframe.VertexList = new List<ImportedMorphVertex>((int)shape.vertexCount);
|
||||||
var vertexEnd = shape.firstVertex + shape.vertexCount;
|
var vertexEnd = shape.firstVertex + shape.vertexCount;
|
||||||
for (uint j = shape.firstVertex; j < vertexEnd; j++)
|
for (int j = (int)shape.firstVertex; j < vertexEnd; j++)
|
||||||
{
|
{
|
||||||
var destVertex = new ImportedMorphVertex();
|
var destVertex = new ImportedMorphVertex();
|
||||||
keyframe.VertexList.Add(destVertex);
|
keyframe.VertexList.Add(destVertex);
|
||||||
@@ -918,7 +918,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
var frame = streamedFrames[frameIndex];
|
var frame = streamedFrames[frameIndex];
|
||||||
var streamedValues = frame.keyList.Select(x => x.value).ToArray();
|
var streamedValues = frame.keyList.Select(x => x.value).ToArray();
|
||||||
for (int curveIndex = 0; curveIndex < frame.keyList.Length;)
|
for (int curveIndex = 0; curveIndex < frame.keyList.Count;)
|
||||||
{
|
{
|
||||||
var index = frame.keyList[curveIndex].index;
|
var index = frame.keyList[curveIndex].index;
|
||||||
if (!Game.Type.IsSRGroup())
|
if (!Game.Type.IsSRGroup())
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using SpirV;
|
using SpirV;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -153,42 +154,42 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
sb.Append(ConvertSerializedShaderState(m_Passe.m_State));
|
sb.Append(ConvertSerializedShaderState(m_Passe.m_State));
|
||||||
|
|
||||||
if (m_Passe.progVertex.m_SubPrograms.Length > 0)
|
if (m_Passe.progVertex.m_SubPrograms.Count > 0)
|
||||||
{
|
{
|
||||||
sb.Append("Program \"vp\" {\n");
|
sb.Append("Program \"vp\" {\n");
|
||||||
sb.Append(ConvertSerializedSubPrograms(m_Passe.progVertex.m_SubPrograms, platforms, shaderPrograms));
|
sb.Append(ConvertSerializedSubPrograms(m_Passe.progVertex.m_SubPrograms, platforms, shaderPrograms));
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Passe.progFragment.m_SubPrograms.Length > 0)
|
if (m_Passe.progFragment.m_SubPrograms.Count > 0)
|
||||||
{
|
{
|
||||||
sb.Append("Program \"fp\" {\n");
|
sb.Append("Program \"fp\" {\n");
|
||||||
sb.Append(ConvertSerializedSubPrograms(m_Passe.progFragment.m_SubPrograms, platforms, shaderPrograms));
|
sb.Append(ConvertSerializedSubPrograms(m_Passe.progFragment.m_SubPrograms, platforms, shaderPrograms));
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Passe.progGeometry.m_SubPrograms.Length > 0)
|
if (m_Passe.progGeometry.m_SubPrograms.Count > 0)
|
||||||
{
|
{
|
||||||
sb.Append("Program \"gp\" {\n");
|
sb.Append("Program \"gp\" {\n");
|
||||||
sb.Append(ConvertSerializedSubPrograms(m_Passe.progGeometry.m_SubPrograms, platforms, shaderPrograms));
|
sb.Append(ConvertSerializedSubPrograms(m_Passe.progGeometry.m_SubPrograms, platforms, shaderPrograms));
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Passe.progHull.m_SubPrograms.Length > 0)
|
if (m_Passe.progHull.m_SubPrograms.Count > 0)
|
||||||
{
|
{
|
||||||
sb.Append("Program \"hp\" {\n");
|
sb.Append("Program \"hp\" {\n");
|
||||||
sb.Append(ConvertSerializedSubPrograms(m_Passe.progHull.m_SubPrograms, platforms, shaderPrograms));
|
sb.Append(ConvertSerializedSubPrograms(m_Passe.progHull.m_SubPrograms, platforms, shaderPrograms));
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Passe.progDomain.m_SubPrograms.Length > 0)
|
if (m_Passe.progDomain.m_SubPrograms.Count > 0)
|
||||||
{
|
{
|
||||||
sb.Append("Program \"dp\" {\n");
|
sb.Append("Program \"dp\" {\n");
|
||||||
sb.Append(ConvertSerializedSubPrograms(m_Passe.progDomain.m_SubPrograms, platforms, shaderPrograms));
|
sb.Append(ConvertSerializedSubPrograms(m_Passe.progDomain.m_SubPrograms, platforms, shaderPrograms));
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Passe.progRayTracing?.m_SubPrograms.Length > 0)
|
if (m_Passe.progRayTracing?.m_SubPrograms.Count > 0)
|
||||||
{
|
{
|
||||||
sb.Append("Program \"rtp\" {\n");
|
sb.Append("Program \"rtp\" {\n");
|
||||||
sb.Append(ConvertSerializedSubPrograms(m_Passe.progRayTracing.m_SubPrograms, platforms, shaderPrograms));
|
sb.Append(ConvertSerializedSubPrograms(m_Passe.progRayTracing.m_SubPrograms, platforms, shaderPrograms));
|
||||||
@@ -200,7 +201,7 @@ namespace AssetStudio
|
|||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string ConvertSerializedSubPrograms(SerializedSubProgram[] m_SubPrograms, ShaderCompilerPlatform[] platforms, ShaderProgram[] shaderPrograms)
|
private static string ConvertSerializedSubPrograms(List<SerializedSubProgram> m_SubPrograms, ShaderCompilerPlatform[] platforms, ShaderProgram[] shaderPrograms)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
var groups = m_SubPrograms.GroupBy(x => x.m_BlobIndex);
|
var groups = m_SubPrograms.GroupBy(x => x.m_BlobIndex);
|
||||||
@@ -496,10 +497,10 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string ConvertSerializedShaderRTBlendState(SerializedShaderRTBlendState[] rtBlend, bool rtSeparateBlend)
|
private static string ConvertSerializedShaderRTBlendState(List<SerializedShaderRTBlendState> rtBlend, bool rtSeparateBlend)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
for (var i = 0; i < rtBlend.Length; i++)
|
for (var i = 0; i < rtBlend.Count; i++)
|
||||||
{
|
{
|
||||||
var blend = rtBlend[i];
|
var blend = rtBlend[i];
|
||||||
if (blend.srcBlend.val != 1f ||
|
if (blend.srcBlend.val != 1f ||
|
||||||
@@ -653,7 +654,7 @@ namespace AssetStudio
|
|||||||
private static string ConvertSerializedTagMap(SerializedTagMap m_Tags, int intent)
|
private static string ConvertSerializedTagMap(SerializedTagMap m_Tags, int intent)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
if (m_Tags.tags.Length > 0)
|
if (m_Tags.tags.Count > 0)
|
||||||
{
|
{
|
||||||
sb.Append(new string(' ', intent));
|
sb.Append(new string(' ', intent));
|
||||||
sb.Append("Tags { ");
|
sb.Append("Tags { ");
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ namespace AssetStudio
|
|||||||
var vertices = new Vector2[subMesh.vertexCount];
|
var vertices = new Vector2[subMesh.vertexCount];
|
||||||
for (int v = 0; v < subMesh.vertexCount; v++)
|
for (int v = 0; v < subMesh.vertexCount; v++)
|
||||||
{
|
{
|
||||||
vertices[v] = vertexReader.ReadVector3();
|
vertices[v] = new Vector3(vertexReader.ReadSingle(), vertexReader.ReadSingle(), vertexReader.ReadSingle());
|
||||||
vertexReader.BaseStream.Position += m_Stream.stride - 12;
|
vertexReader.BaseStream.Position += m_Stream.stride - 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ namespace AssetStudio
|
|||||||
private readonly Dictionary<FloatCurve, List<Keyframe<Float>>> m_floats = new Dictionary<FloatCurve, List<Keyframe<Float>>>();
|
private readonly Dictionary<FloatCurve, List<Keyframe<Float>>> m_floats = new Dictionary<FloatCurve, List<Keyframe<Float>>>();
|
||||||
private readonly Dictionary<PPtrCurve, List<PPtrKeyframe>> m_pptrs = new Dictionary<PPtrCurve, List<PPtrKeyframe>>();
|
private readonly Dictionary<PPtrCurve, List<PPtrKeyframe>> m_pptrs = new Dictionary<PPtrCurve, List<PPtrKeyframe>>();
|
||||||
|
|
||||||
public Vector3Curve[] Translations { get; private set; }
|
public List<Vector3Curve> Translations { get; private set; }
|
||||||
public QuaternionCurve[] Rotations { get; private set; }
|
public List<QuaternionCurve> Rotations { get; private set; }
|
||||||
public Vector3Curve[] Scales { get; private set; }
|
public List<Vector3Curve> Scales { get; private set; }
|
||||||
public Vector3Curve[] Eulers { get; private set; }
|
public List<Vector3Curve> Eulers { get; private set; }
|
||||||
public FloatCurve[] Floats { get; private set; }
|
public List<FloatCurve> Floats { get; private set; }
|
||||||
public PPtrCurve[] PPtrs { get; private set; }
|
public List<PPtrCurve> PPtrs { get; private set; }
|
||||||
|
|
||||||
public AnimationClipConverter(AnimationClip clip)
|
public AnimationClipConverter(AnimationClip clip)
|
||||||
{
|
{
|
||||||
@@ -81,17 +81,17 @@ namespace AssetStudio
|
|||||||
private void CreateCurves()
|
private void CreateCurves()
|
||||||
{
|
{
|
||||||
m_translations.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
m_translations.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
||||||
Translations = m_translations.Keys.ToArray();
|
Translations = m_translations.Keys.ToList();
|
||||||
m_rotations.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
m_rotations.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
||||||
Rotations = m_rotations.Keys.ToArray();
|
Rotations = m_rotations.Keys.ToList();
|
||||||
m_scales.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
m_scales.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
||||||
Scales = m_scales.Keys.ToArray();
|
Scales = m_scales.Keys.ToList();
|
||||||
m_eulers.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
m_eulers.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
||||||
Eulers = m_eulers.Keys.ToArray();
|
Eulers = m_eulers.Keys.ToList();
|
||||||
m_floats.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
m_floats.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
||||||
Floats = m_floats.Keys.ToArray();
|
Floats = m_floats.Keys.ToList();
|
||||||
m_pptrs.AsEnumerable().ToList().ForEach(x => x.Key.curve.AddRange(x.Value));
|
m_pptrs.AsEnumerable().ToList().ForEach(x => x.Key.curve.AddRange(x.Value));
|
||||||
PPtrs = m_pptrs.Keys.ToArray();
|
PPtrs = m_pptrs.Keys.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessStreams(List<StreamedClip.StreamedFrame> streamFrames, AnimationClipBindingConstant bindings, Dictionary<uint, string> tos, float sampleRate)
|
private void ProcessStreams(List<StreamedClip.StreamedFrame> streamFrames, AnimationClipBindingConstant bindings, Dictionary<uint, string> tos, float sampleRate)
|
||||||
@@ -107,7 +107,7 @@ namespace AssetStudio
|
|||||||
for (var frameIndex = 1; frameIndex < streamFrames.Count - 1; frameIndex++)
|
for (var frameIndex = 1; frameIndex < streamFrames.Count - 1; frameIndex++)
|
||||||
{
|
{
|
||||||
var frame = streamFrames[frameIndex];
|
var frame = streamFrames[frameIndex];
|
||||||
for (var curveIndex = 0; curveIndex < frame.keyList.Length;)
|
for (var curveIndex = 0; curveIndex < frame.keyList.Count;)
|
||||||
{
|
{
|
||||||
var curve = frame.keyList[curveIndex];
|
var curve = frame.keyList[curveIndex];
|
||||||
var index = curve.index;
|
var index = curve.index;
|
||||||
@@ -496,7 +496,7 @@ namespace AssetStudio
|
|||||||
for (frameIndex = currentFrame - 1; frameIndex >= 0; frameIndex--)
|
for (frameIndex = currentFrame - 1; frameIndex >= 0; frameIndex--)
|
||||||
{
|
{
|
||||||
var frame = streamFrames[frameIndex];
|
var frame = streamFrames[frameIndex];
|
||||||
for (curveIndex = 0; curveIndex < frame.keyList.Length; curveIndex++)
|
for (curveIndex = 0; curveIndex < frame.keyList.Count; curveIndex++)
|
||||||
{
|
{
|
||||||
var curve = frame.keyList[curveIndex];
|
var curve = frame.keyList[curveIndex];
|
||||||
if (curve.index == curveID)
|
if (curve.index == curveID)
|
||||||
@@ -512,7 +512,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
var curve = frame.keyList[currentCurve];
|
var curve = frame.keyList[currentCurve];
|
||||||
int i = currentCurve + 1;
|
int i = currentCurve + 1;
|
||||||
for (; i < frame.keyList.Length; i++)
|
for (; i < frame.keyList.Count; i++)
|
||||||
{
|
{
|
||||||
if (frame.keyList[i].index != curve.index)
|
if (frame.keyList[i].index != curve.index)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -112,10 +112,10 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
private static bool AddTOS(this AnimationClip clip, Dictionary<uint, string> src, Dictionary<uint, string> dest)
|
private static bool AddTOS(this AnimationClip clip, Dictionary<uint, string> src, Dictionary<uint, string> dest)
|
||||||
{
|
{
|
||||||
int tosCount = clip.m_ClipBindingConstant.genericBindings.Length;
|
int tosCount = clip.m_ClipBindingConstant.genericBindings.Count;
|
||||||
for (int i = 0; i < tosCount; i++)
|
for (int i = 0; i < tosCount; i++)
|
||||||
{
|
{
|
||||||
ref GenericBinding binding = ref clip.m_ClipBindingConstant.genericBindings[i];
|
var binding = clip.m_ClipBindingConstant.genericBindings[i];
|
||||||
if (src.TryGetValue(binding.path, out string path))
|
if (src.TryGetValue(binding.path, out string path))
|
||||||
{
|
{
|
||||||
dest[binding.path] = path;
|
dest[binding.path] = path;
|
||||||
@@ -147,12 +147,12 @@ namespace AssetStudio
|
|||||||
if (!clip.m_Legacy || clip.m_MuscleClip != null)
|
if (!clip.m_Legacy || clip.m_MuscleClip != null)
|
||||||
{
|
{
|
||||||
var converter = AnimationClipConverter.Process(clip);
|
var converter = AnimationClipConverter.Process(clip);
|
||||||
clip.m_RotationCurves = converter.Rotations.Union(clip.m_RotationCurves).ToArray();
|
clip.m_RotationCurves = converter.Rotations.Union(clip.m_RotationCurves).ToList();
|
||||||
clip.m_EulerCurves = converter.Eulers.Union(clip.m_EulerCurves).ToArray();
|
clip.m_EulerCurves = converter.Eulers.Union(clip.m_EulerCurves).ToList();
|
||||||
clip.m_PositionCurves = converter.Translations.Union(clip.m_PositionCurves).ToArray();
|
clip.m_PositionCurves = converter.Translations.Union(clip.m_PositionCurves).ToList();
|
||||||
clip.m_ScaleCurves = converter.Scales.Union(clip.m_ScaleCurves).ToArray();
|
clip.m_ScaleCurves = converter.Scales.Union(clip.m_ScaleCurves).ToList();
|
||||||
clip.m_FloatCurves = converter.Floats.Union(clip.m_FloatCurves).ToArray();
|
clip.m_FloatCurves = converter.Floats.Union(clip.m_FloatCurves).ToList();
|
||||||
clip.m_PPtrCurves = converter.PPtrs.Union(clip.m_PPtrCurves).ToArray();
|
clip.m_PPtrCurves = converter.PPtrs.Union(clip.m_PPtrCurves).ToList();
|
||||||
}
|
}
|
||||||
return ConvertSerializedAnimationClip(clip);
|
return ConvertSerializedAnimationClip(clip);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace AssetStudio
|
|||||||
[Key(0)]
|
[Key(0)]
|
||||||
public GameType GameType { get; set; }
|
public GameType GameType { get; set; }
|
||||||
[Key(1)]
|
[Key(1)]
|
||||||
public AssetEntry[] AssetEntries { get; set; }
|
public List<AssetEntry> AssetEntries { get; set; }
|
||||||
}
|
}
|
||||||
[MessagePackObject]
|
[MessagePackObject]
|
||||||
public record AssetEntry
|
public record AssetEntry
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ using System.Text.RegularExpressions;
|
|||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using MessagePack;
|
using MessagePack;
|
||||||
using System.Reflection.Metadata.Ecma335;
|
|
||||||
|
|
||||||
namespace AssetStudio
|
namespace AssetStudio
|
||||||
{
|
{
|
||||||
@@ -30,7 +29,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public long Offset { get; set; }
|
public long Offset { get; set; }
|
||||||
public string[] Dependencies { get; set; }
|
public List<string> Dependencies { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetUnityVersion(string version)
|
public static void SetUnityVersion(string version)
|
||||||
@@ -207,7 +206,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
Path = relativePath,
|
Path = relativePath,
|
||||||
Offset = assetsFile.offset,
|
Offset = assetsFile.offset,
|
||||||
Dependencies = assetsFile.m_Externals.Select(x => x.fileName).ToArray()
|
Dependencies = assetsFile.m_Externals.Select(x => x.fileName).ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
if (CABMap.ContainsKey(assetsFile.fileName))
|
if (CABMap.ContainsKey(assetsFile.fileName))
|
||||||
@@ -236,7 +235,7 @@ namespace AssetStudio
|
|||||||
writer.Write(kv.Key);
|
writer.Write(kv.Key);
|
||||||
writer.Write(kv.Value.Path);
|
writer.Write(kv.Value.Path);
|
||||||
writer.Write(kv.Value.Offset);
|
writer.Write(kv.Value.Offset);
|
||||||
writer.Write(kv.Value.Dependencies.Length);
|
writer.Write(kv.Value.Dependencies.Count);
|
||||||
foreach (var cab in kv.Value.Dependencies)
|
foreach (var cab in kv.Value.Dependencies)
|
||||||
{
|
{
|
||||||
writer.Write(cab);
|
writer.Write(cab);
|
||||||
@@ -298,10 +297,10 @@ namespace AssetStudio
|
|||||||
var path = reader.ReadString();
|
var path = reader.ReadString();
|
||||||
var offset = reader.ReadInt64();
|
var offset = reader.ReadInt64();
|
||||||
var depCount = reader.ReadInt32();
|
var depCount = reader.ReadInt32();
|
||||||
var dependencies = new string[depCount];
|
var dependencies = new List<string>();
|
||||||
for (int j = 0; j < depCount; j++)
|
for (int j = 0; j < depCount; j++)
|
||||||
{
|
{
|
||||||
dependencies[j] = reader.ReadString();
|
dependencies.Add(reader.ReadString());
|
||||||
}
|
}
|
||||||
var entry = new Entry()
|
var entry = new Entry()
|
||||||
{
|
{
|
||||||
@@ -328,7 +327,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
UpdateContainers(assets, game);
|
UpdateContainers(assets, game);
|
||||||
|
|
||||||
ExportAssetsMap(assets.ToArray(), game, mapName, savePath, exportListType, resetEvent);
|
ExportAssetsMap(assets, game, mapName, savePath, exportListType, resetEvent);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
@@ -528,7 +527,7 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ExportAssetsMap(AssetEntry[] toExportAssets, Game game, string name, string savePath, ExportListType exportListType, ManualResetEvent resetEvent = null)
|
private static void ExportAssetsMap(List<AssetEntry> toExportAssets, Game game, string name, string savePath, ExportListType exportListType, ManualResetEvent resetEvent = null)
|
||||||
{
|
{
|
||||||
ThreadPool.QueueUserWorkItem(state =>
|
ThreadPool.QueueUserWorkItem(state =>
|
||||||
{
|
{
|
||||||
@@ -588,7 +587,7 @@ namespace AssetStudio
|
|||||||
MessagePackSerializer.Serialize(file, assetMap, MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray));
|
MessagePackSerializer.Serialize(file, assetMap, MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info($"Finished buidling AssetMap with {toExportAssets.Length} assets.");
|
Logger.Info($"Finished buidling AssetMap with {toExportAssets.Count} assets.");
|
||||||
}
|
}
|
||||||
|
|
||||||
resetEvent?.Set();
|
resetEvent?.Set();
|
||||||
@@ -613,7 +612,7 @@ namespace AssetStudio
|
|||||||
DumpCABMap(mapName);
|
DumpCABMap(mapName);
|
||||||
|
|
||||||
Logger.Info($"Map build successfully !! {collision} collisions found");
|
Logger.Info($"Map build successfully !! {collision} collisions found");
|
||||||
ExportAssetsMap(assets.ToArray(), game, mapName, savePath, exportListType, resetEvent);
|
ExportAssetsMap(assets, game, mapName, savePath, exportListType, resetEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,6 +157,9 @@ namespace AssetStudio
|
|||||||
case FileType.BlkFile:
|
case FileType.BlkFile:
|
||||||
LoadBlkFile(reader);
|
LoadBlkFile(reader);
|
||||||
break;
|
break;
|
||||||
|
case FileType.MhyFile:
|
||||||
|
LoadMhyFile(reader);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,6 +451,9 @@ namespace AssetStudio
|
|||||||
case FileType.BlbFile:
|
case FileType.BlbFile:
|
||||||
LoadBlbFile(subReader, reader.FullPath, offset, false);
|
LoadBlbFile(subReader, reader.FullPath, offset, false);
|
||||||
break;
|
break;
|
||||||
|
case FileType.MhyFile:
|
||||||
|
LoadMhyFile(subReader, reader.FullPath, offset, false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -478,8 +484,8 @@ namespace AssetStudio
|
|||||||
case FileType.BundleFile:
|
case FileType.BundleFile:
|
||||||
LoadBundleFile(subReader, reader.FullPath, offset, false);
|
LoadBundleFile(subReader, reader.FullPath, offset, false);
|
||||||
break;
|
break;
|
||||||
case FileType.Mhy0File:
|
case FileType.MhyFile:
|
||||||
LoadMhy0File(subReader, reader.FullPath, offset, false);
|
LoadMhyFile(subReader, reader.FullPath, offset, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -497,7 +503,7 @@ namespace AssetStudio
|
|||||||
reader.Dispose();
|
reader.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void LoadMhy0File(FileReader reader, string originalPath = null, long originalOffset = 0, bool log = true)
|
private void LoadMhyFile(FileReader reader, string originalPath = null, long originalOffset = 0, bool log = true)
|
||||||
{
|
{
|
||||||
if (log)
|
if (log)
|
||||||
{
|
{
|
||||||
@@ -505,15 +511,15 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var mhy0File = new Mhy0File(reader, reader.FullPath, (Mhy0)Game);
|
var mhyFile = new MhyFile(reader, reader.FullPath, (Mhy)Game);
|
||||||
Logger.Verbose($"mhy0 total size: {mhy0File.TotalSize:X8}");
|
Logger.Verbose($"mhy total size: {mhyFile.TotalSize:X8}");
|
||||||
foreach (var file in mhy0File.fileList)
|
foreach (var file in mhyFile.fileList)
|
||||||
{
|
{
|
||||||
var dummyPath = Path.Combine(Path.GetDirectoryName(reader.FullPath), file.fileName);
|
var dummyPath = Path.Combine(Path.GetDirectoryName(reader.FullPath), file.fileName);
|
||||||
var cabReader = new FileReader(dummyPath, file.stream);
|
var cabReader = new FileReader(dummyPath, file.stream);
|
||||||
if (cabReader.FileType == FileType.AssetsFile)
|
if (cabReader.FileType == FileType.AssetsFile)
|
||||||
{
|
{
|
||||||
LoadAssetsFromMemory(cabReader, originalPath ?? reader.FullPath, mhy0File.m_Header.unityRevision, originalOffset);
|
LoadAssetsFromMemory(cabReader, originalPath ?? reader.FullPath, mhyFile.m_Header.unityRevision, originalOffset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -524,11 +530,11 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
catch (InvalidCastException)
|
catch (InvalidCastException)
|
||||||
{
|
{
|
||||||
Logger.Error($"Game type mismatch, Expected {nameof(Mhy0)} but got {Game.Name} ({Game.GetType().Name}) !!");
|
Logger.Error($"Game type mismatch, Expected {nameof(Mhy)} but got {Game.Name} ({Game.GetType().Name}) !!");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
var str = $"Error while reading mhy0 file {reader.FullPath}";
|
var str = $"Error while reading mhy file {reader.FullPath}";
|
||||||
if (originalPath != null)
|
if (originalPath != null)
|
||||||
{
|
{
|
||||||
str += $" from {Path.GetFileName(originalPath)}";
|
str += $" from {Path.GetFileName(originalPath)}";
|
||||||
@@ -705,7 +711,7 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
if (obj is GameObject m_GameObject)
|
if (obj is GameObject m_GameObject)
|
||||||
{
|
{
|
||||||
Logger.Verbose($"GameObject with {m_GameObject.m_PathID} in file {m_GameObject.assetsFile.fileName} has {m_GameObject.m_Components.Length} components, Attempting to fetch them...");
|
Logger.Verbose($"GameObject with {m_GameObject.m_PathID} in file {m_GameObject.assetsFile.fileName} has {m_GameObject.m_Components.Count} components, Attempting to fetch them...");
|
||||||
foreach (var pptr in m_GameObject.m_Components)
|
foreach (var pptr in m_GameObject.m_Components)
|
||||||
{
|
{
|
||||||
if (pptr.TryGet(out var m_Component))
|
if (pptr.TryGet(out var m_Component))
|
||||||
@@ -744,7 +750,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
if (m_SpriteAtlas.m_RenderDataMap.Count > 0)
|
if (m_SpriteAtlas.m_RenderDataMap.Count > 0)
|
||||||
{
|
{
|
||||||
Logger.Verbose($"SpriteAtlas with {m_SpriteAtlas.m_PathID} in file {m_SpriteAtlas.assetsFile.fileName} has {m_SpriteAtlas.m_PackedSprites.Length} packed sprites, Attempting to fetch them...");
|
Logger.Verbose($"SpriteAtlas with {m_SpriteAtlas.m_PathID} in file {m_SpriteAtlas.assetsFile.fileName} has {m_SpriteAtlas.m_PackedSprites.Count} packed sprites, Attempting to fetch them...");
|
||||||
foreach (var m_PackedSprite in m_SpriteAtlas.m_PackedSprites)
|
foreach (var m_PackedSprite in m_SpriteAtlas.m_PackedSprites)
|
||||||
{
|
{
|
||||||
if (m_PackedSprite.TryGet(out var m_Sprite))
|
if (m_PackedSprite.TryGet(out var m_Sprite))
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -8,11 +9,11 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
private const uint DefaultUncompressedSize = 0x20000;
|
private const uint DefaultUncompressedSize = 0x20000;
|
||||||
|
|
||||||
private BundleFile.StorageBlock[] m_BlocksInfo;
|
private List<BundleFile.StorageBlock> m_BlocksInfo;
|
||||||
private BundleFile.Node[] m_DirectoryInfo;
|
private List<BundleFile.Node> m_DirectoryInfo;
|
||||||
|
|
||||||
public BundleFile.Header m_Header;
|
public BundleFile.Header m_Header;
|
||||||
public StreamFile[] fileList;
|
public List<StreamFile> fileList;
|
||||||
public long Offset;
|
public long Offset;
|
||||||
|
|
||||||
|
|
||||||
@@ -68,30 +69,30 @@ namespace AssetStudio
|
|||||||
var bundleInfoOffset = reader.Position + reader.ReadInt64();
|
var bundleInfoOffset = reader.Position + reader.ReadInt64();
|
||||||
|
|
||||||
reader.Position = blocksInfoOffset;
|
reader.Position = blocksInfoOffset;
|
||||||
m_BlocksInfo = new BundleFile.StorageBlock[blocksInfoCount];
|
m_BlocksInfo = new List<BundleFile.StorageBlock>();
|
||||||
Logger.Verbose($"Blocks count: {blocksInfoCount}");
|
Logger.Verbose($"Blocks count: {blocksInfoCount}");
|
||||||
for (int i = 0; i < blocksInfoCount; i++)
|
for (int i = 0; i < blocksInfoCount; i++)
|
||||||
{
|
{
|
||||||
m_BlocksInfo[i] = new BundleFile.StorageBlock
|
m_BlocksInfo.Add(new BundleFile.StorageBlock
|
||||||
{
|
{
|
||||||
compressedSize = reader.ReadUInt32(),
|
compressedSize = reader.ReadUInt32(),
|
||||||
uncompressedSize = i == blocksInfoCount - 1 ? lastUncompressedSize : DefaultUncompressedSize,
|
uncompressedSize = i == blocksInfoCount - 1 ? lastUncompressedSize : DefaultUncompressedSize,
|
||||||
flags = (StorageBlockFlags)0x43
|
flags = (StorageBlockFlags)0x43
|
||||||
};
|
});
|
||||||
|
|
||||||
Logger.Verbose($"Block {i} Info: {m_BlocksInfo[i]}");
|
Logger.Verbose($"Block {i} Info: {m_BlocksInfo[i]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.Position = nodesInfoOffset;
|
reader.Position = nodesInfoOffset;
|
||||||
m_DirectoryInfo = new BundleFile.Node[nodesCount];
|
m_DirectoryInfo = new List<BundleFile.Node>();
|
||||||
Logger.Verbose($"Directory count: {nodesCount}");
|
Logger.Verbose($"Directory count: {nodesCount}");
|
||||||
for (int i = 0; i < nodesCount; i++)
|
for (int i = 0; i < nodesCount; i++)
|
||||||
{
|
{
|
||||||
m_DirectoryInfo[i] = new BundleFile.Node
|
m_DirectoryInfo.Add(new BundleFile.Node
|
||||||
{
|
{
|
||||||
offset = reader.ReadInt32(),
|
offset = reader.ReadInt32(),
|
||||||
size = reader.ReadInt32()
|
size = reader.ReadInt32()
|
||||||
};
|
});
|
||||||
|
|
||||||
var pathOffset = reader.Position + reader.ReadInt64();
|
var pathOffset = reader.Position + reader.ReadInt64();
|
||||||
|
|
||||||
@@ -146,12 +147,12 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
Logger.Verbose($"Writing files from blocks stream...");
|
Logger.Verbose($"Writing files from blocks stream...");
|
||||||
|
|
||||||
fileList = new StreamFile[m_DirectoryInfo.Length];
|
fileList = new List<StreamFile>();
|
||||||
for (int i = 0; i < m_DirectoryInfo.Length; i++)
|
for (int i = 0; i < m_DirectoryInfo.Count; i++)
|
||||||
{
|
{
|
||||||
var node = m_DirectoryInfo[i];
|
var node = m_DirectoryInfo[i];
|
||||||
var file = new StreamFile();
|
var file = new StreamFile();
|
||||||
fileList[i] = file;
|
fileList.Add(file);
|
||||||
file.path = node.path;
|
file.path = node.path;
|
||||||
file.fileName = Path.GetFileName(node.path);
|
file.fileName = Path.GetFileName(node.path);
|
||||||
if (node.size >= int.MaxValue)
|
if (node.size >= int.MaxValue)
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace AssetStudio
|
namespace AssetStudio
|
||||||
{
|
{
|
||||||
@@ -104,10 +106,10 @@ namespace AssetStudio
|
|||||||
private UnityCN UnityCN;
|
private UnityCN UnityCN;
|
||||||
|
|
||||||
public Header m_Header;
|
public Header m_Header;
|
||||||
private Node[] m_DirectoryInfo;
|
private List<Node> m_DirectoryInfo;
|
||||||
private StorageBlock[] m_BlocksInfo;
|
private List<StorageBlock> m_BlocksInfo;
|
||||||
|
|
||||||
public StreamFile[] fileList;
|
public List<StreamFile> fileList;
|
||||||
|
|
||||||
|
|
||||||
private bool HasUncompressedDataHash = true;
|
private bool HasUncompressedDataHash = true;
|
||||||
@@ -216,7 +218,7 @@ namespace AssetStudio
|
|||||||
m_Header.size = reader.ReadUInt32();
|
m_Header.size = reader.ReadUInt32();
|
||||||
var numberOfLevelsToDownloadBeforeStreaming = reader.ReadUInt32();
|
var numberOfLevelsToDownloadBeforeStreaming = reader.ReadUInt32();
|
||||||
var levelCount = reader.ReadInt32();
|
var levelCount = reader.ReadInt32();
|
||||||
m_BlocksInfo = new StorageBlock[1];
|
m_BlocksInfo = new List<StorageBlock>();
|
||||||
for (int i = 0; i < levelCount; i++)
|
for (int i = 0; i < levelCount; i++)
|
||||||
{
|
{
|
||||||
var storageBlock = new StorageBlock()
|
var storageBlock = new StorageBlock()
|
||||||
@@ -226,7 +228,7 @@ namespace AssetStudio
|
|||||||
};
|
};
|
||||||
if (i == levelCount - 1)
|
if (i == levelCount - 1)
|
||||||
{
|
{
|
||||||
m_BlocksInfo[0] = storageBlock;
|
m_BlocksInfo.Add(storageBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_Header.version >= 2)
|
if (m_Header.version >= 2)
|
||||||
@@ -277,16 +279,16 @@ namespace AssetStudio
|
|||||||
blocksStream.Position = 0;
|
blocksStream.Position = 0;
|
||||||
var blocksReader = new EndianBinaryReader(blocksStream);
|
var blocksReader = new EndianBinaryReader(blocksStream);
|
||||||
var nodesCount = blocksReader.ReadInt32();
|
var nodesCount = blocksReader.ReadInt32();
|
||||||
m_DirectoryInfo = new Node[nodesCount];
|
m_DirectoryInfo = new List<Node>();
|
||||||
Logger.Verbose($"Directory count: {nodesCount}");
|
Logger.Verbose($"Directory count: {nodesCount}");
|
||||||
for (int i = 0; i < nodesCount; i++)
|
for (int i = 0; i < nodesCount; i++)
|
||||||
{
|
{
|
||||||
m_DirectoryInfo[i] = new Node
|
m_DirectoryInfo.Add(new Node
|
||||||
{
|
{
|
||||||
path = blocksReader.ReadStringToNull(),
|
path = blocksReader.ReadStringToNull(),
|
||||||
offset = blocksReader.ReadUInt32(),
|
offset = blocksReader.ReadUInt32(),
|
||||||
size = blocksReader.ReadUInt32()
|
size = blocksReader.ReadUInt32()
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,12 +296,12 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
Logger.Verbose($"Writing files from blocks stream...");
|
Logger.Verbose($"Writing files from blocks stream...");
|
||||||
|
|
||||||
fileList = new StreamFile[m_DirectoryInfo.Length];
|
fileList = new List<StreamFile>();
|
||||||
for (int i = 0; i < m_DirectoryInfo.Length; i++)
|
for (int i = 0; i < m_DirectoryInfo.Count; i++)
|
||||||
{
|
{
|
||||||
var node = m_DirectoryInfo[i];
|
var node = m_DirectoryInfo[i];
|
||||||
var file = new StreamFile();
|
var file = new StreamFile();
|
||||||
fileList[i] = file;
|
fileList.Add(file);
|
||||||
file.path = node.path;
|
file.path = node.path;
|
||||||
file.fileName = Path.GetFileName(node.path);
|
file.fileName = Path.GetFileName(node.path);
|
||||||
if (node.size >= int.MaxValue)
|
if (node.size >= int.MaxValue)
|
||||||
@@ -412,7 +414,7 @@ namespace AssetStudio
|
|||||||
blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
|
blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
|
||||||
}
|
}
|
||||||
MemoryStream blocksInfoUncompresseddStream;
|
MemoryStream blocksInfoUncompresseddStream;
|
||||||
var blocksInfoBytesSpan = blocksInfoBytes.AsSpan();
|
var blocksInfoBytesSpan = blocksInfoBytes.AsSpan(0, (int)m_Header.compressedBlocksInfoSize);
|
||||||
var uncompressedSize = m_Header.uncompressedBlocksInfoSize;
|
var uncompressedSize = m_Header.uncompressedBlocksInfoSize;
|
||||||
var compressionType = (CompressionType)(m_Header.flags & ArchiveFlags.CompressionTypeMask);
|
var compressionType = (CompressionType)(m_Header.flags & ArchiveFlags.CompressionTypeMask);
|
||||||
Logger.Verbose($"BlockInfo compression type: {compressionType}");
|
Logger.Verbose($"BlockInfo compression type: {compressionType}");
|
||||||
@@ -436,13 +438,15 @@ namespace AssetStudio
|
|||||||
case CompressionType.Lz4: //LZ4
|
case CompressionType.Lz4: //LZ4
|
||||||
case CompressionType.Lz4HC: //LZ4HC
|
case CompressionType.Lz4HC: //LZ4HC
|
||||||
{
|
{
|
||||||
var uncompressedBytes = new byte[uncompressedSize];
|
var uncompressedBytes = BigArrayPool<byte>.Shared.Rent((int)uncompressedSize);
|
||||||
var numWrite = LZ4.Decompress(blocksInfoBytesSpan, uncompressedBytes);
|
var uncompressedBytesSpan = uncompressedBytes.AsSpan(0, (int)uncompressedSize);
|
||||||
|
var numWrite = LZ4.Decompress(blocksInfoBytesSpan, uncompressedBytesSpan);
|
||||||
if (numWrite != uncompressedSize)
|
if (numWrite != uncompressedSize)
|
||||||
{
|
{
|
||||||
throw new IOException($"Lz4 decompression error, write {numWrite} bytes but expected {uncompressedSize} bytes");
|
throw new IOException($"Lz4 decompression error, write {numWrite} bytes but expected {uncompressedSize} bytes");
|
||||||
}
|
}
|
||||||
blocksInfoUncompresseddStream = new MemoryStream(uncompressedBytes);
|
blocksInfoUncompresseddStream = new MemoryStream(uncompressedBytesSpan.ToArray());
|
||||||
|
BigArrayPool<byte>.Shared.Return(uncompressedBytes);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CompressionType.Lz4Mr0k: //Lz4Mr0k
|
case CompressionType.Lz4Mr0k: //Lz4Mr0k
|
||||||
@@ -462,32 +466,32 @@ namespace AssetStudio
|
|||||||
var uncompressedDataHash = blocksInfoReader.ReadBytes(16);
|
var uncompressedDataHash = blocksInfoReader.ReadBytes(16);
|
||||||
}
|
}
|
||||||
var blocksInfoCount = blocksInfoReader.ReadInt32();
|
var blocksInfoCount = blocksInfoReader.ReadInt32();
|
||||||
m_BlocksInfo = new StorageBlock[blocksInfoCount];
|
m_BlocksInfo = new List<StorageBlock>();
|
||||||
Logger.Verbose($"Blocks count: {blocksInfoCount}");
|
Logger.Verbose($"Blocks count: {blocksInfoCount}");
|
||||||
for (int i = 0; i < blocksInfoCount; i++)
|
for (int i = 0; i < blocksInfoCount; i++)
|
||||||
{
|
{
|
||||||
m_BlocksInfo[i] = new StorageBlock
|
m_BlocksInfo.Add(new StorageBlock
|
||||||
{
|
{
|
||||||
uncompressedSize = blocksInfoReader.ReadUInt32(),
|
uncompressedSize = blocksInfoReader.ReadUInt32(),
|
||||||
compressedSize = blocksInfoReader.ReadUInt32(),
|
compressedSize = blocksInfoReader.ReadUInt32(),
|
||||||
flags = (StorageBlockFlags)blocksInfoReader.ReadUInt16()
|
flags = (StorageBlockFlags)blocksInfoReader.ReadUInt16()
|
||||||
};
|
});
|
||||||
|
|
||||||
Logger.Verbose($"Block {i} Info: {m_BlocksInfo[i]}");
|
Logger.Verbose($"Block {i} Info: {m_BlocksInfo[i]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
var nodesCount = blocksInfoReader.ReadInt32();
|
var nodesCount = blocksInfoReader.ReadInt32();
|
||||||
m_DirectoryInfo = new Node[nodesCount];
|
m_DirectoryInfo = new List<Node>();
|
||||||
Logger.Verbose($"Directory count: {nodesCount}");
|
Logger.Verbose($"Directory count: {nodesCount}");
|
||||||
for (int i = 0; i < nodesCount; i++)
|
for (int i = 0; i < nodesCount; i++)
|
||||||
{
|
{
|
||||||
m_DirectoryInfo[i] = new Node
|
m_DirectoryInfo.Add(new Node
|
||||||
{
|
{
|
||||||
offset = blocksInfoReader.ReadInt64(),
|
offset = blocksInfoReader.ReadInt64(),
|
||||||
size = blocksInfoReader.ReadInt64(),
|
size = blocksInfoReader.ReadInt64(),
|
||||||
flags = blocksInfoReader.ReadUInt32(),
|
flags = blocksInfoReader.ReadUInt32(),
|
||||||
path = blocksInfoReader.ReadStringToNull(),
|
path = blocksInfoReader.ReadStringToNull(),
|
||||||
};
|
});
|
||||||
|
|
||||||
Logger.Verbose($"Directory {i} Info: {m_DirectoryInfo[i]}");
|
Logger.Verbose($"Directory {i} Info: {m_DirectoryInfo[i]}");
|
||||||
}
|
}
|
||||||
@@ -502,7 +506,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
Logger.Verbose($"Writing block to blocks stream...");
|
Logger.Verbose($"Writing block to blocks stream...");
|
||||||
|
|
||||||
for (int i = 0; i < m_BlocksInfo.Length; i++)
|
for (int i = 0; i < m_BlocksInfo.Count; i++)
|
||||||
{
|
{
|
||||||
Logger.Verbose($"Reading block {i}...");
|
Logger.Verbose($"Reading block {i}...");
|
||||||
var blockInfo = m_BlocksInfo[i];
|
var blockInfo = m_BlocksInfo[i];
|
||||||
|
|||||||
@@ -7,16 +7,16 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
public sealed class Animation : Behaviour
|
public sealed class Animation : Behaviour
|
||||||
{
|
{
|
||||||
public PPtr<AnimationClip>[] m_Animations;
|
public List<PPtr<AnimationClip>> m_Animations;
|
||||||
|
|
||||||
public Animation(ObjectReader reader) : base(reader)
|
public Animation(ObjectReader reader) : base(reader)
|
||||||
{
|
{
|
||||||
var m_Animation = new PPtr<AnimationClip>(reader);
|
var m_Animation = new PPtr<AnimationClip>(reader);
|
||||||
int numAnimations = reader.ReadInt32();
|
int numAnimations = reader.ReadInt32();
|
||||||
m_Animations = new PPtr<AnimationClip>[numAnimations];
|
m_Animations = new List<PPtr<AnimationClip>>();
|
||||||
for (int i = 0; i < numAnimations; i++)
|
for (int i = 0; i < numAnimations; i++)
|
||||||
{
|
{
|
||||||
m_Animations[i] = new PPtr<AnimationClip>(reader);
|
m_Animations.Add(new PPtr<AnimationClip>(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
int numCurves = reader.ReadInt32();
|
int numCurves = reader.ReadInt32();
|
||||||
m_Curve = new List<Keyframe<T>>(numCurves);
|
m_Curve = new List<Keyframe<T>>();
|
||||||
for (int i = 0; i < numCurves; i++)
|
for (int i = 0; i < numCurves; i++)
|
||||||
{
|
{
|
||||||
m_Curve.Add(new Keyframe<T>(reader, readerFunc));
|
m_Curve.Add(new Keyframe<T>(reader, readerFunc));
|
||||||
@@ -568,7 +568,7 @@ namespace AssetStudio
|
|||||||
public PPtrCurve(ObjectReader reader)
|
public PPtrCurve(ObjectReader reader)
|
||||||
{
|
{
|
||||||
int numCurves = reader.ReadInt32();
|
int numCurves = reader.ReadInt32();
|
||||||
curve = new List<PPtrKeyframe>(numCurves);
|
curve = new List<PPtrKeyframe>();
|
||||||
for (int i = 0; i < numCurves; i++)
|
for (int i = 0; i < numCurves; i++)
|
||||||
{
|
{
|
||||||
curve.Add(new PPtrKeyframe(reader));
|
curve.Add(new PPtrKeyframe(reader));
|
||||||
@@ -646,7 +646,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public HandPose(ObjectReader reader)
|
public HandPose(ObjectReader reader)
|
||||||
{
|
{
|
||||||
m_GrabX = reader.ReadXForm(reader.version);
|
m_GrabX = reader.ReadXForm();
|
||||||
m_DoFArray = reader.ReadSingleArray();
|
m_DoFArray = reader.ReadSingleArray();
|
||||||
m_Override = reader.ReadSingle();
|
m_Override = reader.ReadSingle();
|
||||||
m_CloseOpen = reader.ReadSingle();
|
m_CloseOpen = reader.ReadSingle();
|
||||||
@@ -658,7 +658,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
var handPose = new HandPose();
|
var handPose = new HandPose();
|
||||||
|
|
||||||
handPose.m_GrabX = reader.ReadXForm(reader.version, true);
|
handPose.m_GrabX = reader.ReadXForm4();
|
||||||
handPose.m_DoFArray = reader.ReadSingleArray(20);
|
handPose.m_DoFArray = reader.ReadSingleArray(20);
|
||||||
handPose.m_Override = reader.ReadSingle();
|
handPose.m_Override = reader.ReadSingle();
|
||||||
handPose.m_CloseOpen = reader.ReadSingle();
|
handPose.m_CloseOpen = reader.ReadSingle();
|
||||||
@@ -681,7 +681,7 @@ namespace AssetStudio
|
|||||||
public HumanGoal(ObjectReader reader)
|
public HumanGoal(ObjectReader reader)
|
||||||
{
|
{
|
||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
m_X = reader.ReadXForm(reader.version);
|
m_X = reader.ReadXForm();
|
||||||
m_WeightT = reader.ReadSingle();
|
m_WeightT = reader.ReadSingle();
|
||||||
m_WeightR = reader.ReadSingle();
|
m_WeightR = reader.ReadSingle();
|
||||||
if (version[0] >= 5)//5.0 and up
|
if (version[0] >= 5)//5.0 and up
|
||||||
@@ -695,7 +695,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
var humanGoal = new HumanGoal();
|
var humanGoal = new HumanGoal();
|
||||||
|
|
||||||
humanGoal.m_X = reader.ReadXForm(reader.version, true);
|
humanGoal.m_X = reader.ReadXForm4();
|
||||||
humanGoal.m_WeightT = reader.ReadSingle();
|
humanGoal.m_WeightT = reader.ReadSingle();
|
||||||
humanGoal.m_WeightR = reader.ReadSingle();
|
humanGoal.m_WeightR = reader.ReadSingle();
|
||||||
|
|
||||||
@@ -714,7 +714,7 @@ namespace AssetStudio
|
|||||||
public XForm m_RootX;
|
public XForm m_RootX;
|
||||||
public Vector3 m_LookAtPosition;
|
public Vector3 m_LookAtPosition;
|
||||||
public Vector4 m_LookAtWeight;
|
public Vector4 m_LookAtWeight;
|
||||||
public HumanGoal[] m_GoalArray;
|
public List<HumanGoal> m_GoalArray;
|
||||||
public HandPose m_LeftHandPose;
|
public HandPose m_LeftHandPose;
|
||||||
public HandPose m_RightHandPose;
|
public HandPose m_RightHandPose;
|
||||||
public float[] m_DoFArray;
|
public float[] m_DoFArray;
|
||||||
@@ -724,15 +724,15 @@ namespace AssetStudio
|
|||||||
public HumanPose(ObjectReader reader)
|
public HumanPose(ObjectReader reader)
|
||||||
{
|
{
|
||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
m_RootX = reader.ReadXForm(reader.version);
|
m_RootX = reader.ReadXForm();
|
||||||
m_LookAtPosition = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4();//5.4 and up
|
m_LookAtPosition = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4();//5.4 and up
|
||||||
m_LookAtWeight = reader.ReadVector4();
|
m_LookAtWeight = reader.ReadVector4();
|
||||||
|
|
||||||
int numGoals = reader.ReadInt32();
|
int numGoals = reader.ReadInt32();
|
||||||
m_GoalArray = new HumanGoal[numGoals];
|
m_GoalArray = new List<HumanGoal>();
|
||||||
for (int i = 0; i < numGoals; i++)
|
for (int i = 0; i < numGoals; i++)
|
||||||
{
|
{
|
||||||
m_GoalArray[i] = new HumanGoal(reader);
|
m_GoalArray.Add(new HumanGoal(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_LeftHandPose = new HandPose(reader);
|
m_LeftHandPose = new HandPose(reader);
|
||||||
@@ -742,28 +742,23 @@ namespace AssetStudio
|
|||||||
|
|
||||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 2))//5.2 and up
|
if (version[0] > 5 || (version[0] == 5 && version[1] >= 2))//5.2 and up
|
||||||
{
|
{
|
||||||
int numTDof = reader.ReadInt32();
|
m_TDoFArray = reader.ReadVector3Array();
|
||||||
m_TDoFArray = new Vector3[numTDof];
|
|
||||||
for (int i = 0; i < numTDof; i++)
|
|
||||||
{
|
|
||||||
m_TDoFArray[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4();//5.4 and up
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static HumanPose ParseGI(ObjectReader reader)
|
public static HumanPose ParseGI(ObjectReader reader)
|
||||||
{
|
{
|
||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
var humanPose = new HumanPose();
|
var humanPose = new HumanPose();
|
||||||
|
|
||||||
humanPose.m_RootX = reader.ReadXForm(version, true);
|
humanPose.m_RootX = reader.ReadXForm4();
|
||||||
humanPose.m_LookAtPosition = (Vector3)reader.ReadVector4();
|
humanPose.m_LookAtPosition = (Vector3)reader.ReadVector4();
|
||||||
humanPose.m_LookAtWeight = reader.ReadVector4();
|
humanPose.m_LookAtWeight = reader.ReadVector4();
|
||||||
|
|
||||||
humanPose.m_GoalArray = new HumanGoal[4];
|
humanPose.m_GoalArray = new List<HumanGoal>();
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
humanPose.m_GoalArray[i] = HumanGoal.ParseGI(reader);
|
humanPose.m_GoalArray.Add(HumanGoal.ParseGI(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
humanPose.m_LeftHandPose = HandPose.ParseGI(reader);
|
humanPose.m_LeftHandPose = HandPose.ParseGI(reader);
|
||||||
@@ -771,11 +766,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
humanPose.m_DoFArray = reader.ReadSingleArray(0x37);
|
humanPose.m_DoFArray = reader.ReadSingleArray(0x37);
|
||||||
|
|
||||||
humanPose.m_TDoFArray = new Vector3[0x15];
|
humanPose.m_TDoFArray = reader.ReadVector4Array(0x15).Select(x => (Vector3)x).ToArray();
|
||||||
for (int i = 0; i < 0x15; i++)
|
|
||||||
{
|
|
||||||
humanPose.m_TDoFArray[i] = (Vector3)reader.ReadVector4();
|
|
||||||
}
|
|
||||||
|
|
||||||
reader.Position += 4;
|
reader.Position += 4;
|
||||||
|
|
||||||
@@ -973,17 +964,17 @@ namespace AssetStudio
|
|||||||
public class StreamedFrame
|
public class StreamedFrame
|
||||||
{
|
{
|
||||||
public float time;
|
public float time;
|
||||||
public StreamedCurveKey[] keyList;
|
public List<StreamedCurveKey> keyList;
|
||||||
|
|
||||||
public StreamedFrame(EndianBinaryReader reader)
|
public StreamedFrame(EndianBinaryReader reader)
|
||||||
{
|
{
|
||||||
time = reader.ReadSingle();
|
time = reader.ReadSingle();
|
||||||
|
|
||||||
int numKeys = reader.ReadInt32();
|
int numKeys = reader.ReadInt32();
|
||||||
keyList = new StreamedCurveKey[numKeys];
|
keyList = new List<StreamedCurveKey>();
|
||||||
for (int i = 0; i < numKeys; i++)
|
for (int i = 0; i < numKeys; i++)
|
||||||
{
|
{
|
||||||
keyList[i] = new StreamedCurveKey(reader);
|
keyList.Add(new StreamedCurveKey(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1220,15 +1211,15 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class ValueArrayConstant
|
public class ValueArrayConstant
|
||||||
{
|
{
|
||||||
public ValueConstant[] m_ValueArray;
|
public List<ValueConstant> m_ValueArray;
|
||||||
|
|
||||||
public ValueArrayConstant(ObjectReader reader)
|
public ValueArrayConstant(ObjectReader reader)
|
||||||
{
|
{
|
||||||
int numVals = reader.ReadInt32();
|
int numVals = reader.ReadInt32();
|
||||||
m_ValueArray = new ValueConstant[numVals];
|
m_ValueArray = new List<ValueConstant>();
|
||||||
for (int i = 0; i < numVals; i++)
|
for (int i = 0; i < numVals; i++)
|
||||||
{
|
{
|
||||||
m_ValueArray[i] = new ValueConstant(reader);
|
m_ValueArray.Add(new ValueConstant(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1301,7 +1292,7 @@ namespace AssetStudio
|
|||||||
var bindings = new AnimationClipBindingConstant();
|
var bindings = new AnimationClipBindingConstant();
|
||||||
var genericBindings = new List<GenericBinding>();
|
var genericBindings = new List<GenericBinding>();
|
||||||
var values = m_Binding;
|
var values = m_Binding;
|
||||||
for (int i = 0; i < values.m_ValueArray.Length;)
|
for (int i = 0; i < values.m_ValueArray.Count;)
|
||||||
{
|
{
|
||||||
var curveID = values.m_ValueArray[i].m_ID;
|
var curveID = values.m_ValueArray[i].m_ID;
|
||||||
var curveTypeID = values.m_ValueArray[i].m_TypeID;
|
var curveTypeID = values.m_ValueArray[i].m_TypeID;
|
||||||
@@ -1336,7 +1327,7 @@ namespace AssetStudio
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bindings.genericBindings = genericBindings.ToArray();
|
bindings.genericBindings = genericBindings;
|
||||||
return bindings;
|
return bindings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1371,7 +1362,7 @@ namespace AssetStudio
|
|||||||
public float m_CycleOffset;
|
public float m_CycleOffset;
|
||||||
public float m_AverageAngularSpeed;
|
public float m_AverageAngularSpeed;
|
||||||
public int[] m_IndexArray;
|
public int[] m_IndexArray;
|
||||||
public ValueDelta[] m_ValueArrayDelta;
|
public List<ValueDelta> m_ValueArrayDelta;
|
||||||
public float[] m_ValueArrayReferencePose;
|
public float[] m_ValueArrayReferencePose;
|
||||||
public bool m_Mirror;
|
public bool m_Mirror;
|
||||||
public bool m_LoopTime;
|
public bool m_LoopTime;
|
||||||
@@ -1391,17 +1382,17 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
m_DeltaPose = new HumanPose(reader);
|
m_DeltaPose = new HumanPose(reader);
|
||||||
m_StartX = reader.ReadXForm(reader.version);
|
m_StartX = reader.ReadXForm();
|
||||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 5))//5.5 and up
|
if (version[0] > 5 || (version[0] == 5 && version[1] >= 5))//5.5 and up
|
||||||
{
|
{
|
||||||
m_StopX = reader.ReadXForm(reader.version);
|
m_StopX = reader.ReadXForm();
|
||||||
}
|
}
|
||||||
m_LeftFootStartX = reader.ReadXForm(reader.version);
|
m_LeftFootStartX = reader.ReadXForm();
|
||||||
m_RightFootStartX = reader.ReadXForm(reader.version);
|
m_RightFootStartX = reader.ReadXForm();
|
||||||
if (version[0] < 5)//5.0 down
|
if (version[0] < 5)//5.0 down
|
||||||
{
|
{
|
||||||
m_MotionStartX = reader.ReadXForm(reader.version);
|
m_MotionStartX = reader.ReadXForm();
|
||||||
m_MotionStopX = reader.ReadXForm(reader.version);
|
m_MotionStopX = reader.ReadXForm();
|
||||||
}
|
}
|
||||||
m_AverageSpeed = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4();//5.4 and up
|
m_AverageSpeed = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4();//5.4 and up
|
||||||
m_Clip = new Clip(reader);
|
m_Clip = new Clip(reader);
|
||||||
@@ -1425,10 +1416,10 @@ namespace AssetStudio
|
|||||||
var m_AdditionalCurveIndexArray = reader.ReadInt32Array();
|
var m_AdditionalCurveIndexArray = reader.ReadInt32Array();
|
||||||
}
|
}
|
||||||
int numDeltas = reader.ReadInt32();
|
int numDeltas = reader.ReadInt32();
|
||||||
m_ValueArrayDelta = new ValueDelta[numDeltas];
|
m_ValueArrayDelta = new List<ValueDelta>();
|
||||||
for (int i = 0; i < numDeltas; i++)
|
for (int i = 0; i < numDeltas; i++)
|
||||||
{
|
{
|
||||||
m_ValueArrayDelta[i] = new ValueDelta(reader);
|
m_ValueArrayDelta.Add(new ValueDelta(reader));
|
||||||
}
|
}
|
||||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 3))//5.3 and up
|
if (version[0] > 5 || (version[0] == 5 && version[1] >= 3))//5.3 and up
|
||||||
{
|
{
|
||||||
@@ -1460,10 +1451,10 @@ namespace AssetStudio
|
|||||||
var clipMuscleConstant = new ClipMuscleConstant();
|
var clipMuscleConstant = new ClipMuscleConstant();
|
||||||
|
|
||||||
clipMuscleConstant.m_DeltaPose = HumanPose.ParseGI(reader);
|
clipMuscleConstant.m_DeltaPose = HumanPose.ParseGI(reader);
|
||||||
clipMuscleConstant.m_StartX = reader.ReadXForm(version, true);
|
clipMuscleConstant.m_StartX = reader.ReadXForm4();
|
||||||
clipMuscleConstant.m_StopX = reader.ReadXForm(version, true);
|
clipMuscleConstant.m_StopX = reader.ReadXForm4();
|
||||||
clipMuscleConstant.m_LeftFootStartX = reader.ReadXForm(version, true);
|
clipMuscleConstant.m_LeftFootStartX = reader.ReadXForm4();
|
||||||
clipMuscleConstant.m_RightFootStartX = reader.ReadXForm(version, true);
|
clipMuscleConstant.m_RightFootStartX = reader.ReadXForm4();
|
||||||
|
|
||||||
clipMuscleConstant.m_AverageSpeed = (Vector3)reader.ReadVector4();
|
clipMuscleConstant.m_AverageSpeed = (Vector3)reader.ReadVector4();
|
||||||
|
|
||||||
@@ -1510,10 +1501,10 @@ namespace AssetStudio
|
|||||||
if (valueArrayDeltaCount > 0)
|
if (valueArrayDeltaCount > 0)
|
||||||
{
|
{
|
||||||
reader.Position = valueArrayDeltaOffset;
|
reader.Position = valueArrayDeltaOffset;
|
||||||
clipMuscleConstant.m_ValueArrayDelta = new ValueDelta[valueArrayDeltaCount];
|
clipMuscleConstant.m_ValueArrayDelta = new List<ValueDelta>();
|
||||||
for (int i = 0; i < valueArrayDeltaCount; i++)
|
for (int i = 0; i < valueArrayDeltaCount; i++)
|
||||||
{
|
{
|
||||||
clipMuscleConstant.m_ValueArrayDelta[i] = new ValueDelta(reader);
|
clipMuscleConstant.m_ValueArrayDelta.Add(new ValueDelta(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1611,25 +1602,25 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class AnimationClipBindingConstant : IYAMLExportable
|
public class AnimationClipBindingConstant : IYAMLExportable
|
||||||
{
|
{
|
||||||
public GenericBinding[] genericBindings;
|
public List<GenericBinding> genericBindings;
|
||||||
public PPtr<Object>[] pptrCurveMapping;
|
public List<PPtr<Object>> pptrCurveMapping;
|
||||||
|
|
||||||
public AnimationClipBindingConstant() { }
|
public AnimationClipBindingConstant() { }
|
||||||
|
|
||||||
public AnimationClipBindingConstant(ObjectReader reader)
|
public AnimationClipBindingConstant(ObjectReader reader)
|
||||||
{
|
{
|
||||||
int numBindings = reader.ReadInt32();
|
int numBindings = reader.ReadInt32();
|
||||||
genericBindings = new GenericBinding[numBindings];
|
genericBindings = new List<GenericBinding>();
|
||||||
for (int i = 0; i < numBindings; i++)
|
for (int i = 0; i < numBindings; i++)
|
||||||
{
|
{
|
||||||
genericBindings[i] = new GenericBinding(reader);
|
genericBindings.Add(new GenericBinding(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numMappings = reader.ReadInt32();
|
int numMappings = reader.ReadInt32();
|
||||||
pptrCurveMapping = new PPtr<Object>[numMappings];
|
pptrCurveMapping = new List<PPtr<Object>>();
|
||||||
for (int i = 0; i < numMappings; i++)
|
for (int i = 0; i < numMappings; i++)
|
||||||
{
|
{
|
||||||
pptrCurveMapping[i] = new PPtr<Object>(reader);
|
pptrCurveMapping.Add(new PPtr<Object>(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1732,20 +1723,20 @@ namespace AssetStudio
|
|||||||
public bool m_Legacy;
|
public bool m_Legacy;
|
||||||
public bool m_Compressed;
|
public bool m_Compressed;
|
||||||
public bool m_UseHighQualityCurve;
|
public bool m_UseHighQualityCurve;
|
||||||
public QuaternionCurve[] m_RotationCurves;
|
public List<QuaternionCurve> m_RotationCurves;
|
||||||
public CompressedAnimationCurve[] m_CompressedRotationCurves;
|
public List<CompressedAnimationCurve> m_CompressedRotationCurves;
|
||||||
public Vector3Curve[] m_EulerCurves;
|
public List<Vector3Curve> m_EulerCurves;
|
||||||
public Vector3Curve[] m_PositionCurves;
|
public List<Vector3Curve> m_PositionCurves;
|
||||||
public Vector3Curve[] m_ScaleCurves;
|
public List<Vector3Curve> m_ScaleCurves;
|
||||||
public FloatCurve[] m_FloatCurves;
|
public List<FloatCurve> m_FloatCurves;
|
||||||
public PPtrCurve[] m_PPtrCurves;
|
public List<PPtrCurve> m_PPtrCurves;
|
||||||
public float m_SampleRate;
|
public float m_SampleRate;
|
||||||
public int m_WrapMode;
|
public int m_WrapMode;
|
||||||
public AABB m_Bounds;
|
public AABB m_Bounds;
|
||||||
public uint m_MuscleClipSize;
|
public uint m_MuscleClipSize;
|
||||||
public ClipMuscleConstant m_MuscleClip;
|
public ClipMuscleConstant m_MuscleClip;
|
||||||
public AnimationClipBindingConstant m_ClipBindingConstant;
|
public AnimationClipBindingConstant m_ClipBindingConstant;
|
||||||
public AnimationEvent[] m_Events;
|
public List<AnimationEvent> m_Events;
|
||||||
public StreamingInfo m_StreamData;
|
public StreamingInfo m_StreamData;
|
||||||
|
|
||||||
private bool hasStreamingInfo = false;
|
private bool hasStreamingInfo = false;
|
||||||
@@ -1773,57 +1764,57 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
reader.AlignStream();
|
reader.AlignStream();
|
||||||
int numRCurves = reader.ReadInt32();
|
int numRCurves = reader.ReadInt32();
|
||||||
m_RotationCurves = new QuaternionCurve[numRCurves];
|
m_RotationCurves = new List<QuaternionCurve>();
|
||||||
for (int i = 0; i < numRCurves; i++)
|
for (int i = 0; i < numRCurves; i++)
|
||||||
{
|
{
|
||||||
m_RotationCurves[i] = new QuaternionCurve(reader);
|
m_RotationCurves.Add(new QuaternionCurve(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numCRCurves = reader.ReadInt32();
|
int numCRCurves = reader.ReadInt32();
|
||||||
m_CompressedRotationCurves = new CompressedAnimationCurve[numCRCurves];
|
m_CompressedRotationCurves = new List<CompressedAnimationCurve>();
|
||||||
for (int i = 0; i < numCRCurves; i++)
|
for (int i = 0; i < numCRCurves; i++)
|
||||||
{
|
{
|
||||||
m_CompressedRotationCurves[i] = new CompressedAnimationCurve(reader);
|
m_CompressedRotationCurves.Add(new CompressedAnimationCurve(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 3))//5.3 and up
|
if (version[0] > 5 || (version[0] == 5 && version[1] >= 3))//5.3 and up
|
||||||
{
|
{
|
||||||
int numEulerCurves = reader.ReadInt32();
|
int numEulerCurves = reader.ReadInt32();
|
||||||
m_EulerCurves = new Vector3Curve[numEulerCurves];
|
m_EulerCurves = new List<Vector3Curve>();
|
||||||
for (int i = 0; i < numEulerCurves; i++)
|
for (int i = 0; i < numEulerCurves; i++)
|
||||||
{
|
{
|
||||||
m_EulerCurves[i] = new Vector3Curve(reader);
|
m_EulerCurves.Add(new Vector3Curve(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int numPCurves = reader.ReadInt32();
|
int numPCurves = reader.ReadInt32();
|
||||||
m_PositionCurves = new Vector3Curve[numPCurves];
|
m_PositionCurves = new List<Vector3Curve>();
|
||||||
for (int i = 0; i < numPCurves; i++)
|
for (int i = 0; i < numPCurves; i++)
|
||||||
{
|
{
|
||||||
m_PositionCurves[i] = new Vector3Curve(reader);
|
m_PositionCurves.Add(new Vector3Curve(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numSCurves = reader.ReadInt32();
|
int numSCurves = reader.ReadInt32();
|
||||||
m_ScaleCurves = new Vector3Curve[numSCurves];
|
m_ScaleCurves = new List<Vector3Curve>();
|
||||||
for (int i = 0; i < numSCurves; i++)
|
for (int i = 0; i < numSCurves; i++)
|
||||||
{
|
{
|
||||||
m_ScaleCurves[i] = new Vector3Curve(reader);
|
m_ScaleCurves.Add(new Vector3Curve(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numFCurves = reader.ReadInt32();
|
int numFCurves = reader.ReadInt32();
|
||||||
m_FloatCurves = new FloatCurve[numFCurves];
|
m_FloatCurves = new List<FloatCurve>();
|
||||||
for (int i = 0; i < numFCurves; i++)
|
for (int i = 0; i < numFCurves; i++)
|
||||||
{
|
{
|
||||||
m_FloatCurves[i] = new FloatCurve(reader);
|
m_FloatCurves.Add(new FloatCurve(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
|
if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
|
||||||
{
|
{
|
||||||
int numPtrCurves = reader.ReadInt32();
|
int numPtrCurves = reader.ReadInt32();
|
||||||
m_PPtrCurves = new PPtrCurve[numPtrCurves];
|
m_PPtrCurves = new List<PPtrCurve>();
|
||||||
for (int i = 0; i < numPtrCurves; i++)
|
for (int i = 0; i < numPtrCurves; i++)
|
||||||
{
|
{
|
||||||
m_PPtrCurves[i] = new PPtrCurve(reader);
|
m_PPtrCurves.Add(new PPtrCurve(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1864,10 +1855,10 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
var m_AclClipData = reader.ReadUInt8Array();
|
var m_AclClipData = reader.ReadUInt8Array();
|
||||||
var aclBindingsCount = reader.ReadInt32();
|
var aclBindingsCount = reader.ReadInt32();
|
||||||
var m_AclBindings = new GenericBinding[aclBindingsCount];
|
var m_AclBindings = new List<GenericBinding>();
|
||||||
for (int i = 0; i < aclBindingsCount; i++)
|
for (int i = 0; i < aclBindingsCount; i++)
|
||||||
{
|
{
|
||||||
m_AclBindings[i] = new GenericBinding(reader);
|
m_AclBindings.Add(new GenericBinding(reader));
|
||||||
}
|
}
|
||||||
var m_AclRange = new KeyValuePair<float, float>(reader.ReadSingle(), reader.ReadSingle());
|
var m_AclRange = new KeyValuePair<float, float>(reader.ReadSingle(), reader.ReadSingle());
|
||||||
}
|
}
|
||||||
@@ -1882,10 +1873,10 @@ namespace AssetStudio
|
|||||||
reader.AlignStream();
|
reader.AlignStream();
|
||||||
}
|
}
|
||||||
int numEvents = reader.ReadInt32();
|
int numEvents = reader.ReadInt32();
|
||||||
m_Events = new AnimationEvent[numEvents];
|
m_Events = new List<AnimationEvent>();
|
||||||
for (int i = 0; i < numEvents; i++)
|
for (int i = 0; i < numEvents; i++)
|
||||||
{
|
{
|
||||||
m_Events[i] = new AnimationEvent(reader);
|
m_Events.Add(new AnimationEvent(reader));
|
||||||
}
|
}
|
||||||
if (version[0] >= 2017) //2017 and up
|
if (version[0] >= 2017) //2017 and up
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,15 +38,15 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class SkeletonMask
|
public class SkeletonMask
|
||||||
{
|
{
|
||||||
public SkeletonMaskElement[] m_Data;
|
public List<SkeletonMaskElement> m_Data;
|
||||||
|
|
||||||
public SkeletonMask(ObjectReader reader)
|
public SkeletonMask(ObjectReader reader)
|
||||||
{
|
{
|
||||||
int numElements = reader.ReadInt32();
|
int numElements = reader.ReadInt32();
|
||||||
m_Data = new SkeletonMaskElement[numElements];
|
m_Data = new List<SkeletonMaskElement>();
|
||||||
for (int i = 0; i < numElements; i++)
|
for (int i = 0; i < numElements; i++)
|
||||||
{
|
{
|
||||||
m_Data[i] = new SkeletonMaskElement(reader);
|
m_Data.Add(new SkeletonMaskElement(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class TransitionConstant
|
public class TransitionConstant
|
||||||
{
|
{
|
||||||
public ConditionConstant[] m_ConditionConstantArray;
|
public List<ConditionConstant> m_ConditionConstantArray;
|
||||||
public uint m_DestinationState;
|
public uint m_DestinationState;
|
||||||
public uint m_FullPathID;
|
public uint m_FullPathID;
|
||||||
public uint m_ID;
|
public uint m_ID;
|
||||||
@@ -124,10 +124,10 @@ namespace AssetStudio
|
|||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
|
|
||||||
int numConditions = reader.ReadInt32();
|
int numConditions = reader.ReadInt32();
|
||||||
m_ConditionConstantArray = new ConditionConstant[numConditions];
|
m_ConditionConstantArray = new List<ConditionConstant>();
|
||||||
for (int i = 0; i < numConditions; i++)
|
for (int i = 0; i < numConditions; i++)
|
||||||
{
|
{
|
||||||
m_ConditionConstantArray[i] = new ConditionConstant(reader);
|
m_ConditionConstantArray.Add(new ConditionConstant(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DestinationState = reader.ReadUInt32();
|
m_DestinationState = reader.ReadUInt32();
|
||||||
@@ -191,7 +191,7 @@ namespace AssetStudio
|
|||||||
public float[] m_ChildMagnitudeArray;
|
public float[] m_ChildMagnitudeArray;
|
||||||
public Vector2[] m_ChildPairVectorArray;
|
public Vector2[] m_ChildPairVectorArray;
|
||||||
public float[] m_ChildPairAvgMagInvArray;
|
public float[] m_ChildPairAvgMagInvArray;
|
||||||
public MotionNeighborList[] m_ChildNeighborListArray;
|
public List<MotionNeighborList> m_ChildNeighborListArray;
|
||||||
|
|
||||||
public Blend2dDataConstant(ObjectReader reader)
|
public Blend2dDataConstant(ObjectReader reader)
|
||||||
{
|
{
|
||||||
@@ -201,10 +201,10 @@ namespace AssetStudio
|
|||||||
m_ChildPairAvgMagInvArray = reader.ReadSingleArray();
|
m_ChildPairAvgMagInvArray = reader.ReadSingleArray();
|
||||||
|
|
||||||
int numNeighbours = reader.ReadInt32();
|
int numNeighbours = reader.ReadInt32();
|
||||||
m_ChildNeighborListArray = new MotionNeighborList[numNeighbours];
|
m_ChildNeighborListArray = new List<MotionNeighborList>();
|
||||||
for (int i = 0; i < numNeighbours; i++)
|
for (int i = 0; i < numNeighbours; i++)
|
||||||
{
|
{
|
||||||
m_ChildNeighborListArray[i] = new MotionNeighborList(reader);
|
m_ChildNeighborListArray.Add(new MotionNeighborList(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class BlendTreeConstant
|
public class BlendTreeConstant
|
||||||
{
|
{
|
||||||
public BlendTreeNodeConstant[] m_NodeArray;
|
public List<BlendTreeNodeConstant> m_NodeArray;
|
||||||
public ValueArrayConstant m_BlendEventArrayConstant;
|
public ValueArrayConstant m_BlendEventArrayConstant;
|
||||||
|
|
||||||
public BlendTreeConstant(ObjectReader reader)
|
public BlendTreeConstant(ObjectReader reader)
|
||||||
@@ -311,10 +311,10 @@ namespace AssetStudio
|
|||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
|
|
||||||
int numNodes = reader.ReadInt32();
|
int numNodes = reader.ReadInt32();
|
||||||
m_NodeArray = new BlendTreeNodeConstant[numNodes];
|
m_NodeArray = new List<BlendTreeNodeConstant>();
|
||||||
for (int i = 0; i < numNodes; i++)
|
for (int i = 0; i < numNodes; i++)
|
||||||
{
|
{
|
||||||
m_NodeArray[i] = new BlendTreeNodeConstant(reader);
|
m_NodeArray.Add(new BlendTreeNodeConstant(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] < 4 || (version[0] == 4 && version[1] < 5)) //4.5 down
|
if (version[0] < 4 || (version[0] == 4 && version[1] < 5)) //4.5 down
|
||||||
@@ -327,10 +327,10 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class StateConstant
|
public class StateConstant
|
||||||
{
|
{
|
||||||
public TransitionConstant[] m_TransitionConstantArray;
|
public List<TransitionConstant> m_TransitionConstantArray;
|
||||||
public int[] m_BlendTreeConstantIndexArray;
|
public int[] m_BlendTreeConstantIndexArray;
|
||||||
public LeafInfoConstant[] m_LeafInfoArray;
|
public List<LeafInfoConstant> m_LeafInfoArray;
|
||||||
public BlendTreeConstant[] m_BlendTreeConstantArray;
|
public List<BlendTreeConstant> m_BlendTreeConstantArray;
|
||||||
public uint m_NameID;
|
public uint m_NameID;
|
||||||
public uint m_PathID;
|
public uint m_PathID;
|
||||||
public uint m_FullPathID;
|
public uint m_FullPathID;
|
||||||
@@ -350,10 +350,10 @@ namespace AssetStudio
|
|||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
|
|
||||||
int numTransistions = reader.ReadInt32();
|
int numTransistions = reader.ReadInt32();
|
||||||
m_TransitionConstantArray = new TransitionConstant[numTransistions];
|
m_TransitionConstantArray = new List<TransitionConstant>();
|
||||||
for (int i = 0; i < numTransistions; i++)
|
for (int i = 0; i < numTransistions; i++)
|
||||||
{
|
{
|
||||||
m_TransitionConstantArray[i] = new TransitionConstant(reader);
|
m_TransitionConstantArray.Add(new TransitionConstant(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_BlendTreeConstantIndexArray = reader.ReadInt32Array();
|
m_BlendTreeConstantIndexArray = reader.ReadInt32Array();
|
||||||
@@ -361,18 +361,18 @@ namespace AssetStudio
|
|||||||
if (version[0] < 5 || (version[0] == 5 && version[1] < 2)) //5.2 down
|
if (version[0] < 5 || (version[0] == 5 && version[1] < 2)) //5.2 down
|
||||||
{
|
{
|
||||||
int numInfos = reader.ReadInt32();
|
int numInfos = reader.ReadInt32();
|
||||||
m_LeafInfoArray = new LeafInfoConstant[numInfos];
|
m_LeafInfoArray = new List<LeafInfoConstant>();
|
||||||
for (int i = 0; i < numInfos; i++)
|
for (int i = 0; i < numInfos; i++)
|
||||||
{
|
{
|
||||||
m_LeafInfoArray[i] = new LeafInfoConstant(reader);
|
m_LeafInfoArray.Add(new LeafInfoConstant(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int numBlends = reader.ReadInt32();
|
int numBlends = reader.ReadInt32();
|
||||||
m_BlendTreeConstantArray = new BlendTreeConstant[numBlends];
|
m_BlendTreeConstantArray = new List<BlendTreeConstant>();
|
||||||
for (int i = 0; i < numBlends; i++)
|
for (int i = 0; i < numBlends; i++)
|
||||||
{
|
{
|
||||||
m_BlendTreeConstantArray[i] = new BlendTreeConstant(reader);
|
m_BlendTreeConstantArray.Add(new BlendTreeConstant(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_NameID = reader.ReadUInt32();
|
m_NameID = reader.ReadUInt32();
|
||||||
@@ -428,34 +428,34 @@ namespace AssetStudio
|
|||||||
public class SelectorTransitionConstant
|
public class SelectorTransitionConstant
|
||||||
{
|
{
|
||||||
public uint m_Destination;
|
public uint m_Destination;
|
||||||
public ConditionConstant[] m_ConditionConstantArray;
|
public List<ConditionConstant> m_ConditionConstantArray;
|
||||||
|
|
||||||
public SelectorTransitionConstant(ObjectReader reader)
|
public SelectorTransitionConstant(ObjectReader reader)
|
||||||
{
|
{
|
||||||
m_Destination = reader.ReadUInt32();
|
m_Destination = reader.ReadUInt32();
|
||||||
|
|
||||||
int numConditions = reader.ReadInt32();
|
int numConditions = reader.ReadInt32();
|
||||||
m_ConditionConstantArray = new ConditionConstant[numConditions];
|
m_ConditionConstantArray = new List<ConditionConstant>();
|
||||||
for (int i = 0; i < numConditions; i++)
|
for (int i = 0; i < numConditions; i++)
|
||||||
{
|
{
|
||||||
m_ConditionConstantArray[i] = new ConditionConstant(reader);
|
m_ConditionConstantArray.Add(new ConditionConstant(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SelectorStateConstant
|
public class SelectorStateConstant
|
||||||
{
|
{
|
||||||
public SelectorTransitionConstant[] m_TransitionConstantArray;
|
public List<SelectorTransitionConstant> m_TransitionConstantArray;
|
||||||
public uint m_FullPathID;
|
public uint m_FullPathID;
|
||||||
public bool m_isEntry;
|
public bool m_isEntry;
|
||||||
|
|
||||||
public SelectorStateConstant(ObjectReader reader)
|
public SelectorStateConstant(ObjectReader reader)
|
||||||
{
|
{
|
||||||
int numTransitions = reader.ReadInt32();
|
int numTransitions = reader.ReadInt32();
|
||||||
m_TransitionConstantArray = new SelectorTransitionConstant[numTransitions];
|
m_TransitionConstantArray = new List<SelectorTransitionConstant>();
|
||||||
for (int i = 0; i < numTransitions; i++)
|
for (int i = 0; i < numTransitions; i++)
|
||||||
{
|
{
|
||||||
m_TransitionConstantArray[i] = new SelectorTransitionConstant(reader);
|
m_TransitionConstantArray.Add(new SelectorTransitionConstant(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_FullPathID = reader.ReadUInt32();
|
m_FullPathID = reader.ReadUInt32();
|
||||||
@@ -466,9 +466,9 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class StateMachineConstant
|
public class StateMachineConstant
|
||||||
{
|
{
|
||||||
public StateConstant[] m_StateConstantArray;
|
public List<StateConstant> m_StateConstantArray;
|
||||||
public TransitionConstant[] m_AnyStateTransitionConstantArray;
|
public List<TransitionConstant> m_AnyStateTransitionConstantArray;
|
||||||
public SelectorStateConstant[] m_SelectorStateConstantArray;
|
public List<SelectorStateConstant> m_SelectorStateConstantArray;
|
||||||
public uint m_DefaultState;
|
public uint m_DefaultState;
|
||||||
public uint m_MotionSetCount;
|
public uint m_MotionSetCount;
|
||||||
|
|
||||||
@@ -477,26 +477,26 @@ namespace AssetStudio
|
|||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
|
|
||||||
int numStates = reader.ReadInt32();
|
int numStates = reader.ReadInt32();
|
||||||
m_StateConstantArray = new StateConstant[numStates];
|
m_StateConstantArray = new List<StateConstant>();
|
||||||
for (int i = 0; i < numStates; i++)
|
for (int i = 0; i < numStates; i++)
|
||||||
{
|
{
|
||||||
m_StateConstantArray[i] = new StateConstant(reader);
|
m_StateConstantArray.Add(new StateConstant(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numAnyStates = reader.ReadInt32();
|
int numAnyStates = reader.ReadInt32();
|
||||||
m_AnyStateTransitionConstantArray = new TransitionConstant[numAnyStates];
|
m_AnyStateTransitionConstantArray = new List<TransitionConstant>();
|
||||||
for (int i = 0; i < numAnyStates; i++)
|
for (int i = 0; i < numAnyStates; i++)
|
||||||
{
|
{
|
||||||
m_AnyStateTransitionConstantArray[i] = new TransitionConstant(reader);
|
m_AnyStateTransitionConstantArray.Add(new TransitionConstant(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] >= 5) //5.0 and up
|
if (version[0] >= 5) //5.0 and up
|
||||||
{
|
{
|
||||||
int numSelectors = reader.ReadInt32();
|
int numSelectors = reader.ReadInt32();
|
||||||
m_SelectorStateConstantArray = new SelectorStateConstant[numSelectors];
|
m_SelectorStateConstantArray = new List<SelectorStateConstant>();
|
||||||
for (int i = 0; i < numSelectors; i++)
|
for (int i = 0; i < numSelectors; i++)
|
||||||
{
|
{
|
||||||
m_SelectorStateConstantArray[i] = new SelectorStateConstant(reader);
|
m_SelectorStateConstantArray.Add(new SelectorStateConstant(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -533,21 +533,11 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int numPosValues = reader.ReadInt32();
|
m_PositionValues = reader.ReadVector3Array();
|
||||||
m_PositionValues = new Vector3[numPosValues];
|
|
||||||
for (int i = 0; i < numPosValues; i++)
|
|
||||||
{
|
|
||||||
m_PositionValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up
|
|
||||||
}
|
|
||||||
|
|
||||||
m_QuaternionValues = reader.ReadVector4Array();
|
m_QuaternionValues = reader.ReadVector4Array();
|
||||||
|
|
||||||
int numScaleValues = reader.ReadInt32();
|
m_ScaleValues = reader.ReadVector3Array();
|
||||||
m_ScaleValues = new Vector3[numScaleValues];
|
|
||||||
for (int i = 0; i < numScaleValues; i++)
|
|
||||||
{
|
|
||||||
m_ScaleValues[i] = version[0] > 5 || (version[0] == 5 && version[1] >= 4) ? reader.ReadVector3() : (Vector3)reader.ReadVector4(); //5.4 and up
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 5)) //5.5 and up
|
if (version[0] > 5 || (version[0] == 5 && version[1] >= 5)) //5.5 and up
|
||||||
{
|
{
|
||||||
@@ -562,25 +552,25 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class ControllerConstant
|
public class ControllerConstant
|
||||||
{
|
{
|
||||||
public LayerConstant[] m_LayerArray;
|
public List<LayerConstant> m_LayerArray;
|
||||||
public StateMachineConstant[] m_StateMachineArray;
|
public List<StateMachineConstant> m_StateMachineArray;
|
||||||
public ValueArrayConstant m_Values;
|
public ValueArrayConstant m_Values;
|
||||||
public ValueArray m_DefaultValues;
|
public ValueArray m_DefaultValues;
|
||||||
|
|
||||||
public ControllerConstant(ObjectReader reader)
|
public ControllerConstant(ObjectReader reader)
|
||||||
{
|
{
|
||||||
int numLayers = reader.ReadInt32();
|
int numLayers = reader.ReadInt32();
|
||||||
m_LayerArray = new LayerConstant[numLayers];
|
m_LayerArray = new List<LayerConstant>();
|
||||||
for (int i = 0; i < numLayers; i++)
|
for (int i = 0; i < numLayers; i++)
|
||||||
{
|
{
|
||||||
m_LayerArray[i] = new LayerConstant(reader);
|
m_LayerArray.Add(new LayerConstant(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numStates = reader.ReadInt32();
|
int numStates = reader.ReadInt32();
|
||||||
m_StateMachineArray = new StateMachineConstant[numStates];
|
m_StateMachineArray = new List<StateMachineConstant>();
|
||||||
for (int i = 0; i < numStates; i++)
|
for (int i = 0; i < numStates; i++)
|
||||||
{
|
{
|
||||||
m_StateMachineArray[i] = new StateMachineConstant(reader);
|
m_StateMachineArray.Add(new StateMachineConstant(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Values = new ValueArrayConstant(reader);
|
m_Values = new ValueArrayConstant(reader);
|
||||||
@@ -591,7 +581,7 @@ namespace AssetStudio
|
|||||||
public sealed class AnimatorController : RuntimeAnimatorController
|
public sealed class AnimatorController : RuntimeAnimatorController
|
||||||
{
|
{
|
||||||
public Dictionary<uint, string> m_TOS;
|
public Dictionary<uint, string> m_TOS;
|
||||||
public PPtr<AnimationClip>[] m_AnimationClips;
|
public List<PPtr<AnimationClip>> m_AnimationClips;
|
||||||
|
|
||||||
public AnimatorController(ObjectReader reader) : base(reader)
|
public AnimatorController(ObjectReader reader) : base(reader)
|
||||||
{
|
{
|
||||||
@@ -599,17 +589,17 @@ namespace AssetStudio
|
|||||||
var m_Controller = new ControllerConstant(reader);
|
var m_Controller = new ControllerConstant(reader);
|
||||||
|
|
||||||
int tosSize = reader.ReadInt32();
|
int tosSize = reader.ReadInt32();
|
||||||
m_TOS = new Dictionary<uint, string>(tosSize);
|
m_TOS = new Dictionary<uint, string>();
|
||||||
for (int i = 0; i < tosSize; i++)
|
for (int i = 0; i < tosSize; i++)
|
||||||
{
|
{
|
||||||
m_TOS.Add(reader.ReadUInt32(), reader.ReadAlignedString());
|
m_TOS.Add(reader.ReadUInt32(), reader.ReadAlignedString());
|
||||||
}
|
}
|
||||||
|
|
||||||
int numClips = reader.ReadInt32();
|
int numClips = reader.ReadInt32();
|
||||||
m_AnimationClips = new PPtr<AnimationClip>[numClips];
|
m_AnimationClips = new List<PPtr<AnimationClip>>();
|
||||||
for (int i = 0; i < numClips; i++)
|
for (int i = 0; i < numClips; i++)
|
||||||
{
|
{
|
||||||
m_AnimationClips[i] = new PPtr<AnimationClip>(reader);
|
m_AnimationClips.Add(new PPtr<AnimationClip>(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,17 +20,17 @@ namespace AssetStudio
|
|||||||
public sealed class AnimatorOverrideController : RuntimeAnimatorController
|
public sealed class AnimatorOverrideController : RuntimeAnimatorController
|
||||||
{
|
{
|
||||||
public PPtr<RuntimeAnimatorController> m_Controller;
|
public PPtr<RuntimeAnimatorController> m_Controller;
|
||||||
public AnimationClipOverride[] m_Clips;
|
public List<AnimationClipOverride> m_Clips;
|
||||||
|
|
||||||
public AnimatorOverrideController(ObjectReader reader) : base(reader)
|
public AnimatorOverrideController(ObjectReader reader) : base(reader)
|
||||||
{
|
{
|
||||||
m_Controller = new PPtr<RuntimeAnimatorController>(reader);
|
m_Controller = new PPtr<RuntimeAnimatorController>(reader);
|
||||||
|
|
||||||
int numOverrides = reader.ReadInt32();
|
int numOverrides = reader.ReadInt32();
|
||||||
m_Clips = new AnimationClipOverride[numOverrides];
|
m_Clips = new List<AnimationClipOverride>();
|
||||||
for (int i = 0; i < numOverrides; i++)
|
for (int i = 0; i < numOverrides; i++)
|
||||||
{
|
{
|
||||||
m_Clips[i] = new AnimationClipOverride(reader);
|
m_Clips.Add(new AnimationClipOverride(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,64 +22,24 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public sealed class AssetBundle : NamedObject
|
public sealed class AssetBundle : NamedObject
|
||||||
{
|
{
|
||||||
public PPtr<Object>[] m_PreloadTable;
|
public List<PPtr<Object>> m_PreloadTable;
|
||||||
public KeyValuePair<string, AssetInfo>[] m_Container;
|
public List<KeyValuePair<string, AssetInfo>> m_Container;
|
||||||
//public AssetInfo m_MainAsset;
|
|
||||||
//public uint m_RuntimeComaptability;
|
|
||||||
//public string m_AssetBundleName;
|
|
||||||
//public string[] m_Dependencies;
|
|
||||||
//public bool m_IsStreamedSceneAssetBundle;
|
|
||||||
//public int m_ExplicitDataLayout;
|
|
||||||
//public int m_PathFlags;
|
|
||||||
//public KeyValuePair<string, string>[] m_SceneHashes;
|
|
||||||
|
|
||||||
public AssetBundle(ObjectReader reader) : base(reader)
|
public AssetBundle(ObjectReader reader) : base(reader)
|
||||||
{
|
{
|
||||||
var m_PreloadTableSize = reader.ReadInt32();
|
var m_PreloadTableSize = reader.ReadInt32();
|
||||||
m_PreloadTable = new PPtr<Object>[m_PreloadTableSize];
|
m_PreloadTable = new List<PPtr<Object>>();
|
||||||
for (int i = 0; i < m_PreloadTableSize; i++)
|
for (int i = 0; i < m_PreloadTableSize; i++)
|
||||||
{
|
{
|
||||||
m_PreloadTable[i] = new PPtr<Object>(reader);
|
m_PreloadTable.Add(new PPtr<Object>(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
var m_ContainerSize = reader.ReadInt32();
|
var m_ContainerSize = reader.ReadInt32();
|
||||||
m_Container = new KeyValuePair<string, AssetInfo>[m_ContainerSize];
|
m_Container = new List<KeyValuePair<string, AssetInfo>>();
|
||||||
for (int i = 0; i < m_ContainerSize; i++)
|
for (int i = 0; i < m_ContainerSize; i++)
|
||||||
{
|
{
|
||||||
m_Container[i] = new KeyValuePair<string, AssetInfo>(reader.ReadAlignedString(), new AssetInfo(reader));
|
m_Container.Add(new KeyValuePair<string, AssetInfo>(reader.ReadAlignedString(), new AssetInfo(reader)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (reader.Game.Type.IsMhyGroup())
|
|
||||||
//{
|
|
||||||
// m_MainAsset = new AssetInfo(reader);
|
|
||||||
// m_RuntimeComaptability = reader.ReadUInt32();
|
|
||||||
// m_AssetBundleName = reader.ReadAlignedString();
|
|
||||||
// var dependencyCount = reader.ReadInt32();
|
|
||||||
// m_Dependencies = new string[dependencyCount];
|
|
||||||
// for (int k = 0; k < dependencyCount; k++)
|
|
||||||
// {
|
|
||||||
// m_Dependencies[k] = reader.ReadAlignedString();
|
|
||||||
// }
|
|
||||||
// if (reader.Game.Type.IsGIGroup())
|
|
||||||
// {
|
|
||||||
// m_IsStreamedSceneAssetBundle = reader.ReadBoolean();
|
|
||||||
// reader.AlignStream();
|
|
||||||
// if (reader.Game.Type.IsGICB3() || reader.Game.Type.IsGI())
|
|
||||||
// {
|
|
||||||
// m_ExplicitDataLayout = reader.ReadInt32();
|
|
||||||
// }
|
|
||||||
// m_PathFlags = reader.ReadInt32();
|
|
||||||
// if (reader.Game.Type.IsGI())
|
|
||||||
// {
|
|
||||||
// var sceneHashCount = reader.ReadInt32();
|
|
||||||
// m_SceneHashes = new KeyValuePair<string, string>[sceneHashCount];
|
|
||||||
// for (int l = 0; l < sceneHashCount; l++)
|
|
||||||
// {
|
|
||||||
// m_SceneHashes[l] = new KeyValuePair<string, string>(reader.ReadAlignedString(), reader.ReadAlignedString());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,27 +66,26 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class Skeleton
|
public class Skeleton
|
||||||
{
|
{
|
||||||
public Node[] m_Node;
|
public List<Node> m_Node;
|
||||||
public uint[] m_ID;
|
public uint[] m_ID;
|
||||||
public Axes[] m_AxesArray;
|
public List<Axes> m_AxesArray;
|
||||||
|
|
||||||
|
|
||||||
public Skeleton(ObjectReader reader)
|
public Skeleton(ObjectReader reader)
|
||||||
{
|
{
|
||||||
int numNodes = reader.ReadInt32();
|
int numNodes = reader.ReadInt32();
|
||||||
m_Node = new Node[numNodes];
|
m_Node = new List<Node>();
|
||||||
for (int i = 0; i < numNodes; i++)
|
for (int i = 0; i < numNodes; i++)
|
||||||
{
|
{
|
||||||
m_Node[i] = new Node(reader);
|
m_Node.Add(new Node(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ID = reader.ReadUInt32Array();
|
m_ID = reader.ReadUInt32Array();
|
||||||
|
|
||||||
int numAxes = reader.ReadInt32();
|
int numAxes = reader.ReadInt32();
|
||||||
m_AxesArray = new Axes[numAxes];
|
m_AxesArray = new List<Axes>();
|
||||||
for (int i = 0; i < numAxes; i++)
|
for (int i = 0; i < numAxes; i++)
|
||||||
{
|
{
|
||||||
m_AxesArray[i] = new Axes(reader);
|
m_AxesArray.Add(new Axes(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,12 +96,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public SkeletonPose(ObjectReader reader)
|
public SkeletonPose(ObjectReader reader)
|
||||||
{
|
{
|
||||||
int numXforms = reader.ReadInt32();
|
m_X = reader.ReadXFormArray();
|
||||||
m_X = new XForm[numXforms];
|
|
||||||
for (int i = 0; i < numXforms; i++)
|
|
||||||
{
|
|
||||||
m_X[i] = reader.ReadXForm(reader.version);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +118,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public Handle(ObjectReader reader)
|
public Handle(ObjectReader reader)
|
||||||
{
|
{
|
||||||
m_X = reader.ReadXForm(reader.version);
|
m_X = reader.ReadXForm();
|
||||||
m_ParentHumanIndex = reader.ReadUInt32();
|
m_ParentHumanIndex = reader.ReadUInt32();
|
||||||
m_ID = reader.ReadUInt32();
|
m_ID = reader.ReadUInt32();
|
||||||
}
|
}
|
||||||
@@ -144,7 +138,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public Collider(ObjectReader reader)
|
public Collider(ObjectReader reader)
|
||||||
{
|
{
|
||||||
m_X = reader.ReadXForm(reader.version);
|
m_X = reader.ReadXForm();
|
||||||
m_Type = reader.ReadUInt32();
|
m_Type = reader.ReadUInt32();
|
||||||
m_XMotionType = reader.ReadUInt32();
|
m_XMotionType = reader.ReadUInt32();
|
||||||
m_YMotionType = reader.ReadUInt32();
|
m_YMotionType = reader.ReadUInt32();
|
||||||
@@ -163,8 +157,8 @@ namespace AssetStudio
|
|||||||
public SkeletonPose m_SkeletonPose;
|
public SkeletonPose m_SkeletonPose;
|
||||||
public Hand m_LeftHand;
|
public Hand m_LeftHand;
|
||||||
public Hand m_RightHand;
|
public Hand m_RightHand;
|
||||||
public Handle[] m_Handles;
|
public List<Handle> m_Handles;
|
||||||
public Collider[] m_ColliderArray;
|
public List<Collider> m_ColliderArray;
|
||||||
public int[] m_HumanBoneIndex;
|
public int[] m_HumanBoneIndex;
|
||||||
public float[] m_HumanBoneMass;
|
public float[] m_HumanBoneMass;
|
||||||
public int[] m_ColliderIndex;
|
public int[] m_ColliderIndex;
|
||||||
@@ -183,7 +177,7 @@ namespace AssetStudio
|
|||||||
public Human(ObjectReader reader)
|
public Human(ObjectReader reader)
|
||||||
{
|
{
|
||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
m_RootX = reader.ReadXForm(reader.version);
|
m_RootX = reader.ReadXForm();
|
||||||
m_Skeleton = new Skeleton(reader);
|
m_Skeleton = new Skeleton(reader);
|
||||||
m_SkeletonPose = new SkeletonPose(reader);
|
m_SkeletonPose = new SkeletonPose(reader);
|
||||||
m_LeftHand = new Hand(reader);
|
m_LeftHand = new Hand(reader);
|
||||||
@@ -192,17 +186,17 @@ namespace AssetStudio
|
|||||||
if (version[0] < 2018 || (version[0] == 2018 && version[1] < 2)) //2018.2 down
|
if (version[0] < 2018 || (version[0] == 2018 && version[1] < 2)) //2018.2 down
|
||||||
{
|
{
|
||||||
int numHandles = reader.ReadInt32();
|
int numHandles = reader.ReadInt32();
|
||||||
m_Handles = new Handle[numHandles];
|
m_Handles = new List<Handle>();
|
||||||
for (int i = 0; i < numHandles; i++)
|
for (int i = 0; i < numHandles; i++)
|
||||||
{
|
{
|
||||||
m_Handles[i] = new Handle(reader);
|
m_Handles.Add(new Handle(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numColliders = reader.ReadInt32();
|
int numColliders = reader.ReadInt32();
|
||||||
m_ColliderArray = new Collider[numColliders];
|
m_ColliderArray = new List<Collider>(numColliders);
|
||||||
for (int i = 0; i < numColliders; i++)
|
for (int i = 0; i < numColliders; i++)
|
||||||
{
|
{
|
||||||
m_ColliderArray[i] = new Collider(reader);
|
m_ColliderArray.Add(new Collider(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +265,7 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_RootMotionBoneIndex = reader.ReadInt32();
|
m_RootMotionBoneIndex = reader.ReadInt32();
|
||||||
m_RootMotionBoneX = reader.ReadXForm(reader.version);
|
m_RootMotionBoneX = reader.ReadXForm();
|
||||||
|
|
||||||
if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
|
if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
|
||||||
{
|
{
|
||||||
@@ -295,7 +289,7 @@ namespace AssetStudio
|
|||||||
m_Avatar = new AvatarConstant(reader);
|
m_Avatar = new AvatarConstant(reader);
|
||||||
|
|
||||||
int numTOS = reader.ReadInt32();
|
int numTOS = reader.ReadInt32();
|
||||||
m_TOS = new Dictionary<uint, string>(numTOS);
|
m_TOS = new Dictionary<uint, string>();
|
||||||
for (int i = 0; i < numTOS; i++)
|
for (int i = 0; i < numTOS; i++)
|
||||||
{
|
{
|
||||||
m_TOS.Add(reader.ReadUInt32(), reader.ReadAlignedString());
|
m_TOS.Add(reader.ReadUInt32(), reader.ReadAlignedString());
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
public sealed class GameObject : EditorExtension
|
public sealed class GameObject : EditorExtension
|
||||||
{
|
{
|
||||||
public PPtr<Component>[] m_Components;
|
public List<PPtr<Component>> m_Components;
|
||||||
public string m_Name;
|
public string m_Name;
|
||||||
|
|
||||||
public Transform m_Transform;
|
public Transform m_Transform;
|
||||||
@@ -23,14 +23,14 @@ namespace AssetStudio
|
|||||||
public GameObject(ObjectReader reader) : base(reader)
|
public GameObject(ObjectReader reader) : base(reader)
|
||||||
{
|
{
|
||||||
int m_Component_size = reader.ReadInt32();
|
int m_Component_size = reader.ReadInt32();
|
||||||
m_Components = new PPtr<Component>[m_Component_size];
|
m_Components = new List<PPtr<Component>>();
|
||||||
for (int i = 0; i < m_Component_size; i++)
|
for (int i = 0; i < m_Component_size; i++)
|
||||||
{
|
{
|
||||||
if ((version[0] == 5 && version[1] < 5) || version[0] < 5) //5.5 down
|
if ((version[0] == 5 && version[1] < 5) || version[0] < 5) //5.5 down
|
||||||
{
|
{
|
||||||
int first = reader.ReadInt32();
|
int first = reader.ReadInt32();
|
||||||
}
|
}
|
||||||
m_Components[i] = new PPtr<Component>(reader);
|
m_Components.Add(new PPtr<Component>(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
var m_Layer = reader.ReadInt32();
|
var m_Layer = reader.ReadInt32();
|
||||||
|
|||||||
@@ -17,17 +17,17 @@ namespace AssetStudio
|
|||||||
public sealed class IndexObject : NamedObject
|
public sealed class IndexObject : NamedObject
|
||||||
{
|
{
|
||||||
public int Count;
|
public int Count;
|
||||||
public KeyValuePair<string, Index>[] AssetMap;
|
public List<KeyValuePair<string, Index>> AssetMap;
|
||||||
|
|
||||||
public override string Name => "IndexObject";
|
public override string Name => "IndexObject";
|
||||||
|
|
||||||
public IndexObject(ObjectReader reader) : base(reader)
|
public IndexObject(ObjectReader reader) : base(reader)
|
||||||
{
|
{
|
||||||
Count = reader.ReadInt32();
|
Count = reader.ReadInt32();
|
||||||
AssetMap = new KeyValuePair<string, Index>[Count];
|
AssetMap = new List<KeyValuePair<string, Index>>();
|
||||||
for (int i = 0; i < Count; i++)
|
for (int i = 0; i < Count; i++)
|
||||||
{
|
{
|
||||||
AssetMap[i] = new KeyValuePair<string, Index>(reader.ReadAlignedString(), new Index(reader));
|
AssetMap.Add(new KeyValuePair<string, Index>(reader.ReadAlignedString(), new Index(reader)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,44 +22,44 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class UnityPropertySheet
|
public class UnityPropertySheet
|
||||||
{
|
{
|
||||||
public KeyValuePair<string, UnityTexEnv>[] m_TexEnvs;
|
public List<KeyValuePair<string, UnityTexEnv>> m_TexEnvs;
|
||||||
public KeyValuePair<string, int>[] m_Ints;
|
public List<KeyValuePair<string, int>> m_Ints;
|
||||||
public KeyValuePair<string, float>[] m_Floats;
|
public List<KeyValuePair<string, float>> m_Floats;
|
||||||
public KeyValuePair<string, Color>[] m_Colors;
|
public List<KeyValuePair<string, Color>> m_Colors;
|
||||||
|
|
||||||
public UnityPropertySheet(ObjectReader reader)
|
public UnityPropertySheet(ObjectReader reader)
|
||||||
{
|
{
|
||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
|
|
||||||
int m_TexEnvsSize = reader.ReadInt32();
|
int m_TexEnvsSize = reader.ReadInt32();
|
||||||
m_TexEnvs = new KeyValuePair<string, UnityTexEnv>[m_TexEnvsSize];
|
m_TexEnvs = new List<KeyValuePair<string, UnityTexEnv>>();
|
||||||
for (int i = 0; i < m_TexEnvsSize; i++)
|
for (int i = 0; i < m_TexEnvsSize; i++)
|
||||||
{
|
{
|
||||||
m_TexEnvs[i] = new(reader.ReadAlignedString(), new UnityTexEnv(reader));
|
m_TexEnvs.Add(new(reader.ReadAlignedString(), new UnityTexEnv(reader)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] >= 2021) //2021.1 and up
|
if (version[0] >= 2021) //2021.1 and up
|
||||||
{
|
{
|
||||||
int m_IntsSize = reader.ReadInt32();
|
int m_IntsSize = reader.ReadInt32();
|
||||||
m_Ints = new KeyValuePair<string, int>[m_IntsSize];
|
m_Ints = new List<KeyValuePair<string, int>>();
|
||||||
for (int i = 0; i < m_IntsSize; i++)
|
for (int i = 0; i < m_IntsSize; i++)
|
||||||
{
|
{
|
||||||
m_Ints[i] = new(reader.ReadAlignedString(), reader.ReadInt32());
|
m_Ints.Add(new(reader.ReadAlignedString(), reader.ReadInt32()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_FloatsSize = reader.ReadInt32();
|
int m_FloatsSize = reader.ReadInt32();
|
||||||
m_Floats = new KeyValuePair<string, float>[m_FloatsSize];
|
m_Floats = new List<KeyValuePair<string, float>>();
|
||||||
for (int i = 0; i < m_FloatsSize; i++)
|
for (int i = 0; i < m_FloatsSize; i++)
|
||||||
{
|
{
|
||||||
m_Floats[i] = new(reader.ReadAlignedString(), reader.ReadSingle());
|
m_Floats.Add(new(reader.ReadAlignedString(), reader.ReadSingle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
int m_ColorsSize = reader.ReadInt32();
|
int m_ColorsSize = reader.ReadInt32();
|
||||||
m_Colors = new KeyValuePair<string, Color>[m_ColorsSize];
|
m_Colors = new List<KeyValuePair<string, Color>>();
|
||||||
for (int i = 0; i < m_ColorsSize; i++)
|
for (int i = 0; i < m_ColorsSize; i++)
|
||||||
{
|
{
|
||||||
m_Colors[i] = new(reader.ReadAlignedString(), reader.ReadColor4());
|
m_Colors.Add(new(reader.ReadAlignedString(), reader.ReadColor4()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace AssetStudio
|
|||||||
public Vector3 m_Min;
|
public Vector3 m_Min;
|
||||||
public Vector3 m_Max;
|
public Vector3 m_Max;
|
||||||
|
|
||||||
public MinMaxAABB(EndianBinaryReader reader)
|
public MinMaxAABB(ObjectReader reader)
|
||||||
{
|
{
|
||||||
m_Min = reader.ReadVector3();
|
m_Min = reader.ReadVector3();
|
||||||
m_Max = reader.ReadVector3();
|
m_Max = reader.ReadVector3();
|
||||||
@@ -124,8 +124,8 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
public uint m_CurrentChannels;
|
public uint m_CurrentChannels;
|
||||||
public uint m_VertexCount;
|
public uint m_VertexCount;
|
||||||
public ChannelInfo[] m_Channels;
|
public List<ChannelInfo> m_Channels;
|
||||||
public StreamInfo[] m_Streams;
|
public List<StreamInfo> m_Streams;
|
||||||
public byte[] m_DataSize;
|
public byte[] m_DataSize;
|
||||||
|
|
||||||
public VertexData(ObjectReader reader)
|
public VertexData(ObjectReader reader)
|
||||||
@@ -142,25 +142,18 @@ namespace AssetStudio
|
|||||||
if (version[0] >= 4) //4.0 and up
|
if (version[0] >= 4) //4.0 and up
|
||||||
{
|
{
|
||||||
var m_ChannelsSize = reader.ReadInt32();
|
var m_ChannelsSize = reader.ReadInt32();
|
||||||
m_Channels = new ChannelInfo[m_ChannelsSize];
|
m_Channels = new List<ChannelInfo>();
|
||||||
for (int i = 0; i < m_ChannelsSize; i++)
|
for (int i = 0; i < m_ChannelsSize; i++)
|
||||||
{
|
{
|
||||||
m_Channels[i] = new ChannelInfo(reader);
|
m_Channels.Add(new ChannelInfo(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] < 5) //5.0 down
|
if (version[0] < 5) //5.0 down
|
||||||
{
|
{
|
||||||
if (version[0] < 4)
|
var numStreams = version[0] < 4 ? 4 : reader.ReadInt32();
|
||||||
{
|
m_Streams = new List<StreamInfo>();
|
||||||
m_Streams = new StreamInfo[4];
|
for (int i = 0; i < numStreams; i++)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_Streams = new StreamInfo[reader.ReadInt32()];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < m_Streams.Length; i++)
|
|
||||||
{
|
{
|
||||||
m_Streams[i] = new StreamInfo(reader);
|
m_Streams[i] = new StreamInfo(reader);
|
||||||
}
|
}
|
||||||
@@ -182,13 +175,13 @@ namespace AssetStudio
|
|||||||
private void GetStreams(int[] version)
|
private void GetStreams(int[] version)
|
||||||
{
|
{
|
||||||
var streamCount = m_Channels.Max(x => x.stream) + 1;
|
var streamCount = m_Channels.Max(x => x.stream) + 1;
|
||||||
m_Streams = new StreamInfo[streamCount];
|
m_Streams = new List<StreamInfo>();
|
||||||
uint offset = 0;
|
uint offset = 0;
|
||||||
for (int s = 0; s < streamCount; s++)
|
for (int s = 0; s < streamCount; s++)
|
||||||
{
|
{
|
||||||
uint chnMask = 0;
|
uint chnMask = 0;
|
||||||
uint stride = 0;
|
uint stride = 0;
|
||||||
for (int chn = 0; chn < m_Channels.Length; chn++)
|
for (int chn = 0; chn < m_Channels.Count; chn++)
|
||||||
{
|
{
|
||||||
var m_Channel = m_Channels[chn];
|
var m_Channel = m_Channels[chn];
|
||||||
if (m_Channel.stream == s)
|
if (m_Channel.stream == s)
|
||||||
@@ -200,14 +193,14 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_Streams[s] = new StreamInfo
|
m_Streams.Add(new StreamInfo
|
||||||
{
|
{
|
||||||
channelMask = chnMask,
|
channelMask = chnMask,
|
||||||
offset = offset,
|
offset = offset,
|
||||||
stride = stride,
|
stride = stride,
|
||||||
dividerOp = 0,
|
dividerOp = 0,
|
||||||
frequency = 0
|
frequency = 0
|
||||||
};
|
});
|
||||||
offset += m_VertexCount * stride;
|
offset += m_VertexCount * stride;
|
||||||
//static size_t AlignStreamSize (size_t size) { return (size + (kVertexStreamAlign-1)) & ~(kVertexStreamAlign-1); }
|
//static size_t AlignStreamSize (size_t size) { return (size + (kVertexStreamAlign-1)) & ~(kVertexStreamAlign-1); }
|
||||||
offset = (offset + (16u - 1u)) & ~(16u - 1u);
|
offset = (offset + (16u - 1u)) & ~(16u - 1u);
|
||||||
@@ -216,12 +209,12 @@ namespace AssetStudio
|
|||||||
|
|
||||||
private void GetChannels(int[] version)
|
private void GetChannels(int[] version)
|
||||||
{
|
{
|
||||||
m_Channels = new ChannelInfo[6];
|
m_Channels = new List<ChannelInfo>(6);
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
m_Channels[i] = new ChannelInfo();
|
m_Channels.Add(new ChannelInfo());
|
||||||
}
|
}
|
||||||
for (var s = 0; s < m_Streams.Length; s++)
|
for (var s = 0; s < m_Streams.Count; s++)
|
||||||
{
|
{
|
||||||
var m_Stream = m_Streams[s];
|
var m_Stream = m_Streams[s];
|
||||||
var channelMask = new BitArray(new[] { (int)m_Stream.channelMask });
|
var channelMask = new BitArray(new[] { (int)m_Stream.channelMask });
|
||||||
@@ -345,9 +338,9 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class BlendShapeData
|
public class BlendShapeData
|
||||||
{
|
{
|
||||||
public BlendShapeVertex[] vertices;
|
public List<BlendShapeVertex> vertices;
|
||||||
public MeshBlendShape[] shapes;
|
public List<MeshBlendShape> shapes;
|
||||||
public MeshBlendShapeChannel[] channels;
|
public List<MeshBlendShapeChannel> channels;
|
||||||
public float[] fullWeights;
|
public float[] fullWeights;
|
||||||
|
|
||||||
public BlendShapeData(ObjectReader reader)
|
public BlendShapeData(ObjectReader reader)
|
||||||
@@ -357,24 +350,24 @@ namespace AssetStudio
|
|||||||
if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
|
if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
|
||||||
{
|
{
|
||||||
int numVerts = reader.ReadInt32();
|
int numVerts = reader.ReadInt32();
|
||||||
vertices = new BlendShapeVertex[numVerts];
|
vertices = new List<BlendShapeVertex>();
|
||||||
for (int i = 0; i < numVerts; i++)
|
for (int i = 0; i < numVerts; i++)
|
||||||
{
|
{
|
||||||
vertices[i] = new BlendShapeVertex(reader);
|
vertices.Add(new BlendShapeVertex(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numShapes = reader.ReadInt32();
|
int numShapes = reader.ReadInt32();
|
||||||
shapes = new MeshBlendShape[numShapes];
|
shapes = new List<MeshBlendShape>();
|
||||||
for (int i = 0; i < numShapes; i++)
|
for (int i = 0; i < numShapes; i++)
|
||||||
{
|
{
|
||||||
shapes[i] = new MeshBlendShape(reader);
|
shapes.Add(new MeshBlendShape(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numChannels = reader.ReadInt32();
|
int numChannels = reader.ReadInt32();
|
||||||
channels = new MeshBlendShapeChannel[numChannels];
|
channels = new List<MeshBlendShapeChannel>();
|
||||||
for (int i = 0; i < numChannels; i++)
|
for (int i = 0; i < numChannels; i++)
|
||||||
{
|
{
|
||||||
channels[i] = new MeshBlendShapeChannel(reader);
|
channels.Add(new MeshBlendShapeChannel(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
fullWeights = reader.ReadSingleArray();
|
fullWeights = reader.ReadSingleArray();
|
||||||
@@ -382,17 +375,17 @@ namespace AssetStudio
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var m_ShapesSize = reader.ReadInt32();
|
var m_ShapesSize = reader.ReadInt32();
|
||||||
var m_Shapes = new MeshBlendShape[m_ShapesSize];
|
var m_Shapes = new List<MeshBlendShape>();
|
||||||
for (int i = 0; i < m_ShapesSize; i++)
|
for (int i = 0; i < m_ShapesSize; i++)
|
||||||
{
|
{
|
||||||
m_Shapes[i] = new MeshBlendShape(reader);
|
m_Shapes.Add(new MeshBlendShape(reader));
|
||||||
}
|
}
|
||||||
reader.AlignStream();
|
reader.AlignStream();
|
||||||
var m_ShapeVerticesSize = reader.ReadInt32();
|
var m_ShapeVerticesSize = reader.ReadInt32();
|
||||||
var m_ShapeVertices = new BlendShapeVertex[m_ShapeVerticesSize]; //MeshBlendShapeVertex
|
var m_ShapeVertices = new List<BlendShapeVertex>(); //MeshBlendShapeVertex
|
||||||
for (int i = 0; i < m_ShapeVerticesSize; i++)
|
for (int i = 0; i < m_ShapeVerticesSize; i++)
|
||||||
{
|
{
|
||||||
m_ShapeVertices[i] = new BlendShapeVertex(reader);
|
m_ShapeVertices.Add(new BlendShapeVertex(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -449,14 +442,14 @@ namespace AssetStudio
|
|||||||
public sealed class Mesh : NamedObject
|
public sealed class Mesh : NamedObject
|
||||||
{
|
{
|
||||||
private bool m_Use16BitIndices = true;
|
private bool m_Use16BitIndices = true;
|
||||||
public SubMesh[] m_SubMeshes;
|
public List<SubMesh> m_SubMeshes;
|
||||||
private uint[] m_IndexBuffer;
|
private uint[] m_IndexBuffer;
|
||||||
public BlendShapeData m_Shapes;
|
public BlendShapeData m_Shapes;
|
||||||
public Matrix4x4[] m_BindPose;
|
public Matrix4x4[] m_BindPose;
|
||||||
public uint[] m_BoneNameHashes;
|
public uint[] m_BoneNameHashes;
|
||||||
public int m_VertexCount;
|
public int m_VertexCount;
|
||||||
public float[] m_Vertices;
|
public float[] m_Vertices;
|
||||||
public BoneWeights4[] m_Skin;
|
public List<BoneWeights4> m_Skin;
|
||||||
public float[] m_Normals;
|
public float[] m_Normals;
|
||||||
public float[] m_Colors;
|
public float[] m_Colors;
|
||||||
public float[] m_UV0;
|
public float[] m_UV0;
|
||||||
@@ -502,10 +495,10 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
|
|
||||||
int m_SubMeshesSize = reader.ReadInt32();
|
int m_SubMeshesSize = reader.ReadInt32();
|
||||||
m_SubMeshes = new SubMesh[m_SubMeshesSize];
|
m_SubMeshes = new List<SubMesh>();
|
||||||
for (int i = 0; i < m_SubMeshesSize; i++)
|
for (int i = 0; i < m_SubMeshesSize; i++)
|
||||||
{
|
{
|
||||||
m_SubMeshes[i] = new SubMesh(reader);
|
m_SubMeshes.Add(new SubMesh(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] > 4 || (version[0] == 4 && version[1] >= 1)) //4.1 and up
|
if (version[0] > 4 || (version[0] == 4 && version[1] >= 1)) //4.1 and up
|
||||||
@@ -525,10 +518,10 @@ namespace AssetStudio
|
|||||||
if (version[0] >= 2019) //2019 and up
|
if (version[0] >= 2019) //2019 and up
|
||||||
{
|
{
|
||||||
var m_BonesAABBSize = reader.ReadInt32();
|
var m_BonesAABBSize = reader.ReadInt32();
|
||||||
var m_BonesAABB = new MinMaxAABB[m_BonesAABBSize];
|
var m_BonesAABB = new List<MinMaxAABB>();
|
||||||
for (int i = 0; i < m_BonesAABBSize; i++)
|
for (int i = 0; i < m_BonesAABBSize; i++)
|
||||||
{
|
{
|
||||||
m_BonesAABB[i] = new MinMaxAABB(reader);
|
m_BonesAABB.Add(new MinMaxAABB(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
var m_VariableBoneCountWeights = reader.ReadUInt32Array();
|
var m_VariableBoneCountWeights = reader.ReadUInt32Array();
|
||||||
@@ -594,10 +587,11 @@ namespace AssetStudio
|
|||||||
m_VertexCount = reader.ReadInt32();
|
m_VertexCount = reader.ReadInt32();
|
||||||
m_Vertices = reader.ReadSingleArray(m_VertexCount * 3); //Vector3
|
m_Vertices = reader.ReadSingleArray(m_VertexCount * 3); //Vector3
|
||||||
|
|
||||||
m_Skin = new BoneWeights4[reader.ReadInt32()];
|
var skinNum = reader.ReadInt32();
|
||||||
for (int s = 0; s < m_Skin.Length; s++)
|
m_Skin = new List<BoneWeights4>();
|
||||||
|
for (int s = 0; s < skinNum; s++)
|
||||||
{
|
{
|
||||||
m_Skin[s] = new BoneWeights4(reader);
|
m_Skin.Add(new BoneWeights4(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_BindPose = reader.ReadMatrixArray();
|
m_BindPose = reader.ReadMatrixArray();
|
||||||
@@ -633,10 +627,11 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
if (version[0] < 2018 || (version[0] == 2018 && version[1] < 2)) //2018.2 down
|
if (version[0] < 2018 || (version[0] == 2018 && version[1] < 2)) //2018.2 down
|
||||||
{
|
{
|
||||||
m_Skin = new BoneWeights4[reader.ReadInt32()];
|
var skinNum = reader.ReadInt32();
|
||||||
for (int s = 0; s < m_Skin.Length; s++)
|
m_Skin = new List<BoneWeights4>();
|
||||||
|
for (int s = 0; s < skinNum; s++)
|
||||||
{
|
{
|
||||||
m_Skin[s] = new BoneWeights4(reader);
|
m_Skin.Add(new BoneWeights4(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -763,7 +758,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
m_VertexCount = (int)m_VertexData.m_VertexCount;
|
m_VertexCount = (int)m_VertexData.m_VertexCount;
|
||||||
|
|
||||||
for (var chn = 0; chn < m_VertexData.m_Channels.Length; chn++)
|
for (var chn = 0; chn < m_VertexData.m_Channels.Count; chn++)
|
||||||
{
|
{
|
||||||
var m_Channel = m_VertexData.m_Channels[chn];
|
var m_Channel = m_VertexData.m_Channels[chn];
|
||||||
if (m_Channel.dimension > 0)
|
if (m_Channel.dimension > 0)
|
||||||
@@ -1184,10 +1179,10 @@ namespace AssetStudio
|
|||||||
|
|
||||||
private void InitMSkin()
|
private void InitMSkin()
|
||||||
{
|
{
|
||||||
m_Skin = new BoneWeights4[m_VertexCount];
|
m_Skin = new List<BoneWeights4>();
|
||||||
for (int i = 0; i < m_VertexCount; i++)
|
for (int i = 0; i < m_VertexCount; i++)
|
||||||
{
|
{
|
||||||
m_Skin[i] = new BoneWeights4();
|
m_Skin.Add(new BoneWeights4());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public MiHoYoBinData(ObjectReader reader) : base(reader)
|
public MiHoYoBinData(ObjectReader reader) : base(reader)
|
||||||
{
|
{
|
||||||
var length = reader.ReadInt32();
|
RawData = reader.ReadUInt8Array();
|
||||||
RawData = reader.ReadBytes(length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string AsString => Type switch
|
public string AsString => Type switch
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
public static bool Parsable;
|
public static bool Parsable;
|
||||||
|
|
||||||
public PPtr<Material>[] m_Materials;
|
public List<PPtr<Material>> m_Materials;
|
||||||
public StaticBatchInfo m_StaticBatchInfo;
|
public StaticBatchInfo m_StaticBatchInfo;
|
||||||
public uint[] m_SubsetIndices;
|
public uint[] m_SubsetIndices;
|
||||||
private bool isNewHeader = false;
|
private bool isNewHeader = false;
|
||||||
@@ -165,10 +165,10 @@ namespace AssetStudio
|
|||||||
var m_ShaderLODDistanceRatio = reader.ReadSingle();
|
var m_ShaderLODDistanceRatio = reader.ReadSingle();
|
||||||
}
|
}
|
||||||
var m_MaterialsSize = reader.ReadInt32();
|
var m_MaterialsSize = reader.ReadInt32();
|
||||||
m_Materials = new PPtr<Material>[m_MaterialsSize];
|
m_Materials = new List<PPtr<Material>>();
|
||||||
for (int i = 0; i < m_MaterialsSize; i++)
|
for (int i = 0; i < m_MaterialsSize; i++)
|
||||||
{
|
{
|
||||||
m_Materials[i] = new PPtr<Material>(reader);
|
m_Materials.Add(new PPtr<Material>(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] < 3) //3.0 down
|
if (version[0] < 3) //3.0 down
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
public class ResourceManager : Object
|
public class ResourceManager : Object
|
||||||
{
|
{
|
||||||
public KeyValuePair<string, PPtr<Object>>[] m_Container;
|
public List<KeyValuePair<string, PPtr<Object>>> m_Container;
|
||||||
|
|
||||||
public ResourceManager(ObjectReader reader) : base(reader)
|
public ResourceManager(ObjectReader reader) : base(reader)
|
||||||
{
|
{
|
||||||
var m_ContainerSize = reader.ReadInt32();
|
var m_ContainerSize = reader.ReadInt32();
|
||||||
m_Container = new KeyValuePair<string, PPtr<Object>>[m_ContainerSize];
|
m_Container = new List<KeyValuePair<string, PPtr<Object>>>();
|
||||||
for (int i = 0; i < m_ContainerSize; i++)
|
for (int i = 0; i < m_ContainerSize; i++)
|
||||||
{
|
{
|
||||||
m_Container[i] = new KeyValuePair<string, PPtr<Object>>(reader.ReadAlignedString(), new PPtr<Object>(reader));
|
m_Container.Add(new KeyValuePair<string, PPtr<Object>>(reader.ReadAlignedString(), new PPtr<Object>(reader)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class StructParameter
|
public class StructParameter
|
||||||
{
|
{
|
||||||
public MatrixParameter[] m_MatrixParams;
|
public List<MatrixParameter> m_MatrixParams;
|
||||||
public VectorParameter[] m_VectorParams;
|
public List<VectorParameter> m_VectorParams;
|
||||||
|
|
||||||
public StructParameter(EndianBinaryReader reader)
|
public StructParameter(EndianBinaryReader reader)
|
||||||
{
|
{
|
||||||
@@ -29,17 +29,17 @@ namespace AssetStudio
|
|||||||
var m_StructSize = reader.ReadInt32();
|
var m_StructSize = reader.ReadInt32();
|
||||||
|
|
||||||
int numVectorParams = reader.ReadInt32();
|
int numVectorParams = reader.ReadInt32();
|
||||||
m_VectorParams = new VectorParameter[numVectorParams];
|
m_VectorParams = new List<VectorParameter>();
|
||||||
for (int i = 0; i < numVectorParams; i++)
|
for (int i = 0; i < numVectorParams; i++)
|
||||||
{
|
{
|
||||||
m_VectorParams[i] = new VectorParameter(reader);
|
m_VectorParams.Add(new VectorParameter(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numMatrixParams = reader.ReadInt32();
|
int numMatrixParams = reader.ReadInt32();
|
||||||
m_MatrixParams = new MatrixParameter[numMatrixParams];
|
m_MatrixParams = new List<MatrixParameter>();
|
||||||
for (int i = 0; i < numMatrixParams; i++)
|
for (int i = 0; i < numMatrixParams; i++)
|
||||||
{
|
{
|
||||||
m_MatrixParams[i] = new MatrixParameter(reader);
|
m_MatrixParams.Add(new MatrixParameter(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,15 +113,15 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class SerializedProperties
|
public class SerializedProperties
|
||||||
{
|
{
|
||||||
public SerializedProperty[] m_Props;
|
public List<SerializedProperty> m_Props;
|
||||||
|
|
||||||
public SerializedProperties(EndianBinaryReader reader)
|
public SerializedProperties(EndianBinaryReader reader)
|
||||||
{
|
{
|
||||||
int numProps = reader.ReadInt32();
|
int numProps = reader.ReadInt32();
|
||||||
m_Props = new SerializedProperty[numProps];
|
m_Props = new List<SerializedProperty>();
|
||||||
for (int i = 0; i < numProps; i++)
|
for (int i = 0; i < numProps; i++)
|
||||||
{
|
{
|
||||||
m_Props[i] = new SerializedProperty(reader);
|
m_Props.Add(new SerializedProperty(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,7 +206,7 @@ namespace AssetStudio
|
|||||||
public class SerializedShaderState
|
public class SerializedShaderState
|
||||||
{
|
{
|
||||||
public string m_Name;
|
public string m_Name;
|
||||||
public SerializedShaderRTBlendState[] rtBlend;
|
public List<SerializedShaderRTBlendState> rtBlend;
|
||||||
public bool rtSeparateBlend;
|
public bool rtSeparateBlend;
|
||||||
public SerializedShaderFloatValue zClip;
|
public SerializedShaderFloatValue zClip;
|
||||||
public SerializedShaderFloatValue zTest;
|
public SerializedShaderFloatValue zTest;
|
||||||
@@ -237,10 +237,10 @@ namespace AssetStudio
|
|||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
|
|
||||||
m_Name = reader.ReadAlignedString();
|
m_Name = reader.ReadAlignedString();
|
||||||
rtBlend = new SerializedShaderRTBlendState[8];
|
rtBlend = new List<SerializedShaderRTBlendState>();
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
rtBlend[i] = new SerializedShaderRTBlendState(reader);
|
rtBlend.Add(new SerializedShaderRTBlendState(reader));
|
||||||
}
|
}
|
||||||
rtSeparateBlend = reader.ReadBoolean();
|
rtSeparateBlend = reader.ReadBoolean();
|
||||||
reader.AlignStream();
|
reader.AlignStream();
|
||||||
@@ -291,16 +291,16 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class ParserBindChannels
|
public class ParserBindChannels
|
||||||
{
|
{
|
||||||
public ShaderBindChannel[] m_Channels;
|
public List<ShaderBindChannel> m_Channels;
|
||||||
public uint m_SourceMap;
|
public uint m_SourceMap;
|
||||||
|
|
||||||
public ParserBindChannels(EndianBinaryReader reader)
|
public ParserBindChannels(EndianBinaryReader reader)
|
||||||
{
|
{
|
||||||
int numChannels = reader.ReadInt32();
|
int numChannels = reader.ReadInt32();
|
||||||
m_Channels = new ShaderBindChannel[numChannels];
|
m_Channels = new List<ShaderBindChannel>();
|
||||||
for (int i = 0; i < numChannels; i++)
|
for (int i = 0; i < numChannels; i++)
|
||||||
{
|
{
|
||||||
m_Channels[i] = new ShaderBindChannel(reader);
|
m_Channels.Add(new ShaderBindChannel(reader));
|
||||||
}
|
}
|
||||||
reader.AlignStream();
|
reader.AlignStream();
|
||||||
|
|
||||||
@@ -391,9 +391,9 @@ namespace AssetStudio
|
|||||||
public class ConstantBuffer
|
public class ConstantBuffer
|
||||||
{
|
{
|
||||||
public int m_NameIndex;
|
public int m_NameIndex;
|
||||||
public MatrixParameter[] m_MatrixParams;
|
public List<MatrixParameter> m_MatrixParams;
|
||||||
public VectorParameter[] m_VectorParams;
|
public List<VectorParameter> m_VectorParams;
|
||||||
public StructParameter[] m_StructParams;
|
public List<StructParameter> m_StructParams;
|
||||||
public int m_Size;
|
public int m_Size;
|
||||||
public bool m_IsPartialCB;
|
public bool m_IsPartialCB;
|
||||||
|
|
||||||
@@ -404,25 +404,25 @@ namespace AssetStudio
|
|||||||
m_NameIndex = reader.ReadInt32();
|
m_NameIndex = reader.ReadInt32();
|
||||||
|
|
||||||
int numMatrixParams = reader.ReadInt32();
|
int numMatrixParams = reader.ReadInt32();
|
||||||
m_MatrixParams = new MatrixParameter[numMatrixParams];
|
m_MatrixParams = new List<MatrixParameter>();
|
||||||
for (int i = 0; i < numMatrixParams; i++)
|
for (int i = 0; i < numMatrixParams; i++)
|
||||||
{
|
{
|
||||||
m_MatrixParams[i] = new MatrixParameter(reader);
|
m_MatrixParams.Add(new MatrixParameter(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numVectorParams = reader.ReadInt32();
|
int numVectorParams = reader.ReadInt32();
|
||||||
m_VectorParams = new VectorParameter[numVectorParams];
|
m_VectorParams = new List<VectorParameter>();
|
||||||
for (int i = 0; i < numVectorParams; i++)
|
for (int i = 0; i < numVectorParams; i++)
|
||||||
{
|
{
|
||||||
m_VectorParams[i] = new VectorParameter(reader);
|
m_VectorParams.Add(new VectorParameter(reader));
|
||||||
}
|
}
|
||||||
if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 3)) //2017.3 and up
|
if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 3)) //2017.3 and up
|
||||||
{
|
{
|
||||||
int numStructParams = reader.ReadInt32();
|
int numStructParams = reader.ReadInt32();
|
||||||
m_StructParams = new StructParameter[numStructParams];
|
m_StructParams = new List<StructParameter>();
|
||||||
for (int i = 0; i < numStructParams; i++)
|
for (int i = 0; i < numStructParams; i++)
|
||||||
{
|
{
|
||||||
m_StructParams[i] = new StructParameter(reader);
|
m_StructParams.Add(new StructParameter(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_Size = reader.ReadInt32();
|
m_Size = reader.ReadInt32();
|
||||||
@@ -492,71 +492,71 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class SerializedProgramParameters
|
public class SerializedProgramParameters
|
||||||
{
|
{
|
||||||
public VectorParameter[] m_VectorParams;
|
public List<VectorParameter> m_VectorParams;
|
||||||
public MatrixParameter[] m_MatrixParams;
|
public List<MatrixParameter> m_MatrixParams;
|
||||||
public TextureParameter[] m_TextureParams;
|
public List<TextureParameter> m_TextureParams;
|
||||||
public BufferBinding[] m_BufferParams;
|
public List<BufferBinding> m_BufferParams;
|
||||||
public ConstantBuffer[] m_ConstantBuffers;
|
public List<ConstantBuffer> m_ConstantBuffers;
|
||||||
public BufferBinding[] m_ConstantBufferBindings;
|
public List<BufferBinding> m_ConstantBufferBindings;
|
||||||
public UAVParameter[] m_UAVParams;
|
public List<UAVParameter> m_UAVParams;
|
||||||
public SamplerParameter[] m_Samplers;
|
public List<SamplerParameter> m_Samplers;
|
||||||
|
|
||||||
public SerializedProgramParameters(ObjectReader reader)
|
public SerializedProgramParameters(ObjectReader reader)
|
||||||
{
|
{
|
||||||
int numVectorParams = reader.ReadInt32();
|
int numVectorParams = reader.ReadInt32();
|
||||||
m_VectorParams = new VectorParameter[numVectorParams];
|
m_VectorParams = new List<VectorParameter>();
|
||||||
for (int i = 0; i < numVectorParams; i++)
|
for (int i = 0; i < numVectorParams; i++)
|
||||||
{
|
{
|
||||||
m_VectorParams[i] = new VectorParameter(reader);
|
m_VectorParams.Add(new VectorParameter(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numMatrixParams = reader.ReadInt32();
|
int numMatrixParams = reader.ReadInt32();
|
||||||
m_MatrixParams = new MatrixParameter[numMatrixParams];
|
m_MatrixParams = new List<MatrixParameter>();
|
||||||
for (int i = 0; i < numMatrixParams; i++)
|
for (int i = 0; i < numMatrixParams; i++)
|
||||||
{
|
{
|
||||||
m_MatrixParams[i] = new MatrixParameter(reader);
|
m_MatrixParams.Add(new MatrixParameter(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numTextureParams = reader.ReadInt32();
|
int numTextureParams = reader.ReadInt32();
|
||||||
m_TextureParams = new TextureParameter[numTextureParams];
|
m_TextureParams = new List<TextureParameter>();
|
||||||
for (int i = 0; i < numTextureParams; i++)
|
for (int i = 0; i < numTextureParams; i++)
|
||||||
{
|
{
|
||||||
m_TextureParams[i] = new TextureParameter(reader);
|
m_TextureParams.Add(new TextureParameter(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numBufferParams = reader.ReadInt32();
|
int numBufferParams = reader.ReadInt32();
|
||||||
m_BufferParams = new BufferBinding[numBufferParams];
|
m_BufferParams = new List<BufferBinding>();
|
||||||
for (int i = 0; i < numBufferParams; i++)
|
for (int i = 0; i < numBufferParams; i++)
|
||||||
{
|
{
|
||||||
m_BufferParams[i] = new BufferBinding(reader);
|
m_BufferParams.Add(new BufferBinding(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numConstantBuffers = reader.ReadInt32();
|
int numConstantBuffers = reader.ReadInt32();
|
||||||
m_ConstantBuffers = new ConstantBuffer[numConstantBuffers];
|
m_ConstantBuffers = new List<ConstantBuffer>();
|
||||||
for (int i = 0; i < numConstantBuffers; i++)
|
for (int i = 0; i < numConstantBuffers; i++)
|
||||||
{
|
{
|
||||||
m_ConstantBuffers[i] = new ConstantBuffer(reader);
|
m_ConstantBuffers.Add(new ConstantBuffer(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numConstantBufferBindings = reader.ReadInt32();
|
int numConstantBufferBindings = reader.ReadInt32();
|
||||||
m_ConstantBufferBindings = new BufferBinding[numConstantBufferBindings];
|
m_ConstantBufferBindings = new List<BufferBinding>();
|
||||||
for (int i = 0; i < numConstantBufferBindings; i++)
|
for (int i = 0; i < numConstantBufferBindings; i++)
|
||||||
{
|
{
|
||||||
m_ConstantBufferBindings[i] = new BufferBinding(reader);
|
m_ConstantBufferBindings.Add(new BufferBinding(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numUAVParams = reader.ReadInt32();
|
int numUAVParams = reader.ReadInt32();
|
||||||
m_UAVParams = new UAVParameter[numUAVParams];
|
m_UAVParams = new List<UAVParameter>();
|
||||||
for (int i = 0; i < numUAVParams; i++)
|
for (int i = 0; i < numUAVParams; i++)
|
||||||
{
|
{
|
||||||
m_UAVParams[i] = new UAVParameter(reader);
|
m_UAVParams.Add(new UAVParameter(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numSamplers = reader.ReadInt32();
|
int numSamplers = reader.ReadInt32();
|
||||||
m_Samplers = new SamplerParameter[numSamplers];
|
m_Samplers = new List<SamplerParameter>();
|
||||||
for (int i = 0; i < numSamplers; i++)
|
for (int i = 0; i < numSamplers; i++)
|
||||||
{
|
{
|
||||||
m_Samplers[i] = new SamplerParameter(reader);
|
m_Samplers.Add(new SamplerParameter(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -569,14 +569,14 @@ namespace AssetStudio
|
|||||||
public sbyte m_ShaderHardwareTier;
|
public sbyte m_ShaderHardwareTier;
|
||||||
public ShaderGpuProgramType m_GpuProgramType;
|
public ShaderGpuProgramType m_GpuProgramType;
|
||||||
public SerializedProgramParameters m_Parameters;
|
public SerializedProgramParameters m_Parameters;
|
||||||
public VectorParameter[] m_VectorParams;
|
public List<VectorParameter> m_VectorParams;
|
||||||
public MatrixParameter[] m_MatrixParams;
|
public List<MatrixParameter> m_MatrixParams;
|
||||||
public TextureParameter[] m_TextureParams;
|
public List<TextureParameter> m_TextureParams;
|
||||||
public BufferBinding[] m_BufferParams;
|
public List<BufferBinding> m_BufferParams;
|
||||||
public ConstantBuffer[] m_ConstantBuffers;
|
public List<ConstantBuffer> m_ConstantBuffers;
|
||||||
public BufferBinding[] m_ConstantBufferBindings;
|
public List<BufferBinding> m_ConstantBufferBindings;
|
||||||
public UAVParameter[] m_UAVParams;
|
public List<UAVParameter> m_UAVParams;
|
||||||
public SamplerParameter[] m_Samplers;
|
public List<SamplerParameter> m_Samplers;
|
||||||
|
|
||||||
public static bool HasGlobalLocalKeywordIndices(SerializedType type) => type.Match("E99740711222CD922E9A6F92FF1EB07A", "450A058C218DAF000647948F2F59DA6D");
|
public static bool HasGlobalLocalKeywordIndices(SerializedType type) => type.Match("E99740711222CD922E9A6F92FF1EB07A", "450A058C218DAF000647948F2F59DA6D");
|
||||||
public static bool HasInstancedStructuredBuffers(SerializedType type) => type.Match("E99740711222CD922E9A6F92FF1EB07A");
|
public static bool HasInstancedStructuredBuffers(SerializedType type) => type.Match("E99740711222CD922E9A6F92FF1EB07A");
|
||||||
@@ -630,61 +630,61 @@ namespace AssetStudio
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int numVectorParams = reader.ReadInt32();
|
int numVectorParams = reader.ReadInt32();
|
||||||
m_VectorParams = new VectorParameter[numVectorParams];
|
m_VectorParams = new List<VectorParameter>();
|
||||||
for (int i = 0; i < numVectorParams; i++)
|
for (int i = 0; i < numVectorParams; i++)
|
||||||
{
|
{
|
||||||
m_VectorParams[i] = new VectorParameter(reader);
|
m_VectorParams.Add(new VectorParameter(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numMatrixParams = reader.ReadInt32();
|
int numMatrixParams = reader.ReadInt32();
|
||||||
m_MatrixParams = new MatrixParameter[numMatrixParams];
|
m_MatrixParams = new List<MatrixParameter>();
|
||||||
for (int i = 0; i < numMatrixParams; i++)
|
for (int i = 0; i < numMatrixParams; i++)
|
||||||
{
|
{
|
||||||
m_MatrixParams[i] = new MatrixParameter(reader);
|
m_MatrixParams.Add(new MatrixParameter(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numTextureParams = reader.ReadInt32();
|
int numTextureParams = reader.ReadInt32();
|
||||||
m_TextureParams = new TextureParameter[numTextureParams];
|
m_TextureParams = new List<TextureParameter>();
|
||||||
for (int i = 0; i < numTextureParams; i++)
|
for (int i = 0; i < numTextureParams; i++)
|
||||||
{
|
{
|
||||||
m_TextureParams[i] = new TextureParameter(reader);
|
m_TextureParams.Add(new TextureParameter(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numBufferParams = reader.ReadInt32();
|
int numBufferParams = reader.ReadInt32();
|
||||||
m_BufferParams = new BufferBinding[numBufferParams];
|
m_BufferParams = new List<BufferBinding>();
|
||||||
for (int i = 0; i < numBufferParams; i++)
|
for (int i = 0; i < numBufferParams; i++)
|
||||||
{
|
{
|
||||||
m_BufferParams[i] = new BufferBinding(reader);
|
m_BufferParams.Add(new BufferBinding(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numConstantBuffers = reader.ReadInt32();
|
int numConstantBuffers = reader.ReadInt32();
|
||||||
m_ConstantBuffers = new ConstantBuffer[numConstantBuffers];
|
m_ConstantBuffers = new List<ConstantBuffer>();
|
||||||
for (int i = 0; i < numConstantBuffers; i++)
|
for (int i = 0; i < numConstantBuffers; i++)
|
||||||
{
|
{
|
||||||
m_ConstantBuffers[i] = new ConstantBuffer(reader);
|
m_ConstantBuffers.Add(new ConstantBuffer(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numConstantBufferBindings = reader.ReadInt32();
|
int numConstantBufferBindings = reader.ReadInt32();
|
||||||
m_ConstantBufferBindings = new BufferBinding[numConstantBufferBindings];
|
m_ConstantBufferBindings = new List<BufferBinding>();
|
||||||
for (int i = 0; i < numConstantBufferBindings; i++)
|
for (int i = 0; i < numConstantBufferBindings; i++)
|
||||||
{
|
{
|
||||||
m_ConstantBufferBindings[i] = new BufferBinding(reader);
|
m_ConstantBufferBindings.Add(new BufferBinding(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
int numUAVParams = reader.ReadInt32();
|
int numUAVParams = reader.ReadInt32();
|
||||||
m_UAVParams = new UAVParameter[numUAVParams];
|
m_UAVParams = new List<UAVParameter>();
|
||||||
for (int i = 0; i < numUAVParams; i++)
|
for (int i = 0; i < numUAVParams; i++)
|
||||||
{
|
{
|
||||||
m_UAVParams[i] = new UAVParameter(reader);
|
m_UAVParams.Add(new UAVParameter(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] >= 2017) //2017 and up
|
if (version[0] >= 2017) //2017 and up
|
||||||
{
|
{
|
||||||
int numSamplers = reader.ReadInt32();
|
int numSamplers = reader.ReadInt32();
|
||||||
m_Samplers = new SamplerParameter[numSamplers];
|
m_Samplers = new List<SamplerParameter>();
|
||||||
for (int i = 0; i < numSamplers; i++)
|
for (int i = 0; i < numSamplers; i++)
|
||||||
{
|
{
|
||||||
m_Samplers[i] = new SamplerParameter(reader);
|
m_Samplers.Add(new SamplerParameter(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -704,10 +704,10 @@ namespace AssetStudio
|
|||||||
if (HasInstancedStructuredBuffers(reader.serializedType))
|
if (HasInstancedStructuredBuffers(reader.serializedType))
|
||||||
{
|
{
|
||||||
int numInstancedStructuredBuffers = reader.ReadInt32();
|
int numInstancedStructuredBuffers = reader.ReadInt32();
|
||||||
var m_InstancedStructuredBuffers = new ConstantBuffer[numInstancedStructuredBuffers];
|
var m_InstancedStructuredBuffers = new List<ConstantBuffer>();
|
||||||
for (int i = 0; i < numInstancedStructuredBuffers; i++)
|
for (int i = 0; i < numInstancedStructuredBuffers; i++)
|
||||||
{
|
{
|
||||||
m_InstancedStructuredBuffers[i] = new ConstantBuffer(reader);
|
m_InstancedStructuredBuffers.Add(new ConstantBuffer(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -715,7 +715,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class SerializedProgram
|
public class SerializedProgram
|
||||||
{
|
{
|
||||||
public SerializedSubProgram[] m_SubPrograms;
|
public List<SerializedSubProgram> m_SubPrograms;
|
||||||
public SerializedProgramParameters m_CommonParameters;
|
public SerializedProgramParameters m_CommonParameters;
|
||||||
public ushort[] m_SerializedKeywordStateMask;
|
public ushort[] m_SerializedKeywordStateMask;
|
||||||
|
|
||||||
@@ -724,10 +724,10 @@ namespace AssetStudio
|
|||||||
var version = reader.version;
|
var version = reader.version;
|
||||||
|
|
||||||
int numSubPrograms = reader.ReadInt32();
|
int numSubPrograms = reader.ReadInt32();
|
||||||
m_SubPrograms = new SerializedSubProgram[numSubPrograms];
|
m_SubPrograms = new List<SerializedSubProgram>();
|
||||||
for (int i = 0; i < numSubPrograms; i++)
|
for (int i = 0; i < numSubPrograms; i++)
|
||||||
{
|
{
|
||||||
m_SubPrograms[i] = new SerializedSubProgram(reader);
|
m_SubPrograms.Add(new SerializedSubProgram(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((version[0] == 2020 && version[1] > 3) ||
|
if ((version[0] == 2020 && version[1] > 3) ||
|
||||||
@@ -756,11 +756,11 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class SerializedPass
|
public class SerializedPass
|
||||||
{
|
{
|
||||||
public Hash128[] m_EditorDataHash;
|
public List<Hash128> m_EditorDataHash;
|
||||||
public byte[] m_Platforms;
|
public byte[] m_Platforms;
|
||||||
public ushort[] m_LocalKeywordMask;
|
public ushort[] m_LocalKeywordMask;
|
||||||
public ushort[] m_GlobalKeywordMask;
|
public ushort[] m_GlobalKeywordMask;
|
||||||
public KeyValuePair<string, int>[] m_NameIndices;
|
public List<KeyValuePair<string, int>> m_NameIndices;
|
||||||
public PassType m_Type;
|
public PassType m_Type;
|
||||||
public SerializedShaderState m_State;
|
public SerializedShaderState m_State;
|
||||||
public uint m_ProgramMask;
|
public uint m_ProgramMask;
|
||||||
@@ -784,10 +784,10 @@ namespace AssetStudio
|
|||||||
if (version[0] > 2020 || (version[0] == 2020 && version[1] >= 2)) //2020.2 and up
|
if (version[0] > 2020 || (version[0] == 2020 && version[1] >= 2)) //2020.2 and up
|
||||||
{
|
{
|
||||||
int numEditorDataHash = reader.ReadInt32();
|
int numEditorDataHash = reader.ReadInt32();
|
||||||
m_EditorDataHash = new Hash128[numEditorDataHash];
|
m_EditorDataHash = new List<Hash128>();
|
||||||
for (int i = 0; i < numEditorDataHash; i++)
|
for (int i = 0; i < numEditorDataHash; i++)
|
||||||
{
|
{
|
||||||
m_EditorDataHash[i] = new Hash128(reader);
|
m_EditorDataHash.Add(new Hash128(reader));
|
||||||
}
|
}
|
||||||
reader.AlignStream();
|
reader.AlignStream();
|
||||||
m_Platforms = reader.ReadUInt8Array();
|
m_Platforms = reader.ReadUInt8Array();
|
||||||
@@ -802,10 +802,10 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
|
|
||||||
int numIndices = reader.ReadInt32();
|
int numIndices = reader.ReadInt32();
|
||||||
m_NameIndices = new KeyValuePair<string, int>[numIndices];
|
m_NameIndices = new List<KeyValuePair<string, int>>();
|
||||||
for (int i = 0; i < numIndices; i++)
|
for (int i = 0; i < numIndices; i++)
|
||||||
{
|
{
|
||||||
m_NameIndices[i] = new KeyValuePair<string, int>(reader.ReadAlignedString(), reader.ReadInt32());
|
m_NameIndices.Add(new KeyValuePair<string, int>(reader.ReadAlignedString(), reader.ReadInt32()));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Type = (PassType)reader.ReadInt32();
|
m_Type = (PassType)reader.ReadInt32();
|
||||||
@@ -840,32 +840,32 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public class SerializedTagMap
|
public class SerializedTagMap
|
||||||
{
|
{
|
||||||
public KeyValuePair<string, string>[] tags;
|
public List<KeyValuePair<string, string>> tags;
|
||||||
|
|
||||||
public SerializedTagMap(EndianBinaryReader reader)
|
public SerializedTagMap(EndianBinaryReader reader)
|
||||||
{
|
{
|
||||||
int numTags = reader.ReadInt32();
|
int numTags = reader.ReadInt32();
|
||||||
tags = new KeyValuePair<string, string>[numTags];
|
tags = new List<KeyValuePair<string, string>>();
|
||||||
for (int i = 0; i < numTags; i++)
|
for (int i = 0; i < numTags; i++)
|
||||||
{
|
{
|
||||||
tags[i] = new KeyValuePair<string, string>(reader.ReadAlignedString(), reader.ReadAlignedString());
|
tags.Add(new KeyValuePair<string, string>(reader.ReadAlignedString(), reader.ReadAlignedString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SerializedSubShader
|
public class SerializedSubShader
|
||||||
{
|
{
|
||||||
public SerializedPass[] m_Passes;
|
public List<SerializedPass> m_Passes;
|
||||||
public SerializedTagMap m_Tags;
|
public SerializedTagMap m_Tags;
|
||||||
public int m_LOD;
|
public int m_LOD;
|
||||||
|
|
||||||
public SerializedSubShader(ObjectReader reader)
|
public SerializedSubShader(ObjectReader reader)
|
||||||
{
|
{
|
||||||
int numPasses = reader.ReadInt32();
|
int numPasses = reader.ReadInt32();
|
||||||
m_Passes = new SerializedPass[numPasses];
|
m_Passes = new List<SerializedPass>();
|
||||||
for (int i = 0; i < numPasses; i++)
|
for (int i = 0; i < numPasses; i++)
|
||||||
{
|
{
|
||||||
m_Passes[i] = new SerializedPass(reader);
|
m_Passes.Add(new SerializedPass(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Tags = new SerializedTagMap(reader);
|
m_Tags = new SerializedTagMap(reader);
|
||||||
@@ -900,14 +900,14 @@ namespace AssetStudio
|
|||||||
public class SerializedShader
|
public class SerializedShader
|
||||||
{
|
{
|
||||||
public SerializedProperties m_PropInfo;
|
public SerializedProperties m_PropInfo;
|
||||||
public SerializedSubShader[] m_SubShaders;
|
public List<SerializedSubShader> m_SubShaders;
|
||||||
public string[] m_KeywordNames;
|
public string[] m_KeywordNames;
|
||||||
public byte[] m_KeywordFlags;
|
public byte[] m_KeywordFlags;
|
||||||
public string m_Name;
|
public string m_Name;
|
||||||
public string m_CustomEditorName;
|
public string m_CustomEditorName;
|
||||||
public string m_FallbackName;
|
public string m_FallbackName;
|
||||||
public SerializedShaderDependency[] m_Dependencies;
|
public List<SerializedShaderDependency> m_Dependencies;
|
||||||
public SerializedCustomEditorForRenderPipeline[] m_CustomEditorForRenderPipelines;
|
public List<SerializedCustomEditorForRenderPipeline> m_CustomEditorForRenderPipelines;
|
||||||
public bool m_DisableNoSubshadersMessage;
|
public bool m_DisableNoSubshadersMessage;
|
||||||
|
|
||||||
public SerializedShader(ObjectReader reader)
|
public SerializedShader(ObjectReader reader)
|
||||||
@@ -917,10 +917,10 @@ namespace AssetStudio
|
|||||||
m_PropInfo = new SerializedProperties(reader);
|
m_PropInfo = new SerializedProperties(reader);
|
||||||
|
|
||||||
int numSubShaders = reader.ReadInt32();
|
int numSubShaders = reader.ReadInt32();
|
||||||
m_SubShaders = new SerializedSubShader[numSubShaders];
|
m_SubShaders = new List<SerializedSubShader>();
|
||||||
for (int i = 0; i < numSubShaders; i++)
|
for (int i = 0; i < numSubShaders; i++)
|
||||||
{
|
{
|
||||||
m_SubShaders[i] = new SerializedSubShader(reader);
|
m_SubShaders.Add(new SerializedSubShader(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] > 2021 || (version[0] == 2021 && version[1] >= 2)) //2021.2 and up
|
if (version[0] > 2021 || (version[0] == 2021 && version[1] >= 2)) //2021.2 and up
|
||||||
@@ -935,19 +935,19 @@ namespace AssetStudio
|
|||||||
m_FallbackName = reader.ReadAlignedString();
|
m_FallbackName = reader.ReadAlignedString();
|
||||||
|
|
||||||
int numDependencies = reader.ReadInt32();
|
int numDependencies = reader.ReadInt32();
|
||||||
m_Dependencies = new SerializedShaderDependency[numDependencies];
|
m_Dependencies = new List<SerializedShaderDependency>();
|
||||||
for (int i = 0; i < numDependencies; i++)
|
for (int i = 0; i < numDependencies; i++)
|
||||||
{
|
{
|
||||||
m_Dependencies[i] = new SerializedShaderDependency(reader);
|
m_Dependencies.Add(new SerializedShaderDependency(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] >= 2021) //2021.1 and up
|
if (version[0] >= 2021) //2021.1 and up
|
||||||
{
|
{
|
||||||
int m_CustomEditorForRenderPipelinesSize = reader.ReadInt32();
|
int m_CustomEditorForRenderPipelinesSize = reader.ReadInt32();
|
||||||
m_CustomEditorForRenderPipelines = new SerializedCustomEditorForRenderPipeline[m_CustomEditorForRenderPipelinesSize];
|
m_CustomEditorForRenderPipelines = new List<SerializedCustomEditorForRenderPipeline>();
|
||||||
for (int i = 0; i < m_CustomEditorForRenderPipelinesSize; i++)
|
for (int i = 0; i < m_CustomEditorForRenderPipelinesSize; i++)
|
||||||
{
|
{
|
||||||
m_CustomEditorForRenderPipelines[i] = new SerializedCustomEditorForRenderPipeline(reader);
|
m_CustomEditorForRenderPipelines.Add(new SerializedCustomEditorForRenderPipeline(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,12 @@ namespace AssetStudio
|
|||||||
public sealed class SkinnedMeshRenderer : Renderer
|
public sealed class SkinnedMeshRenderer : Renderer
|
||||||
{
|
{
|
||||||
public PPtr<Mesh> m_Mesh;
|
public PPtr<Mesh> m_Mesh;
|
||||||
public PPtr<Transform>[] m_Bones;
|
public List<PPtr<Transform>> m_Bones;
|
||||||
public float[] m_BlendShapeWeights;
|
public float[] m_BlendShapeWeights;
|
||||||
public PPtr<Transform> m_RootBone;
|
public PPtr<Transform> m_RootBone;
|
||||||
public AABB m_AABB;
|
public AABB m_AABB;
|
||||||
public bool m_DirtyAABB;
|
public bool m_DirtyAABB;
|
||||||
|
|
||||||
|
|
||||||
public SkinnedMeshRenderer(ObjectReader reader) : base(reader)
|
public SkinnedMeshRenderer(ObjectReader reader) : base(reader)
|
||||||
{
|
{
|
||||||
int m_Quality = reader.ReadInt32();
|
int m_Quality = reader.ReadInt32();
|
||||||
@@ -29,10 +28,11 @@ namespace AssetStudio
|
|||||||
|
|
||||||
m_Mesh = new PPtr<Mesh>(reader);
|
m_Mesh = new PPtr<Mesh>(reader);
|
||||||
|
|
||||||
m_Bones = new PPtr<Transform>[reader.ReadInt32()];
|
var numBones = reader.ReadInt32();
|
||||||
for (int b = 0; b < m_Bones.Length; b++)
|
m_Bones = new List<PPtr<Transform>>();
|
||||||
|
for (int b = 0; b < numBones; b++)
|
||||||
{
|
{
|
||||||
m_Bones[b] = new PPtr<Transform>(reader);
|
m_Bones.Add(new PPtr<Transform>(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
|
if (version[0] > 4 || (version[0] == 4 && version[1] >= 3)) //4.3 and up
|
||||||
|
|||||||
@@ -79,14 +79,14 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
public PPtr<Texture2D> texture;
|
public PPtr<Texture2D> texture;
|
||||||
public PPtr<Texture2D> alphaTexture;
|
public PPtr<Texture2D> alphaTexture;
|
||||||
public SecondarySpriteTexture[] secondaryTextures;
|
public List<SecondarySpriteTexture> secondaryTextures;
|
||||||
public SubMesh[] m_SubMeshes;
|
public List<SubMesh> m_SubMeshes;
|
||||||
public byte[] m_IndexBuffer;
|
public byte[] m_IndexBuffer;
|
||||||
public VertexData m_VertexData;
|
public VertexData m_VertexData;
|
||||||
public SpriteVertex[] vertices;
|
public List<SpriteVertex> vertices;
|
||||||
public ushort[] indices;
|
public ushort[] indices;
|
||||||
public Matrix4x4[] m_Bindpose;
|
public Matrix4x4[] m_Bindpose;
|
||||||
public BoneWeights4[] m_SourceSkin;
|
public List<BoneWeights4> m_SourceSkin;
|
||||||
public Rectf textureRect;
|
public Rectf textureRect;
|
||||||
public Vector2 textureRectOffset;
|
public Vector2 textureRectOffset;
|
||||||
public Vector2 atlasRectOffset;
|
public Vector2 atlasRectOffset;
|
||||||
@@ -107,20 +107,20 @@ namespace AssetStudio
|
|||||||
if (version[0] >= 2019) //2019 and up
|
if (version[0] >= 2019) //2019 and up
|
||||||
{
|
{
|
||||||
var secondaryTexturesSize = reader.ReadInt32();
|
var secondaryTexturesSize = reader.ReadInt32();
|
||||||
secondaryTextures = new SecondarySpriteTexture[secondaryTexturesSize];
|
secondaryTextures = new List<SecondarySpriteTexture>();
|
||||||
for (int i = 0; i < secondaryTexturesSize; i++)
|
for (int i = 0; i < secondaryTexturesSize; i++)
|
||||||
{
|
{
|
||||||
secondaryTextures[i] = new SecondarySpriteTexture(reader);
|
secondaryTextures.Add(new SecondarySpriteTexture(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up
|
if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up
|
||||||
{
|
{
|
||||||
var m_SubMeshesSize = reader.ReadInt32();
|
var m_SubMeshesSize = reader.ReadInt32();
|
||||||
m_SubMeshes = new SubMesh[m_SubMeshesSize];
|
m_SubMeshes = new List<SubMesh>();
|
||||||
for (int i = 0; i < m_SubMeshesSize; i++)
|
for (int i = 0; i < m_SubMeshesSize; i++)
|
||||||
{
|
{
|
||||||
m_SubMeshes[i] = new SubMesh(reader);
|
m_SubMeshes.Add(new SubMesh(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_IndexBuffer = reader.ReadUInt8Array();
|
m_IndexBuffer = reader.ReadUInt8Array();
|
||||||
@@ -131,10 +131,10 @@ namespace AssetStudio
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var verticesSize = reader.ReadInt32();
|
var verticesSize = reader.ReadInt32();
|
||||||
vertices = new SpriteVertex[verticesSize];
|
vertices = new List<SpriteVertex>();
|
||||||
for (int i = 0; i < verticesSize; i++)
|
for (int i = 0; i < verticesSize; i++)
|
||||||
{
|
{
|
||||||
vertices[i] = new SpriteVertex(reader);
|
vertices.Add(new SpriteVertex(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
indices = reader.ReadUInt16Array();
|
indices = reader.ReadUInt16Array();
|
||||||
@@ -204,7 +204,7 @@ namespace AssetStudio
|
|||||||
public string[] m_AtlasTags;
|
public string[] m_AtlasTags;
|
||||||
public PPtr<SpriteAtlas> m_SpriteAtlas;
|
public PPtr<SpriteAtlas> m_SpriteAtlas;
|
||||||
public SpriteRenderData m_RD;
|
public SpriteRenderData m_RD;
|
||||||
public Vector2[][] m_PhysicsShape;
|
public List<Vector2[]> m_PhysicsShape;
|
||||||
|
|
||||||
public Sprite(ObjectReader reader) : base(reader)
|
public Sprite(ObjectReader reader) : base(reader)
|
||||||
{
|
{
|
||||||
@@ -247,10 +247,10 @@ namespace AssetStudio
|
|||||||
if (version[0] >= 2017) //2017 and up
|
if (version[0] >= 2017) //2017 and up
|
||||||
{
|
{
|
||||||
var m_PhysicsShapeSize = reader.ReadInt32();
|
var m_PhysicsShapeSize = reader.ReadInt32();
|
||||||
m_PhysicsShape = new Vector2[m_PhysicsShapeSize][];
|
m_PhysicsShape = new List<Vector2[]>();
|
||||||
for (int i = 0; i < m_PhysicsShapeSize; i++)
|
for (int i = 0; i < m_PhysicsShapeSize; i++)
|
||||||
{
|
{
|
||||||
m_PhysicsShape[i] = reader.ReadVector2Array();
|
m_PhysicsShape.Add(reader.ReadVector2Array());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace AssetStudio
|
|||||||
public Vector4 uvTransform;
|
public Vector4 uvTransform;
|
||||||
public float downscaleMultiplier;
|
public float downscaleMultiplier;
|
||||||
public SpriteSettings settingsRaw;
|
public SpriteSettings settingsRaw;
|
||||||
public SecondarySpriteTexture[] secondaryTextures;
|
public List<SecondarySpriteTexture> secondaryTextures;
|
||||||
|
|
||||||
public SpriteAtlasData(ObjectReader reader)
|
public SpriteAtlasData(ObjectReader reader)
|
||||||
{
|
{
|
||||||
@@ -32,10 +32,10 @@ namespace AssetStudio
|
|||||||
if (version[0] > 2020 || (version[0] == 2020 && version[1] >= 2)) //2020.2 and up
|
if (version[0] > 2020 || (version[0] == 2020 && version[1] >= 2)) //2020.2 and up
|
||||||
{
|
{
|
||||||
var secondaryTexturesSize = reader.ReadInt32();
|
var secondaryTexturesSize = reader.ReadInt32();
|
||||||
secondaryTextures = new SecondarySpriteTexture[secondaryTexturesSize];
|
secondaryTextures = new List<SecondarySpriteTexture>();
|
||||||
for (int i = 0; i < secondaryTexturesSize; i++)
|
for (int i = 0; i < secondaryTexturesSize; i++)
|
||||||
{
|
{
|
||||||
secondaryTextures[i] = new SecondarySpriteTexture(reader);
|
secondaryTextures.Add(new SecondarySpriteTexture(reader));
|
||||||
}
|
}
|
||||||
reader.AlignStream();
|
reader.AlignStream();
|
||||||
}
|
}
|
||||||
@@ -44,23 +44,23 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public sealed class SpriteAtlas : NamedObject
|
public sealed class SpriteAtlas : NamedObject
|
||||||
{
|
{
|
||||||
public PPtr<Sprite>[] m_PackedSprites;
|
public List<PPtr<Sprite>> m_PackedSprites;
|
||||||
public Dictionary<KeyValuePair<Guid, long>, SpriteAtlasData> m_RenderDataMap;
|
public Dictionary<KeyValuePair<Guid, long>, SpriteAtlasData> m_RenderDataMap;
|
||||||
public bool m_IsVariant;
|
public bool m_IsVariant;
|
||||||
|
|
||||||
public SpriteAtlas(ObjectReader reader) : base(reader)
|
public SpriteAtlas(ObjectReader reader) : base(reader)
|
||||||
{
|
{
|
||||||
var m_PackedSpritesSize = reader.ReadInt32();
|
var m_PackedSpritesSize = reader.ReadInt32();
|
||||||
m_PackedSprites = new PPtr<Sprite>[m_PackedSpritesSize];
|
m_PackedSprites = new List<PPtr<Sprite>>();
|
||||||
for (int i = 0; i < m_PackedSpritesSize; i++)
|
for (int i = 0; i < m_PackedSpritesSize; i++)
|
||||||
{
|
{
|
||||||
m_PackedSprites[i] = new PPtr<Sprite>(reader);
|
m_PackedSprites.Add(new PPtr<Sprite>(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
var m_PackedSpriteNamesToIndex = reader.ReadStringArray();
|
var m_PackedSpriteNamesToIndex = reader.ReadStringArray();
|
||||||
|
|
||||||
var m_RenderDataMapSize = reader.ReadInt32();
|
var m_RenderDataMapSize = reader.ReadInt32();
|
||||||
m_RenderDataMap = new Dictionary<KeyValuePair<Guid, long>, SpriteAtlasData>(m_RenderDataMapSize);
|
m_RenderDataMap = new Dictionary<KeyValuePair<Guid, long>, SpriteAtlasData>();
|
||||||
for (int i = 0; i < m_RenderDataMapSize; i++)
|
for (int i = 0; i < m_RenderDataMapSize; i++)
|
||||||
{
|
{
|
||||||
var first = new Guid(reader.ReadBytes(16));
|
var first = new Guid(reader.ReadBytes(16));
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace AssetStudio
|
|||||||
public Quaternion m_LocalRotation;
|
public Quaternion m_LocalRotation;
|
||||||
public Vector3 m_LocalPosition;
|
public Vector3 m_LocalPosition;
|
||||||
public Vector3 m_LocalScale;
|
public Vector3 m_LocalScale;
|
||||||
public PPtr<Transform>[] m_Children;
|
public List<PPtr<Transform>> m_Children;
|
||||||
public PPtr<Transform> m_Father;
|
public PPtr<Transform> m_Father;
|
||||||
|
|
||||||
public Transform(ObjectReader reader) : base(reader)
|
public Transform(ObjectReader reader) : base(reader)
|
||||||
@@ -20,10 +20,10 @@ namespace AssetStudio
|
|||||||
m_LocalScale = reader.ReadVector3();
|
m_LocalScale = reader.ReadVector3();
|
||||||
|
|
||||||
int m_ChildrenCount = reader.ReadInt32();
|
int m_ChildrenCount = reader.ReadInt32();
|
||||||
m_Children = new PPtr<Transform>[m_ChildrenCount];
|
m_Children = new List<PPtr<Transform>>();
|
||||||
for (int i = 0; i < m_ChildrenCount; i++)
|
for (int i = 0; i < m_ChildrenCount; i++)
|
||||||
{
|
{
|
||||||
m_Children[i] = new PPtr<Transform>(reader);
|
m_Children.Add(new PPtr<Transform>(reader));
|
||||||
}
|
}
|
||||||
m_Father = new PPtr<Transform>(reader);
|
m_Father = new PPtr<Transform>(reader);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.IO;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace AssetStudio
|
namespace AssetStudio
|
||||||
{
|
{
|
||||||
@@ -44,10 +45,10 @@ namespace AssetStudio
|
|||||||
if (version[0] >= 2020) //2020.1 and up
|
if (version[0] >= 2020) //2020.1 and up
|
||||||
{
|
{
|
||||||
var m_VideoShadersSize = reader.ReadInt32();
|
var m_VideoShadersSize = reader.ReadInt32();
|
||||||
var m_VideoShaders = new PPtr<Shader>[m_VideoShadersSize];
|
var m_VideoShaders = new List<PPtr<Shader>>();
|
||||||
for (int i = 0; i < m_VideoShadersSize; i++)
|
for (int i = 0; i < m_VideoShadersSize; i++)
|
||||||
{
|
{
|
||||||
m_VideoShaders[i] = new PPtr<Shader>(reader);
|
m_VideoShaders.Add(new PPtr<Shader>(reader));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_ExternalResources = new StreamedResource(reader);
|
m_ExternalResources = new StreamedResource(reader);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Buffers;
|
||||||
using System.Buffers.Binary;
|
using System.Buffers.Binary;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -108,6 +109,31 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
return base.ReadDouble();
|
return base.ReadDouble();
|
||||||
}
|
}
|
||||||
|
public override byte[] ReadBytes(int count)
|
||||||
|
{
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
return Array.Empty<byte>();
|
||||||
|
}
|
||||||
|
|
||||||
|
var buffer = ArrayPool<byte>.Shared.Rent(0x1000);
|
||||||
|
List<byte> result = new List<byte>();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
var readNum = Math.Min(count, buffer.Length);
|
||||||
|
int n = Read(buffer, 0, readNum);
|
||||||
|
if (n == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.AddRange(buffer[..n]);
|
||||||
|
count -= n;
|
||||||
|
} while (count > 0);
|
||||||
|
|
||||||
|
ArrayPool<byte>.Shared.Return(buffer);
|
||||||
|
return result.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
public void AlignStream()
|
public void AlignStream()
|
||||||
{
|
{
|
||||||
@@ -164,11 +190,6 @@ namespace AssetStudio
|
|||||||
return new Vector2(ReadSingle(), ReadSingle());
|
return new Vector2(ReadSingle(), ReadSingle());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector3 ReadVector3()
|
|
||||||
{
|
|
||||||
return new Vector3(ReadSingle(), ReadSingle(), ReadSingle());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector4 ReadVector4()
|
public Vector4 ReadVector4()
|
||||||
{
|
{
|
||||||
return new Vector4(ReadSingle(), ReadSingle(), ReadSingle(), ReadSingle());
|
return new Vector4(ReadSingle(), ReadSingle(), ReadSingle(), ReadSingle());
|
||||||
@@ -184,33 +205,24 @@ namespace AssetStudio
|
|||||||
return new Matrix4x4(ReadSingleArray(16));
|
return new Matrix4x4(ReadSingleArray(16));
|
||||||
}
|
}
|
||||||
|
|
||||||
public XForm ReadXForm(int[] version, bool isVector4 = false)
|
|
||||||
{
|
|
||||||
var t = (version[0] > 5 || (version[0] == 5 && version[1] >= 4)) && !isVector4 ? ReadVector3() : (Vector3)ReadVector4();//5.4 and up
|
|
||||||
var q = ReadQuaternion();
|
|
||||||
var s = (version[0] > 5 || (version[0] == 5 && version[1] >= 4)) && !isVector4 ? ReadVector3() : (Vector3)ReadVector4();//5.4 and up
|
|
||||||
|
|
||||||
return new XForm(t, q, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Float ReadFloat()
|
public Float ReadFloat()
|
||||||
{
|
{
|
||||||
return new Float(ReadSingle());
|
return new Float(ReadSingle());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ReadMhy0Int()
|
public int ReadMhyInt()
|
||||||
{
|
{
|
||||||
var buffer = ReadBytes(6);
|
var buffer = ReadBytes(6);
|
||||||
return buffer[2] | (buffer[4] << 8) | (buffer[0] << 0x10) | (buffer[5] << 0x18);
|
return buffer[2] | (buffer[4] << 8) | (buffer[0] << 0x10) | (buffer[5] << 0x18);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint ReadMhy0UInt()
|
public uint ReadMhyUInt()
|
||||||
{
|
{
|
||||||
var buffer = ReadBytes(7);
|
var buffer = ReadBytes(7);
|
||||||
return (uint)(buffer[1] | (buffer[6] << 8) | (buffer[3] << 0x10) | (buffer[2] << 0x18));
|
return (uint)(buffer[1] | (buffer[6] << 8) | (buffer[3] << 0x10) | (buffer[2] << 0x18));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReadMhy0String()
|
public string ReadMhyString()
|
||||||
{
|
{
|
||||||
var pos = BaseStream.Position;
|
var pos = BaseStream.Position;
|
||||||
var str = ReadStringToNull();
|
var str = ReadStringToNull();
|
||||||
@@ -218,94 +230,134 @@ namespace AssetStudio
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
private T[] ReadArray<T>(Func<T> del, int length)
|
internal T[] ReadArray<T>(Func<T> del, int length)
|
||||||
{
|
{
|
||||||
var array = new T[length];
|
if (length < 0x1000)
|
||||||
for (int i = 0; i < length; i++)
|
|
||||||
{
|
{
|
||||||
array[i] = del();
|
var array = new T[length];
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
array[i] = del();
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var list = new List<T>();
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
list.Add(del());
|
||||||
|
}
|
||||||
|
return list.ToArray();
|
||||||
}
|
}
|
||||||
return array;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool[] ReadBooleanArray()
|
public bool[] ReadBooleanArray(int length = 0)
|
||||||
{
|
{
|
||||||
return ReadArray(ReadBoolean, ReadInt32());
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
|
return ReadArray(ReadBoolean, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] ReadUInt8Array()
|
public byte[] ReadUInt8Array(int length = 0)
|
||||||
{
|
{
|
||||||
return ReadBytes(ReadInt32());
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
|
return ReadBytes(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public short[] ReadInt16Array()
|
public short[] ReadInt16Array(int length = 0)
|
||||||
{
|
|
||||||
return ReadArray(ReadInt16, ReadInt32());
|
|
||||||
}
|
|
||||||
|
|
||||||
public short[] ReadInt16Array(int length)
|
|
||||||
{
|
{
|
||||||
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
return ReadArray(ReadInt16, length);
|
return ReadArray(ReadInt16, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ushort[] ReadUInt16Array()
|
public ushort[] ReadUInt16Array(int length = 0)
|
||||||
{
|
{
|
||||||
return ReadArray(ReadUInt16, ReadInt32());
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
|
return ReadArray(ReadUInt16, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] ReadInt32Array()
|
public int[] ReadInt32Array(int length = 0)
|
||||||
{
|
|
||||||
return ReadArray(ReadInt32, ReadInt32());
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] ReadInt32Array(int length)
|
|
||||||
{
|
{
|
||||||
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
return ReadArray(ReadInt32, length);
|
return ReadArray(ReadInt32, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint[] ReadUInt32Array()
|
public uint[] ReadUInt32Array(int length = 0)
|
||||||
{
|
|
||||||
return ReadArray(ReadUInt32, ReadInt32());
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint[][] ReadUInt32ArrayArray()
|
|
||||||
{
|
|
||||||
return ReadArray(ReadUInt32Array, ReadInt32());
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint[] ReadUInt32Array(int length)
|
|
||||||
{
|
{
|
||||||
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
return ReadArray(ReadUInt32, length);
|
return ReadArray(ReadUInt32, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float[] ReadSingleArray()
|
public uint[][] ReadUInt32ArrayArray(int length = 0)
|
||||||
{
|
{
|
||||||
return ReadArray(ReadSingle, ReadInt32());
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
|
return ReadArray(() => ReadUInt32Array(), length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float[] ReadSingleArray(int length)
|
public float[] ReadSingleArray(int length = 0)
|
||||||
{
|
{
|
||||||
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
return ReadArray(ReadSingle, length);
|
return ReadArray(ReadSingle, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string[] ReadStringArray()
|
public string[] ReadStringArray(int length = 0)
|
||||||
{
|
{
|
||||||
return ReadArray(ReadAlignedString, ReadInt32());
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
|
return ReadArray(ReadAlignedString, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2[] ReadVector2Array()
|
public Vector2[] ReadVector2Array(int length = 0)
|
||||||
{
|
{
|
||||||
return ReadArray(ReadVector2, ReadInt32());
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
|
return ReadArray(ReadVector2, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector4[] ReadVector4Array()
|
public Vector4[] ReadVector4Array(int length = 0)
|
||||||
{
|
{
|
||||||
return ReadArray(ReadVector4, ReadInt32());
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
|
return ReadArray(ReadVector4, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Matrix4x4[] ReadMatrixArray()
|
public Matrix4x4[] ReadMatrixArray(int length = 0)
|
||||||
{
|
{
|
||||||
return ReadArray(ReadMatrix, ReadInt32());
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
|
return ReadArray(ReadMatrix, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace AssetStudio
|
|||||||
Logger.Verbose($"Parsed signature does not match with expected signature {Convert.ToHexString(zipMagic)} or {Convert.ToHexString(zipSpannedMagic)}");
|
Logger.Verbose($"Parsed signature does not match with expected signature {Convert.ToHexString(zipMagic)} or {Convert.ToHexString(zipSpannedMagic)}");
|
||||||
if (mhy0Magic.SequenceEqual(magic))
|
if (mhy0Magic.SequenceEqual(magic))
|
||||||
{
|
{
|
||||||
return FileType.Mhy0File;
|
return FileType.MhyFile;
|
||||||
}
|
}
|
||||||
Logger.Verbose($"Parsed signature does not match with expected signature {Convert.ToHexString(mhy0Magic)}");
|
Logger.Verbose($"Parsed signature does not match with expected signature {Convert.ToHexString(mhy0Magic)}");
|
||||||
if (blbMagic.SequenceEqual(magic))
|
if (blbMagic.SequenceEqual(magic))
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace AssetStudio
|
|||||||
BrotliFile,
|
BrotliFile,
|
||||||
ZipFile,
|
ZipFile,
|
||||||
BlkFile,
|
BlkFile,
|
||||||
Mhy0File,
|
MhyFile,
|
||||||
BlbFile,
|
BlbFile,
|
||||||
ENCRFile,
|
ENCRFile,
|
||||||
BlockFile
|
BlockFile
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ namespace AssetStudio
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
Games.Add(index++, new(GameType.Normal));
|
Games.Add(index++, new(GameType.Normal));
|
||||||
Games.Add(index++, new(GameType.UnityCN));
|
Games.Add(index++, new(GameType.UnityCN));
|
||||||
Games.Add(index++, new Mhy0(GameType.GI, GIMhy0ShiftRow, GIMhy0Key, GIMhy0Mul, GIExpansionKey, GISBox, GIInitVector, GIInitSeed));
|
Games.Add(index++, new Mhy(GameType.GI, GIMhyShiftRow, GIMhyKey, GIMhyMul, GIExpansionKey, GISBox, GIInitVector, GIInitSeed));
|
||||||
Games.Add(index++, new Mr0k(GameType.GI_Pack, PackExpansionKey, blockKey: PackBlockKey));
|
Games.Add(index++, new Mr0k(GameType.GI_Pack, PackExpansionKey, blockKey: PackBlockKey));
|
||||||
Games.Add(index++, new Mr0k(GameType.GI_CB1));
|
Games.Add(index++, new Mr0k(GameType.GI_CB1));
|
||||||
Games.Add(index++, new Blk(GameType.GI_CB2, GI_CBXExpansionKey, initVector: GI_CBXInitVector, initSeed: GI_CBXInitSeed));
|
Games.Add(index++, new Blk(GameType.GI_CB2, GI_CBXExpansionKey, initVector: GI_CBXInitVector, initSeed: GI_CBXInitSeed));
|
||||||
Games.Add(index++, new Blk(GameType.GI_CB3, GI_CBXExpansionKey, initVector: GI_CBXInitVector, initSeed: GI_CBXInitSeed));
|
Games.Add(index++, new Blk(GameType.GI_CB3, GI_CBXExpansionKey, initVector: GI_CBXInitVector, initSeed: GI_CBXInitSeed));
|
||||||
Games.Add(index++, new Mhy0(GameType.GI_CB3Pre, GI_CBXMhy0ShiftRow, GI_CBXMhy0Key, GI_CBXMhy0Mul, GI_CBXExpansionKey, GI_CBXSBox, GI_CBXInitVector, GI_CBXInitSeed));
|
Games.Add(index++, new Mhy(GameType.GI_CB3Pre, GI_CBXMhyShiftRow, GI_CBXMhyKey, GI_CBXMhyMul, GI_CBXExpansionKey, GI_CBXSBox, GI_CBXInitVector, GI_CBXInitSeed));
|
||||||
Games.Add(index++, new Mr0k(GameType.BH3, BH3ExpansionKey, BH3SBox, BH3InitVector, BH3BlockKey));
|
Games.Add(index++, new Mr0k(GameType.BH3, BH3ExpansionKey, BH3SBox, BH3InitVector, BH3BlockKey));
|
||||||
Games.Add(index++, new Mr0k(GameType.BH3Pre, PackExpansionKey, blockKey: PackBlockKey));
|
Games.Add(index++, new Mr0k(GameType.BH3Pre, PackExpansionKey, blockKey: PackBlockKey));
|
||||||
Games.Add(index++, new Mr0k(GameType.SR_CB2, Mr0kExpansionKey, initVector: Mr0kInitVector, blockKey: Mr0kBlockKey));
|
Games.Add(index++, new Mr0k(GameType.SR_CB2, Mr0kExpansionKey, initVector: Mr0kInitVector, blockKey: Mr0kBlockKey));
|
||||||
@@ -108,17 +108,17 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public record Mhy0 : Blk
|
public record Mhy : Blk
|
||||||
{
|
{
|
||||||
public byte[] Mhy0ShiftRow { get; }
|
public byte[] MhyShiftRow { get; }
|
||||||
public byte[] Mhy0Key { get; }
|
public byte[] MhyKey { get; }
|
||||||
public byte[] Mhy0Mul { get; }
|
public byte[] MhyMul { get; }
|
||||||
|
|
||||||
public Mhy0(GameType type, byte[] mhy0ShiftRow, byte[] mhy0Key, byte[] mhy0Mul, byte[] expansionKey = null, byte[] sBox = null, byte[] initVector = null, ulong initSeed = 0) : base(type, expansionKey, sBox, initVector, initSeed)
|
public Mhy(GameType type, byte[] mhyShiftRow, byte[] mhyKey, byte[] mhyMul, byte[] expansionKey = null, byte[] sBox = null, byte[] initVector = null, ulong initSeed = 0) : base(type, expansionKey, sBox, initVector, initSeed)
|
||||||
{
|
{
|
||||||
Mhy0ShiftRow = mhy0ShiftRow;
|
MhyShiftRow = mhyShiftRow;
|
||||||
Mhy0Key = mhy0Key;
|
MhyKey = mhyKey;
|
||||||
Mhy0Mul = mhy0Mul;
|
MhyMul = mhyMul;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,33 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace AssetStudio
|
namespace AssetStudio
|
||||||
{
|
{
|
||||||
public class Mhy0File
|
public class MhyFile
|
||||||
{
|
{
|
||||||
private BundleFile.StorageBlock[] m_BlocksInfo;
|
private string signature;
|
||||||
private BundleFile.Node[] m_DirectoryInfo;
|
private List<BundleFile.StorageBlock> m_BlocksInfo;
|
||||||
|
private List<BundleFile.Node> m_DirectoryInfo;
|
||||||
|
|
||||||
public BundleFile.Header m_Header;
|
public BundleFile.Header m_Header;
|
||||||
public StreamFile[] fileList;
|
public List<StreamFile> fileList;
|
||||||
public long Offset;
|
public long Offset;
|
||||||
public Mhy0 mhy0;
|
public Mhy mhy;
|
||||||
|
|
||||||
public long TotalSize => 8 + m_Header.compressedBlocksInfoSize + m_BlocksInfo.Sum(x => x.compressedSize);
|
public long TotalSize => 8 + m_Header.compressedBlocksInfoSize + m_BlocksInfo.Sum(x => x.compressedSize);
|
||||||
|
|
||||||
public Mhy0File(FileReader reader, string path, Mhy0 mhy0)
|
public MhyFile(FileReader reader, string path, Mhy mhy)
|
||||||
{
|
{
|
||||||
this.mhy0 = mhy0;
|
this.mhy = mhy;
|
||||||
Offset = reader.Position;
|
Offset = reader.Position;
|
||||||
reader.Endian = EndianType.LittleEndian;
|
reader.Endian = EndianType.LittleEndian;
|
||||||
|
|
||||||
var signature = reader.ReadStringToNull(4);
|
signature = reader.ReadStringToNull(4);
|
||||||
Logger.Verbose($"Parsed signature {signature}");
|
Logger.Verbose($"Parsed signature {signature}");
|
||||||
if (signature != "mhy0")
|
if (signature != "mhy0")
|
||||||
throw new Exception("not a mhy0");
|
throw new Exception("not a mhy file");
|
||||||
|
|
||||||
m_Header = new BundleFile.Header
|
m_Header = new BundleFile.Header
|
||||||
{
|
{
|
||||||
@@ -44,17 +46,19 @@ namespace AssetStudio
|
|||||||
|
|
||||||
private void ReadBlocksInfoAndDirectory(FileReader reader)
|
private void ReadBlocksInfoAndDirectory(FileReader reader)
|
||||||
{
|
{
|
||||||
|
int offset = 0x20;
|
||||||
var blocksInfo = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
|
var blocksInfo = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
|
||||||
DescrambleHeader(blocksInfo);
|
DescrambleHeader(blocksInfo);
|
||||||
|
|
||||||
Logger.Verbose($"Descrambled blocksInfo signature {Convert.ToHexString(blocksInfo, 0 , 4)}");
|
Logger.Verbose($"Descrambled blocksInfo signature {Convert.ToHexString(blocksInfo, 0 , 4)}");
|
||||||
using var blocksInfoStream = new MemoryStream(blocksInfo, 0x20, (int)m_Header.compressedBlocksInfoSize - 0x20);
|
using var blocksInfoStream = new MemoryStream(blocksInfo, offset, (int)m_Header.compressedBlocksInfoSize - offset);
|
||||||
using var blocksInfoReader = new EndianBinaryReader(blocksInfoStream);
|
using var blocksInfoReader = new EndianBinaryReader(blocksInfoStream);
|
||||||
m_Header.uncompressedBlocksInfoSize = blocksInfoReader.ReadMhy0UInt();
|
m_Header.uncompressedBlocksInfoSize = blocksInfoReader.ReadMhyUInt();
|
||||||
Logger.Verbose($"uncompressed blocksInfo size: 0x{m_Header.uncompressedBlocksInfoSize:X8}");
|
Logger.Verbose($"uncompressed blocksInfo size: 0x{m_Header.uncompressedBlocksInfoSize:X8}");
|
||||||
var compressedBlocksInfo = blocksInfoReader.ReadBytes((int)blocksInfoReader.Remaining);
|
var compressedBlocksInfo = blocksInfoReader.ReadBytes((int)blocksInfoReader.Remaining);
|
||||||
var uncompressedBlocksInfo = new byte[(int)m_Header.uncompressedBlocksInfoSize];
|
var uncompressedBlocksInfo = BigArrayPool<byte>.Shared.Rent((int)m_Header.uncompressedBlocksInfoSize);
|
||||||
var numWrite = LZ4.Decompress(compressedBlocksInfo, uncompressedBlocksInfo);
|
var uncompressedBlocksInfoSpan = uncompressedBlocksInfo.AsSpan(0, (int)m_Header.uncompressedBlocksInfoSize);
|
||||||
|
var numWrite = LZ4.Decompress(compressedBlocksInfo, uncompressedBlocksInfoSpan);
|
||||||
if (numWrite != m_Header.uncompressedBlocksInfoSize)
|
if (numWrite != m_Header.uncompressedBlocksInfoSize)
|
||||||
{
|
{
|
||||||
throw new IOException($"Lz4 decompression error, write {numWrite} bytes but expected {m_Header.uncompressedBlocksInfoSize} bytes");
|
throw new IOException($"Lz4 decompression error, write {numWrite} bytes but expected {m_Header.uncompressedBlocksInfoSize} bytes");
|
||||||
@@ -63,36 +67,38 @@ namespace AssetStudio
|
|||||||
Logger.Verbose($"Writing block and directory to blocks stream...");
|
Logger.Verbose($"Writing block and directory to blocks stream...");
|
||||||
using var blocksInfoUncompressedStream = new MemoryStream(uncompressedBlocksInfo);
|
using var blocksInfoUncompressedStream = new MemoryStream(uncompressedBlocksInfo);
|
||||||
using var blocksInfoUncompressedReader = new EndianBinaryReader(blocksInfoUncompressedStream);
|
using var blocksInfoUncompressedReader = new EndianBinaryReader(blocksInfoUncompressedStream);
|
||||||
var nodesCount = blocksInfoUncompressedReader.ReadMhy0Int();
|
var nodesCount = blocksInfoUncompressedReader.ReadMhyInt();
|
||||||
m_DirectoryInfo = new BundleFile.Node[nodesCount];
|
m_DirectoryInfo = new List<BundleFile.Node>();
|
||||||
Logger.Verbose($"Directory count: {nodesCount}");
|
Logger.Verbose($"Directory count: {nodesCount}");
|
||||||
for (int i = 0; i < nodesCount; i++)
|
for (int i = 0; i < nodesCount; i++)
|
||||||
{
|
{
|
||||||
m_DirectoryInfo[i] = new BundleFile.Node
|
m_DirectoryInfo.Add(new BundleFile.Node
|
||||||
{
|
{
|
||||||
path = blocksInfoUncompressedReader.ReadMhy0String(),
|
path = blocksInfoUncompressedReader.ReadMhyString(),
|
||||||
flags = blocksInfoUncompressedReader.ReadBoolean() ? 4u : 0,
|
flags = blocksInfoUncompressedReader.ReadBoolean() ? 4u : 0,
|
||||||
offset = blocksInfoUncompressedReader.ReadMhy0Int(),
|
offset = blocksInfoUncompressedReader.ReadMhyInt(),
|
||||||
size = blocksInfoUncompressedReader.ReadMhy0UInt()
|
size = blocksInfoUncompressedReader.ReadMhyUInt()
|
||||||
};
|
});
|
||||||
|
|
||||||
Logger.Verbose($"Directory {i} Info: {m_DirectoryInfo[i]}");
|
Logger.Verbose($"Directory {i} Info: {m_DirectoryInfo[i]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
var blocksInfoCount = blocksInfoUncompressedReader.ReadMhy0Int();
|
var blocksInfoCount = blocksInfoUncompressedReader.ReadMhyInt();
|
||||||
m_BlocksInfo = new BundleFile.StorageBlock[blocksInfoCount];
|
m_BlocksInfo = new List<BundleFile.StorageBlock>();
|
||||||
Logger.Verbose($"Blocks count: {blocksInfoCount}");
|
Logger.Verbose($"Blocks count: {blocksInfoCount}");
|
||||||
for (int i = 0; i < blocksInfoCount; i++)
|
for (int i = 0; i < blocksInfoCount; i++)
|
||||||
{
|
{
|
||||||
m_BlocksInfo[i] = new BundleFile.StorageBlock
|
m_BlocksInfo.Add(new BundleFile.StorageBlock
|
||||||
{
|
{
|
||||||
compressedSize = (uint)blocksInfoUncompressedReader.ReadMhy0Int(),
|
compressedSize = (uint)blocksInfoUncompressedReader.ReadMhyInt(),
|
||||||
uncompressedSize = blocksInfoUncompressedReader.ReadMhy0UInt(),
|
uncompressedSize = blocksInfoUncompressedReader.ReadMhyUInt(),
|
||||||
flags = (StorageBlockFlags)0x43
|
flags = (StorageBlockFlags)0x43
|
||||||
};
|
});
|
||||||
|
|
||||||
Logger.Verbose($"Block {i} Info: {m_BlocksInfo[i]}");
|
Logger.Verbose($"Block {i} Info: {m_BlocksInfo[i]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BigArrayPool<byte>.Shared.Return(uncompressedBlocksInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stream CreateBlocksStream(string path)
|
private Stream CreateBlocksStream(string path)
|
||||||
@@ -122,12 +128,13 @@ namespace AssetStudio
|
|||||||
var uncompressedBytes = BigArrayPool<byte>.Shared.Rent(uncompressedSize);
|
var uncompressedBytes = BigArrayPool<byte>.Shared.Rent(uncompressedSize);
|
||||||
reader.Read(compressedBytes, 0, compressedSize);
|
reader.Read(compressedBytes, 0, compressedSize);
|
||||||
|
|
||||||
|
var offset = 0xC;
|
||||||
var compressedBytesSpan = compressedBytes.AsSpan(0, compressedSize);
|
var compressedBytesSpan = compressedBytes.AsSpan(0, compressedSize);
|
||||||
var uncompressedBytesSpan = uncompressedBytes.AsSpan(0, uncompressedSize);
|
var uncompressedBytesSpan = uncompressedBytes.AsSpan(0, uncompressedSize);
|
||||||
DescrambleEntry(compressedBytesSpan);
|
DescrambleEntry(compressedBytesSpan);
|
||||||
|
|
||||||
Logger.Verbose($"Descrambled block signature {Convert.ToHexString(compressedBytes, 0, 4)}");
|
Logger.Verbose($"Descrambled block signature {Convert.ToHexString(compressedBytes, 0, 4)}");
|
||||||
var numWrite = LZ4.Decompress(compressedBytesSpan[0xC..compressedSize], uncompressedBytesSpan);
|
var numWrite = LZ4.Decompress(compressedBytesSpan[offset..], uncompressedBytesSpan);
|
||||||
if (numWrite != uncompressedSize)
|
if (numWrite != uncompressedSize)
|
||||||
{
|
{
|
||||||
throw new IOException($"Lz4 decompression error, write {numWrite} bytes but expected {uncompressedSize} bytes");
|
throw new IOException($"Lz4 decompression error, write {numWrite} bytes but expected {uncompressedSize} bytes");
|
||||||
@@ -143,12 +150,12 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
Logger.Verbose($"Writing files from blocks stream...");
|
Logger.Verbose($"Writing files from blocks stream...");
|
||||||
|
|
||||||
fileList = new StreamFile[m_DirectoryInfo.Length];
|
fileList = new List<StreamFile>();
|
||||||
for (int i = 0; i < m_DirectoryInfo.Length; i++)
|
for (int i = 0; i < m_DirectoryInfo.Count; i++)
|
||||||
{
|
{
|
||||||
var node = m_DirectoryInfo[i];
|
var node = m_DirectoryInfo[i];
|
||||||
var file = new StreamFile();
|
var file = new StreamFile();
|
||||||
fileList[i] = file;
|
fileList.Add(file);
|
||||||
file.path = node.path;
|
file.path = node.path;
|
||||||
file.fileName = Path.GetFileName(node.path);
|
file.fileName = Path.GetFileName(node.path);
|
||||||
if (node.size >= int.MaxValue)
|
if (node.size >= int.MaxValue)
|
||||||
@@ -177,9 +184,9 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
for (int j = 0; j < 0x10; j++)
|
for (int j = 0; j < 0x10; j++)
|
||||||
{
|
{
|
||||||
int k = mhy0.Mhy0ShiftRow[(2 - i) * 0x10 + j];
|
int k = mhy.MhyShiftRow[(2 - i) * 0x10 + j];
|
||||||
int idx = j % 8;
|
int idx = j % 8;
|
||||||
vector[j] = (byte)(mhy0.Mhy0Key[idx] ^ mhy0.SBox[(j % 4 * 0x100) | GF256Mul(mhy0.Mhy0Mul[idx], input[k])]);
|
vector[j] = (byte)(mhy.MhyKey[idx] ^ mhy.SBox[(j % 4 * 0x100) | GF256Mul(mhy.MhyMul[idx], input[k])]);
|
||||||
}
|
}
|
||||||
vector.CopyTo(input);
|
vector.CopyTo(input);
|
||||||
}
|
}
|
||||||
@@ -193,8 +200,8 @@ namespace AssetStudio
|
|||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
input[i] ^= input[i + 4];
|
input[i] ^= input[i + 4];
|
||||||
|
|
||||||
var currentEntry = roundedEntrySize + 4;
|
|
||||||
var finished = false;
|
var finished = false;
|
||||||
|
var currentEntry = roundedEntrySize + 4;
|
||||||
while (currentEntry < blockSize && !finished)
|
while (currentEntry < blockSize && !finished)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < entrySize; i++)
|
for (int i = 0; i < entrySize; i++)
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace AssetStudio
|
namespace AssetStudio
|
||||||
{
|
{
|
||||||
@@ -43,10 +40,64 @@ namespace AssetStudio
|
|||||||
Logger.Verbose($"Initialized reader for {type} object with {m_PathID} in file {assetsFile.fileName} !!");
|
Logger.Verbose($"Initialized reader for {type} object with {m_PathID} in file {assetsFile.fileName} !!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int Read(byte[] buffer, int index, int count)
|
||||||
|
{
|
||||||
|
var pos = Position - byteStart;
|
||||||
|
if (pos + count > byteSize)
|
||||||
|
{
|
||||||
|
throw new EndOfStreamException("Unable to read beyond the end of the stream.");
|
||||||
|
}
|
||||||
|
return base.Read(buffer, index, count);
|
||||||
|
}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
Logger.Verbose($"Resetting reader position to object offset 0x{byteStart:X8}...");
|
Logger.Verbose($"Resetting reader position to object offset 0x{byteStart:X8}...");
|
||||||
Position = byteStart;
|
Position = byteStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector3 ReadVector3()
|
||||||
|
{
|
||||||
|
if (version[0] > 5 || (version[0] == 5 && version[1] >= 4))
|
||||||
|
{
|
||||||
|
return new Vector3(ReadSingle(), ReadSingle(), ReadSingle());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new Vector4(ReadSingle(), ReadSingle(), ReadSingle(), ReadSingle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public XForm ReadXForm()
|
||||||
|
{
|
||||||
|
var t = ReadVector3();
|
||||||
|
var q = ReadQuaternion();
|
||||||
|
var s = ReadVector3();
|
||||||
|
|
||||||
|
return new XForm(t, q, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public XForm ReadXForm4()
|
||||||
|
{
|
||||||
|
var t = ReadVector4();
|
||||||
|
var q = ReadQuaternion();
|
||||||
|
var s = ReadVector4();
|
||||||
|
|
||||||
|
return new XForm(t, q, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3[] ReadVector3Array(int length = 0)
|
||||||
|
{
|
||||||
|
if (length == 0)
|
||||||
|
{
|
||||||
|
length = ReadInt32();
|
||||||
|
}
|
||||||
|
return ReadArray(ReadVector3, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public XForm[] ReadXFormArray()
|
||||||
|
{
|
||||||
|
return ReadArray(ReadXForm, ReadInt32());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,10 +85,11 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
FileType.BundleFile => "UnityFS\x00",
|
FileType.BundleFile => "UnityFS\x00",
|
||||||
FileType.BlbFile => "Blb\x02",
|
FileType.BlbFile => "Blb\x02",
|
||||||
FileType.Mhy0File => "mhy0",
|
FileType.MhyFile => Encoding.UTF8.GetString(reader.ReadBytes(4)),
|
||||||
FileType.ENCRFile => "ENCR\x00",
|
FileType.ENCRFile => "ENCR\x00",
|
||||||
_ => throw new InvalidOperationException()
|
_ => throw new InvalidOperationException()
|
||||||
};
|
};
|
||||||
|
reader.Position = 0;
|
||||||
|
|
||||||
Logger.Verbose($"Prased signature: {signature}");
|
Logger.Verbose($"Prased signature: {signature}");
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
using MessagePack;
|
using MessagePack;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace AssetStudio
|
namespace AssetStudio
|
||||||
{
|
{
|
||||||
public static class ResourceMap
|
public static class ResourceMap
|
||||||
{
|
{
|
||||||
private static AssetMap Instance = new() { GameType = GameType.Normal, AssetEntries = Array.Empty<AssetEntry>() };
|
private static AssetMap Instance = new() { GameType = GameType.Normal, AssetEntries = new List<AssetEntry>() };
|
||||||
public static AssetEntry[] GetEntries() => Instance.AssetEntries;
|
public static List<AssetEntry> GetEntries() => Instance.AssetEntries;
|
||||||
public static void FromFile(string path)
|
public static void FromFile(string path)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(path))
|
if (!string.IsNullOrEmpty(path))
|
||||||
@@ -31,7 +32,7 @@ namespace AssetStudio
|
|||||||
public static void Clear()
|
public static void Clear()
|
||||||
{
|
{
|
||||||
Instance.GameType = GameType.Normal;
|
Instance.GameType = GameType.Normal;
|
||||||
Instance.AssetEntries = Array.Empty<AssetEntry>();
|
Instance.AssetEntries = new List<AssetEntry>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
// Read Types
|
// Read Types
|
||||||
int typeCount = reader.ReadInt32();
|
int typeCount = reader.ReadInt32();
|
||||||
m_Types = new List<SerializedType>(typeCount);
|
m_Types = new List<SerializedType>();
|
||||||
Logger.Verbose($"Found {typeCount} serialized types");
|
Logger.Verbose($"Found {typeCount} serialized types");
|
||||||
for (int i = 0; i < typeCount; i++)
|
for (int i = 0; i < typeCount; i++)
|
||||||
{
|
{
|
||||||
@@ -120,9 +120,9 @@ namespace AssetStudio
|
|||||||
|
|
||||||
// Read Objects
|
// Read Objects
|
||||||
int objectCount = reader.ReadInt32();
|
int objectCount = reader.ReadInt32();
|
||||||
m_Objects = new List<ObjectInfo>(objectCount);
|
m_Objects = new List<ObjectInfo>();
|
||||||
Objects = new List<Object>(objectCount);
|
Objects = new List<Object>();
|
||||||
ObjectsDic = new Dictionary<long, Object>(objectCount);
|
ObjectsDic = new Dictionary<long, Object>();
|
||||||
Logger.Verbose($"Found {objectCount} objects");
|
Logger.Verbose($"Found {objectCount} objects");
|
||||||
for (int i = 0; i < objectCount; i++)
|
for (int i = 0; i < objectCount; i++)
|
||||||
{
|
{
|
||||||
@@ -182,7 +182,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
int scriptCount = reader.ReadInt32();
|
int scriptCount = reader.ReadInt32();
|
||||||
Logger.Verbose($"Found {scriptCount} scripts");
|
Logger.Verbose($"Found {scriptCount} scripts");
|
||||||
m_ScriptTypes = new List<LocalSerializedObjectIdentifier>(scriptCount);
|
m_ScriptTypes = new List<LocalSerializedObjectIdentifier>();
|
||||||
for (int i = 0; i < scriptCount; i++)
|
for (int i = 0; i < scriptCount; i++)
|
||||||
{
|
{
|
||||||
var m_ScriptType = new LocalSerializedObjectIdentifier();
|
var m_ScriptType = new LocalSerializedObjectIdentifier();
|
||||||
@@ -202,7 +202,7 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
|
|
||||||
int externalsCount = reader.ReadInt32();
|
int externalsCount = reader.ReadInt32();
|
||||||
m_Externals = new List<FileIdentifier>(externalsCount);
|
m_Externals = new List<FileIdentifier>();
|
||||||
Logger.Verbose($"Found {externalsCount} externals");
|
Logger.Verbose($"Found {externalsCount} externals");
|
||||||
for (int i = 0; i < externalsCount; i++)
|
for (int i = 0; i < externalsCount; i++)
|
||||||
{
|
{
|
||||||
@@ -225,7 +225,7 @@ namespace AssetStudio
|
|||||||
if (header.m_Version >= SerializedFileFormatVersion.SupportsRefObject)
|
if (header.m_Version >= SerializedFileFormatVersion.SupportsRefObject)
|
||||||
{
|
{
|
||||||
int refTypesCount = reader.ReadInt32();
|
int refTypesCount = reader.ReadInt32();
|
||||||
m_RefTypes = new List<SerializedType>(refTypesCount);
|
m_RefTypes = new List<SerializedType>();
|
||||||
Logger.Verbose($"Found {refTypesCount} reference types");
|
Logger.Verbose($"Found {refTypesCount} reference types");
|
||||||
for (int i = 0; i < refTypesCount; i++)
|
for (int i = 0; i < refTypesCount; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ namespace AssetStudio
|
|||||||
var next = 4 + first.Count;
|
var next = 4 + first.Count;
|
||||||
var second = GetNodes(map, next);
|
var second = GetNodes(map, next);
|
||||||
var size = reader.ReadInt32();
|
var size = reader.ReadInt32();
|
||||||
var dic = new List<KeyValuePair<object, object>>(size);
|
var dic = new List<KeyValuePair<object, object>>();
|
||||||
for (int j = 0; j < size; j++)
|
for (int j = 0; j < size; j++)
|
||||||
{
|
{
|
||||||
int tmp1 = 0;
|
int tmp1 = 0;
|
||||||
@@ -276,7 +276,7 @@ namespace AssetStudio
|
|||||||
var vector = GetNodes(m_Nodes, i);
|
var vector = GetNodes(m_Nodes, i);
|
||||||
i += vector.Count - 1;
|
i += vector.Count - 1;
|
||||||
var size = reader.ReadInt32();
|
var size = reader.ReadInt32();
|
||||||
var list = new List<object>(size);
|
var list = new List<object>();
|
||||||
for (int j = 0; j < size; j++)
|
for (int j = 0; j < size; j++)
|
||||||
{
|
{
|
||||||
int tmp = 3;
|
int tmp = 3;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
public class WebFile
|
public class WebFile
|
||||||
{
|
{
|
||||||
public StreamFile[] fileList;
|
public List<StreamFile> fileList;
|
||||||
|
|
||||||
private class WebData
|
private class WebData
|
||||||
{
|
{
|
||||||
@@ -43,7 +43,7 @@ namespace AssetStudio
|
|||||||
dataList.Add(data);
|
dataList.Add(data);
|
||||||
}
|
}
|
||||||
Logger.Verbose("Writing files to streams...");
|
Logger.Verbose("Writing files to streams...");
|
||||||
fileList = new StreamFile[dataList.Count];
|
fileList = new List<StreamFile>();
|
||||||
for (int i = 0; i < dataList.Count; i++)
|
for (int i = 0; i < dataList.Count; i++)
|
||||||
{
|
{
|
||||||
var data = dataList[i];
|
var data = dataList[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user