Fixed Sprite read

improved script dump
This commit is contained in:
Perfare
2018-12-11 04:50:38 +08:00
parent eb170d4f34
commit 356d5fa8a4
9 changed files with 161 additions and 59 deletions

View File

@ -174,7 +174,8 @@ namespace AssetStudio
m_PixelsToUnits = reader.ReadSingle();
if (version[0] > 5
|| (version[0] == 5 && version[1] > 4)
|| (version[0] == 5 && version[1] == 4 && version[2] >= 2)) //5.4.2 and up
|| (version[0] == 5 && version[1] == 4 && version[2] >= 2)
|| (version[0] == 5 && version[1] == 4 && version[2] == 1 && buildType.IsPatch && version[3] >= 3)) //5.4.1p3 and up
{
m_Pivot = reader.ReadVector2();
}

View File

@ -36,12 +36,20 @@ namespace AssetStudio
return "";
}
public static string ReadStringToNull(this BinaryReader reader)
public static string ReadStringToNull(this BinaryReader reader, int maxLength = 32767)
{
var bytes = new List<byte>();
byte b;
while (reader.BaseStream.Position != reader.BaseStream.Length && (b = reader.ReadByte()) != 0)
int count = 0;
while (reader.BaseStream.Position != reader.BaseStream.Length && count < maxLength)
{
var b = reader.ReadByte();
if (b == 0)
{
break;
}
bytes.Add(b);
count++;
}
return Encoding.UTF8.GetString(bytes.ToArray());
}

View File

@ -70,7 +70,7 @@ namespace AssetStudio
private static FileType CheckFileType(EndianBinaryReader reader)
{
var signature = reader.ReadStringToNull();
var signature = reader.ReadStringToNull(20);
reader.Position = 0;
switch (signature)
{

Binary file not shown.