mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-07-14 02:54:16 -04:00
Support the 'UnityFS' asset bundle type and a lot of change
This commit is contained in:
@ -86,13 +86,19 @@ namespace Unity_Studio
|
||||
m_3D = m_Legacy3D;
|
||||
|
||||
m_Source = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
||||
//m_Source = Path.GetFileName(m_Source);
|
||||
m_Source = Path.Combine(Path.GetDirectoryName(sourceFile.filePath), m_Source.Replace("archive:/",""));
|
||||
if (m_Source.Contains("archive:/"))//resS文件在bundle里
|
||||
{
|
||||
m_Source = m_Source.Replace("archive:/", "").Replace(preloadData.sourceFile.fileName + "/", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Source = Path.Combine(Path.GetDirectoryName(sourceFile.filePath), m_Source.Replace("archive:/", ""));
|
||||
}
|
||||
m_Offset = a_Stream.ReadInt64();
|
||||
m_Size = a_Stream.ReadInt64();
|
||||
m_CompressionFormat = a_Stream.ReadInt32();
|
||||
}
|
||||
|
||||
|
||||
if (readSwitch)
|
||||
{
|
||||
m_AudioData = new byte[m_Size];
|
||||
@ -103,11 +109,18 @@ namespace Unity_Studio
|
||||
}
|
||||
else if (File.Exists(m_Source))
|
||||
{
|
||||
using (BinaryReader reader = new BinaryReader(File.OpenRead(m_Source)))
|
||||
BinaryReader reader = new BinaryReader(File.OpenRead(m_Source));
|
||||
reader.BaseStream.Position = m_Offset;
|
||||
reader.Read(m_AudioData, 0, (int)m_Size);
|
||||
reader.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
EndianStream estream = null;
|
||||
if (UnityStudioForm.assetsfileandstream.TryGetValue(m_Source, out estream))
|
||||
{
|
||||
reader.BaseStream.Position = m_Offset;
|
||||
reader.Read(m_AudioData, 0, (int)m_Size);
|
||||
reader.Close();
|
||||
estream.Position = m_Offset;
|
||||
m_AudioData = estream.ReadBytes((int)m_Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user