Some other minor fixes

This commit is contained in:
VaDiM
2026-06-19 20:59:50 +03:00
parent ed453e60fc
commit a5825bd693
11 changed files with 102 additions and 110 deletions
+14 -9
View File
@@ -615,17 +615,22 @@ namespace AssetStudio
private void ReadAssets()
{
var serializedVer = AssetsFileList[0].header.m_Version;
if (serializedVer <= SerializedFileFormatVersion.Unknown_6 && serializedVer >= SerializedFileFormatVersion.Unknown_5 && AutoLegacyVersion == null && Options.GameSpecific.CustomUnityVersion == null)
switch (serializedVer)
{
var versions = serializedVer == SerializedFileFormatVersion.Unknown_6
? "'2.1.0f1', '2.5.0f1', '2.6.0f1'"
: "'1.2.0f1', '1.6.0f1', '2.0.0f1";
Logger.Warning(
"\nUnable to detect legacy Unity version automatically\n" +
"If the assets load with errors try to specify one of the following Unity versions\n" +
$"Possible versions: {versions}");
case SerializedFileFormatVersion.Unknown_5:
case SerializedFileFormatVersion.Unknown_6:
if (AutoLegacyVersion == null && Options.GameSpecific.CustomUnityVersion == null)
{
var versions = serializedVer == SerializedFileFormatVersion.Unknown_6
? "'2.1.0f1', '2.5.0f1', '2.6.0f1'"
: "'1.2.0f1', '1.6.0f1', '2.0.0f1'";
Logger.Warning(
"\nUnable to detect legacy Unity version automatically\n" +
"If the assets load with errors try to specify one of the following Unity versions\n" +
$"Possible versions: {versions}");
}
break;
}
Logger.Info("Read assets...");
var jsonOptions = new JsonSerializerOptions
+1 -1
View File
@@ -110,7 +110,7 @@ namespace AssetStudio
if (bundleSize > streamSize)
Logger.Warning("Bundle size is incorrect.");
IsDataAfterBundle = streamSize - bundleSize > 200;
var unityVer = m_Header.unityRevision;
var customUnityVer = studioOptions.GameSpecific.CustomUnityVersion;
if (customUnityVer != null)
+1 -1
View File
@@ -509,7 +509,7 @@ namespace AssetStudio
{
var version = reader.version;
data = reader.ReadUInt32Array();
if (version.IsInRange((2022, 3, 19), 2023) //2022.3.19f1 to 2023
if (version.IsInRange((2022, 3, 19), 2023) //2022.3.19f1 - 2023 down
|| version >= (2023, 2, 8)) //2023.2.8f1 and up
{
curveCount = reader.ReadUInt16();
+28 -37
View File
@@ -577,30 +577,12 @@ namespace AssetStudio
m_Use16BitIndices = reader.ReadInt32() > 0;
}
if (version <= (2, 5)) //2.0 - 2.5 down
if (version < (2, 6)) //2.0 - 2.6 down
{
int m_IndexBufferCount = reader.ReadInt32();
if (m_Use16BitIndices)
{
var indexBufferList = new List<uint>();
for (var i = 0; i < m_IndexBufferCount / 2; i++)
{
indexBufferList.Add(reader.ReadUInt16());
}
if (version >= (2, 1))
{
reader.AlignStream();
}
m_IndexBuffer = indexBufferList.ToArray();
}
else
{
m_IndexBuffer = reader.ReadUInt32Array(m_IndexBufferCount / 4);
}
m_IndexBuffer = ReadIndexBuffer(reader, m_Use16BitIndices);
}
int m_SubMeshesCount = reader.ReadInt32();
var m_SubMeshesCount = reader.ReadInt32();
reader.ThrowIfTooLarge(m_SubMeshesCount * 12f);
m_SubMeshes = new List<SubMesh>();
for (var i = 0; i < m_SubMeshesCount; i++)
@@ -687,22 +669,7 @@ namespace AssetStudio
m_Use16BitIndices = m_IndexFormat == 0;
}
int m_IndexBufferSize = reader.ReadInt32();
if (m_Use16BitIndices)
{
var indexBufferList = new List<uint>();
for (var i = 0; i < m_IndexBufferSize / 2; i++)
{
indexBufferList.Add(reader.ReadUInt16());
}
reader.AlignStream();
m_IndexBuffer = indexBufferList.ToArray();
}
else
{
m_IndexBuffer = reader.ReadUInt32Array(m_IndexBufferSize / 4);
}
m_IndexBuffer = ReadIndexBuffer(reader, m_Use16BitIndices);
}
if (version < (3, 5)) //3.4.2 and earlier
@@ -848,6 +815,30 @@ namespace AssetStudio
ProcessData();
}
private static uint[] ReadIndexBuffer(ObjectReader reader, bool use16BitIndices)
{
var indexBufferSize = reader.ReadInt32();
reader.ThrowIfTooLarge(indexBufferSize);
if (use16BitIndices)
{
var indexBuffer = new uint[indexBufferSize / 2];
for (var i = 0; i < indexBufferSize / 2; i++)
{
indexBuffer[i] = reader.ReadUInt16();
}
if (reader.version >= (2, 1))
{
reader.AlignStream();
}
return indexBuffer;
}
else
{
return reader.ReadUInt32Array(indexBufferSize / 4);
}
}
public void ProcessData()
{
if (isLoaded)