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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
//using System.Diagnostics; //remove this later
|
||||
using System.Text;
|
||||
|
||||
namespace Unity_Studio
|
||||
{
|
||||
@ -31,6 +29,7 @@ namespace Unity_Studio
|
||||
public SortedDictionary<int, ClassStrStruct> ClassStructures = new SortedDictionary<int, ClassStrStruct>();
|
||||
|
||||
private bool baseDefinitions = false;
|
||||
private List<int[]> classIDs = new List<int[]>();//use for 5.5.0
|
||||
|
||||
public class UnityShared
|
||||
{
|
||||
@ -84,7 +83,9 @@ namespace Unity_Studio
|
||||
break;
|
||||
}
|
||||
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
|
||||
m_Version = a_Stream.ReadStringToNull();
|
||||
@ -94,7 +95,7 @@ namespace Unity_Studio
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -163,10 +164,19 @@ namespace Unity_Studio
|
||||
asset.Offset = a_Stream.ReadInt32();
|
||||
asset.Offset += dataOffset;
|
||||
asset.Size = a_Stream.ReadInt32();
|
||||
asset.Type1 = a_Stream.ReadInt32();
|
||||
asset.Type2 = a_Stream.ReadUInt16();
|
||||
a_Stream.Position += 2;
|
||||
if (fileGen >= 15)
|
||||
if (fileGen > 15)
|
||||
{
|
||||
int index = a_Stream.ReadInt32();
|
||||
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();
|
||||
//this is a single byte, not an int32
|
||||
@ -184,7 +194,7 @@ namespace Unity_Studio
|
||||
}
|
||||
else
|
||||
{
|
||||
asset.TypeString = "unknown";
|
||||
asset.TypeString = "Unknown Type " + asset.Type2;
|
||||
}
|
||||
|
||||
asset.uniqueID = i.ToString(assetIDfmt);
|
||||
@ -258,6 +268,21 @@ namespace Unity_Studio
|
||||
{
|
||||
int classID = a_Stream.ReadInt32();
|
||||
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;
|
||||
|
||||
if (baseDefinitions)
|
||||
@ -357,7 +382,7 @@ namespace Unity_Studio
|
||||
int num1 = a_Stream.ReadInt32();
|
||||
|
||||
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"); }
|
||||
//Debug.WriteLine(varTypeStr + " " + varNameStr + " " + size);
|
||||
@ -368,7 +393,6 @@ namespace Unity_Studio
|
||||
aClass.SubItems.Add(classID.ToString());
|
||||
ClassStructures.Add(classID, aClass);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -208,6 +208,9 @@ namespace Unity_Studio
|
||||
Names[272] = "AudioMixerSnapshot";
|
||||
Names[273] = "AudioMixerGroup";
|
||||
Names[290] = "AssetBundleManifest";
|
||||
Names[300] = "RuntimeInitializeOnLoadManager";
|
||||
Names[301] = "CloudWebServicesManager";
|
||||
Names[310] = "UnityConnectSettings";
|
||||
Names[1001] = "Prefab";
|
||||
Names[1002] = "EditorExtensionImpl";
|
||||
Names[1003] = "AssetImporter";
|
||||
|
@ -54,7 +54,7 @@ namespace Unity_Studio
|
||||
{
|
||||
return base.ReadChar();
|
||||
}
|
||||
|
||||
|
||||
public override Int16 ReadInt16()
|
||||
{
|
||||
if (endian == EndianType.BigEndian)
|
||||
@ -65,7 +65,7 @@ namespace Unity_Studio
|
||||
}
|
||||
else return base.ReadInt16();
|
||||
}
|
||||
|
||||
|
||||
public override int ReadInt32()
|
||||
{
|
||||
if (endian == EndianType.BigEndian)
|
||||
@ -76,7 +76,7 @@ namespace Unity_Studio
|
||||
}
|
||||
else return base.ReadInt32();
|
||||
}
|
||||
|
||||
|
||||
public override Int64 ReadInt64()
|
||||
{
|
||||
if (endian == EndianType.BigEndian)
|
||||
@ -87,7 +87,7 @@ namespace Unity_Studio
|
||||
}
|
||||
else return base.ReadInt64();
|
||||
}
|
||||
|
||||
|
||||
public override UInt16 ReadUInt16()
|
||||
{
|
||||
if (endian == EndianType.BigEndian)
|
||||
@ -98,7 +98,7 @@ namespace Unity_Studio
|
||||
}
|
||||
else return base.ReadUInt16();
|
||||
}
|
||||
|
||||
|
||||
public override UInt32 ReadUInt32()
|
||||
{
|
||||
if (endian == EndianType.BigEndian)
|
||||
@ -120,7 +120,7 @@ namespace Unity_Studio
|
||||
}
|
||||
else return base.ReadUInt64();
|
||||
}
|
||||
|
||||
|
||||
public override Single ReadSingle()
|
||||
{
|
||||
if (endian == EndianType.BigEndian)
|
||||
@ -131,7 +131,7 @@ namespace Unity_Studio
|
||||
}
|
||||
else return base.ReadSingle();
|
||||
}
|
||||
|
||||
|
||||
public override Double ReadDouble()
|
||||
{
|
||||
if (endian == EndianType.BigEndian)
|
||||
@ -182,20 +182,14 @@ namespace Unity_Studio
|
||||
}
|
||||
else { return ""; }
|
||||
}
|
||||
|
||||
|
||||
public string ReadStringToNull()
|
||||
{
|
||||
string result = "";
|
||||
char c;
|
||||
for (int i = 0; i < base.BaseStream.Length; i++)
|
||||
{
|
||||
if ((c = (char)base.ReadByte()) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
result += c.ToString();
|
||||
}
|
||||
return result;
|
||||
var bytes = new List<byte>();
|
||||
byte b;
|
||||
while ((b = ReadByte()) != 0)
|
||||
bytes.Add(b);
|
||||
return Encoding.UTF8.GetString(bytes.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,107 +27,162 @@ namespace Unity_Studio
|
||||
|
||||
if (readSwitch)
|
||||
{
|
||||
int m_AsciiStartOffset = a_Stream.ReadInt32();
|
||||
|
||||
if (sourceFile.version[0] <= 3)
|
||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)
|
||||
{
|
||||
int m_FontCountX = a_Stream.ReadInt32();
|
||||
int m_FontCountY = a_Stream.ReadInt32();
|
||||
}
|
||||
|
||||
float m_Kerning = a_Stream.ReadSingle();
|
||||
float m_LineSpacing = a_Stream.ReadSingle();
|
||||
|
||||
if (sourceFile.version[0] <= 3)
|
||||
{
|
||||
int m_PerCharacterKerning_size = a_Stream.ReadInt32();
|
||||
for (int i = 0; i < m_PerCharacterKerning_size; i++)
|
||||
var m_LineSpacing = a_Stream.ReadSingle();
|
||||
var m_DefaultMaterial = sourceFile.ReadPPtr();
|
||||
var m_FontSize = a_Stream.ReadSingle();
|
||||
var m_Texture = sourceFile.ReadPPtr();
|
||||
int m_AsciiStartOffset = a_Stream.ReadInt32();
|
||||
var m_Tracking = a_Stream.ReadSingle();
|
||||
var m_CharacterSpacing = a_Stream.ReadInt32();
|
||||
var m_CharacterPadding = a_Stream.ReadInt32();
|
||||
var m_ConvertCase = a_Stream.ReadInt32();
|
||||
int m_CharacterRects_size = a_Stream.ReadInt32();
|
||||
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();
|
||||
}
|
||||
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
|
||||
{
|
||||
int m_CharacterSpacing = a_Stream.ReadInt32();
|
||||
int m_CharacterPadding = a_Stream.ReadInt32();
|
||||
}
|
||||
int m_AsciiStartOffset = a_Stream.ReadInt32();
|
||||
|
||||
int m_ConvertCase = a_Stream.ReadInt32();
|
||||
PPtr m_DefaultMaterial = sourceFile.ReadPPtr();
|
||||
if (sourceFile.version[0] <= 3)
|
||||
{
|
||||
int m_FontCountX = a_Stream.ReadInt32();
|
||||
int m_FontCountY = a_Stream.ReadInt32();
|
||||
}
|
||||
|
||||
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();
|
||||
float m_Kerning = a_Stream.ReadSingle();
|
||||
float m_LineSpacing = a_Stream.ReadSingle();
|
||||
|
||||
if (sourceFile.version[0] <= 3)
|
||||
{
|
||||
int m_PerCharacterKerning_size = a_Stream.ReadInt32();
|
||||
for (int i = 0; i < m_PerCharacterKerning_size; i++)
|
||||
{
|
||||
int first = a_Stream.ReadInt32();
|
||||
float second = a_Stream.ReadSingle();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
bool flipped = a_Stream.ReadBoolean();
|
||||
a_Stream.Position += 3;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -16,6 +16,15 @@ namespace Unity_Studio
|
||||
var a_Stream = preloadData.sourceFile.a_Stream;
|
||||
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 && 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();
|
||||
}
|
||||
|
||||
if (version[0] < 3) { a_Stream.Position += 16; } //m_LightmapTilingOffset vector4d
|
||||
if (version[0] < 3)
|
||||
{
|
||||
a_Stream.Position += 16;//m_LightmapTilingOffset vector4d
|
||||
}
|
||||
else
|
||||
{
|
||||
int m_SubsetIndices_size = a_Stream.ReadInt32();
|
||||
a_Stream.Position += m_SubsetIndices_size * 4;
|
||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 and up
|
||||
{
|
||||
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();
|
||||
|
||||
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();
|
||||
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(); }
|
||||
else { int m_SortingLayer = a_Stream.ReadInt32(); }
|
||||
|
||||
|
||||
int m_SortingOrder = a_Stream.ReadInt16();
|
||||
a_Stream.AlignStream(4);
|
||||
}
|
||||
|
@ -442,8 +442,8 @@ namespace Unity_Studio
|
||||
}
|
||||
case TextureFormat.ATC_RGBA8: //透明通道很奇怪?
|
||||
{
|
||||
q_format = (int)QFORMAT.Q_FORMAT_ATC_RGBA_EXPLICIT_ALPHA;
|
||||
glInternalFormat = KTXHeader.GL_ATC_RGBA_EXPLICIT_ALPHA_AMD;
|
||||
q_format = (int)QFORMAT.Q_FORMAT_ATC_RGBA_INTERPOLATED_ALPHA;
|
||||
glInternalFormat = KTXHeader.GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD;
|
||||
glBaseInternalFormat = KTXHeader.GL_RGBA;
|
||||
break;
|
||||
}
|
||||
|
@ -174,6 +174,7 @@
|
||||
<Compile Include="Unity Classes\PlayerSettings.cs" />
|
||||
<Compile Include="Unity Classes\RectTransform.cs" />
|
||||
<Compile Include="Unity Classes\Renderer.cs" />
|
||||
<Compile Include="Unity Classes\Shader.cs" />
|
||||
<Compile Include="Unity Classes\SkinnedMeshRenderer.cs" />
|
||||
<Compile Include="Unity Classes\MeshFilter.cs" />
|
||||
<Compile Include="Unity Classes\TextAsset.cs" />
|
||||
|
@ -700,6 +700,11 @@ namespace Unity_Studio
|
||||
break;
|
||||
}
|
||||
case 48: //Shader
|
||||
{
|
||||
Shader m_TextAsset = new Shader(asset, false);
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case 49: //TextAsset
|
||||
{
|
||||
TextAsset m_TextAsset = new TextAsset(asset, false);
|
||||
@ -1286,13 +1291,23 @@ namespace Unity_Studio
|
||||
break;
|
||||
}
|
||||
#endregion
|
||||
#region Shader & TextAsset
|
||||
#region Shader
|
||||
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:
|
||||
{
|
||||
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");
|
||||
textPreviewBox.Text = m_Script_Text;
|
||||
textPreviewBox.Visible = true;
|
||||
@ -1924,7 +1939,7 @@ namespace Unity_Studio
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -3131,7 +3146,7 @@ namespace Unity_Studio
|
||||
case 48:
|
||||
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++;
|
||||
}
|
||||
break;
|
||||
@ -3380,6 +3395,11 @@ namespace Unity_Studio
|
||||
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)
|
||||
{
|
||||
File.WriteAllBytes(exportFilename, m_TextAsset.m_Script);
|
||||
|
Loading…
x
Reference in New Issue
Block a user