improved
This commit is contained in:
@@ -5,20 +5,12 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class Animation
|
||||
public sealed class Animation : Behaviour
|
||||
{
|
||||
public PPtr m_GameObject;
|
||||
public List<PPtr> m_Animations;
|
||||
|
||||
public Animation(AssetPreloadData preloadData)
|
||||
public Animation(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
reader.Position = preloadData.Offset;
|
||||
|
||||
m_GameObject = sourceFile.ReadPPtr();
|
||||
var m_Enabled = reader.ReadByte();
|
||||
reader.AlignStream(4);
|
||||
var m_Animation = sourceFile.ReadPPtr();
|
||||
int numAnimations = reader.ReadInt32();
|
||||
m_Animations = new List<PPtr>(numAnimations);
|
||||
|
||||
@@ -790,9 +790,8 @@ namespace AssetStudio
|
||||
kHumanoid = 3
|
||||
};
|
||||
|
||||
public class AnimationClip
|
||||
public sealed class AnimationClip : NamedObject
|
||||
{
|
||||
public string m_Name { get; set; }
|
||||
public AnimationType m_AnimationType { get; set; }
|
||||
public bool m_Legacy { get; set; }
|
||||
public bool m_Compressed { get; set; }
|
||||
@@ -813,14 +812,8 @@ namespace AssetStudio
|
||||
//public List<AnimationEvent> m_Events { get; set; }
|
||||
|
||||
|
||||
public AnimationClip(AssetPreloadData preloadData)
|
||||
public AnimationClip(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var version = sourceFile.version;
|
||||
var reader = preloadData.InitReader();
|
||||
reader.Position = preloadData.Offset;
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
if (version[0] >= 5)//5.0 and up
|
||||
{
|
||||
m_Legacy = reader.ReadBoolean();
|
||||
|
||||
@@ -5,21 +5,13 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class Animator
|
||||
public sealed class Animator : Behaviour
|
||||
{
|
||||
public PPtr m_GameObject;
|
||||
public PPtr m_Avatar;
|
||||
public PPtr m_Controller;
|
||||
|
||||
public Animator(AssetPreloadData preloadData)
|
||||
public Animator(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
reader.Position = preloadData.Offset;
|
||||
|
||||
m_GameObject = sourceFile.ReadPPtr();
|
||||
var m_Enabled = reader.ReadByte();
|
||||
reader.AlignStream(4);
|
||||
m_Avatar = sourceFile.ReadPPtr();
|
||||
m_Controller = sourceFile.ReadPPtr();
|
||||
}
|
||||
|
||||
@@ -526,19 +526,12 @@ namespace AssetStudio
|
||||
}
|
||||
}
|
||||
|
||||
public class AnimatorController
|
||||
public sealed class AnimatorController : NamedObject
|
||||
{
|
||||
public string m_Name;
|
||||
public PPtr[] m_AnimationClips;
|
||||
|
||||
public AnimatorController(AssetPreloadData preloadData)
|
||||
public AnimatorController(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var version = preloadData.sourceFile.version;
|
||||
var reader = preloadData.InitReader();
|
||||
reader.Position = preloadData.Offset;
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
var m_ControllerSize = reader.ReadUInt32();
|
||||
var m_Controller = new ControllerConstant(reader, version);
|
||||
|
||||
|
||||
@@ -5,19 +5,13 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class AnimatorOverrideController
|
||||
class AnimatorOverrideController : NamedObject
|
||||
{
|
||||
public string m_Name;
|
||||
public PPtr m_Controller;
|
||||
public PPtr[][] m_Clips;
|
||||
|
||||
public AnimatorOverrideController(AssetPreloadData preloadData)
|
||||
public AnimatorOverrideController(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
reader.Position = preloadData.Offset;
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
m_Controller = sourceFile.ReadPPtr();
|
||||
|
||||
int numOverrides = reader.ReadInt32();
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Text;
|
||||
namespace AssetStudio
|
||||
{
|
||||
|
||||
class AssetBundle
|
||||
public sealed class AssetBundle : NamedObject
|
||||
{
|
||||
public class AssetInfo
|
||||
{
|
||||
@@ -21,15 +21,10 @@ namespace AssetStudio
|
||||
public AssetInfo second;
|
||||
}
|
||||
|
||||
|
||||
public List<ContainerData> m_Container = new List<ContainerData>();
|
||||
|
||||
public AssetBundle(AssetPreloadData preloadData)
|
||||
public AssetBundle(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
var m_Name = reader.ReadAlignedString();
|
||||
var size = reader.ReadInt32();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class AudioClip
|
||||
public sealed class AudioClip : NamedObject
|
||||
{
|
||||
public string m_Name;
|
||||
public int m_Format;
|
||||
@@ -32,30 +32,21 @@ namespace AssetStudio
|
||||
public long m_Size;
|
||||
public byte[] m_AudioData;
|
||||
|
||||
public bool version5;
|
||||
|
||||
public AudioClip(AssetPreloadData preloadData, bool readSwitch)
|
||||
public AudioClip(AssetPreloadData preloadData, bool readData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
version5 = sourceFile.version[0] >= 5;
|
||||
if (sourceFile.version[0] < 5)
|
||||
if (version[0] < 5)
|
||||
{
|
||||
|
||||
m_Format = reader.ReadInt32(); //channels?
|
||||
m_Format = reader.ReadInt32();
|
||||
m_Type = (AudioType)reader.ReadInt32();
|
||||
m_3D = reader.ReadBoolean();
|
||||
m_UseHardware = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
|
||||
if (sourceFile.version[0] >= 4 || (sourceFile.version[0] == 3 && sourceFile.version[1] >= 2)) //3.2.0 to 5
|
||||
if (version[0] >= 4 || (version[0] == 3 && version[1] >= 2)) //3.2.0 to 5
|
||||
{
|
||||
int m_Stream = reader.ReadInt32();
|
||||
m_Size = reader.ReadInt32();
|
||||
var tsize = m_Size % 4 != 0 ? m_Size + 4 - m_Size % 4 : m_Size;
|
||||
//TODO: Need more test
|
||||
if (preloadData.Size + preloadData.Offset - reader.Position != tsize)
|
||||
{
|
||||
m_Offset = reader.ReadInt32();
|
||||
@@ -69,7 +60,7 @@ namespace AssetStudio
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LoadType = reader.ReadInt32(); //Decompress on load, Compressed in memory, Streaming
|
||||
m_LoadType = reader.ReadInt32();
|
||||
m_Channels = reader.ReadInt32();
|
||||
m_Frequency = reader.ReadInt32();
|
||||
m_BitsPerSample = reader.ReadInt32();
|
||||
@@ -89,7 +80,7 @@ namespace AssetStudio
|
||||
m_CompressionFormat = (AudioCompressionFormat)reader.ReadInt32();
|
||||
}
|
||||
|
||||
if (readSwitch)
|
||||
if (readData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(m_Source))
|
||||
{
|
||||
@@ -101,166 +92,6 @@ namespace AssetStudio
|
||||
m_AudioData = reader.ReadBytes((int)m_Size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
preloadData.InfoText = "Compression format: ";
|
||||
|
||||
if (sourceFile.version[0] < 5)
|
||||
{
|
||||
switch (m_Type)
|
||||
{
|
||||
case AudioType.ACC:
|
||||
preloadData.extension = ".m4a";
|
||||
preloadData.InfoText += "Acc";
|
||||
break;
|
||||
case AudioType.AIFF:
|
||||
preloadData.extension = ".aif";
|
||||
preloadData.InfoText += "AIFF";
|
||||
break;
|
||||
case AudioType.IT:
|
||||
preloadData.extension = ".it";
|
||||
preloadData.InfoText += "Impulse tracker";
|
||||
break;
|
||||
case AudioType.MOD:
|
||||
preloadData.extension = ".mod";
|
||||
preloadData.InfoText += "Protracker / Fasttracker MOD";
|
||||
break;
|
||||
case AudioType.MPEG:
|
||||
preloadData.extension = ".mp3";
|
||||
preloadData.InfoText += "MP2/MP3 MPEG";
|
||||
break;
|
||||
case AudioType.OGGVORBIS:
|
||||
preloadData.extension = ".ogg";
|
||||
preloadData.InfoText += "Ogg vorbis";
|
||||
break;
|
||||
case AudioType.S3M:
|
||||
preloadData.extension = ".s3m";
|
||||
preloadData.InfoText += "ScreamTracker 3";
|
||||
break;
|
||||
case AudioType.WAV:
|
||||
preloadData.extension = ".wav";
|
||||
preloadData.InfoText += "Microsoft WAV";
|
||||
break;
|
||||
case AudioType.XM:
|
||||
preloadData.extension = ".xm";
|
||||
preloadData.InfoText += "FastTracker 2 XM";
|
||||
break;
|
||||
case AudioType.XMA:
|
||||
preloadData.extension = ".wav";
|
||||
preloadData.InfoText += "Xbox360 XMA";
|
||||
break;
|
||||
case AudioType.VAG:
|
||||
preloadData.extension = ".vag";
|
||||
preloadData.InfoText += "PlayStation Portable ADPCM";
|
||||
break;
|
||||
case AudioType.AUDIOQUEUE:
|
||||
preloadData.extension = ".fsb";
|
||||
preloadData.InfoText += "iPhone";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_CompressionFormat)
|
||||
{
|
||||
case AudioCompressionFormat.PCM:
|
||||
preloadData.extension = ".fsb";
|
||||
preloadData.InfoText += "PCM";
|
||||
break;
|
||||
case AudioCompressionFormat.Vorbis:
|
||||
preloadData.extension = ".fsb";
|
||||
preloadData.InfoText += "Vorbis";
|
||||
break;
|
||||
case AudioCompressionFormat.ADPCM:
|
||||
preloadData.extension = ".fsb";
|
||||
preloadData.InfoText += "ADPCM";
|
||||
break;
|
||||
case AudioCompressionFormat.MP3:
|
||||
preloadData.extension = ".fsb";
|
||||
preloadData.InfoText += "MP3";
|
||||
break;
|
||||
case AudioCompressionFormat.VAG:
|
||||
preloadData.extension = ".vag";
|
||||
preloadData.InfoText += "PlayStation Portable ADPCM";
|
||||
break;
|
||||
case AudioCompressionFormat.HEVAG:
|
||||
preloadData.extension = ".vag";
|
||||
preloadData.InfoText += "PSVita ADPCM";
|
||||
break;
|
||||
case AudioCompressionFormat.XMA:
|
||||
preloadData.extension = ".wav";
|
||||
preloadData.InfoText += "Xbox360 XMA";
|
||||
break;
|
||||
case AudioCompressionFormat.AAC:
|
||||
preloadData.extension = ".m4a";
|
||||
preloadData.InfoText += "AAC";
|
||||
break;
|
||||
case AudioCompressionFormat.GCADPCM:
|
||||
preloadData.extension = ".fsb";
|
||||
preloadData.InfoText += "Nintendo 3DS/Wii DSP";
|
||||
break;
|
||||
case AudioCompressionFormat.ATRAC9:
|
||||
preloadData.extension = ".at9";
|
||||
preloadData.InfoText += "PSVita ATRAC9";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (preloadData.extension == null)
|
||||
{
|
||||
preloadData.extension = ".AudioClip";
|
||||
preloadData.InfoText += "Unknown";
|
||||
}
|
||||
|
||||
preloadData.InfoText += "\n3D: " + m_3D;
|
||||
|
||||
preloadData.Text = m_Name;
|
||||
if (m_Source != null)
|
||||
preloadData.fullSize = preloadData.Size + (int)m_Size;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsFMODSupport
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!version5)
|
||||
{
|
||||
switch (m_Type)
|
||||
{
|
||||
case AudioType.AIFF:
|
||||
case AudioType.IT:
|
||||
case AudioType.MOD:
|
||||
case AudioType.S3M:
|
||||
case AudioType.XM:
|
||||
case AudioType.XMA:
|
||||
case AudioType.VAG:
|
||||
case AudioType.AUDIOQUEUE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_CompressionFormat)
|
||||
{
|
||||
case AudioCompressionFormat.PCM:
|
||||
case AudioCompressionFormat.Vorbis:
|
||||
case AudioCompressionFormat.ADPCM:
|
||||
case AudioCompressionFormat.MP3:
|
||||
case AudioCompressionFormat.VAG:
|
||||
case AudioCompressionFormat.HEVAG:
|
||||
case AudioCompressionFormat.XMA:
|
||||
case AudioCompressionFormat.GCADPCM:
|
||||
case AudioCompressionFormat.ATRAC9:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -325,21 +325,14 @@ namespace AssetStudio
|
||||
}
|
||||
}
|
||||
|
||||
public class Avatar
|
||||
public sealed class Avatar : NamedObject
|
||||
{
|
||||
public string m_Name { get; set; }
|
||||
public uint m_AvatarSize { get; set; }
|
||||
public AvatarConstant m_Avatar { get; set; }
|
||||
public List<KeyValuePair<uint, string>> m_TOS { get; set; }
|
||||
|
||||
public Avatar(AssetPreloadData preloadData)
|
||||
public Avatar(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var version = sourceFile.version;
|
||||
var reader = preloadData.InitReader();
|
||||
reader.Position = preloadData.Offset;
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
m_AvatarSize = reader.ReadUInt32();
|
||||
m_Avatar = new AvatarConstant(reader, version);
|
||||
|
||||
|
||||
18
AssetStudio/Classes/Behaviour.cs
Normal file
18
AssetStudio/Classes/Behaviour.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public abstract class Behaviour : Component
|
||||
{
|
||||
public byte m_Enabled;
|
||||
|
||||
protected Behaviour(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
m_Enabled = reader.ReadByte();
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,32 +5,40 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class BuildSettings
|
||||
public sealed class BuildSettings : Object
|
||||
{
|
||||
public string m_Version;
|
||||
|
||||
public BuildSettings(AssetPreloadData preloadData)
|
||||
public BuildSettings(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
int levels = reader.ReadInt32();
|
||||
for (int l = 0; l < levels; l++) { string level = reader.ReadAlignedString(); }
|
||||
|
||||
if (sourceFile.version[0] == 5)
|
||||
for (int l = 0; l < levels; l++)
|
||||
{
|
||||
int preloadedPlugins = reader.ReadInt32();
|
||||
for (int l = 0; l < preloadedPlugins; l++) { string preloadedPlugin = reader.ReadAlignedString(); }
|
||||
var level = reader.ReadAlignedString();
|
||||
}
|
||||
|
||||
reader.Position += 4; //bool flags
|
||||
if (sourceFile.fileGen >= 8) { reader.Position += 4; } //bool flags
|
||||
if (sourceFile.fileGen >= 9) { reader.Position += 4; } //bool flags
|
||||
if (sourceFile.version[0] == 5 ||
|
||||
(sourceFile.version[0] == 4 && (sourceFile.version[1] >= 3 ||
|
||||
(sourceFile.version[1] == 2 && sourceFile.buildType[0] != "a"))))
|
||||
{ reader.Position += 4; } //bool flags
|
||||
if (version[0] >= 5)
|
||||
{
|
||||
int preloadedPlugins = reader.ReadInt32();
|
||||
for (int l = 0; l < preloadedPlugins; l++)
|
||||
{
|
||||
var preloadedPlugin = reader.ReadAlignedString();
|
||||
}
|
||||
}
|
||||
|
||||
reader.Position += 4;
|
||||
if (version[0] >= 3) //3.0 and up
|
||||
{
|
||||
reader.Position += 4;
|
||||
}
|
||||
if (version[0] > 3 || (version[0] == 3 && version[1] >= 5))//3.5 and up
|
||||
{
|
||||
reader.Position += 4;
|
||||
}
|
||||
if (version[0] >= 5 || (version[0] == 4 && (version[1] >= 3 || (version[1] == 2 && buildType[0] != "a"))))
|
||||
{
|
||||
reader.Position += 4;
|
||||
}
|
||||
m_Version = reader.ReadAlignedString();
|
||||
}
|
||||
}
|
||||
|
||||
17
AssetStudio/Classes/Component.cs
Normal file
17
AssetStudio/Classes/Component.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public abstract class Component : EditorExtension
|
||||
{
|
||||
public PPtr m_GameObject;
|
||||
|
||||
protected Component(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
m_GameObject = sourceFile.ReadPPtr();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
AssetStudio/Classes/EditorExtension.cs
Normal file
19
AssetStudio/Classes/EditorExtension.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public abstract class EditorExtension : Object
|
||||
{
|
||||
protected EditorExtension(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
if (platform == BuildTarget.NoTarget)
|
||||
{
|
||||
var m_PrefabParentObject = sourceFile.ReadPPtr();
|
||||
var m_PrefabInternal = sourceFile.ReadPPtr();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,147 +5,116 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class UFont
|
||||
public sealed class Font : NamedObject
|
||||
{
|
||||
public string m_Name;
|
||||
public byte[] m_FontData;
|
||||
|
||||
public UFont(AssetPreloadData preloadData, bool readSwitch)
|
||||
public Font(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var version = sourceFile.version;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
|
||||
if (readSwitch)
|
||||
if ((version[0] == 5 && version[1] >= 5) || version[0] > 5)//5.5 and up
|
||||
{
|
||||
if ((version[0] == 5 && version[1] >= 5) || version[0] > 5)//5.5 and up
|
||||
var m_LineSpacing = reader.ReadSingle();
|
||||
var m_DefaultMaterial = sourceFile.ReadPPtr();
|
||||
var m_FontSize = reader.ReadSingle();
|
||||
var m_Texture = sourceFile.ReadPPtr();
|
||||
int m_AsciiStartOffset = reader.ReadInt32();
|
||||
var m_Tracking = reader.ReadSingle();
|
||||
var m_CharacterSpacing = reader.ReadInt32();
|
||||
var m_CharacterPadding = reader.ReadInt32();
|
||||
var m_ConvertCase = reader.ReadInt32();
|
||||
int m_CharacterRects_size = reader.ReadInt32();
|
||||
for (int i = 0; i < m_CharacterRects_size; i++)
|
||||
{
|
||||
var m_LineSpacing = reader.ReadSingle();
|
||||
var m_DefaultMaterial = sourceFile.ReadPPtr();
|
||||
var m_FontSize = reader.ReadSingle();
|
||||
var m_Texture = sourceFile.ReadPPtr();
|
||||
int m_AsciiStartOffset = reader.ReadInt32();
|
||||
var m_Tracking = reader.ReadSingle();
|
||||
var m_CharacterSpacing = reader.ReadInt32();
|
||||
var m_CharacterPadding = reader.ReadInt32();
|
||||
var m_ConvertCase = reader.ReadInt32();
|
||||
int m_CharacterRects_size = reader.ReadInt32();
|
||||
for (int i = 0; i < m_CharacterRects_size; i++)
|
||||
{
|
||||
reader.Position += 44;//CharacterInfo data 41
|
||||
}
|
||||
int m_KerningValues_size = reader.ReadInt32();
|
||||
for (int i = 0; i < m_KerningValues_size; i++)
|
||||
{
|
||||
reader.Position += 8;
|
||||
}
|
||||
var m_PixelScale = reader.ReadSingle();
|
||||
int m_FontData_size = reader.ReadInt32();
|
||||
if (m_FontData_size > 0)
|
||||
{
|
||||
m_FontData = reader.ReadBytes(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";
|
||||
}
|
||||
}
|
||||
reader.Position += 44;//CharacterInfo data 41
|
||||
}
|
||||
else
|
||||
int m_KerningValues_size = reader.ReadInt32();
|
||||
for (int i = 0; i < m_KerningValues_size; i++)
|
||||
{
|
||||
int m_AsciiStartOffset = reader.ReadInt32();
|
||||
|
||||
if (version[0] <= 3)
|
||||
{
|
||||
int m_FontCountX = reader.ReadInt32();
|
||||
int m_FontCountY = reader.ReadInt32();
|
||||
}
|
||||
|
||||
float m_Kerning = reader.ReadSingle();
|
||||
float m_LineSpacing = reader.ReadSingle();
|
||||
|
||||
if (version[0] <= 3)
|
||||
{
|
||||
int m_PerCharacterKerning_size = reader.ReadInt32();
|
||||
for (int i = 0; i < m_PerCharacterKerning_size; i++)
|
||||
{
|
||||
int first = reader.ReadInt32();
|
||||
float second = reader.ReadSingle();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int m_CharacterSpacing = reader.ReadInt32();
|
||||
int m_CharacterPadding = reader.ReadInt32();
|
||||
}
|
||||
|
||||
int m_ConvertCase = reader.ReadInt32();
|
||||
PPtr m_DefaultMaterial = sourceFile.ReadPPtr();
|
||||
|
||||
int m_CharacterRects_size = reader.ReadInt32();
|
||||
for (int i = 0; i < m_CharacterRects_size; i++)
|
||||
{
|
||||
int index = reader.ReadInt32();
|
||||
//Rectf uv
|
||||
float uvx = reader.ReadSingle();
|
||||
float uvy = reader.ReadSingle();
|
||||
float uvwidth = reader.ReadSingle();
|
||||
float uvheight = reader.ReadSingle();
|
||||
//Rectf vert
|
||||
float vertx = reader.ReadSingle();
|
||||
float verty = reader.ReadSingle();
|
||||
float vertwidth = reader.ReadSingle();
|
||||
float vertheight = reader.ReadSingle();
|
||||
float width = reader.ReadSingle();
|
||||
|
||||
if (version[0] >= 4)
|
||||
{
|
||||
var flipped = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
}
|
||||
|
||||
PPtr m_Texture = sourceFile.ReadPPtr();
|
||||
|
||||
int m_KerningValues_size = reader.ReadInt32();
|
||||
for (int i = 0; i < m_KerningValues_size; i++)
|
||||
{
|
||||
int pairfirst = reader.ReadInt16();
|
||||
int pairsecond = reader.ReadInt16();
|
||||
float second = reader.ReadSingle();
|
||||
}
|
||||
|
||||
if (version[0] <= 3)
|
||||
{
|
||||
var m_GridFont = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
else { float m_PixelScale = reader.ReadSingle(); }
|
||||
|
||||
int m_FontData_size = reader.ReadInt32();
|
||||
if (m_FontData_size > 0)
|
||||
{
|
||||
m_FontData = reader.ReadBytes(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";
|
||||
}
|
||||
}
|
||||
reader.Position += 8;
|
||||
}
|
||||
var m_PixelScale = reader.ReadSingle();
|
||||
int m_FontData_size = reader.ReadInt32();
|
||||
if (m_FontData_size > 0)
|
||||
{
|
||||
m_FontData = reader.ReadBytes(m_FontData_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
preloadData.Text = m_Name;
|
||||
int m_AsciiStartOffset = reader.ReadInt32();
|
||||
|
||||
if (version[0] <= 3)
|
||||
{
|
||||
int m_FontCountX = reader.ReadInt32();
|
||||
int m_FontCountY = reader.ReadInt32();
|
||||
}
|
||||
|
||||
float m_Kerning = reader.ReadSingle();
|
||||
float m_LineSpacing = reader.ReadSingle();
|
||||
|
||||
if (version[0] <= 3)
|
||||
{
|
||||
int m_PerCharacterKerning_size = reader.ReadInt32();
|
||||
for (int i = 0; i < m_PerCharacterKerning_size; i++)
|
||||
{
|
||||
int first = reader.ReadInt32();
|
||||
float second = reader.ReadSingle();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int m_CharacterSpacing = reader.ReadInt32();
|
||||
int m_CharacterPadding = reader.ReadInt32();
|
||||
}
|
||||
|
||||
int m_ConvertCase = reader.ReadInt32();
|
||||
PPtr m_DefaultMaterial = sourceFile.ReadPPtr();
|
||||
|
||||
int m_CharacterRects_size = reader.ReadInt32();
|
||||
for (int i = 0; i < m_CharacterRects_size; i++)
|
||||
{
|
||||
int index = reader.ReadInt32();
|
||||
//Rectf uv
|
||||
float uvx = reader.ReadSingle();
|
||||
float uvy = reader.ReadSingle();
|
||||
float uvwidth = reader.ReadSingle();
|
||||
float uvheight = reader.ReadSingle();
|
||||
//Rectf vert
|
||||
float vertx = reader.ReadSingle();
|
||||
float verty = reader.ReadSingle();
|
||||
float vertwidth = reader.ReadSingle();
|
||||
float vertheight = reader.ReadSingle();
|
||||
float width = reader.ReadSingle();
|
||||
|
||||
if (version[0] >= 4)
|
||||
{
|
||||
var flipped = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
}
|
||||
|
||||
PPtr m_Texture = sourceFile.ReadPPtr();
|
||||
|
||||
int m_KerningValues_size = reader.ReadInt32();
|
||||
for (int i = 0; i < m_KerningValues_size; i++)
|
||||
{
|
||||
int pairfirst = reader.ReadInt16();
|
||||
int pairsecond = reader.ReadInt16();
|
||||
float second = reader.ReadSingle();
|
||||
}
|
||||
|
||||
if (version[0] <= 3)
|
||||
{
|
||||
var m_GridFont = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
else { float m_PixelScale = reader.ReadSingle(); }
|
||||
|
||||
int m_FontData_size = reader.ReadInt32();
|
||||
if (m_FontData_size > 0)
|
||||
{
|
||||
m_FontData = reader.ReadBytes(m_FontData_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,58 +6,39 @@ using System.Windows.Forms;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class GameObject : TreeNode
|
||||
public sealed class GameObject : EditorExtension
|
||||
{
|
||||
public AssetPreloadData asset;
|
||||
public List<PPtr> m_Components;
|
||||
public int m_Layer;
|
||||
public string m_Name;
|
||||
public ushort m_Tag;
|
||||
public bool m_IsActive;
|
||||
|
||||
public string uniqueID = "0";//this way file and folder TreeNodes will be treated as FBX scene
|
||||
|
||||
public PPtr m_Transform;
|
||||
public PPtr m_MeshRenderer;
|
||||
public PPtr m_MeshFilter;
|
||||
public PPtr m_SkinnedMeshRenderer;
|
||||
public PPtr m_Animator;
|
||||
|
||||
public GameObject(AssetPreloadData preloadData)
|
||||
public GameObject(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
if (preloadData != null)
|
||||
int m_Component_size = reader.ReadInt32();
|
||||
m_Components = new List<PPtr>(m_Component_size);
|
||||
for (int j = 0; j < m_Component_size; j++)
|
||||
{
|
||||
asset = preloadData;
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
uniqueID = preloadData.uniqueID;
|
||||
|
||||
int m_Component_size = reader.ReadInt32();
|
||||
m_Components = new List<PPtr>(m_Component_size);
|
||||
for (int j = 0; j < m_Component_size; j++)
|
||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 and up
|
||||
{
|
||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 and up
|
||||
{
|
||||
m_Components.Add(sourceFile.ReadPPtr());
|
||||
}
|
||||
else
|
||||
{
|
||||
int first = reader.ReadInt32();
|
||||
m_Components.Add(sourceFile.ReadPPtr());
|
||||
}
|
||||
m_Components.Add(sourceFile.ReadPPtr());
|
||||
}
|
||||
else
|
||||
{
|
||||
int first = reader.ReadInt32();
|
||||
m_Components.Add(sourceFile.ReadPPtr());
|
||||
}
|
||||
}
|
||||
|
||||
m_Layer = reader.ReadInt32();
|
||||
m_Name = reader.ReadAlignedString();
|
||||
if (m_Name == "") { m_Name = "GameObject #" + uniqueID; }
|
||||
m_Tag = reader.ReadUInt16();
|
||||
m_IsActive = reader.ReadBoolean();
|
||||
var m_Layer = reader.ReadInt32();
|
||||
m_Name = reader.ReadAlignedString();
|
||||
|
||||
Text = m_Name;
|
||||
preloadData.Text = m_Name;
|
||||
//name should be unique
|
||||
Name = uniqueID;
|
||||
if (m_Name == "")
|
||||
{
|
||||
m_Name = "GameObject #" + preloadData.uniqueID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class TexEnv
|
||||
public class TexEnv
|
||||
{
|
||||
public string name;
|
||||
public PPtr m_Texture;
|
||||
@@ -13,21 +13,20 @@ namespace AssetStudio
|
||||
public float[] m_Offset;
|
||||
}
|
||||
|
||||
class strFloatPair
|
||||
public class strFloatPair
|
||||
{
|
||||
public string first;
|
||||
public float second;
|
||||
}
|
||||
|
||||
class strColorPair
|
||||
public class strColorPair
|
||||
{
|
||||
public string first;
|
||||
public float[] second;
|
||||
}
|
||||
|
||||
class Material
|
||||
public sealed class Material : NamedObject
|
||||
{
|
||||
public string m_Name;
|
||||
public PPtr m_Shader;
|
||||
public string[] m_ShaderKeywords;
|
||||
public int m_CustomRenderQueue;
|
||||
@@ -35,12 +34,8 @@ namespace AssetStudio
|
||||
public strFloatPair[] m_Floats;
|
||||
public strColorPair[] m_Colors;
|
||||
|
||||
public Material(AssetPreloadData preloadData)
|
||||
public Material(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
m_Shader = sourceFile.ReadPPtr();
|
||||
|
||||
if (sourceFile.version[0] == 4 && (sourceFile.version[1] >= 2 || (sourceFile.version[1] == 1 && sourceFile.buildType[0] != "a")))
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,18 +5,13 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class MeshFilter
|
||||
public sealed class MeshFilter : Component
|
||||
{
|
||||
public long preloadIndex;
|
||||
public PPtr m_GameObject = new PPtr();
|
||||
public PPtr m_Mesh = new PPtr();
|
||||
public PPtr m_Mesh;
|
||||
|
||||
public MeshFilter(AssetPreloadData preloadData)
|
||||
public MeshFilter(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_GameObject = sourceFile.ReadPPtr();
|
||||
m_Mesh = sourceFile.ReadPPtr();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,86 +5,11 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class StaticBatchInfo
|
||||
public sealed class MeshRenderer : Renderer
|
||||
{
|
||||
public ushort firstSubMesh;
|
||||
public ushort subMeshCount;
|
||||
}
|
||||
|
||||
public class MeshRenderer
|
||||
{
|
||||
public PPtr m_GameObject;
|
||||
public PPtr[] m_Materials;
|
||||
public StaticBatchInfo m_StaticBatchInfo;
|
||||
public uint[] m_SubsetIndices;
|
||||
|
||||
protected MeshRenderer() { }
|
||||
|
||||
public MeshRenderer(AssetPreloadData preloadData)
|
||||
public MeshRenderer(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var version = sourceFile.version;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_GameObject = sourceFile.ReadPPtr();
|
||||
if (version[0] < 5)
|
||||
{
|
||||
var m_Enabled = reader.ReadBoolean();
|
||||
var m_CastShadows = reader.ReadByte();
|
||||
var m_ReceiveShadows = reader.ReadBoolean();
|
||||
var m_LightmapIndex = reader.ReadByte();
|
||||
}
|
||||
else
|
||||
{
|
||||
var m_Enabled = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
var m_CastShadows = reader.ReadByte();
|
||||
var m_ReceiveShadows = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
if (version[0] >= 2018)//2018 and up
|
||||
{
|
||||
var m_RenderingLayerMask = reader.ReadUInt32();
|
||||
}
|
||||
var m_LightmapIndex = reader.ReadUInt16();
|
||||
var m_LightmapIndexDynamic = reader.ReadUInt16();
|
||||
}
|
||||
|
||||
if (version[0] >= 3)
|
||||
{
|
||||
reader.Position += 16;//Vector4f m_LightmapTilingOffset
|
||||
}
|
||||
|
||||
if (version[0] >= 5)
|
||||
{
|
||||
reader.Position += 16;//Vector4f m_LightmapTilingOffsetDynamic
|
||||
}
|
||||
|
||||
m_Materials = new PPtr[reader.ReadInt32()];
|
||||
for (int m = 0; m < m_Materials.Length; m++)
|
||||
{
|
||||
m_Materials[m] = sourceFile.ReadPPtr();
|
||||
}
|
||||
|
||||
if (version[0] < 3)
|
||||
{
|
||||
reader.Position += 16;//m_LightmapTilingOffset vector4d
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 and up
|
||||
{
|
||||
m_StaticBatchInfo = new StaticBatchInfo
|
||||
{
|
||||
firstSubMesh = reader.ReadUInt16(),
|
||||
subMeshCount = reader.ReadUInt16()
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
int numSubsetIndices = reader.ReadInt32();
|
||||
m_SubsetIndices = reader.ReadUInt32Array(numSubsetIndices);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,21 +5,13 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class MonoBehaviour
|
||||
public sealed class MonoBehaviour : Behaviour
|
||||
{
|
||||
public PPtr m_GameObject;
|
||||
public byte m_Enabled;
|
||||
public PPtr m_Script;
|
||||
public string m_Name;
|
||||
|
||||
public MonoBehaviour(AssetPreloadData preloadData)
|
||||
public MonoBehaviour(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_GameObject = sourceFile.ReadPPtr();
|
||||
m_Enabled = reader.ReadByte();
|
||||
reader.AlignStream(4);
|
||||
m_Script = sourceFile.ReadPPtr();
|
||||
m_Name = reader.ReadAlignedString();
|
||||
}
|
||||
|
||||
@@ -5,20 +5,14 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class MonoScript
|
||||
public sealed class MonoScript : NamedObject
|
||||
{
|
||||
public string m_Name;
|
||||
public string m_ClassName;
|
||||
public string m_Namespace = string.Empty;
|
||||
public string m_AssemblyName;
|
||||
|
||||
public MonoScript(AssetPreloadData preloadData)
|
||||
public MonoScript(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
var version = sourceFile.version;
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
if (version[0] > 3 || (version[0] == 3 && version[1] >= 4)) //3.4 and up
|
||||
{
|
||||
var m_ExecutionOrder = reader.ReadInt32();
|
||||
|
||||
@@ -5,32 +5,17 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class MovieTexture
|
||||
public sealed class MovieTexture : Texture
|
||||
{
|
||||
public string m_Name;
|
||||
public byte[] m_MovieData;
|
||||
|
||||
public MovieTexture(AssetPreloadData preloadData, bool readSwitch)
|
||||
public MovieTexture(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
if (readSwitch)
|
||||
{
|
||||
var m_Loop = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
//PPtr<AudioClip>
|
||||
sourceFile.ReadPPtr();
|
||||
var size = reader.ReadInt32();
|
||||
m_MovieData = reader.ReadBytes(size);
|
||||
var m_ColorSpace = reader.ReadInt32();
|
||||
}
|
||||
else
|
||||
{
|
||||
preloadData.extension = ".ogv";
|
||||
preloadData.Text = m_Name;
|
||||
}
|
||||
var m_Loop = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
//PPtr<AudioClip>
|
||||
sourceFile.ReadPPtr();
|
||||
m_MovieData = reader.ReadBytes(reader.ReadInt32());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
17
AssetStudio/Classes/NamedObject.cs
Normal file
17
AssetStudio/Classes/NamedObject.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class NamedObject : EditorExtension
|
||||
{
|
||||
public string m_Name;
|
||||
|
||||
public NamedObject(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
m_Name = reader.ReadAlignedString();
|
||||
}
|
||||
}
|
||||
}
|
||||
32
AssetStudio/Classes/Object.cs
Normal file
32
AssetStudio/Classes/Object.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public abstract class Object
|
||||
{
|
||||
public AssetPreloadData preloadData;
|
||||
public AssetsFile sourceFile;
|
||||
protected EndianBinaryReader reader;
|
||||
public int[] version;
|
||||
protected string[] buildType;
|
||||
protected BuildTarget platform;
|
||||
|
||||
protected Object(AssetPreloadData preloadData)
|
||||
{
|
||||
this.preloadData = preloadData;
|
||||
sourceFile = preloadData.sourceFile;
|
||||
reader = preloadData.InitReader();
|
||||
version = sourceFile.version;
|
||||
buildType = sourceFile.buildType;
|
||||
platform = (BuildTarget)sourceFile.platform;
|
||||
|
||||
if (platform == BuildTarget.NoTarget)
|
||||
{
|
||||
var m_ObjectHideFlags = reader.ReadUInt32();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,18 +5,14 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class PlayerSettings
|
||||
public sealed class PlayerSettings : Object
|
||||
{
|
||||
public string companyName;
|
||||
public string productName;
|
||||
|
||||
public PlayerSettings(AssetPreloadData preloadData)
|
||||
public PlayerSettings(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
|
||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 4) || sourceFile.version[0] > 5)//5.4.0 nad up
|
||||
if ((version[0] == 5 && version[1] >= 4) || version[0] > 5)//5.4.0 nad up
|
||||
{
|
||||
//productGUID
|
||||
reader.ReadInt32();
|
||||
@@ -24,9 +20,9 @@ namespace AssetStudio
|
||||
reader.ReadInt32();
|
||||
reader.ReadInt32();
|
||||
}
|
||||
if (sourceFile.version[0] >= 3)
|
||||
if (version[0] >= 3)
|
||||
{
|
||||
if (sourceFile.version[0] == 3 && sourceFile.version[1] < 2)
|
||||
if (version[0] == 3 && version[1] < 2)
|
||||
{
|
||||
string AndroidLicensePublicKey = reader.ReadAlignedString();
|
||||
}
|
||||
@@ -38,31 +34,31 @@ namespace AssetStudio
|
||||
int defaultScreenOrientation = reader.ReadInt32();
|
||||
int targetDevice = reader.ReadInt32();
|
||||
|
||||
if (sourceFile.version[0] < 5 || (sourceFile.version[0] == 5 && sourceFile.version[1] < 1))
|
||||
if (version[0] < 5 || (version[0] == 5 && version[1] < 1))
|
||||
{
|
||||
int targetGlesGraphics = reader.ReadInt32();
|
||||
}
|
||||
|
||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] < 1) || (sourceFile.version[0] == 4 && sourceFile.version[1] == 6 && sourceFile.version[2] >= 3))
|
||||
if ((version[0] == 5 && version[1] < 1) || (version[0] == 4 && version[1] == 6 && version[2] >= 3))
|
||||
{
|
||||
int targetIOSGraphics = reader.ReadInt32();
|
||||
}
|
||||
|
||||
if (sourceFile.version[0] >= 5 || sourceFile.version[0] == 5 && (sourceFile.version[1] > 2 || (sourceFile.version[1] == 2 && sourceFile.version[2] >= 1)))
|
||||
if (version[0] >= 5 || version[0] == 5 && (version[1] > 2 || (version[1] == 2 && version[2] >= 1)))
|
||||
{
|
||||
bool useOnDemandResources = reader.ReadBoolean(); reader.AlignStream(4);
|
||||
}
|
||||
|
||||
if (sourceFile.version[0] < 5 || (sourceFile.version[0] == 5 && sourceFile.version[1] < 3))
|
||||
if (version[0] < 5 || (version[0] == 5 && version[1] < 3))
|
||||
{
|
||||
int targetResolution = reader.ReadInt32();
|
||||
}
|
||||
|
||||
if (sourceFile.version[0] == 3 && sourceFile.version[1] <= 1)
|
||||
if (version[0] == 3 && version[1] <= 1)
|
||||
{
|
||||
bool OverrideIPodMusic = reader.ReadBoolean(); reader.AlignStream(4);
|
||||
}
|
||||
else if (sourceFile.version[0] == 3 && sourceFile.version[1] <= 4)
|
||||
else if (version[0] == 3 && version[1] <= 4)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -5,26 +5,10 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class RectTransform
|
||||
public sealed class RectTransform : Transform
|
||||
{
|
||||
public Transform m_Transform;
|
||||
|
||||
public RectTransform(AssetPreloadData preloadData)
|
||||
public RectTransform(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
m_Transform = new Transform(preloadData);
|
||||
|
||||
//var sourceFile = preloadData.sourceFile;
|
||||
//var a_Stream = preloadData.sourceFile.a_Stream;
|
||||
|
||||
/*
|
||||
float[2] AnchorsMin
|
||||
float[2] AnchorsMax
|
||||
float[2] Pivod
|
||||
float Width
|
||||
float Height
|
||||
float[2] ?
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
116
AssetStudio/Classes/Renderer.cs
Normal file
116
AssetStudio/Classes/Renderer.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class StaticBatchInfo
|
||||
{
|
||||
public ushort firstSubMesh;
|
||||
public ushort subMeshCount;
|
||||
}
|
||||
|
||||
public abstract class Renderer : Component
|
||||
{
|
||||
public PPtr[] m_Materials;
|
||||
public StaticBatchInfo m_StaticBatchInfo;
|
||||
public uint[] m_SubsetIndices;
|
||||
|
||||
protected Renderer(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
if (version[0] < 5)
|
||||
{
|
||||
var m_Enabled = reader.ReadBoolean();
|
||||
var m_CastShadows = reader.ReadByte();
|
||||
var m_ReceiveShadows = reader.ReadBoolean();
|
||||
var m_LightmapIndex = reader.ReadByte();
|
||||
}
|
||||
else
|
||||
{
|
||||
var m_Enabled = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
var m_CastShadows = reader.ReadByte();
|
||||
var m_ReceiveShadows = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
if (version[0] >= 2018)//2018 and up
|
||||
{
|
||||
var m_RenderingLayerMask = reader.ReadUInt32();
|
||||
}
|
||||
var m_LightmapIndex = reader.ReadUInt16();
|
||||
var m_LightmapIndexDynamic = reader.ReadUInt16();
|
||||
}
|
||||
|
||||
if (version[0] >= 3)
|
||||
{
|
||||
reader.Position += 16;//Vector4f m_LightmapTilingOffset
|
||||
}
|
||||
|
||||
if (version[0] >= 5)
|
||||
{
|
||||
reader.Position += 16;//Vector4f m_LightmapTilingOffsetDynamic
|
||||
}
|
||||
|
||||
m_Materials = new PPtr[reader.ReadInt32()];
|
||||
for (int m = 0; m < m_Materials.Length; m++)
|
||||
{
|
||||
m_Materials[m] = sourceFile.ReadPPtr();
|
||||
}
|
||||
|
||||
if (version[0] < 3)
|
||||
{
|
||||
reader.Position += 16;//m_LightmapTilingOffset vector4d
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 and up
|
||||
{
|
||||
m_StaticBatchInfo = new StaticBatchInfo
|
||||
{
|
||||
firstSubMesh = reader.ReadUInt16(),
|
||||
subMeshCount = reader.ReadUInt16()
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
int numSubsetIndices = reader.ReadInt32();
|
||||
m_SubsetIndices = reader.ReadUInt32Array(numSubsetIndices);
|
||||
}
|
||||
|
||||
var m_StaticBatchRoot = sourceFile.ReadPPtr();
|
||||
|
||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 4) || sourceFile.version[0] > 5)//5.4.0 and up
|
||||
{
|
||||
var m_ProbeAnchor = sourceFile.ReadPPtr();
|
||||
var m_LightProbeVolumeOverride = sourceFile.ReadPPtr();
|
||||
}
|
||||
else if (version[0] >= 4 || (version[0] == 3 && version[1] >= 5))//3.5 - 5.3
|
||||
{
|
||||
var m_UseLightProbes = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
if (version[0] == 5)//5.0 and up
|
||||
{
|
||||
int m_ReflectionProbeUsage = reader.ReadInt32();
|
||||
}
|
||||
var m_LightProbeAnchor = sourceFile.ReadPPtr();
|
||||
}
|
||||
|
||||
if (version[0] >= 5 || (version[0] == 4 && version[1] >= 3))//4.3 and up
|
||||
{
|
||||
if (version[0] == 4 && version[1] == 3)//4.3
|
||||
{
|
||||
int m_SortingLayer = reader.ReadInt16();
|
||||
}
|
||||
else
|
||||
{
|
||||
int m_SortingLayerID = reader.ReadInt32();
|
||||
//SInt16 m_SortingOrder 5.6 and up
|
||||
}
|
||||
|
||||
int m_SortingOrder = reader.ReadInt16();
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,62 +8,34 @@ using Lz4;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class Shader
|
||||
public sealed class Shader : NamedObject
|
||||
{
|
||||
public string m_Name;
|
||||
public byte[] m_Script;
|
||||
|
||||
public Shader(AssetPreloadData preloadData, bool readSwitch)
|
||||
public Shader(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
|
||||
if (readSwitch)
|
||||
if (sourceFile.version[0] == 5 && sourceFile.version[1] >= 5 || sourceFile.version[0] > 5) //5.5.0 and up
|
||||
{
|
||||
if (sourceFile.version[0] == 5 && sourceFile.version[1] >= 5 || sourceFile.version[0] > 5)//5.5.0 and up
|
||||
{
|
||||
var str = (string)ShaderResource.ResourceManager.GetObject($"Shader{sourceFile.version[0]}{sourceFile.version[1]}");
|
||||
if (str == null)
|
||||
{
|
||||
str = preloadData.GetClassString();
|
||||
if (str == null)
|
||||
m_Script = Encoding.UTF8.GetBytes("Serialized Shader can't be read");
|
||||
else
|
||||
m_Script = Encoding.UTF8.GetBytes(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Position = preloadData.Offset;
|
||||
var sb = new StringBuilder();
|
||||
var members = new JavaScriptSerializer().Deserialize<List<ClassMember>>(str);
|
||||
ClassStructHelper.ReadClassString(sb, members, reader);
|
||||
m_Script = Encoding.UTF8.GetBytes(sb.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Script = reader.ReadBytes(reader.ReadInt32());
|
||||
if (sourceFile.version[0] == 5 && sourceFile.version[1] >= 3) //5.3 - 5.4
|
||||
{
|
||||
reader.AlignStream(4);
|
||||
reader.ReadAlignedString();//m_PathName
|
||||
var decompressedSize = reader.ReadUInt32();
|
||||
var m_SubProgramBlob = reader.ReadBytes(reader.ReadInt32());
|
||||
var decompressedBytes = new byte[decompressedSize];
|
||||
using (var decoder = new Lz4DecoderStream(new MemoryStream(m_SubProgramBlob)))
|
||||
{
|
||||
decoder.Read(decompressedBytes, 0, (int)decompressedSize);
|
||||
}
|
||||
m_Script = m_Script.Concat(decompressedBytes.ToArray()).ToArray();
|
||||
}
|
||||
}
|
||||
var str = preloadData.Dump();
|
||||
m_Script = Encoding.UTF8.GetBytes(str ?? "Serialized Shader can't be read");
|
||||
}
|
||||
else
|
||||
{
|
||||
preloadData.extension = ".txt";
|
||||
preloadData.Text = m_Name;
|
||||
m_Script = reader.ReadBytes(reader.ReadInt32());
|
||||
if (sourceFile.version[0] == 5 && sourceFile.version[1] >= 3) //5.3 - 5.4
|
||||
{
|
||||
reader.AlignStream(4);
|
||||
var m_PathName = reader.ReadAlignedString();
|
||||
var decompressedSize = reader.ReadUInt32();
|
||||
var m_SubProgramBlob = reader.ReadBytes(reader.ReadInt32());
|
||||
var decompressedBytes = new byte[decompressedSize];
|
||||
using (var decoder = new Lz4DecoderStream(new MemoryStream(m_SubProgramBlob)))
|
||||
{
|
||||
decoder.Read(decompressedBytes, 0, (int)decompressedSize);
|
||||
}
|
||||
|
||||
m_Script = m_Script.Concat(decompressedBytes.ToArray()).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,112 +5,14 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class SkinnedMeshRenderer : MeshRenderer
|
||||
public sealed class SkinnedMeshRenderer : Renderer
|
||||
{
|
||||
public PPtr m_Mesh;
|
||||
public PPtr[] m_Bones;
|
||||
public List<float> m_BlendShapeWeights;
|
||||
|
||||
public SkinnedMeshRenderer(AssetPreloadData preloadData)
|
||||
public SkinnedMeshRenderer(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var version = sourceFile.version;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_GameObject = sourceFile.ReadPPtr();
|
||||
if (version[0] < 5)
|
||||
{
|
||||
var m_Enabled = reader.ReadBoolean();
|
||||
var m_CastShadows = reader.ReadByte();
|
||||
var m_ReceiveShadows = reader.ReadBoolean();
|
||||
var m_LightmapIndex = reader.ReadByte();
|
||||
}
|
||||
else
|
||||
{
|
||||
var m_Enabled = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
var m_CastShadows = reader.ReadByte();
|
||||
var m_ReceiveShadows = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
if (version[0] >= 2018)//2018 and up
|
||||
{
|
||||
var m_RenderingLayerMask = reader.ReadUInt32();
|
||||
}
|
||||
var m_LightmapIndex = reader.ReadUInt16();
|
||||
var m_LightmapIndexDynamic = reader.ReadUInt16();
|
||||
}
|
||||
|
||||
if (version[0] >= 3)
|
||||
{
|
||||
reader.Position += 16;//Vector4f m_LightmapTilingOffset
|
||||
}
|
||||
|
||||
if (version[0] >= 5)
|
||||
{
|
||||
reader.Position += 16;//Vector4f m_LightmapTilingOffsetDynamic
|
||||
}
|
||||
|
||||
m_Materials = new PPtr[reader.ReadInt32()];
|
||||
for (int m = 0; m < m_Materials.Length; m++)
|
||||
{
|
||||
m_Materials[m] = sourceFile.ReadPPtr();
|
||||
}
|
||||
|
||||
if (version[0] < 3)
|
||||
{
|
||||
reader.Position += 16;//m_LightmapTilingOffset vector4d
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 and up
|
||||
{
|
||||
m_StaticBatchInfo = new StaticBatchInfo
|
||||
{
|
||||
firstSubMesh = reader.ReadUInt16(),
|
||||
subMeshCount = reader.ReadUInt16()
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
int numSubsetIndices = reader.ReadInt32();
|
||||
m_SubsetIndices = reader.ReadUInt32Array(numSubsetIndices);
|
||||
}
|
||||
|
||||
var m_StaticBatchRoot = sourceFile.ReadPPtr();
|
||||
|
||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 4) || sourceFile.version[0] > 5)//5.4.0 and up
|
||||
{
|
||||
var m_ProbeAnchor = sourceFile.ReadPPtr();
|
||||
var m_LightProbeVolumeOverride = sourceFile.ReadPPtr();
|
||||
}
|
||||
else if (version[0] >= 4 || (version[0] == 3 && version[1] >= 5))//3.5 - 5.3
|
||||
{
|
||||
var m_UseLightProbes = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
if (version[0] == 5)//5.0 and up
|
||||
{
|
||||
int m_ReflectionProbeUsage = reader.ReadInt32();
|
||||
}
|
||||
var m_LightProbeAnchor = sourceFile.ReadPPtr();
|
||||
}
|
||||
|
||||
if (version[0] >= 5 || (version[0] == 4 && version[1] >= 3))//4.3 and up
|
||||
{
|
||||
if (version[0] == 4 && version[1] == 3)//4.3
|
||||
{
|
||||
int m_SortingLayer = reader.ReadInt16();
|
||||
}
|
||||
else
|
||||
{
|
||||
int m_SortingLayerID = reader.ReadInt32();
|
||||
//SInt16 m_SortingOrder 5.6 and up
|
||||
}
|
||||
|
||||
int m_SortingOrder = reader.ReadInt16();
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
}
|
||||
|
||||
int m_Quality = reader.ReadInt32();
|
||||
var m_UpdateWhenOffscreen = reader.ReadBoolean();
|
||||
var m_SkinNormals = reader.ReadBoolean(); //3.1.0 and below
|
||||
|
||||
@@ -6,9 +6,8 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class Sprite
|
||||
public sealed class Sprite : NamedObject
|
||||
{
|
||||
public string m_Name;
|
||||
public RectangleF m_Rect;
|
||||
public float m_PixelsToUnits;
|
||||
public PointF m_Pivot;
|
||||
@@ -18,171 +17,159 @@ namespace AssetStudio
|
||||
public RectangleF textureRect;
|
||||
public PointF[][] m_PhysicsShape;
|
||||
|
||||
public Sprite(AssetPreloadData preloadData, bool readSwitch)
|
||||
public Sprite(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
var version = sourceFile.version;
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
if (readSwitch)
|
||||
//Rectf m_Rect
|
||||
m_Rect = new RectangleF(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
|
||||
//Vector2f m_Offset
|
||||
reader.Position += 8;
|
||||
if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up
|
||||
{
|
||||
//Rectf m_Rect
|
||||
m_Rect = new RectangleF(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
|
||||
//Vector2f m_Offset
|
||||
reader.Position += 8;
|
||||
if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up
|
||||
//Vector4f m_Border
|
||||
reader.Position += 16;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
//Vector2f m_Pivot
|
||||
m_Pivot = new PointF(reader.ReadSingle(), reader.ReadSingle());
|
||||
}
|
||||
|
||||
var m_Extrude = reader.ReadUInt32();
|
||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 3)) //5.3 and up
|
||||
{
|
||||
var m_IsPolygon = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
|
||||
if (version[0] >= 2017) //2017 and up
|
||||
{
|
||||
//pair m_RenderDataKey
|
||||
first = new Guid(reader.ReadBytes(16));
|
||||
var second = reader.ReadInt64();
|
||||
//vector m_AtlasTags
|
||||
var size = reader.ReadInt32();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
//Vector4f m_Border
|
||||
reader.Position += 16;
|
||||
var data = reader.ReadAlignedString();
|
||||
}
|
||||
|
||||
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
|
||||
//PPtr<SpriteAtlas> m_SpriteAtlas
|
||||
m_SpriteAtlas = sourceFile.ReadPPtr();
|
||||
}
|
||||
|
||||
//SpriteRenderData m_RD
|
||||
// PPtr<Texture2D> texture
|
||||
texture = sourceFile.ReadPPtr();
|
||||
// PPtr<Texture2D> alphaTexture
|
||||
if (version[0] >= 5) //5.0 and up
|
||||
{
|
||||
var alphaTexture = sourceFile.ReadPPtr();
|
||||
}
|
||||
|
||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up
|
||||
{
|
||||
// vector m_SubMeshes
|
||||
var size = reader.ReadInt32();
|
||||
// SubMesh data
|
||||
if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 3)) //2017.3 and up
|
||||
{
|
||||
//Vector2f m_Pivot
|
||||
m_Pivot = new PointF(reader.ReadSingle(), reader.ReadSingle());
|
||||
}
|
||||
|
||||
var m_Extrude = reader.ReadUInt32();
|
||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 3)) //5.3 and up
|
||||
{
|
||||
var m_IsPolygon = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
|
||||
if (version[0] >= 2017) //2017 and up
|
||||
{
|
||||
//pair m_RenderDataKey
|
||||
first = new Guid(reader.ReadBytes(16));
|
||||
var second = reader.ReadInt64();
|
||||
//vector m_AtlasTags
|
||||
var size = reader.ReadInt32();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
var data = reader.ReadAlignedString();
|
||||
}
|
||||
|
||||
//PPtr<SpriteAtlas> m_SpriteAtlas
|
||||
m_SpriteAtlas = sourceFile.ReadPPtr();
|
||||
}
|
||||
|
||||
//SpriteRenderData m_RD
|
||||
// PPtr<Texture2D> texture
|
||||
texture = sourceFile.ReadPPtr();
|
||||
// PPtr<Texture2D> alphaTexture
|
||||
if (version[0] >= 5) //5.0 and up
|
||||
{
|
||||
var alphaTexture = sourceFile.ReadPPtr();
|
||||
}
|
||||
|
||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up
|
||||
{
|
||||
// vector m_SubMeshes
|
||||
var size = reader.ReadInt32();
|
||||
// SubMesh data
|
||||
if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 3)) //2017.3 and up
|
||||
{
|
||||
reader.Position += 48 * size;
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Position += 44 * size;
|
||||
}
|
||||
|
||||
// vector m_IndexBuffer
|
||||
size = reader.ReadInt32();
|
||||
reader.Position += size; //UInt8 data
|
||||
reader.AlignStream(4);
|
||||
// VertexData m_VertexData
|
||||
if (version[0] < 2018)//2018 down
|
||||
{
|
||||
var m_CurrentChannels = reader.ReadInt32();
|
||||
}
|
||||
var m_VertexCount = reader.ReadUInt32();
|
||||
// vector m_Channels
|
||||
size = reader.ReadInt32();
|
||||
reader.Position += size * 4; //ChannelInfo data
|
||||
// TypelessData m_DataSize
|
||||
size = reader.ReadInt32();
|
||||
reader.Position += size; //UInt8 data
|
||||
reader.AlignStream(4);
|
||||
|
||||
if (version[0] >= 2018)//2018 and up
|
||||
{
|
||||
// vector m_Bindpose
|
||||
// Matrix4x4f data
|
||||
size = reader.ReadInt32();
|
||||
reader.Position += size * 64;
|
||||
if (version[0] == 2018 && version[1] < 2) //2018.2 down
|
||||
{
|
||||
// vector m_SourceSkin
|
||||
// BoneWeights4 data
|
||||
size = reader.ReadInt32();
|
||||
reader.Position += size * 32;
|
||||
}
|
||||
}
|
||||
reader.Position += 48 * size;
|
||||
}
|
||||
else
|
||||
{
|
||||
// vector vertices
|
||||
var size = reader.ReadInt32();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
//SpriteVertex data
|
||||
reader.Position += 12; //Vector3f pos
|
||||
if (version[0] < 4 || (version[0] == 4 && version[1] <= 3)) //4.3 and down
|
||||
reader.Position += 8; //Vector2f uv
|
||||
}
|
||||
reader.Position += 44 * size;
|
||||
}
|
||||
|
||||
// vector indices
|
||||
// vector m_IndexBuffer
|
||||
size = reader.ReadInt32();
|
||||
reader.Position += size; //UInt8 data
|
||||
reader.AlignStream(4);
|
||||
// VertexData m_VertexData
|
||||
if (version[0] < 2018)//2018 down
|
||||
{
|
||||
var m_CurrentChannels = reader.ReadInt32();
|
||||
}
|
||||
var m_VertexCount = reader.ReadUInt32();
|
||||
// vector m_Channels
|
||||
size = reader.ReadInt32();
|
||||
reader.Position += size * 4; //ChannelInfo data
|
||||
// TypelessData m_DataSize
|
||||
size = reader.ReadInt32();
|
||||
reader.Position += size; //UInt8 data
|
||||
reader.AlignStream(4);
|
||||
|
||||
if (version[0] >= 2018)//2018 and up
|
||||
{
|
||||
// vector m_Bindpose
|
||||
// Matrix4x4f data
|
||||
size = reader.ReadInt32();
|
||||
reader.Position += 2 * size; //UInt16 data
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
|
||||
// Rectf textureRect
|
||||
textureRect = new RectangleF(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
|
||||
// Vector2f textureRectOffset
|
||||
reader.Position += 8;
|
||||
// Vector2f atlasRectOffset - 5.6 and up
|
||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up
|
||||
{
|
||||
reader.Position += 8;
|
||||
}
|
||||
// unsigned int settingsRaw
|
||||
reader.Position += 4;
|
||||
// Vector4f uvTransform - 4.5 and up
|
||||
if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up
|
||||
{
|
||||
reader.Position += 16;
|
||||
}
|
||||
if (version[0] >= 2017) //2017 and up
|
||||
{
|
||||
// float downscaleMultiplier - 2017 and up
|
||||
reader.Position += 4;
|
||||
//vector m_PhysicsShape - 2017 and up
|
||||
var m_PhysicsShape_size = reader.ReadInt32();
|
||||
m_PhysicsShape = new PointF[m_PhysicsShape_size][];
|
||||
for (int i = 0; i < m_PhysicsShape_size; i++)
|
||||
reader.Position += size * 64;
|
||||
if (version[0] == 2018 && version[1] < 2) //2018.2 down
|
||||
{
|
||||
var data_size = reader.ReadInt32();
|
||||
//Vector2f
|
||||
m_PhysicsShape[i] = new PointF[data_size];
|
||||
for (int j = 0; j < data_size; j++)
|
||||
{
|
||||
m_PhysicsShape[i][j] = new PointF(reader.ReadSingle(), reader.ReadSingle());
|
||||
}
|
||||
// vector m_SourceSkin
|
||||
// BoneWeights4 data
|
||||
size = reader.ReadInt32();
|
||||
reader.Position += size * 32;
|
||||
}
|
||||
}
|
||||
//vector m_Bones 2018 and up
|
||||
}
|
||||
else
|
||||
{
|
||||
preloadData.Text = m_Name;
|
||||
// vector vertices
|
||||
var size = reader.ReadInt32();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
//SpriteVertex data
|
||||
reader.Position += 12; //Vector3f pos
|
||||
if (version[0] < 4 || (version[0] == 4 && version[1] <= 3)) //4.3 and down
|
||||
reader.Position += 8; //Vector2f uv
|
||||
}
|
||||
|
||||
// vector indices
|
||||
size = reader.ReadInt32();
|
||||
reader.Position += 2 * size; //UInt16 data
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
|
||||
// Rectf textureRect
|
||||
textureRect = new RectangleF(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
|
||||
// Vector2f textureRectOffset
|
||||
reader.Position += 8;
|
||||
// Vector2f atlasRectOffset - 5.6 and up
|
||||
if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up
|
||||
{
|
||||
reader.Position += 8;
|
||||
}
|
||||
// unsigned int settingsRaw
|
||||
reader.Position += 4;
|
||||
// Vector4f uvTransform - 4.5 and up
|
||||
if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up
|
||||
{
|
||||
reader.Position += 16;
|
||||
}
|
||||
if (version[0] >= 2017) //2017 and up
|
||||
{
|
||||
// float downscaleMultiplier - 2017 and up
|
||||
reader.Position += 4;
|
||||
//vector m_PhysicsShape - 2017 and up
|
||||
var m_PhysicsShape_size = reader.ReadInt32();
|
||||
m_PhysicsShape = new PointF[m_PhysicsShape_size][];
|
||||
for (int i = 0; i < m_PhysicsShape_size; i++)
|
||||
{
|
||||
var data_size = reader.ReadInt32();
|
||||
//Vector2f
|
||||
m_PhysicsShape[i] = new PointF[data_size];
|
||||
for (int j = 0; j < data_size; j++)
|
||||
{
|
||||
m_PhysicsShape[i][j] = new PointF(reader.ReadSingle(), reader.ReadSingle());
|
||||
}
|
||||
}
|
||||
}
|
||||
//vector m_Bones 2018 and up
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,19 +6,15 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class SpriteAtlas
|
||||
public sealed class SpriteAtlas : NamedObject
|
||||
{
|
||||
public List<PPtr> textures = new List<PPtr>();
|
||||
public List<RectangleF> textureRects = new List<RectangleF>();
|
||||
public List<Guid> guids = new List<Guid>();
|
||||
|
||||
|
||||
public SpriteAtlas(AssetPreloadData preloadData)
|
||||
public SpriteAtlas(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
var m_Name = reader.ReadAlignedString();
|
||||
//vector m_PackedSprites
|
||||
var size = reader.ReadInt32();
|
||||
for (int i = 0; i < size; i++)
|
||||
|
||||
@@ -6,27 +6,13 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class TextAsset
|
||||
public sealed class TextAsset : NamedObject
|
||||
{
|
||||
public string m_Name;
|
||||
public byte[] m_Script;
|
||||
|
||||
public TextAsset(AssetPreloadData preloadData, bool readSwitch)
|
||||
public TextAsset(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
|
||||
if (readSwitch)
|
||||
{
|
||||
m_Script = reader.ReadBytes(reader.ReadInt32());
|
||||
}
|
||||
else
|
||||
{
|
||||
preloadData.extension = ".txt";
|
||||
preloadData.Text = m_Name;
|
||||
}
|
||||
m_Script = reader.ReadBytes(reader.ReadInt32());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
20
AssetStudio/Classes/Texture.cs
Normal file
20
AssetStudio/Classes/Texture.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public abstract class Texture : NamedObject
|
||||
{
|
||||
protected Texture(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 3)) //2017.3 and up
|
||||
{
|
||||
var m_ForcedFallbackFormat = reader.ReadInt32();
|
||||
var m_DownscaleFallback = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,8 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class Texture2D
|
||||
public sealed class Texture2D : Texture
|
||||
{
|
||||
public AssetPreloadData preloadData;
|
||||
|
||||
public string m_Name;
|
||||
public int m_Width;
|
||||
public int m_Height;
|
||||
public int m_CompleteImageSize;
|
||||
@@ -37,20 +34,8 @@ namespace AssetStudio
|
||||
public uint size;
|
||||
public string path;
|
||||
|
||||
public Texture2D(AssetPreloadData preloadData, bool readSwitch)
|
||||
public Texture2D(AssetPreloadData preloadData, bool readData) : base(preloadData)
|
||||
{
|
||||
this.preloadData = preloadData;
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
var version = sourceFile.version;
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 3))//2017.3 and up
|
||||
{
|
||||
var m_ForcedFallbackFormat = reader.ReadInt32();
|
||||
var m_DownscaleFallback = reader.ReadBoolean();
|
||||
reader.AlignStream(4);
|
||||
}
|
||||
m_Width = reader.ReadInt32();
|
||||
m_Height = reader.ReadInt32();
|
||||
m_CompleteImageSize = reader.ReadInt32();
|
||||
@@ -116,7 +101,7 @@ namespace AssetStudio
|
||||
path = reader.ReadAlignedString();
|
||||
}
|
||||
|
||||
if (readSwitch)
|
||||
if (readData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
@@ -127,29 +112,6 @@ namespace AssetStudio
|
||||
image_data = reader.ReadBytes(image_data_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
preloadData.InfoText = $"Width: {m_Width}\nHeight: {m_Height}\nFormat: {m_TextureFormat}";
|
||||
|
||||
switch (m_FilterMode)
|
||||
{
|
||||
case 0: preloadData.InfoText += "\nFilter Mode: Point "; break;
|
||||
case 1: preloadData.InfoText += "\nFilter Mode: Bilinear "; break;
|
||||
case 2: preloadData.InfoText += "\nFilter Mode: Trilinear "; break;
|
||||
}
|
||||
|
||||
preloadData.InfoText += $"\nAnisotropic level: {m_Aniso}\nMip map bias: {m_MipBias}";
|
||||
|
||||
switch (m_WrapMode)
|
||||
{
|
||||
case 0: preloadData.InfoText += "\nWrap mode: Repeat"; break;
|
||||
case 1: preloadData.InfoText += "\nWrap mode: Clamp"; break;
|
||||
}
|
||||
|
||||
preloadData.Text = m_Name;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
preloadData.fullSize = preloadData.Size + (int)size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,28 +6,16 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class Transform
|
||||
public class Transform : Component
|
||||
{
|
||||
public PPtr m_GameObject;
|
||||
public float[] m_LocalRotation;
|
||||
public float[] m_LocalPosition;
|
||||
public float[] m_LocalScale;
|
||||
public List<PPtr> m_Children;
|
||||
public PPtr m_Father;
|
||||
|
||||
public Transform(Vector3 t, Quaternion q, Vector3 s)
|
||||
public Transform(AssetPreloadData preloadData) : base(preloadData)
|
||||
{
|
||||
m_LocalPosition = new[] { t.X, t.Y, t.Z };
|
||||
m_LocalRotation = new[] { q.X, q.Y, q.Z, q.W };
|
||||
m_LocalScale = new[] { s.X, s.Y, s.Z };
|
||||
}
|
||||
|
||||
public Transform(AssetPreloadData preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_GameObject = sourceFile.ReadPPtr();
|
||||
m_LocalRotation = new[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
|
||||
m_LocalPosition = new[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
|
||||
m_LocalScale = new[] { reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() };
|
||||
|
||||
@@ -6,18 +6,14 @@ using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class VideoClip
|
||||
public sealed class VideoClip : NamedObject
|
||||
{
|
||||
public string m_Name;
|
||||
public byte[] m_VideoData;
|
||||
public string m_OriginalPath;
|
||||
|
||||
public VideoClip(AssetPreloadData preloadData, bool readSwitch)
|
||||
public VideoClip(AssetPreloadData preloadData, bool readData) : base(preloadData)
|
||||
{
|
||||
var sourceFile = preloadData.sourceFile;
|
||||
var reader = preloadData.InitReader();
|
||||
|
||||
m_Name = reader.ReadAlignedString();
|
||||
var m_OriginalPath = reader.ReadAlignedString();
|
||||
m_OriginalPath = reader.ReadAlignedString();
|
||||
var m_ProxyWidth = reader.ReadUInt32();
|
||||
var m_ProxyHeight = reader.ReadUInt32();
|
||||
var Width = reader.ReadUInt32();
|
||||
@@ -49,7 +45,7 @@ namespace AssetStudio
|
||||
var m_Size = reader.ReadUInt64();
|
||||
var m_HasSplitAlpha = reader.ReadBoolean();
|
||||
|
||||
if (readSwitch)
|
||||
if (readData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(m_Source))
|
||||
{
|
||||
@@ -61,12 +57,6 @@ namespace AssetStudio
|
||||
m_VideoData = reader.ReadBytes((int)m_Size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
preloadData.extension = Path.GetExtension(m_OriginalPath);
|
||||
preloadData.Text = m_Name;
|
||||
preloadData.fullSize = preloadData.Size + (int)m_Size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user