mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-06-03 00:58:13 -04:00
support Unity 5.5
This commit is contained in:
parent
d079368acf
commit
dcde8902f1
@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
//using System.Diagnostics; //remove this later
|
using System.Text;
|
||||||
|
|
||||||
namespace Unity_Studio
|
namespace Unity_Studio
|
||||||
{
|
{
|
||||||
@ -31,6 +29,7 @@ namespace Unity_Studio
|
|||||||
public SortedDictionary<int, ClassStrStruct> ClassStructures = new SortedDictionary<int, ClassStrStruct>();
|
public SortedDictionary<int, ClassStrStruct> ClassStructures = new SortedDictionary<int, ClassStrStruct>();
|
||||||
|
|
||||||
private bool baseDefinitions = false;
|
private bool baseDefinitions = false;
|
||||||
|
private List<int[]> classIDs = new List<int[]>();//use for 5.5.0
|
||||||
|
|
||||||
public class UnityShared
|
public class UnityShared
|
||||||
{
|
{
|
||||||
@ -84,7 +83,9 @@ namespace Unity_Studio
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 14://5.0.0 beta and final
|
case 14://5.0.0 beta and final
|
||||||
case 15://5.0.1 and up
|
case 15://5.0.1 - 5.4
|
||||||
|
case 16://??.. no sure
|
||||||
|
case 17://5.5.0 and up
|
||||||
{
|
{
|
||||||
a_Stream.Position += 4;//azero
|
a_Stream.Position += 4;//azero
|
||||||
m_Version = a_Stream.ReadStringToNull();
|
m_Version = a_Stream.ReadStringToNull();
|
||||||
@ -94,7 +95,7 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
//MessageBox.Show("Unsupported Unity version!", "Unity Studio Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
//MessageBox.Show("Unsupported Unity version!" + fileGen, "Unity Studio Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,10 +164,19 @@ namespace Unity_Studio
|
|||||||
asset.Offset = a_Stream.ReadInt32();
|
asset.Offset = a_Stream.ReadInt32();
|
||||||
asset.Offset += dataOffset;
|
asset.Offset += dataOffset;
|
||||||
asset.Size = a_Stream.ReadInt32();
|
asset.Size = a_Stream.ReadInt32();
|
||||||
asset.Type1 = a_Stream.ReadInt32();
|
if (fileGen > 15)
|
||||||
asset.Type2 = a_Stream.ReadUInt16();
|
{
|
||||||
a_Stream.Position += 2;
|
int index = a_Stream.ReadInt32();
|
||||||
if (fileGen >= 15)
|
asset.Type1 = classIDs[index][0];
|
||||||
|
asset.Type2 = (ushort)classIDs[index][1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
asset.Type1 = a_Stream.ReadInt32();
|
||||||
|
asset.Type2 = a_Stream.ReadUInt16();
|
||||||
|
a_Stream.Position += 2;
|
||||||
|
}
|
||||||
|
if (fileGen == 15)
|
||||||
{
|
{
|
||||||
byte unknownByte = a_Stream.ReadByte();
|
byte unknownByte = a_Stream.ReadByte();
|
||||||
//this is a single byte, not an int32
|
//this is a single byte, not an int32
|
||||||
@ -184,7 +194,7 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
asset.TypeString = "unknown";
|
asset.TypeString = "Unknown Type " + asset.Type2;
|
||||||
}
|
}
|
||||||
|
|
||||||
asset.uniqueID = i.ToString(assetIDfmt);
|
asset.uniqueID = i.ToString(assetIDfmt);
|
||||||
@ -258,6 +268,21 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
int classID = a_Stream.ReadInt32();
|
int classID = a_Stream.ReadInt32();
|
||||||
if (classID < 0) { a_Stream.Position += 16; }
|
if (classID < 0) { a_Stream.Position += 16; }
|
||||||
|
if (fileGen > 15)
|
||||||
|
{
|
||||||
|
a_Stream.ReadByte();
|
||||||
|
int type1;
|
||||||
|
if ((type1 = a_Stream.ReadInt16()) >= 0)
|
||||||
|
{
|
||||||
|
type1 = -1 - type1;
|
||||||
|
a_Stream.Position += 16;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
type1 = classID;
|
||||||
|
}
|
||||||
|
classIDs.Add(new int[] { type1, classID });
|
||||||
|
}
|
||||||
a_Stream.Position += 16;
|
a_Stream.Position += 16;
|
||||||
|
|
||||||
if (baseDefinitions)
|
if (baseDefinitions)
|
||||||
@ -357,7 +382,7 @@ namespace Unity_Studio
|
|||||||
int num1 = a_Stream.ReadInt32();
|
int num1 = a_Stream.ReadInt32();
|
||||||
|
|
||||||
if (index == 0) { className = varTypeStr + " " + varNameStr; }
|
if (index == 0) { className = varTypeStr + " " + varNameStr; }
|
||||||
else { classVarStr.AppendFormat("{0}{1} {2} {3}\r\n", (new string('\t', level)), varTypeStr, varNameStr, size); }
|
else { classVarStr.AppendFormat("{0}{1} {2} {3}\r\n", (new string('\t', level - 1)), varTypeStr, varNameStr, size); }
|
||||||
|
|
||||||
//for (int t = 0; t < level; t++) { Debug.Write("\t"); }
|
//for (int t = 0; t < level; t++) { Debug.Write("\t"); }
|
||||||
//Debug.WriteLine(varTypeStr + " " + varNameStr + " " + size);
|
//Debug.WriteLine(varTypeStr + " " + varNameStr + " " + size);
|
||||||
@ -368,7 +393,6 @@ namespace Unity_Studio
|
|||||||
aClass.SubItems.Add(classID.ToString());
|
aClass.SubItems.Add(classID.ToString());
|
||||||
ClassStructures.Add(classID, aClass);
|
ClassStructures.Add(classID, aClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -208,6 +208,9 @@ namespace Unity_Studio
|
|||||||
Names[272] = "AudioMixerSnapshot";
|
Names[272] = "AudioMixerSnapshot";
|
||||||
Names[273] = "AudioMixerGroup";
|
Names[273] = "AudioMixerGroup";
|
||||||
Names[290] = "AssetBundleManifest";
|
Names[290] = "AssetBundleManifest";
|
||||||
|
Names[300] = "RuntimeInitializeOnLoadManager";
|
||||||
|
Names[301] = "CloudWebServicesManager";
|
||||||
|
Names[310] = "UnityConnectSettings";
|
||||||
Names[1001] = "Prefab";
|
Names[1001] = "Prefab";
|
||||||
Names[1002] = "EditorExtensionImpl";
|
Names[1002] = "EditorExtensionImpl";
|
||||||
Names[1003] = "AssetImporter";
|
Names[1003] = "AssetImporter";
|
||||||
|
@ -54,7 +54,7 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
return base.ReadChar();
|
return base.ReadChar();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Int16 ReadInt16()
|
public override Int16 ReadInt16()
|
||||||
{
|
{
|
||||||
if (endian == EndianType.BigEndian)
|
if (endian == EndianType.BigEndian)
|
||||||
@ -65,7 +65,7 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
else return base.ReadInt16();
|
else return base.ReadInt16();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int ReadInt32()
|
public override int ReadInt32()
|
||||||
{
|
{
|
||||||
if (endian == EndianType.BigEndian)
|
if (endian == EndianType.BigEndian)
|
||||||
@ -76,7 +76,7 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
else return base.ReadInt32();
|
else return base.ReadInt32();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Int64 ReadInt64()
|
public override Int64 ReadInt64()
|
||||||
{
|
{
|
||||||
if (endian == EndianType.BigEndian)
|
if (endian == EndianType.BigEndian)
|
||||||
@ -87,7 +87,7 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
else return base.ReadInt64();
|
else return base.ReadInt64();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override UInt16 ReadUInt16()
|
public override UInt16 ReadUInt16()
|
||||||
{
|
{
|
||||||
if (endian == EndianType.BigEndian)
|
if (endian == EndianType.BigEndian)
|
||||||
@ -98,7 +98,7 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
else return base.ReadUInt16();
|
else return base.ReadUInt16();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override UInt32 ReadUInt32()
|
public override UInt32 ReadUInt32()
|
||||||
{
|
{
|
||||||
if (endian == EndianType.BigEndian)
|
if (endian == EndianType.BigEndian)
|
||||||
@ -120,7 +120,7 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
else return base.ReadUInt64();
|
else return base.ReadUInt64();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Single ReadSingle()
|
public override Single ReadSingle()
|
||||||
{
|
{
|
||||||
if (endian == EndianType.BigEndian)
|
if (endian == EndianType.BigEndian)
|
||||||
@ -131,7 +131,7 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
else return base.ReadSingle();
|
else return base.ReadSingle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Double ReadDouble()
|
public override Double ReadDouble()
|
||||||
{
|
{
|
||||||
if (endian == EndianType.BigEndian)
|
if (endian == EndianType.BigEndian)
|
||||||
@ -182,20 +182,14 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
else { return ""; }
|
else { return ""; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReadStringToNull()
|
public string ReadStringToNull()
|
||||||
{
|
{
|
||||||
string result = "";
|
var bytes = new List<byte>();
|
||||||
char c;
|
byte b;
|
||||||
for (int i = 0; i < base.BaseStream.Length; i++)
|
while ((b = ReadByte()) != 0)
|
||||||
{
|
bytes.Add(b);
|
||||||
if ((c = (char)base.ReadByte()) == 0)
|
return Encoding.UTF8.GetString(bytes.ToArray());
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
result += c.ToString();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,107 +27,162 @@ namespace Unity_Studio
|
|||||||
|
|
||||||
if (readSwitch)
|
if (readSwitch)
|
||||||
{
|
{
|
||||||
int m_AsciiStartOffset = a_Stream.ReadInt32();
|
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)
|
||||||
|
|
||||||
if (sourceFile.version[0] <= 3)
|
|
||||||
{
|
{
|
||||||
int m_FontCountX = a_Stream.ReadInt32();
|
var m_LineSpacing = a_Stream.ReadSingle();
|
||||||
int m_FontCountY = a_Stream.ReadInt32();
|
var m_DefaultMaterial = sourceFile.ReadPPtr();
|
||||||
}
|
var m_FontSize = a_Stream.ReadSingle();
|
||||||
|
var m_Texture = sourceFile.ReadPPtr();
|
||||||
float m_Kerning = a_Stream.ReadSingle();
|
int m_AsciiStartOffset = a_Stream.ReadInt32();
|
||||||
float m_LineSpacing = a_Stream.ReadSingle();
|
var m_Tracking = a_Stream.ReadSingle();
|
||||||
|
var m_CharacterSpacing = a_Stream.ReadInt32();
|
||||||
if (sourceFile.version[0] <= 3)
|
var m_CharacterPadding = a_Stream.ReadInt32();
|
||||||
{
|
var m_ConvertCase = a_Stream.ReadInt32();
|
||||||
int m_PerCharacterKerning_size = a_Stream.ReadInt32();
|
int m_CharacterRects_size = a_Stream.ReadInt32();
|
||||||
for (int i = 0; i < m_PerCharacterKerning_size; i++)
|
for (int i = 0; i < m_CharacterRects_size; i++)
|
||||||
{
|
{
|
||||||
int first = a_Stream.ReadInt32();
|
int index = a_Stream.ReadInt32();
|
||||||
|
//Rectf uv
|
||||||
|
float uvx = a_Stream.ReadSingle();
|
||||||
|
float uvy = a_Stream.ReadSingle();
|
||||||
|
float uvwidth = a_Stream.ReadSingle();
|
||||||
|
float uvheight = a_Stream.ReadSingle();
|
||||||
|
//Rectf vert
|
||||||
|
float vertx = a_Stream.ReadSingle();
|
||||||
|
float verty = a_Stream.ReadSingle();
|
||||||
|
float vertwidth = a_Stream.ReadSingle();
|
||||||
|
float vertheight = a_Stream.ReadSingle();
|
||||||
|
float width = a_Stream.ReadSingle();
|
||||||
|
|
||||||
|
if (sourceFile.version[0] >= 4)
|
||||||
|
{
|
||||||
|
bool flipped = a_Stream.ReadBoolean();
|
||||||
|
a_Stream.Position += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int m_KerningValues_size = a_Stream.ReadInt32();
|
||||||
|
for (int i = 0; i < m_KerningValues_size; i++)
|
||||||
|
{
|
||||||
|
int pairfirst = a_Stream.ReadInt16();
|
||||||
|
int pairsecond = a_Stream.ReadInt16();
|
||||||
float second = a_Stream.ReadSingle();
|
float second = a_Stream.ReadSingle();
|
||||||
}
|
}
|
||||||
|
var m_PixelScale = a_Stream.ReadSingle();
|
||||||
|
int m_FontData_size = a_Stream.ReadInt32();
|
||||||
|
if (m_FontData_size > 0)
|
||||||
|
{
|
||||||
|
m_FontData = new byte[m_FontData_size];
|
||||||
|
a_Stream.Read(m_FontData, 0, m_FontData_size);
|
||||||
|
|
||||||
|
if (m_FontData[0] == 79 && m_FontData[1] == 84 && m_FontData[2] == 84 && m_FontData[3] == 79)
|
||||||
|
{ preloadData.extension = ".otf"; }
|
||||||
|
else { preloadData.extension = ".ttf"; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int m_CharacterSpacing = a_Stream.ReadInt32();
|
int m_AsciiStartOffset = a_Stream.ReadInt32();
|
||||||
int m_CharacterPadding = a_Stream.ReadInt32();
|
|
||||||
}
|
|
||||||
|
|
||||||
int m_ConvertCase = a_Stream.ReadInt32();
|
if (sourceFile.version[0] <= 3)
|
||||||
PPtr m_DefaultMaterial = sourceFile.ReadPPtr();
|
{
|
||||||
|
int m_FontCountX = a_Stream.ReadInt32();
|
||||||
|
int m_FontCountY = a_Stream.ReadInt32();
|
||||||
|
}
|
||||||
|
|
||||||
int m_CharacterRects_size = a_Stream.ReadInt32();
|
float m_Kerning = a_Stream.ReadSingle();
|
||||||
for (int i = 0; i < m_CharacterRects_size; i++)
|
float m_LineSpacing = a_Stream.ReadSingle();
|
||||||
{
|
|
||||||
int index = a_Stream.ReadInt32();
|
if (sourceFile.version[0] <= 3)
|
||||||
//Rectf uv
|
{
|
||||||
float uvx = a_Stream.ReadSingle();
|
int m_PerCharacterKerning_size = a_Stream.ReadInt32();
|
||||||
float uvy = a_Stream.ReadSingle();
|
for (int i = 0; i < m_PerCharacterKerning_size; i++)
|
||||||
float uvwidth = a_Stream.ReadSingle();
|
{
|
||||||
float uvheight = a_Stream.ReadSingle();
|
int first = a_Stream.ReadInt32();
|
||||||
//Rectf vert
|
float second = a_Stream.ReadSingle();
|
||||||
float vertx = a_Stream.ReadSingle();
|
}
|
||||||
float verty = a_Stream.ReadSingle();
|
}
|
||||||
float vertwidth = a_Stream.ReadSingle();
|
else
|
||||||
float vertheight = a_Stream.ReadSingle();
|
{
|
||||||
float width = a_Stream.ReadSingle();
|
int m_CharacterSpacing = a_Stream.ReadInt32();
|
||||||
|
int m_CharacterPadding = a_Stream.ReadInt32();
|
||||||
|
}
|
||||||
|
|
||||||
|
int m_ConvertCase = a_Stream.ReadInt32();
|
||||||
|
PPtr m_DefaultMaterial = sourceFile.ReadPPtr();
|
||||||
|
|
||||||
|
int m_CharacterRects_size = a_Stream.ReadInt32();
|
||||||
|
for (int i = 0; i < m_CharacterRects_size; i++)
|
||||||
|
{
|
||||||
|
int index = a_Stream.ReadInt32();
|
||||||
|
//Rectf uv
|
||||||
|
float uvx = a_Stream.ReadSingle();
|
||||||
|
float uvy = a_Stream.ReadSingle();
|
||||||
|
float uvwidth = a_Stream.ReadSingle();
|
||||||
|
float uvheight = a_Stream.ReadSingle();
|
||||||
|
//Rectf vert
|
||||||
|
float vertx = a_Stream.ReadSingle();
|
||||||
|
float verty = a_Stream.ReadSingle();
|
||||||
|
float vertwidth = a_Stream.ReadSingle();
|
||||||
|
float vertheight = a_Stream.ReadSingle();
|
||||||
|
float width = a_Stream.ReadSingle();
|
||||||
|
|
||||||
|
if (sourceFile.version[0] >= 4)
|
||||||
|
{
|
||||||
|
bool flipped = a_Stream.ReadBoolean();
|
||||||
|
a_Stream.Position += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PPtr m_Texture = sourceFile.ReadPPtr();
|
||||||
|
|
||||||
|
int m_KerningValues_size = a_Stream.ReadInt32();
|
||||||
|
for (int i = 0; i < m_KerningValues_size; i++)
|
||||||
|
{
|
||||||
|
int pairfirst = a_Stream.ReadInt16();
|
||||||
|
int pairsecond = a_Stream.ReadInt16();
|
||||||
|
float second = a_Stream.ReadSingle();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceFile.version[0] <= 3)
|
||||||
|
{
|
||||||
|
bool m_GridFont = a_Stream.ReadBoolean();
|
||||||
|
a_Stream.Position += 3; //4 byte alignment
|
||||||
|
}
|
||||||
|
else { float m_PixelScale = a_Stream.ReadSingle(); }
|
||||||
|
|
||||||
|
int m_FontData_size = a_Stream.ReadInt32();
|
||||||
|
if (m_FontData_size > 0)
|
||||||
|
{
|
||||||
|
m_FontData = new byte[m_FontData_size];
|
||||||
|
a_Stream.Read(m_FontData, 0, m_FontData_size);
|
||||||
|
|
||||||
|
if (m_FontData[0] == 79 && m_FontData[1] == 84 && m_FontData[2] == 84 && m_FontData[3] == 79)
|
||||||
|
{ preloadData.extension = ".otf"; }
|
||||||
|
else { preloadData.extension = ".ttf"; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float m_FontSize = a_Stream.ReadSingle();//problem here in minifootball
|
||||||
|
float m_Ascent = a_Stream.ReadSingle();
|
||||||
|
uint m_DefaultStyle = a_Stream.ReadUInt32();
|
||||||
|
|
||||||
|
int m_FontNames = a_Stream.ReadInt32();
|
||||||
|
for (int i = 0; i < m_FontNames; i++)
|
||||||
|
{
|
||||||
|
string m_FontName = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
||||||
|
}
|
||||||
|
|
||||||
if (sourceFile.version[0] >= 4)
|
if (sourceFile.version[0] >= 4)
|
||||||
{
|
{
|
||||||
bool flipped = a_Stream.ReadBoolean();
|
int m_FallbackFonts = a_Stream.ReadInt32();
|
||||||
a_Stream.Position += 3;
|
for (int i = 0; i < m_FallbackFonts; i++)
|
||||||
|
{
|
||||||
|
PPtr m_FallbackFont = sourceFile.ReadPPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
int m_FontRenderingMode = a_Stream.ReadInt32();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PPtr m_Texture = sourceFile.ReadPPtr();
|
|
||||||
|
|
||||||
int m_KerningValues_size = a_Stream.ReadInt32();
|
|
||||||
for (int i = 0; i < m_KerningValues_size; i++)
|
|
||||||
{
|
|
||||||
int pairfirst = a_Stream.ReadInt16();
|
|
||||||
int pairsecond = a_Stream.ReadInt16();
|
|
||||||
float second = a_Stream.ReadSingle();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceFile.version[0] <= 3)
|
|
||||||
{
|
|
||||||
bool m_GridFont = a_Stream.ReadBoolean();
|
|
||||||
a_Stream.Position += 3; //4 byte alignment
|
|
||||||
}
|
|
||||||
else { float m_PixelScale = a_Stream.ReadSingle(); }
|
|
||||||
|
|
||||||
int m_FontData_size = a_Stream.ReadInt32();
|
|
||||||
if (m_FontData_size > 0)
|
|
||||||
{
|
|
||||||
m_FontData = new byte[m_FontData_size];
|
|
||||||
a_Stream.Read(m_FontData, 0, m_FontData_size);
|
|
||||||
|
|
||||||
if (m_FontData[0] == 79 && m_FontData[1] == 84 && m_FontData[2] == 84 && m_FontData[3] == 79)
|
|
||||||
{ preloadData.extension = ".otf"; }
|
|
||||||
else { preloadData.extension = ".ttf"; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
float m_FontSize = a_Stream.ReadSingle();//problem here in minifootball
|
|
||||||
float m_Ascent = a_Stream.ReadSingle();
|
|
||||||
uint m_DefaultStyle = a_Stream.ReadUInt32();
|
|
||||||
|
|
||||||
int m_FontNames = a_Stream.ReadInt32();
|
|
||||||
for (int i = 0; i < m_FontNames; i++)
|
|
||||||
{
|
|
||||||
string m_FontName = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceFile.version[0] >= 4)
|
|
||||||
{
|
|
||||||
int m_FallbackFonts = a_Stream.ReadInt32();
|
|
||||||
for (int i = 0; i < m_FallbackFonts; i++)
|
|
||||||
{
|
|
||||||
PPtr m_FallbackFont = sourceFile.ReadPPtr();
|
|
||||||
}
|
|
||||||
|
|
||||||
int m_FontRenderingMode = a_Stream.ReadInt32();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,15 @@ namespace Unity_Studio
|
|||||||
var a_Stream = preloadData.sourceFile.a_Stream;
|
var a_Stream = preloadData.sourceFile.a_Stream;
|
||||||
a_Stream.Position = preloadData.Offset;
|
a_Stream.Position = preloadData.Offset;
|
||||||
|
|
||||||
|
|
||||||
|
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 nad up
|
||||||
|
{
|
||||||
|
//productGUID
|
||||||
|
a_Stream.ReadInt32();
|
||||||
|
a_Stream.ReadInt32();
|
||||||
|
a_Stream.ReadInt32();
|
||||||
|
a_Stream.ReadInt32();
|
||||||
|
}
|
||||||
if (sourceFile.version[0] >= 3)
|
if (sourceFile.version[0] >= 3)
|
||||||
{
|
{
|
||||||
if (sourceFile.version[0] == 3 && sourceFile.version[1] < 2) { string AndroidLicensePublicKey = a_Stream.ReadAlignedString(a_Stream.ReadInt32()); }
|
if (sourceFile.version[0] == 3 && sourceFile.version[1] < 2) { string AndroidLicensePublicKey = a_Stream.ReadAlignedString(a_Stream.ReadInt32()); }
|
||||||
|
74
Unity Studio/Unity Classes/Shader.cs
Normal file
74
Unity Studio/Unity Classes/Shader.cs
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Unity_Studio
|
||||||
|
{
|
||||||
|
class Shader
|
||||||
|
{
|
||||||
|
public string m_Name;
|
||||||
|
public byte[] m_Script;
|
||||||
|
public string m_PathName;
|
||||||
|
|
||||||
|
public Shader(AssetPreloadData preloadData, bool readSwitch)
|
||||||
|
{
|
||||||
|
var sourceFile = preloadData.sourceFile;
|
||||||
|
var a_Stream = preloadData.sourceFile.a_Stream;
|
||||||
|
a_Stream.Position = preloadData.Offset;
|
||||||
|
preloadData.extension = ".txt";
|
||||||
|
|
||||||
|
if (sourceFile.platform == -2)
|
||||||
|
{
|
||||||
|
uint m_ObjectHideFlags = a_Stream.ReadUInt32();
|
||||||
|
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
|
||||||
|
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Name = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
||||||
|
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)
|
||||||
|
{
|
||||||
|
if (readSwitch)
|
||||||
|
{
|
||||||
|
m_Script = Encoding.UTF8.GetBytes("Serialized Shader can't be read");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_Name != "") { preloadData.Text = m_Name; }
|
||||||
|
else { preloadData.Text = preloadData.TypeString + " #" + preloadData.uniqueID; }
|
||||||
|
preloadData.SubItems.AddRange(new string[] { preloadData.TypeString, preloadData.exportSize.ToString() });
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int m_Script_size = a_Stream.ReadInt32();
|
||||||
|
|
||||||
|
if (readSwitch) //asset is read for preview or export
|
||||||
|
{
|
||||||
|
m_Script = new byte[m_Script_size];
|
||||||
|
a_Stream.Read(m_Script, 0, m_Script_size);
|
||||||
|
|
||||||
|
if (m_Script[0] == 93) { m_Script = SevenZip.Compression.LZMA.SevenZipHelper.Decompress(m_Script); }
|
||||||
|
if (m_Script[0] == 60 || (m_Script[0] == 239 && m_Script[1] == 187 && m_Script[2] == 191 && m_Script[3] == 60)) { preloadData.extension = ".xml"; }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
byte lzmaTest = a_Stream.ReadByte();
|
||||||
|
if (lzmaTest == 93)
|
||||||
|
{
|
||||||
|
a_Stream.Position += 4;
|
||||||
|
preloadData.exportSize = a_Stream.ReadInt32(); //actualy int64
|
||||||
|
a_Stream.Position -= 8;
|
||||||
|
}
|
||||||
|
else { preloadData.exportSize = m_Script_size; }
|
||||||
|
|
||||||
|
a_Stream.Position += m_Script_size - 1;
|
||||||
|
|
||||||
|
if (m_Name != "") { preloadData.Text = m_Name; }
|
||||||
|
else { preloadData.Text = preloadData.TypeString + " #" + preloadData.uniqueID; }
|
||||||
|
preloadData.SubItems.AddRange(new string[] { preloadData.TypeString, preloadData.exportSize.ToString() });
|
||||||
|
}
|
||||||
|
a_Stream.AlignStream(4);
|
||||||
|
m_PathName = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -60,14 +60,29 @@ namespace Unity_Studio
|
|||||||
m_Materials[m] = sourceFile.ReadPPtr();
|
m_Materials[m] = sourceFile.ReadPPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version[0] < 3) { a_Stream.Position += 16; } //m_LightmapTilingOffset vector4d
|
if (version[0] < 3)
|
||||||
|
{
|
||||||
|
a_Stream.Position += 16;//m_LightmapTilingOffset vector4d
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int m_SubsetIndices_size = a_Stream.ReadInt32();
|
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 and up
|
||||||
a_Stream.Position += m_SubsetIndices_size * 4;
|
{
|
||||||
|
a_Stream.Position += 4;//m_StaticBatchInfo
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int m_SubsetIndices_size = a_Stream.ReadInt32();
|
||||||
|
a_Stream.Position += m_SubsetIndices_size * 4;
|
||||||
|
}
|
||||||
PPtr m_StaticBatchRoot = sourceFile.ReadPPtr();
|
PPtr m_StaticBatchRoot = sourceFile.ReadPPtr();
|
||||||
|
|
||||||
if (version[0] >= 4 || (version[0] == 3 && version[1] >= 5))
|
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 4) || sourceFile.version[0] > 5)//5.4.0 and up
|
||||||
|
{
|
||||||
|
PPtr m_ProbeAnchor = sourceFile.ReadPPtr();
|
||||||
|
PPtr m_LightProbeVolumeOverride = sourceFile.ReadPPtr();
|
||||||
|
}
|
||||||
|
else if (version[0] >= 4 || (version[0] == 3 && version[1] >= 5))
|
||||||
{
|
{
|
||||||
bool m_UseLightProbes = a_Stream.ReadBoolean();
|
bool m_UseLightProbes = a_Stream.ReadBoolean();
|
||||||
a_Stream.Position += 3; //alignment
|
a_Stream.Position += 3; //alignment
|
||||||
@ -80,7 +95,7 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
if (version[0] == 4 && version[1] <= 3) { int m_SortingLayer = a_Stream.ReadInt16(); }
|
if (version[0] == 4 && version[1] <= 3) { int m_SortingLayer = a_Stream.ReadInt16(); }
|
||||||
else { int m_SortingLayer = a_Stream.ReadInt32(); }
|
else { int m_SortingLayer = a_Stream.ReadInt32(); }
|
||||||
|
|
||||||
int m_SortingOrder = a_Stream.ReadInt16();
|
int m_SortingOrder = a_Stream.ReadInt16();
|
||||||
a_Stream.AlignStream(4);
|
a_Stream.AlignStream(4);
|
||||||
}
|
}
|
||||||
|
@ -442,8 +442,8 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
case TextureFormat.ATC_RGBA8: //透明通道很奇怪?
|
case TextureFormat.ATC_RGBA8: //透明通道很奇怪?
|
||||||
{
|
{
|
||||||
q_format = (int)QFORMAT.Q_FORMAT_ATC_RGBA_EXPLICIT_ALPHA;
|
q_format = (int)QFORMAT.Q_FORMAT_ATC_RGBA_INTERPOLATED_ALPHA;
|
||||||
glInternalFormat = KTXHeader.GL_ATC_RGBA_EXPLICIT_ALPHA_AMD;
|
glInternalFormat = KTXHeader.GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD;
|
||||||
glBaseInternalFormat = KTXHeader.GL_RGBA;
|
glBaseInternalFormat = KTXHeader.GL_RGBA;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -174,6 +174,7 @@
|
|||||||
<Compile Include="Unity Classes\PlayerSettings.cs" />
|
<Compile Include="Unity Classes\PlayerSettings.cs" />
|
||||||
<Compile Include="Unity Classes\RectTransform.cs" />
|
<Compile Include="Unity Classes\RectTransform.cs" />
|
||||||
<Compile Include="Unity Classes\Renderer.cs" />
|
<Compile Include="Unity Classes\Renderer.cs" />
|
||||||
|
<Compile Include="Unity Classes\Shader.cs" />
|
||||||
<Compile Include="Unity Classes\SkinnedMeshRenderer.cs" />
|
<Compile Include="Unity Classes\SkinnedMeshRenderer.cs" />
|
||||||
<Compile Include="Unity Classes\MeshFilter.cs" />
|
<Compile Include="Unity Classes\MeshFilter.cs" />
|
||||||
<Compile Include="Unity Classes\TextAsset.cs" />
|
<Compile Include="Unity Classes\TextAsset.cs" />
|
||||||
|
@ -700,6 +700,11 @@ namespace Unity_Studio
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 48: //Shader
|
case 48: //Shader
|
||||||
|
{
|
||||||
|
Shader m_TextAsset = new Shader(asset, false);
|
||||||
|
exportable = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 49: //TextAsset
|
case 49: //TextAsset
|
||||||
{
|
{
|
||||||
TextAsset m_TextAsset = new TextAsset(asset, false);
|
TextAsset m_TextAsset = new TextAsset(asset, false);
|
||||||
@ -1286,13 +1291,23 @@ namespace Unity_Studio
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Shader & TextAsset
|
#region Shader
|
||||||
case 48:
|
case 48:
|
||||||
|
{
|
||||||
|
Shader m_TextAsset = new Shader(asset, true);
|
||||||
|
string m_Script_Text = Encoding.UTF8.GetString(m_TextAsset.m_Script);
|
||||||
|
m_Script_Text = Regex.Replace(m_Script_Text, "(?<!\r)\n", "\r\n");
|
||||||
|
textPreviewBox.Text = m_Script_Text;
|
||||||
|
textPreviewBox.Visible = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region TextAsset
|
||||||
case 49:
|
case 49:
|
||||||
{
|
{
|
||||||
TextAsset m_TextAsset = new TextAsset(asset, true);
|
TextAsset m_TextAsset = new TextAsset(asset, true);
|
||||||
|
|
||||||
string m_Script_Text = UnicodeEncoding.UTF8.GetString(m_TextAsset.m_Script);
|
string m_Script_Text = Encoding.UTF8.GetString(m_TextAsset.m_Script);
|
||||||
m_Script_Text = Regex.Replace(m_Script_Text, "(?<!\r)\n", "\r\n");
|
m_Script_Text = Regex.Replace(m_Script_Text, "(?<!\r)\n", "\r\n");
|
||||||
textPreviewBox.Text = m_Script_Text;
|
textPreviewBox.Text = m_Script_Text;
|
||||||
textPreviewBox.Visible = true;
|
textPreviewBox.Visible = true;
|
||||||
@ -1924,7 +1939,7 @@ namespace Unity_Studio
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (openAfterExport.Checked && File.Exists(saveFileDialog1.FileName)) { System.Diagnostics.Process.Start(saveFileDialog1.FileName); }
|
if (openAfterExport.Checked && File.Exists(saveFileDialog1.FileName)) { try { Process.Start(saveFileDialog1.FileName); } catch { } }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3131,7 +3146,7 @@ namespace Unity_Studio
|
|||||||
case 48:
|
case 48:
|
||||||
if (!ExportFileExists(exportpath + asset.Text + ".txt", asset.TypeString))
|
if (!ExportFileExists(exportpath + asset.Text + ".txt", asset.TypeString))
|
||||||
{
|
{
|
||||||
ExportText(new TextAsset(asset, true), exportpath + asset.Text + ".txt");
|
ExportShader(new Shader(asset, true), exportpath + asset.Text + ".txt");
|
||||||
exportedCount++;
|
exportedCount++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3380,6 +3395,11 @@ namespace Unity_Studio
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ExportShader(Shader m_Shader, string exportFilename)
|
||||||
|
{
|
||||||
|
File.WriteAllBytes(exportFilename, m_Shader.m_Script);
|
||||||
|
}
|
||||||
|
|
||||||
private void ExportText(TextAsset m_TextAsset, string exportFilename)
|
private void ExportText(TextAsset m_TextAsset, string exportFilename)
|
||||||
{
|
{
|
||||||
File.WriteAllBytes(exportFilename, m_TextAsset.m_Script);
|
File.WriteAllBytes(exportFilename, m_TextAsset.m_Script);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user