improved
This commit is contained in:
parent
250856598b
commit
767e4d0bf6
|
@ -162,7 +162,14 @@
|
|||
<Compile Include="Classes\AnimatorController.cs" />
|
||||
<Compile Include="Classes\AnimatorOverrideController.cs" />
|
||||
<Compile Include="Classes\Avatar.cs" />
|
||||
<Compile Include="Classes\Behaviour.cs" />
|
||||
<Compile Include="Classes\Component.cs" />
|
||||
<Compile Include="Classes\EditorExtension.cs" />
|
||||
<Compile Include="Classes\MonoScript.cs" />
|
||||
<Compile Include="Classes\NamedObject.cs" />
|
||||
<Compile Include="Classes\Object.cs" />
|
||||
<Compile Include="Classes\Renderer.cs" />
|
||||
<Compile Include="Classes\Texture.cs" />
|
||||
<Compile Include="OpenFolderDialog.cs" />
|
||||
<Compile Include="Classes\AssetBundle.cs" />
|
||||
<Compile Include="Classes\MovieTexture.cs" />
|
||||
|
@ -172,6 +179,7 @@
|
|||
<Compile Include="StudioClasses\AssetPreloadData.cs" />
|
||||
<Compile Include="Classes\AudioClip.cs" />
|
||||
<Compile Include="Classes\BuildSettings.cs" />
|
||||
<Compile Include="StudioClasses\AudioClipConverter.cs" />
|
||||
<Compile Include="StudioClasses\BinaryReaderExtensions.cs" />
|
||||
<Compile Include="StudioClasses\BinaryWriterExtensions.cs" />
|
||||
<Compile Include="StudioClasses\BundleFile.cs" />
|
||||
|
@ -180,14 +188,10 @@
|
|||
<Compile Include="StudioClasses\ClassStructHelper.cs" />
|
||||
<Compile Include="StudioClasses\FBXExporter.cs" />
|
||||
<Compile Include="StudioClasses\BuildTarget.cs" />
|
||||
<Compile Include="StudioClasses\GameObjectTreeNode.cs" />
|
||||
<Compile Include="StudioClasses\ModelConverter.cs" />
|
||||
<Compile Include="StudioClasses\ResourcesHelper.cs" />
|
||||
<Compile Include="StudioClasses\SevenZipHelper.cs" />
|
||||
<Compile Include="StudioClasses\ShaderResource.Designer.cs">
|
||||
<DependentUpon>ShaderResource.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="StudioClasses\SpriteHelper.cs" />
|
||||
<Compile Include="StudioClasses\EndianBinaryReader.cs" />
|
||||
<Compile Include="StudioClasses\Exporter.cs" />
|
||||
|
@ -246,10 +250,6 @@
|
|||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="StudioClasses\ShaderResource.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>ShaderResource.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
|
|
|
@ -150,7 +150,16 @@
|
|||
<Compile Include="Brotli\Transform.cs" />
|
||||
<Compile Include="Brotli\Utils.cs" />
|
||||
<Compile Include="Brotli\WordTransformType.cs" />
|
||||
<Compile Include="Classes\Behaviour.cs" />
|
||||
<Compile Include="Classes\Component.cs" />
|
||||
<Compile Include="Classes\EditorExtension.cs" />
|
||||
<Compile Include="Classes\MonoScript.cs" />
|
||||
<Compile Include="Classes\NamedObject.cs" />
|
||||
<Compile Include="Classes\Object.cs" />
|
||||
<Compile Include="Classes\Renderer.cs" />
|
||||
<Compile Include="Classes\Texture.cs" />
|
||||
<Compile Include="StudioClasses\AudioClipConverter.cs" />
|
||||
<Compile Include="StudioClasses\GameObjectTreeNode.cs" />
|
||||
<Compile Include="StudioClasses\SevenZipHelper.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
@ -168,11 +177,6 @@
|
|||
<Compile Include="StudioClasses\ClassMember.cs" />
|
||||
<Compile Include="StudioClasses\ClassStructHelper.cs" />
|
||||
<Compile Include="StudioClasses\ResourcesHelper.cs" />
|
||||
<Compile Include="StudioClasses\ShaderResource.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>ShaderResource.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Classes\AssetBundle.cs" />
|
||||
<Compile Include="Classes\MovieTexture.cs" />
|
||||
<Compile Include="Classes\Sprite.cs" />
|
||||
|
@ -244,10 +248,6 @@
|
|||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="StudioClasses\ShaderResource.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>ShaderResource.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="AssetStudioForm.resx">
|
||||
<DependentUpon>AssetStudioForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace AssetStudio
|
|||
|
||||
//tree search
|
||||
private int nextGObject;
|
||||
private List<GameObject> treeSrcResults = new List<GameObject>();
|
||||
private List<GameObjectTreeNode> treeSrcResults = new List<GameObjectTreeNode>();
|
||||
|
||||
[DllImport("gdi32.dll")]
|
||||
private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts);
|
||||
|
@ -172,8 +172,7 @@ namespace AssetStudio
|
|||
return;
|
||||
}
|
||||
|
||||
BuildAssetStructures(!dontLoadAssetsMenuItem.Checked, displayAll.Checked, !dontBuildHierarchyMenuItem.Checked, buildClassStructuresMenuItem.Checked,
|
||||
displayOriginalName.Checked, out var fileNodes);
|
||||
BuildAssetStructures(!dontLoadAssetsMenuItem.Checked, displayAll.Checked, !dontBuildHierarchyMenuItem.Checked, buildClassStructuresMenuItem.Checked, displayOriginalName.Checked);
|
||||
|
||||
BeginInvoke(new Action(() =>
|
||||
{
|
||||
|
@ -194,7 +193,7 @@ namespace AssetStudio
|
|||
if (!dontBuildHierarchyMenuItem.Checked)
|
||||
{
|
||||
sceneTreeView.BeginUpdate();
|
||||
sceneTreeView.Nodes.AddRange(fileNodes.ToArray());
|
||||
sceneTreeView.Nodes.AddRange(treeNodeCollection.ToArray());
|
||||
foreach (TreeNode node in sceneTreeView.Nodes)
|
||||
{
|
||||
node.HideCheckBox();
|
||||
|
@ -491,14 +490,11 @@ namespace AssetStudio
|
|||
{
|
||||
if (treeSrcResults.Count == 0)
|
||||
{
|
||||
foreach (var aFile in assetsfileList)
|
||||
foreach (var node in treeNodeDictionary.Values)
|
||||
{
|
||||
foreach (var gObject in aFile.GameObjectList.Values)
|
||||
if (node.Text.IndexOf(treeSearch.Text, StringComparison.CurrentCultureIgnoreCase) >= 0)
|
||||
{
|
||||
if (gObject.Text.IndexOf(treeSearch.Text, StringComparison.CurrentCultureIgnoreCase) >= 0)
|
||||
{
|
||||
treeSrcResults.Add(gObject);
|
||||
}
|
||||
treeSrcResults.Add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -517,7 +513,7 @@ namespace AssetStudio
|
|||
|
||||
private void sceneTreeView_AfterCheck(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
foreach (GameObject childNode in e.Node.Nodes)
|
||||
foreach (TreeNode childNode in e.Node.Nodes)
|
||||
{
|
||||
childNode.Checked = e.Node.Checked;
|
||||
}
|
||||
|
@ -661,8 +657,25 @@ namespace AssetStudio
|
|||
case ClassIDReference.Texture2D:
|
||||
{
|
||||
imageTexture?.Dispose();
|
||||
var m_Texture2D = new Texture2DConverter(new Texture2D(asset, true));
|
||||
imageTexture = m_Texture2D.ConvertToBitmap(true);
|
||||
var m_Texture2D = new Texture2D(asset, true);
|
||||
|
||||
//Info
|
||||
asset.InfoText = $"Width: {m_Texture2D.m_Width}\nHeight: {m_Texture2D.m_Height}\nFormat: {m_Texture2D.m_TextureFormat}";
|
||||
switch (m_Texture2D.m_FilterMode)
|
||||
{
|
||||
case 0: asset.InfoText += "\nFilter Mode: Point "; break;
|
||||
case 1: asset.InfoText += "\nFilter Mode: Bilinear "; break;
|
||||
case 2: asset.InfoText += "\nFilter Mode: Trilinear "; break;
|
||||
}
|
||||
asset.InfoText += $"\nAnisotropic level: {m_Texture2D.m_Aniso}\nMip map bias: {m_Texture2D.m_MipBias}";
|
||||
switch (m_Texture2D.m_WrapMode)
|
||||
{
|
||||
case 0: asset.InfoText += "\nWrap mode: Repeat"; break;
|
||||
case 1: asset.InfoText += "\nWrap mode: Clamp"; break;
|
||||
}
|
||||
|
||||
var converter = new Texture2DConverter(m_Texture2D);
|
||||
imageTexture = converter.ConvertToBitmap(true);
|
||||
if (imageTexture != null)
|
||||
{
|
||||
previewPanel.BackgroundImage = imageTexture;
|
||||
|
@ -679,7 +692,95 @@ namespace AssetStudio
|
|||
}
|
||||
case ClassIDReference.AudioClip:
|
||||
{
|
||||
AudioClip m_AudioClip = new AudioClip(asset, true);
|
||||
var m_AudioClip = new AudioClip(asset, true);
|
||||
|
||||
//Info
|
||||
asset.InfoText = "Compression format: ";
|
||||
if (m_AudioClip.version[0] < 5)
|
||||
{
|
||||
switch (m_AudioClip.m_Type)
|
||||
{
|
||||
case AudioType.ACC:
|
||||
asset.InfoText += "Acc";
|
||||
break;
|
||||
case AudioType.AIFF:
|
||||
asset.InfoText += "AIFF";
|
||||
break;
|
||||
case AudioType.IT:
|
||||
asset.InfoText += "Impulse tracker";
|
||||
break;
|
||||
case AudioType.MOD:
|
||||
asset.InfoText += "Protracker / Fasttracker MOD";
|
||||
break;
|
||||
case AudioType.MPEG:
|
||||
asset.InfoText += "MP2/MP3 MPEG";
|
||||
break;
|
||||
case AudioType.OGGVORBIS:
|
||||
asset.InfoText += "Ogg vorbis";
|
||||
break;
|
||||
case AudioType.S3M:
|
||||
asset.InfoText += "ScreamTracker 3";
|
||||
break;
|
||||
case AudioType.WAV:
|
||||
asset.InfoText += "Microsoft WAV";
|
||||
break;
|
||||
case AudioType.XM:
|
||||
asset.InfoText += "FastTracker 2 XM";
|
||||
break;
|
||||
case AudioType.XMA:
|
||||
asset.InfoText += "Xbox360 XMA";
|
||||
break;
|
||||
case AudioType.VAG:
|
||||
asset.InfoText += "PlayStation Portable ADPCM";
|
||||
break;
|
||||
case AudioType.AUDIOQUEUE:
|
||||
asset.InfoText += "iPhone";
|
||||
break;
|
||||
default:
|
||||
asset.InfoText += "Unknown";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_AudioClip.m_CompressionFormat)
|
||||
{
|
||||
case AudioCompressionFormat.PCM:
|
||||
asset.InfoText += "PCM";
|
||||
break;
|
||||
case AudioCompressionFormat.Vorbis:
|
||||
asset.InfoText += "Vorbis";
|
||||
break;
|
||||
case AudioCompressionFormat.ADPCM:
|
||||
asset.InfoText += "ADPCM";
|
||||
break;
|
||||
case AudioCompressionFormat.MP3:
|
||||
asset.InfoText += "MP3";
|
||||
break;
|
||||
case AudioCompressionFormat.VAG:
|
||||
asset.InfoText += "PlayStation Portable ADPCM";
|
||||
break;
|
||||
case AudioCompressionFormat.HEVAG:
|
||||
asset.InfoText += "PSVita ADPCM";
|
||||
break;
|
||||
case AudioCompressionFormat.XMA:
|
||||
asset.InfoText += "Xbox360 XMA";
|
||||
break;
|
||||
case AudioCompressionFormat.AAC:
|
||||
asset.InfoText += "AAC";
|
||||
break;
|
||||
case AudioCompressionFormat.GCADPCM:
|
||||
asset.InfoText += "Nintendo 3DS/Wii DSP";
|
||||
break;
|
||||
case AudioCompressionFormat.ATRAC9:
|
||||
asset.InfoText += "PSVita ATRAC9";
|
||||
break;
|
||||
default:
|
||||
asset.InfoText += "Unknown";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_AudioClip.m_AudioData == null)
|
||||
break;
|
||||
FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
|
||||
|
@ -713,7 +814,7 @@ namespace AssetStudio
|
|||
}
|
||||
case ClassIDReference.Shader:
|
||||
{
|
||||
Shader m_TextAsset = new Shader(asset, true);
|
||||
Shader m_TextAsset = new Shader(asset);
|
||||
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 = m_Script_Text.Replace("\0", "\\0");
|
||||
|
@ -723,7 +824,7 @@ namespace AssetStudio
|
|||
}
|
||||
case ClassIDReference.TextAsset:
|
||||
{
|
||||
TextAsset m_TextAsset = new TextAsset(asset, true);
|
||||
TextAsset m_TextAsset = new TextAsset(asset);
|
||||
|
||||
string m_Script_Text = Encoding.UTF8.GetString(m_TextAsset.m_Script);
|
||||
m_Script_Text = Regex.Replace(m_Script_Text, "(?<!\r)\n", "\r\n");
|
||||
|
@ -737,7 +838,7 @@ namespace AssetStudio
|
|||
var m_MonoBehaviour = new MonoBehaviour(asset);
|
||||
if (asset.Type1 != asset.Type2 && asset.sourceFile.ClassStructures.ContainsKey(asset.Type1))
|
||||
{
|
||||
textPreviewBox.Text = asset.GetClassString();
|
||||
textPreviewBox.Text = asset.Dump();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -749,7 +850,7 @@ namespace AssetStudio
|
|||
}
|
||||
case ClassIDReference.Font:
|
||||
{
|
||||
UFont m_Font = new UFont(asset, true);
|
||||
Font m_Font = new Font(asset);
|
||||
if (m_Font.m_FontData != null)
|
||||
{
|
||||
IntPtr data = Marshal.AllocCoTaskMem(m_Font.m_FontData.Length);
|
||||
|
@ -768,28 +869,28 @@ namespace AssetStudio
|
|||
{
|
||||
fontPreviewBox.SelectionStart = 0;
|
||||
fontPreviewBox.SelectionLength = 80;
|
||||
fontPreviewBox.SelectionFont = new Font(pfc.Families[0], 16, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionFont = new System.Drawing.Font(pfc.Families[0], 16, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionStart = 81;
|
||||
fontPreviewBox.SelectionLength = 56;
|
||||
fontPreviewBox.SelectionFont = new Font(pfc.Families[0], 12, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionFont = new System.Drawing.Font(pfc.Families[0], 12, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionStart = 138;
|
||||
fontPreviewBox.SelectionLength = 56;
|
||||
fontPreviewBox.SelectionFont = new Font(pfc.Families[0], 18, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionFont = new System.Drawing.Font(pfc.Families[0], 18, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionStart = 195;
|
||||
fontPreviewBox.SelectionLength = 56;
|
||||
fontPreviewBox.SelectionFont = new Font(pfc.Families[0], 24, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionFont = new System.Drawing.Font(pfc.Families[0], 24, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionStart = 252;
|
||||
fontPreviewBox.SelectionLength = 56;
|
||||
fontPreviewBox.SelectionFont = new Font(pfc.Families[0], 36, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionFont = new System.Drawing.Font(pfc.Families[0], 36, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionStart = 309;
|
||||
fontPreviewBox.SelectionLength = 56;
|
||||
fontPreviewBox.SelectionFont = new Font(pfc.Families[0], 48, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionFont = new System.Drawing.Font(pfc.Families[0], 48, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionStart = 366;
|
||||
fontPreviewBox.SelectionLength = 56;
|
||||
fontPreviewBox.SelectionFont = new Font(pfc.Families[0], 60, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionFont = new System.Drawing.Font(pfc.Families[0], 60, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionStart = 423;
|
||||
fontPreviewBox.SelectionLength = 55;
|
||||
fontPreviewBox.SelectionFont = new Font(pfc.Families[0], 72, FontStyle.Regular);
|
||||
fontPreviewBox.SelectionFont = new System.Drawing.Font(pfc.Families[0], 72, FontStyle.Regular);
|
||||
fontPreviewBox.Visible = true;
|
||||
}
|
||||
}
|
||||
|
@ -801,7 +902,7 @@ namespace AssetStudio
|
|||
}
|
||||
case ClassIDReference.Mesh:
|
||||
{
|
||||
var m_Mesh = new Mesh(asset, true);
|
||||
var m_Mesh = new Mesh(asset);
|
||||
if (m_Mesh.m_VertexCount > 0)
|
||||
{
|
||||
viewMatrixData = Matrix4.CreateRotationY(-(float)Math.PI / 4) * Matrix4.CreateRotationX(-(float)Math.PI / 6);
|
||||
|
@ -954,9 +1055,10 @@ namespace AssetStudio
|
|||
case ClassIDReference.Sprite:
|
||||
{
|
||||
imageTexture?.Dispose();
|
||||
imageTexture = SpriteHelper.GetImageFromSprite(asset);
|
||||
imageTexture = SpriteHelper.GetImageFromSprite(new Sprite(asset));
|
||||
if (imageTexture != null)
|
||||
{
|
||||
asset.InfoText = $"Width: {imageTexture.Width}\nHeight: {imageTexture.Height}\n";
|
||||
previewPanel.BackgroundImage = imageTexture;
|
||||
if (imageTexture.Width > previewPanel.Width || imageTexture.Height > previewPanel.Height)
|
||||
previewPanel.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
|
@ -981,7 +1083,7 @@ namespace AssetStudio
|
|||
}
|
||||
default:
|
||||
{
|
||||
var str = asset.GetClassString();
|
||||
var str = asset.Dump();
|
||||
if (str != null)
|
||||
{
|
||||
textPreviewBox.Text = str;
|
||||
|
@ -1292,14 +1394,11 @@ namespace AssetStudio
|
|||
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var gameObjects = new List<GameObject>();
|
||||
foreach (var assetsFile in assetsfileList)
|
||||
foreach (var node in treeNodeDictionary.Values)
|
||||
{
|
||||
foreach (var m_GameObject in assetsFile.GameObjectList.Values)
|
||||
if (node.Checked || exportAll)
|
||||
{
|
||||
if (m_GameObject.Checked || exportAll)
|
||||
{
|
||||
gameObjects.Add(m_GameObject);
|
||||
}
|
||||
gameObjects.Add(node.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1841,7 +1940,7 @@ namespace AssetStudio
|
|||
var selectasset = (AssetPreloadData)assetListView.Items[assetListView.SelectedIndices[0]];
|
||||
if (selectasset.gameObject != null)
|
||||
{
|
||||
sceneTreeView.SelectedNode = selectasset.gameObject;
|
||||
sceneTreeView.SelectedNode = treeNodeDictionary[selectasset.gameObject];
|
||||
tabControl1.SelectedTab = tabPage1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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] ?
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.10.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.10.0.0")]
|
||||
[assembly: AssemblyVersion("0.11.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.11.0.0")]
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace AssetStudio
|
|||
public string TypeString;
|
||||
public int fullSize;
|
||||
public string InfoText;
|
||||
public string extension;
|
||||
|
||||
public AssetsFile sourceFile;
|
||||
public GameObject gameObject;
|
||||
|
@ -31,7 +30,7 @@ namespace AssetStudio
|
|||
return reader;
|
||||
}
|
||||
|
||||
public string GetClassString()
|
||||
public string Dump()
|
||||
{
|
||||
var reader = InitReader();
|
||||
if (sourceFile.ClassStructures.TryGetValue(Type1, out var classStructure))
|
||||
|
|
|
@ -0,0 +1,177 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class AudioClipConverter
|
||||
{
|
||||
private AudioClip m_AudioClip;
|
||||
|
||||
public AudioClipConverter(AudioClip audioClip)
|
||||
{
|
||||
m_AudioClip = audioClip;
|
||||
}
|
||||
|
||||
public byte[] ConvertToWav()
|
||||
{
|
||||
var exinfo = new FMOD.CREATESOUNDEXINFO();
|
||||
var result = FMOD.Factory.System_Create(out var system);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return null;
|
||||
result = system.init(1, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return null;
|
||||
exinfo.cbsize = Marshal.SizeOf(exinfo);
|
||||
exinfo.length = (uint)m_AudioClip.m_Size;
|
||||
result = system.createSound(m_AudioClip.m_AudioData, FMOD.MODE.OPENMEMORY, ref exinfo, out var sound);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return null;
|
||||
result = sound.getSubSound(0, out var subsound);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return null;
|
||||
result = subsound.getFormat(out var type, out var format, out int NumChannels, out int BitsPerSample);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return null;
|
||||
result = subsound.getDefaults(out var frequency, out int priority);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return null;
|
||||
var SampleRate = (int)frequency;
|
||||
result = subsound.getLength(out var length, FMOD.TIMEUNIT.PCMBYTES);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return null;
|
||||
result = subsound.@lock(0, length, out var ptr1, out var ptr2, out var len1, out var len2);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return null;
|
||||
byte[] buffer = new byte[len1 + 44];
|
||||
//添加wav头
|
||||
Encoding.UTF8.GetBytes("RIFF").CopyTo(buffer, 0);
|
||||
BitConverter.GetBytes(len1 + 36).CopyTo(buffer, 4);
|
||||
Encoding.UTF8.GetBytes("WAVEfmt ").CopyTo(buffer, 8);
|
||||
BitConverter.GetBytes(16).CopyTo(buffer, 16);
|
||||
BitConverter.GetBytes((short)1).CopyTo(buffer, 20);
|
||||
BitConverter.GetBytes((short)NumChannels).CopyTo(buffer, 22);
|
||||
BitConverter.GetBytes(SampleRate).CopyTo(buffer, 24);
|
||||
BitConverter.GetBytes(SampleRate * NumChannels * BitsPerSample / 8).CopyTo(buffer, 28);
|
||||
BitConverter.GetBytes((short)(NumChannels * BitsPerSample / 8)).CopyTo(buffer, 32);
|
||||
BitConverter.GetBytes((short)BitsPerSample).CopyTo(buffer, 34);
|
||||
Encoding.UTF8.GetBytes("data").CopyTo(buffer, 36);
|
||||
BitConverter.GetBytes(len1).CopyTo(buffer, 40);
|
||||
Marshal.Copy(ptr1, buffer, 44, (int)len1);
|
||||
result = subsound.unlock(ptr1, ptr2, len1, len2);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return null;
|
||||
subsound.release();
|
||||
sound.release();
|
||||
system.release();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public string GetExtensionName()
|
||||
{
|
||||
if (m_AudioClip.sourceFile.version[0] < 5)
|
||||
{
|
||||
switch (m_AudioClip.m_Type)
|
||||
{
|
||||
case AudioType.ACC:
|
||||
return ".m4a";
|
||||
case AudioType.AIFF:
|
||||
return ".aif";
|
||||
case AudioType.IT:
|
||||
return ".it";
|
||||
case AudioType.MOD:
|
||||
return ".mod";
|
||||
case AudioType.MPEG:
|
||||
return ".mp3";
|
||||
case AudioType.OGGVORBIS:
|
||||
return ".ogg";
|
||||
case AudioType.S3M:
|
||||
return ".s3m";
|
||||
case AudioType.WAV:
|
||||
return ".wav";
|
||||
case AudioType.XM:
|
||||
return ".xm";
|
||||
case AudioType.XMA:
|
||||
return ".wav";
|
||||
case AudioType.VAG:
|
||||
return ".vag";
|
||||
case AudioType.AUDIOQUEUE:
|
||||
return ".fsb";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (m_AudioClip.m_CompressionFormat)
|
||||
{
|
||||
case AudioCompressionFormat.PCM:
|
||||
return ".fsb";
|
||||
case AudioCompressionFormat.Vorbis:
|
||||
return ".fsb";
|
||||
case AudioCompressionFormat.ADPCM:
|
||||
return ".fsb";
|
||||
case AudioCompressionFormat.MP3:
|
||||
return ".fsb";
|
||||
case AudioCompressionFormat.VAG:
|
||||
return ".vag";
|
||||
case AudioCompressionFormat.HEVAG:
|
||||
return ".vag";
|
||||
case AudioCompressionFormat.XMA:
|
||||
return ".wav";
|
||||
case AudioCompressionFormat.AAC:
|
||||
return ".m4a";
|
||||
case AudioCompressionFormat.GCADPCM:
|
||||
return ".fsb";
|
||||
case AudioCompressionFormat.ATRAC9:
|
||||
return ".at9";
|
||||
}
|
||||
}
|
||||
|
||||
return ".AudioClip";
|
||||
}
|
||||
|
||||
public bool IsFMODSupport
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_AudioClip.sourceFile.version[0] < 5)
|
||||
{
|
||||
switch (m_AudioClip.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_AudioClip.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,14 +12,16 @@ namespace AssetStudio
|
|||
{
|
||||
public static bool ExportTexture2D(AssetPreloadData asset, string exportPathName, bool flip)
|
||||
{
|
||||
var texture2D = new Texture2D(asset, true);
|
||||
if (texture2D.image_data == null || texture2D.image_data.Length == 0)
|
||||
var m_Texture2D = new Texture2D(asset, true);
|
||||
if (m_Texture2D.image_data == null || m_Texture2D.image_data.Length == 0)
|
||||
return false;
|
||||
var m_Texture2D = new Texture2DConverter(texture2D);
|
||||
var convert = (bool)Properties.Settings.Default["convertTexture"];
|
||||
var bitmap = m_Texture2D.ConvertToBitmap(flip);
|
||||
if (convert && bitmap != null)
|
||||
var converter = new Texture2DConverter(m_Texture2D);
|
||||
var convertTexture = (bool)Properties.Settings.Default["convertTexture"];
|
||||
if (convertTexture)
|
||||
{
|
||||
var bitmap = converter.ConvertToBitmap(flip);
|
||||
if (bitmap == null)
|
||||
return false;
|
||||
ImageFormat format = null;
|
||||
var ext = (string)Properties.Settings.Default["convertType"];
|
||||
switch (ext)
|
||||
|
@ -43,10 +45,10 @@ namespace AssetStudio
|
|||
}
|
||||
else
|
||||
{
|
||||
var exportFullName = exportPathName + asset.Text + m_Texture2D.GetExtensionName();
|
||||
var exportFullName = exportPathName + asset.Text + converter.GetExtensionName();
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
File.WriteAllBytes(exportFullName, m_Texture2D.ConvertToContainer());
|
||||
File.WriteAllBytes(exportFullName, converter.ConvertToContainer());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -57,65 +59,20 @@ namespace AssetStudio
|
|||
if (m_AudioClip.m_AudioData == null)
|
||||
return false;
|
||||
var convertAudio = (bool)Properties.Settings.Default["convertAudio"];
|
||||
if (convertAudio && m_AudioClip.IsFMODSupport)
|
||||
var converter = new AudioClipConverter(m_AudioClip);
|
||||
if (convertAudio && converter.IsFMODSupport)
|
||||
{
|
||||
var exportFullName = exportPath + asset.Text + ".wav";
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
FMOD.CREATESOUNDEXINFO exinfo = new FMOD.CREATESOUNDEXINFO();
|
||||
var result = FMOD.Factory.System_Create(out var system);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
var buffer = converter.ConvertToWav();
|
||||
if (buffer == null)
|
||||
return false;
|
||||
result = system.init(1, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return false;
|
||||
exinfo.cbsize = Marshal.SizeOf(exinfo);
|
||||
exinfo.length = (uint)m_AudioClip.m_Size;
|
||||
result = system.createSound(m_AudioClip.m_AudioData, FMOD.MODE.OPENMEMORY, ref exinfo, out var sound);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return false;
|
||||
result = sound.getSubSound(0, out var subsound);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return false;
|
||||
result = subsound.getFormat(out var type, out var format, out int NumChannels, out int BitsPerSample);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return false;
|
||||
result = subsound.getDefaults(out var frequency, out int priority);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return false;
|
||||
var SampleRate = (int)frequency;
|
||||
result = subsound.getLength(out var length, FMOD.TIMEUNIT.PCMBYTES);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return false;
|
||||
result = subsound.@lock(0, length, out var ptr1, out var ptr2, out var len1, out var len2);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return false;
|
||||
byte[] buffer = new byte[len1 + 44];
|
||||
//添加wav头
|
||||
Encoding.UTF8.GetBytes("RIFF").CopyTo(buffer, 0);
|
||||
BitConverter.GetBytes(len1 + 36).CopyTo(buffer, 4);
|
||||
Encoding.UTF8.GetBytes("WAVEfmt ").CopyTo(buffer, 8);
|
||||
BitConverter.GetBytes(16).CopyTo(buffer, 16);
|
||||
BitConverter.GetBytes((short)1).CopyTo(buffer, 20);
|
||||
BitConverter.GetBytes((short)NumChannels).CopyTo(buffer, 22);
|
||||
BitConverter.GetBytes(SampleRate).CopyTo(buffer, 24);
|
||||
BitConverter.GetBytes(SampleRate * NumChannels * BitsPerSample / 8).CopyTo(buffer, 28);
|
||||
BitConverter.GetBytes((short)(NumChannels * BitsPerSample / 8)).CopyTo(buffer, 32);
|
||||
BitConverter.GetBytes((short)BitsPerSample).CopyTo(buffer, 34);
|
||||
Encoding.UTF8.GetBytes("data").CopyTo(buffer, 36);
|
||||
BitConverter.GetBytes(len1).CopyTo(buffer, 40);
|
||||
Marshal.Copy(ptr1, buffer, 44, (int)len1);
|
||||
File.WriteAllBytes(exportFullName, buffer);
|
||||
result = subsound.unlock(ptr1, ptr2, len1, len2);
|
||||
if (result != FMOD.RESULT.OK)
|
||||
return false;
|
||||
subsound.release();
|
||||
sound.release();
|
||||
system.release();
|
||||
}
|
||||
else
|
||||
{
|
||||
var exportFullName = exportPath + asset.Text + asset.extension;
|
||||
var exportFullName = exportPath + asset.Text + converter.GetExtensionName();
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
File.WriteAllBytes(exportFullName, m_AudioClip.m_AudioData);
|
||||
|
@ -125,8 +82,8 @@ namespace AssetStudio
|
|||
|
||||
public static bool ExportShader(AssetPreloadData asset, string exportPath)
|
||||
{
|
||||
var m_Shader = new Shader(asset, true);
|
||||
var exportFullName = exportPath + asset.Text + asset.extension;
|
||||
var m_Shader = new Shader(asset);
|
||||
var exportFullName = exportPath + asset.Text + ".shader";
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
File.WriteAllBytes(exportFullName, m_Shader.m_Script);
|
||||
|
@ -135,8 +92,8 @@ namespace AssetStudio
|
|||
|
||||
public static bool ExportTextAsset(AssetPreloadData asset, string exportPath)
|
||||
{
|
||||
var m_TextAsset = new TextAsset(asset, true);
|
||||
var exportFullName = exportPath + asset.Text + asset.extension;
|
||||
var m_TextAsset = new TextAsset(asset);
|
||||
var exportFullName = exportPath + asset.Text + ".txt";
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
File.WriteAllBytes(exportFullName, m_TextAsset.m_Script);
|
||||
|
@ -152,7 +109,7 @@ namespace AssetStudio
|
|||
string str;
|
||||
if (asset.Type1 != asset.Type2 && asset.sourceFile.ClassStructures.ContainsKey(asset.Type1))
|
||||
{
|
||||
str = asset.GetClassString();
|
||||
str = asset.Dump();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -164,10 +121,15 @@ namespace AssetStudio
|
|||
|
||||
public static bool ExportFont(AssetPreloadData asset, string exportPath)
|
||||
{
|
||||
var m_Font = new UFont(asset, true);
|
||||
var m_Font = new Font(asset);
|
||||
if (m_Font.m_FontData != null)
|
||||
{
|
||||
var exportFullName = exportPath + asset.Text + asset.extension;
|
||||
string extension = ".ttf";
|
||||
if (m_Font.m_FontData[0] == 79 && m_Font.m_FontData[1] == 84 && m_Font.m_FontData[2] == 84 && m_Font.m_FontData[3] == 79)
|
||||
{
|
||||
extension = ".otf";
|
||||
}
|
||||
var exportFullName = exportPath + asset.Text + extension;
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
File.WriteAllBytes(exportFullName, m_Font.m_FontData);
|
||||
|
@ -178,10 +140,10 @@ namespace AssetStudio
|
|||
|
||||
public static bool ExportMesh(AssetPreloadData asset, string exportPath)
|
||||
{
|
||||
var m_Mesh = new Mesh(asset, true);
|
||||
var m_Mesh = new Mesh(asset);
|
||||
if (m_Mesh.m_VertexCount <= 0)
|
||||
return false;
|
||||
var exportFullName = exportPath + asset.Text + asset.extension;
|
||||
var exportFullName = exportPath + asset.Text + ".obj";
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
var sb = new StringBuilder();
|
||||
|
@ -262,7 +224,7 @@ namespace AssetStudio
|
|||
var m_VideoClip = new VideoClip(asset, true);
|
||||
if (m_VideoClip.m_VideoData != null)
|
||||
{
|
||||
var exportFullName = exportPath + asset.Text + asset.extension;
|
||||
var exportFullName = exportPath + asset.Text + Path.GetExtension(m_VideoClip.m_OriginalPath);
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
File.WriteAllBytes(exportFullName, m_VideoClip.m_VideoData);
|
||||
|
@ -273,8 +235,8 @@ namespace AssetStudio
|
|||
|
||||
public static bool ExportMovieTexture(AssetPreloadData asset, string exportPath)
|
||||
{
|
||||
var m_MovieTexture = new MovieTexture(asset, true);
|
||||
var exportFullName = exportPath + asset.Text + asset.extension;
|
||||
var m_MovieTexture = new MovieTexture(asset);
|
||||
var exportFullName = exportPath + asset.Text + ".ogv";
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
File.WriteAllBytes(exportFullName, m_MovieTexture.m_MovieData);
|
||||
|
@ -300,7 +262,7 @@ namespace AssetStudio
|
|||
var exportFullName = exportPath + asset.Text + "." + type.ToLower();
|
||||
if (ExportFileExists(exportFullName))
|
||||
return false;
|
||||
var bitmap = SpriteHelper.GetImageFromSprite(asset);
|
||||
var bitmap = SpriteHelper.GetImageFromSprite(new Sprite(asset));
|
||||
if (bitmap != null)
|
||||
{
|
||||
bitmap.Save(exportFullName, format);
|
||||
|
@ -340,7 +302,7 @@ namespace AssetStudio
|
|||
public static bool ExportGameObject(GameObject gameObject, string exportPath, List<AssetPreloadData> animationList = null)
|
||||
{
|
||||
var convert = animationList != null ? new ModelConverter(gameObject, animationList) : new ModelConverter(gameObject);
|
||||
exportPath = exportPath + Studio.FixFileName(gameObject.Text) + ".fbx";
|
||||
exportPath = exportPath + Studio.FixFileName(gameObject.m_Name) + ".fbx";
|
||||
return ModelConverter(convert, exportPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace AssetStudio
|
|||
//write connections here and Mesh objects separately without having to backtrack through their MEshFilter to het the GameObject ID
|
||||
//also note that MeshFilters are not unique, they cannot be used for instancing geometry
|
||||
cb2.AppendFormat("\n\n\t;Geometry::, Model::{0}", m_GameObject.m_Name);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",3{0},1{1}", MeshPD.uniqueID, m_GameObject.uniqueID);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",3{0},1{1}", MeshPD.uniqueID, m_GameObject.preloadData.uniqueID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ namespace AssetStudio
|
|||
{
|
||||
Materials.Add(MaterialPD);
|
||||
cb2.AppendFormat("\n\n\t;Material::, Model::{0}", m_GameObject.m_Name);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",6{0},1{1}", MaterialPD.uniqueID, m_GameObject.uniqueID);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",6{0},1{1}", MaterialPD.uniqueID, m_GameObject.preloadData.uniqueID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ namespace AssetStudio
|
|||
{
|
||||
Materials.Add(MaterialPD);
|
||||
cb2.AppendFormat("\n\n\t;Material::, Model::{0}", m_GameObject.m_Name);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",6{0},1{1}", MaterialPD.uniqueID, m_GameObject.uniqueID);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",6{0},1{1}", MaterialPD.uniqueID, m_GameObject.preloadData.uniqueID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,11 @@ namespace AssetStudio
|
|||
{
|
||||
LimbNodes.Add(m_Bone);
|
||||
//also collect the root bone
|
||||
if (m_Bone.Parent.Level > 0) { LimbNodes.Add((GameObject)m_Bone.Parent); }
|
||||
var parent = (GameObjectTreeNode)treeNodeDictionary[m_Bone].Parent;
|
||||
if (parent.Level > 0)
|
||||
{
|
||||
LimbNodes.Add(parent.gameObject);
|
||||
}
|
||||
//should I collect siblings?
|
||||
}
|
||||
|
||||
|
@ -396,28 +400,28 @@ namespace AssetStudio
|
|||
{
|
||||
if ((bool)Properties.Settings.Default["exportDeformers"] && (bool)Properties.Settings.Default["convertDummies"] && LimbNodes.Contains(m_GameObject))
|
||||
{
|
||||
ob.AppendFormat("\n\tNodeAttribute: 2{0}, \"NodeAttribute::\", \"LimbNode\" {{", m_GameObject.uniqueID);
|
||||
ob.AppendFormat("\n\tNodeAttribute: 2{0}, \"NodeAttribute::\", \"LimbNode\" {{", m_GameObject.preloadData.uniqueID);
|
||||
ob.Append("\n\t\tTypeFlags: \"Skeleton\"");
|
||||
ob.Append("\n\t}");
|
||||
|
||||
ob.AppendFormat("\n\tModel: 1{0}, \"Model::{1}\", \"LimbNode\" {{", m_GameObject.uniqueID, m_GameObject.m_Name);
|
||||
ob.AppendFormat("\n\tModel: 1{0}, \"Model::{1}\", \"LimbNode\" {{", m_GameObject.preloadData.uniqueID, m_GameObject.m_Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
ob.AppendFormat("\n\tNodeAttribute: 2{0}, \"NodeAttribute::\", \"Null\" {{", m_GameObject.uniqueID);
|
||||
ob.AppendFormat("\n\tNodeAttribute: 2{0}, \"NodeAttribute::\", \"Null\" {{", m_GameObject.preloadData.uniqueID);
|
||||
ob.Append("\n\t\tTypeFlags: \"Null\"");
|
||||
ob.Append("\n\t}");
|
||||
|
||||
ob.AppendFormat("\n\tModel: 1{0}, \"Model::{1}\", \"Null\" {{", m_GameObject.uniqueID, m_GameObject.m_Name);
|
||||
ob.AppendFormat("\n\tModel: 1{0}, \"Model::{1}\", \"Null\" {{", m_GameObject.preloadData.uniqueID, m_GameObject.m_Name);
|
||||
}
|
||||
|
||||
//connect NodeAttribute to Model
|
||||
cb.AppendFormat("\n\n\t;NodeAttribute::, Model::{0}", m_GameObject.m_Name);
|
||||
cb.AppendFormat("\n\tC: \"OO\",2{0},1{0}", m_GameObject.uniqueID);
|
||||
cb.AppendFormat("\n\tC: \"OO\",2{0},1{0}", m_GameObject.preloadData.uniqueID);
|
||||
}
|
||||
else
|
||||
{
|
||||
ob.AppendFormat("\n\tModel: 1{0}, \"Model::{1}\", \"Mesh\" {{", m_GameObject.uniqueID, m_GameObject.m_Name);
|
||||
ob.AppendFormat("\n\tModel: 1{0}, \"Model::{1}\", \"Mesh\" {{", m_GameObject.preloadData.uniqueID, m_GameObject.m_Name);
|
||||
}
|
||||
|
||||
ob.Append("\n\t\tVersion: 232");
|
||||
|
@ -442,16 +446,16 @@ namespace AssetStudio
|
|||
ob.Append("\n\t\tCulling: \"CullingOff\"\n\t}");
|
||||
|
||||
//connect Model to parent
|
||||
GameObject parentObject = (GameObject)m_GameObject.Parent;
|
||||
var parentObject = ((GameObjectTreeNode)treeNodeDictionary[m_GameObject].Parent).gameObject;
|
||||
if (GameObjects.Contains(parentObject))
|
||||
{
|
||||
cb.AppendFormat("\n\n\t;Model::{0}, Model::{1}", m_GameObject.m_Name, parentObject.m_Name);
|
||||
cb.AppendFormat("\n\tC: \"OO\",1{0},1{1}", m_GameObject.uniqueID, parentObject.uniqueID);
|
||||
cb.AppendFormat("\n\tC: \"OO\",1{0},1{1}", m_GameObject.preloadData.uniqueID, parentObject.preloadData.uniqueID);
|
||||
}
|
||||
else
|
||||
{
|
||||
cb.AppendFormat("\n\n\t;Model::{0}, Model::RootNode", m_GameObject.m_Name);
|
||||
cb.AppendFormat("\n\tC: \"OO\",1{0},0", m_GameObject.uniqueID);
|
||||
cb.AppendFormat("\n\tC: \"OO\",1{0},0", m_GameObject.preloadData.uniqueID);
|
||||
}
|
||||
|
||||
|
||||
|
@ -461,7 +465,7 @@ namespace AssetStudio
|
|||
#region write non-skinnned Geometry
|
||||
foreach (var MeshPD in Meshes)
|
||||
{
|
||||
Mesh m_Mesh = new Mesh(MeshPD, true);
|
||||
Mesh m_Mesh = new Mesh(MeshPD);
|
||||
MeshFBX(m_Mesh, MeshPD.uniqueID, ob);
|
||||
|
||||
//write data 8MB at a time
|
||||
|
@ -489,7 +493,7 @@ namespace AssetStudio
|
|||
//find a way to test if a mesh instance was loaded previously and if it uses the same skeleton, then create instance or copy
|
||||
var keepID = MeshPD.uniqueID;
|
||||
MeshPD.uniqueID = SkinnedMeshPD.uniqueID;
|
||||
Mesh m_Mesh = new Mesh(MeshPD, true);
|
||||
Mesh m_Mesh = new Mesh(MeshPD);
|
||||
MeshFBX(m_Mesh, MeshPD.uniqueID, ob);
|
||||
|
||||
//write data 8MB at a time
|
||||
|
@ -497,13 +501,13 @@ namespace AssetStudio
|
|||
{ FBXwriter.Write(ob); ob.Clear(); }
|
||||
|
||||
cb2.AppendFormat("\n\n\t;Geometry::, Model::{0}", m_GameObject.m_Name);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",3{0},1{1}", MeshPD.uniqueID, m_GameObject.uniqueID);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",3{0},1{1}", MeshPD.uniqueID, m_GameObject.preloadData.uniqueID);
|
||||
|
||||
if ((bool)Properties.Settings.Default["exportDeformers"])
|
||||
{
|
||||
//add BindPose node
|
||||
pb.Append("\n\t\tPoseNode: {");
|
||||
pb.AppendFormat("\n\t\t\tNode: 1{0}", m_GameObject.uniqueID);
|
||||
pb.AppendFormat("\n\t\t\tNode: 1{0}", m_GameObject.preloadData.uniqueID);
|
||||
//pb.Append("\n\t\t\tMatrix: *16 {");
|
||||
//pb.Append("\n\t\t\t\ta: ");
|
||||
//pb.Append("\n\t\t\t} ");
|
||||
|
@ -516,7 +520,7 @@ namespace AssetStudio
|
|||
|
||||
//connect Model to DisplayLayer
|
||||
cb2.AppendFormat("\n\n\t;Model::{0}, DisplayLayer::", m_GameObject.m_Name);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",1{0},5{1}", m_GameObject.uniqueID, SkinnedMeshPD.uniqueID);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",1{0},5{1}", m_GameObject.preloadData.uniqueID, SkinnedMeshPD.uniqueID);
|
||||
|
||||
//write Deformers
|
||||
if (m_Mesh.m_Skin.Length > 0 && m_Mesh.m_BindPose.Length >= m_SkinnedMeshRenderer.m_Bones.Length)
|
||||
|
@ -616,7 +620,7 @@ namespace AssetStudio
|
|||
|
||||
//connect dummy Model to SubDeformer
|
||||
cb2.AppendFormat("\n\n\t;Model::{0}, SubDeformer::", m_Bone.m_Name);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",1{0},4{1}{2}", m_Bone.uniqueID, b, SkinnedMeshPD.uniqueID);
|
||||
cb2.AppendFormat("\n\tC: \"OO\",1{0},4{1}{2}", m_Bone.preloadData.uniqueID, b, SkinnedMeshPD.uniqueID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -633,7 +637,7 @@ namespace AssetStudio
|
|||
{
|
||||
//add BindPose node
|
||||
pb.Append("\n\t\tPoseNode: {");
|
||||
pb.AppendFormat("\n\t\t\tNode: 1{0}", m_Bone.uniqueID);
|
||||
pb.AppendFormat("\n\t\t\tNode: 1{0}", m_Bone.preloadData.uniqueID);
|
||||
//pb.Append("\n\t\t\tMatrix: *16 {");
|
||||
//pb.Append("\n\t\t\t\ta: ");
|
||||
//pb.Append("\n\t\t\t} ");
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class GameObjectTreeNode : TreeNode
|
||||
{
|
||||
public GameObject gameObject;
|
||||
|
||||
public GameObjectTreeNode(GameObject gameObject)
|
||||
{
|
||||
if (gameObject != null)
|
||||
{
|
||||
this.gameObject = gameObject;
|
||||
Text = gameObject.m_Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -86,7 +86,7 @@ namespace AssetStudio
|
|||
var frameList = new List<ImportedFrame>();
|
||||
while (assetsfileList.TryGetTransform(rootTransform.m_Father, out var m_Father))
|
||||
{
|
||||
frameList.Add(ConvertFrames(m_Father));
|
||||
frameList.Add(ConvertFrame(m_Father));
|
||||
rootTransform = m_Father;
|
||||
}
|
||||
if (frameList.Count > 0)
|
||||
|
@ -192,7 +192,7 @@ namespace AssetStudio
|
|||
}
|
||||
}
|
||||
|
||||
private ImportedFrame ConvertFrames(Transform trans)
|
||||
private ImportedFrame ConvertFrame(Transform trans)
|
||||
{
|
||||
var frame = new ImportedFrame();
|
||||
assetsfileList.TryGetGameObject(trans.m_GameObject, out var m_GameObject);
|
||||
|
@ -205,21 +205,24 @@ namespace AssetStudio
|
|||
return frame;
|
||||
}
|
||||
|
||||
private ImportedFrame ConvertFrame(Transform trans, string name)
|
||||
private ImportedFrame ConvertFrame(Vector3 t, Quaternion q, Vector3 s, string name)
|
||||
{
|
||||
var frame = new ImportedFrame();
|
||||
frame.Name = name;
|
||||
frame.InitChildren(0);
|
||||
var m_EulerRotation = QuatToEuler(new[] { trans.m_LocalRotation[0], -trans.m_LocalRotation[1], -trans.m_LocalRotation[2], trans.m_LocalRotation[3] });
|
||||
var m_LocalPosition = new[] { t.X, t.Y, t.Z };
|
||||
var m_LocalRotation = new[] { q.X, q.Y, q.Z, q.W };
|
||||
var m_LocalScale = new[] { s.X, s.Y, s.Z };
|
||||
var m_EulerRotation = QuatToEuler(new[] { m_LocalRotation[0], -m_LocalRotation[1], -m_LocalRotation[2], m_LocalRotation[3] });
|
||||
frame.LocalRotation = new[] { m_EulerRotation[0], m_EulerRotation[1], m_EulerRotation[2] };
|
||||
frame.LocalScale = new[] { trans.m_LocalScale[0], trans.m_LocalScale[1], trans.m_LocalScale[2] };
|
||||
frame.LocalPosition = new[] { -trans.m_LocalPosition[0], trans.m_LocalPosition[1], trans.m_LocalPosition[2] };
|
||||
frame.LocalScale = new[] { m_LocalScale[0], m_LocalScale[1], m_LocalScale[2] };
|
||||
frame.LocalPosition = new[] { -m_LocalPosition[0], m_LocalPosition[1], m_LocalPosition[2] };
|
||||
return frame;
|
||||
}
|
||||
|
||||
private void ConvertFrames(Transform trans, ImportedFrame parent)
|
||||
{
|
||||
var frame = ConvertFrames(trans);
|
||||
var frame = ConvertFrame(trans);
|
||||
if (parent == null)
|
||||
{
|
||||
FrameList.Add(frame);
|
||||
|
@ -235,7 +238,7 @@ namespace AssetStudio
|
|||
}
|
||||
}
|
||||
|
||||
private void ConvertMeshRenderer(MeshRenderer meshR)
|
||||
private void ConvertMeshRenderer(Renderer meshR)
|
||||
{
|
||||
var mesh = GetMesh(meshR);
|
||||
if (mesh == null)
|
||||
|
@ -558,13 +561,13 @@ namespace AssetStudio
|
|||
MeshList.Add(iMesh);
|
||||
}
|
||||
|
||||
private Mesh GetMesh(MeshRenderer meshR)
|
||||
private Mesh GetMesh(Renderer meshR)
|
||||
{
|
||||
if (meshR is SkinnedMeshRenderer sMesh)
|
||||
{
|
||||
if (assetsfileList.TryGetPD(sMesh.m_Mesh, out var MeshPD))
|
||||
{
|
||||
return new Mesh(MeshPD, true);
|
||||
return new Mesh(MeshPD);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -579,7 +582,7 @@ namespace AssetStudio
|
|||
var m_MeshFilter = new MeshFilter(assetPreloadData);
|
||||
if (assetsfileList.TryGetPD(m_MeshFilter.m_Mesh, out var MeshPD))
|
||||
{
|
||||
return new Mesh(MeshPD, true);
|
||||
return new Mesh(MeshPD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1075,8 +1078,7 @@ namespace AssetStudio
|
|||
var v4 = (Vector4)xform.s;
|
||||
s = (Vector3)v4;
|
||||
}
|
||||
var curTransform = new Transform(t, xform.q, s);
|
||||
var frame = ConvertFrame(curTransform, transformName);
|
||||
var frame = ConvertFrame(t, xform.q, s, transformName);
|
||||
parentFrame.AddChild(frame);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AssetStudio {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class ShaderResource {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal ShaderResource() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AssetStudio.StudioClasses.ShaderResource", typeof(ShaderResource).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用此强类型资源类,为所有资源查找
|
||||
/// 重写当前线程的 CurrentUICulture 属性。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 [{"Level":0,"Type":"string","Name":"m_Name","Size":-1,"Flag":32769},{"Level":1,"Type":"Array","Name":"Array","Size":-1,"Flag":16385},{"Level":2,"Type":"int","Name":"size","Size":4,"Flag":1},{"Level":2,"Type":"char","Name":"data","Size":1,"Flag":1},{"Level":0,"Type":"SerializedShader","Name":"m_ParsedForm","Size":-1,"Flag":32768},{"Level":1,"Type":"SerializedProperties","Name":"m_PropInfo","Size":-1,"Flag":32768},{"Level":2,"Type":"vector","Name":"m_Props","Size":-1,"Flag":32768},{"Level":3,"Type":"Arr... 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string Shader20171 {
|
||||
get {
|
||||
return ResourceManager.GetString("Shader20171", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 [{"Level":0,"Type":"string","Name":"m_Name","Size":-1,"Flag":32769},{"Level":1,"Type":"Array","Name":"Array","Size":-1,"Flag":16385},{"Level":2,"Type":"int","Name":"size","Size":4,"Flag":1},{"Level":2,"Type":"char","Name":"data","Size":1,"Flag":1},{"Level":0,"Type":"SerializedShader","Name":"m_ParsedForm","Size":-1,"Flag":32768},{"Level":1,"Type":"SerializedProperties","Name":"m_PropInfo","Size":-1,"Flag":32768},{"Level":2,"Type":"vector","Name":"m_Props","Size":-1,"Flag":32768},{"Level":3,"Type":"Arr... 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string Shader20172 {
|
||||
get {
|
||||
return ResourceManager.GetString("Shader20172", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 [{"Level":0,"Type":"string","Name":"m_Name","Size":-1,"Flag":32769},{"Level":1,"Type":"Array","Name":"Array","Size":-1,"Flag":16385},{"Level":2,"Type":"int","Name":"size","Size":4,"Flag":1},{"Level":2,"Type":"char","Name":"data","Size":1,"Flag":1},{"Level":0,"Type":"SerializedShader","Name":"m_ParsedForm","Size":-1,"Flag":32768},{"Level":1,"Type":"SerializedProperties","Name":"m_PropInfo","Size":-1,"Flag":32768},{"Level":2,"Type":"vector","Name":"m_Props","Size":-1,"Flag":32768},{"Level":3,"Type":"Arr... 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string Shader20173 {
|
||||
get {
|
||||
return ResourceManager.GetString("Shader20173", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 [{"Level":0,"Type":"string","Name":"m_Name","Size":-1,"Flag":32769},{"Level":1,"Type":"Array","Name":"Array","Size":-1,"Flag":16385},{"Level":2,"Type":"int","Name":"size","Size":4,"Flag":1},{"Level":2,"Type":"char","Name":"data","Size":1,"Flag":1},{"Level":0,"Type":"SerializedShader","Name":"m_ParsedForm","Size":-1,"Flag":32768},{"Level":1,"Type":"SerializedProperties","Name":"m_PropInfo","Size":-1,"Flag":32768},{"Level":2,"Type":"vector","Name":"m_Props","Size":-1,"Flag":32768},{"Level":3,"Type":"Arr... 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string Shader55 {
|
||||
get {
|
||||
return ResourceManager.GetString("Shader55", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 [{"Level":0,"Type":"string","Name":"m_Name","Size":-1,"Flag":32769},{"Level":1,"Type":"Array","Name":"Array","Size":-1,"Flag":16385},{"Level":2,"Type":"int","Name":"size","Size":4,"Flag":1},{"Level":2,"Type":"char","Name":"data","Size":1,"Flag":1},{"Level":0,"Type":"SerializedShader","Name":"m_ParsedForm","Size":-1,"Flag":32768},{"Level":1,"Type":"SerializedProperties","Name":"m_PropInfo","Size":-1,"Flag":32768},{"Level":2,"Type":"vector","Name":"m_Props","Size":-1,"Flag":32768},{"Level":3,"Type":"Arr... 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string Shader56 {
|
||||
get {
|
||||
return ResourceManager.GetString("Shader56", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -11,9 +11,8 @@ namespace AssetStudio
|
|||
{
|
||||
static class SpriteHelper
|
||||
{
|
||||
public static Bitmap GetImageFromSprite(AssetPreloadData asset)
|
||||
public static Bitmap GetImageFromSprite(Sprite m_Sprite)
|
||||
{
|
||||
var m_Sprite = new Sprite(asset, true);
|
||||
if (assetsfileList.TryGetPD(m_Sprite.m_SpriteAtlas, out var assetPreloadData))
|
||||
{
|
||||
var m_SpriteAtlas = new SpriteAtlas(assetPreloadData);
|
||||
|
@ -21,7 +20,6 @@ namespace AssetStudio
|
|||
|
||||
if (index >= 0 && assetsfileList.TryGetPD(m_SpriteAtlas.textures[index], out assetPreloadData))
|
||||
{
|
||||
SpriteInfo(asset, assetPreloadData, m_SpriteAtlas.textureRects[index]);
|
||||
try
|
||||
{
|
||||
if (m_Sprite.m_PhysicsShape.Length > 0)
|
||||
|
@ -40,7 +38,6 @@ namespace AssetStudio
|
|||
{
|
||||
if (assetsfileList.TryGetPD(m_Sprite.texture, out assetPreloadData))
|
||||
{
|
||||
SpriteInfo(asset, assetPreloadData, m_Sprite.textureRect);
|
||||
return CutImage(assetPreloadData, m_Sprite.textureRect);
|
||||
}
|
||||
}
|
||||
|
@ -48,14 +45,6 @@ namespace AssetStudio
|
|||
return null;
|
||||
}
|
||||
|
||||
private static void SpriteInfo(AssetPreloadData asset, AssetPreloadData texture2DAsset, RectangleF textureRect)
|
||||
{
|
||||
var info = texture2DAsset.InfoText;
|
||||
var start = info.IndexOf("Format");
|
||||
info = info.Substring(start, info.Length - start);
|
||||
asset.InfoText = $"Width: {textureRect.Width}\nHeight: {textureRect.Height}\n" + info;
|
||||
}
|
||||
|
||||
private static Bitmap CutImage(AssetPreloadData texture2DAsset, RectangleF textureRect)
|
||||
{
|
||||
var texture2D = new Texture2DConverter(new Texture2D(texture2DAsset, true));
|
||||
|
|
|
@ -25,6 +25,8 @@ namespace AssetStudio
|
|||
public static string productName = "";
|
||||
public static bool moduleLoaded;
|
||||
public static Dictionary<string, ModuleDef> LoadedModuleDic = new Dictionary<string, ModuleDef>();
|
||||
public static List<GameObjectTreeNode> treeNodeCollection = new List<GameObjectTreeNode>();
|
||||
public static Dictionary<GameObject, GameObjectTreeNode> treeNodeDictionary = new Dictionary<GameObject, GameObjectTreeNode>();
|
||||
|
||||
//UI
|
||||
public static Action<int> SetProgressBarValue;
|
||||
|
@ -153,10 +155,8 @@ namespace AssetStudio
|
|||
return extractedCount;
|
||||
}
|
||||
|
||||
public static void BuildAssetStructures(bool loadAssets, bool displayAll, bool buildHierarchy, bool buildClassStructures, bool displayOriginalName, out List<GameObject> fileNodes)
|
||||
public static void BuildAssetStructures(bool loadAssets, bool displayAll, bool buildHierarchy, bool buildClassStructures, bool displayOriginalName)
|
||||
{
|
||||
fileNodes = null;
|
||||
|
||||
#region first loop - read asset data & create list
|
||||
if (loadAssets)
|
||||
{
|
||||
|
@ -180,43 +180,52 @@ namespace AssetStudio
|
|||
{
|
||||
case ClassIDReference.GameObject:
|
||||
{
|
||||
GameObject m_GameObject = new GameObject(asset);
|
||||
var m_GameObject = new GameObject(asset);
|
||||
asset.Text = m_GameObject.m_Name;
|
||||
assetsFile.GameObjectList.Add(asset.m_PathID, m_GameObject);
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.Transform:
|
||||
{
|
||||
Transform m_Transform = new Transform(asset);
|
||||
var m_Transform = new Transform(asset);
|
||||
assetsFile.TransformList.Add(asset.m_PathID, m_Transform);
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.RectTransform:
|
||||
{
|
||||
RectTransform m_Rect = new RectTransform(asset);
|
||||
assetsFile.TransformList.Add(asset.m_PathID, m_Rect.m_Transform);
|
||||
var m_Rect = new RectTransform(asset);
|
||||
assetsFile.TransformList.Add(asset.m_PathID, m_Rect);
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.Texture2D:
|
||||
{
|
||||
Texture2D m_Texture2D = new Texture2D(asset, false);
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.Mesh:
|
||||
case ClassIDReference.Shader:
|
||||
{
|
||||
Shader m_Shader = new Shader(asset, false);
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.TextAsset:
|
||||
case ClassIDReference.AnimationClip:
|
||||
case ClassIDReference.AudioClip:
|
||||
case ClassIDReference.Font:
|
||||
case ClassIDReference.MovieTexture:
|
||||
case ClassIDReference.Sprite:
|
||||
case ClassIDReference.VideoClip:
|
||||
{
|
||||
TextAsset m_TextAsset = new TextAsset(asset, false);
|
||||
var obj = new NamedObject(asset);
|
||||
asset.Text = obj.m_Name;
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.AudioClip:
|
||||
case ClassIDReference.Avatar:
|
||||
case ClassIDReference.AnimatorController:
|
||||
case ClassIDReference.AnimatorOverrideController:
|
||||
case ClassIDReference.Material:
|
||||
case ClassIDReference.MonoScript:
|
||||
case ClassIDReference.SpriteAtlas:
|
||||
{
|
||||
var obj = new NamedObject(asset);
|
||||
asset.Text = obj.m_Name;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.Animator:
|
||||
{
|
||||
AudioClip m_AudioClip = new AudioClip(asset, false);
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
|
@ -235,58 +244,16 @@ namespace AssetStudio
|
|||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.Font:
|
||||
{
|
||||
UFont m_Font = new UFont(asset, false);
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.PlayerSettings:
|
||||
{
|
||||
var plSet = new PlayerSettings(asset);
|
||||
productName = plSet.productName;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.Mesh:
|
||||
{
|
||||
Mesh m_Mesh = new Mesh(asset, false);
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.AssetBundle:
|
||||
{
|
||||
ab = new AssetBundle(asset);
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.VideoClip:
|
||||
{
|
||||
var m_VideoClip = new VideoClip(asset, false);
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.MovieTexture:
|
||||
{
|
||||
var m_MovieTexture = new MovieTexture(asset, false);
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.Sprite:
|
||||
{
|
||||
var m_Sprite = new Sprite(asset, false);
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.Animator:
|
||||
{
|
||||
exportable = true;
|
||||
break;
|
||||
}
|
||||
case ClassIDReference.AnimationClip:
|
||||
{
|
||||
exportable = true;
|
||||
var reader = asset.sourceFile.reader;
|
||||
reader.Position = asset.Offset;
|
||||
asset.Text = reader.ReadAlignedString();
|
||||
asset.Text = ab.m_Name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +302,6 @@ namespace AssetStudio
|
|||
#region second loop - build tree structure
|
||||
if (buildHierarchy)
|
||||
{
|
||||
fileNodes = new List<GameObject>();
|
||||
var gameObjectCount = assetsfileList.Sum(x => x.GameObjectList.Values.Count);
|
||||
if (gameObjectCount > 0)
|
||||
{
|
||||
|
@ -345,9 +311,8 @@ namespace AssetStudio
|
|||
|
||||
foreach (var assetsFile in assetsfileList)
|
||||
{
|
||||
GameObject fileNode = new GameObject(null);
|
||||
fileNode.Text = Path.GetFileName(assetsFile.filePath);
|
||||
fileNode.m_Name = "RootNode";
|
||||
var fileNode = new GameObjectTreeNode(null); //RootNode
|
||||
fileNode.Text = assetsFile.fileName;
|
||||
|
||||
foreach (var m_GameObject in assetsFile.GameObjectList.Values)
|
||||
{
|
||||
|
@ -399,7 +364,7 @@ namespace AssetStudio
|
|||
case ClassIDReference.Animator:
|
||||
{
|
||||
m_GameObject.m_Animator = m_Component;
|
||||
asset.Text = m_GameObject.asset.Text;
|
||||
asset.Text = m_GameObject.preloadData.Text;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -413,19 +378,29 @@ namespace AssetStudio
|
|||
{
|
||||
if (assetsfileList.TryGetTransform(m_Transform.m_Father, out var m_Father))
|
||||
{
|
||||
if (assetsfileList.TryGetGameObject(m_Father.m_GameObject, out parentNode))
|
||||
if (assetsfileList.TryGetGameObject(m_Father.m_GameObject, out var parentGameObject))
|
||||
{
|
||||
if (!treeNodeDictionary.TryGetValue(parentGameObject, out parentNode))
|
||||
{
|
||||
parentNode = new GameObjectTreeNode(parentGameObject);
|
||||
treeNodeDictionary.Add(parentGameObject, parentNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parentNode.Nodes.Add(m_GameObject);
|
||||
if (!treeNodeDictionary.TryGetValue(m_GameObject, out var currentNode))
|
||||
{
|
||||
currentNode = new GameObjectTreeNode(m_GameObject);
|
||||
treeNodeDictionary.Add(m_GameObject, currentNode);
|
||||
}
|
||||
parentNode.Nodes.Add(currentNode);
|
||||
ProgressBarPerformStep();
|
||||
}
|
||||
|
||||
if (fileNode.Nodes.Count > 0)
|
||||
{
|
||||
fileNodes.Add(fileNode);
|
||||
treeNodeCollection.Add(fileNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -608,10 +583,10 @@ namespace AssetStudio
|
|||
{
|
||||
ThreadPool.QueueUserWorkItem(state =>
|
||||
{
|
||||
foreach (TreeNode node in nodes)
|
||||
foreach (GameObjectTreeNode node in nodes)
|
||||
{
|
||||
//遍历一级子节点
|
||||
foreach (TreeNode j in node.Nodes)
|
||||
foreach (GameObjectTreeNode j in node.Nodes)
|
||||
{
|
||||
ProgressBarPerformStep();
|
||||
//收集所有子节点
|
||||
|
@ -643,7 +618,7 @@ namespace AssetStudio
|
|||
{
|
||||
try
|
||||
{
|
||||
ExportGameObject((GameObject)j, targetPath);
|
||||
ExportGameObject(j.gameObject, targetPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -658,10 +633,10 @@ namespace AssetStudio
|
|||
});
|
||||
}
|
||||
|
||||
private static void CollectNode(TreeNode node, List<GameObject> gameObjects)
|
||||
private static void CollectNode(GameObjectTreeNode node, List<GameObject> gameObjects)
|
||||
{
|
||||
gameObjects.Add((GameObject)node);
|
||||
foreach (TreeNode i in node.Nodes)
|
||||
gameObjects.Add(node.gameObject);
|
||||
foreach (GameObjectTreeNode i in node.Nodes)
|
||||
{
|
||||
CollectNode(i, gameObjects);
|
||||
}
|
||||
|
@ -698,11 +673,11 @@ namespace AssetStudio
|
|||
SetProgressBarMaximum(gameObjects.Count);
|
||||
foreach (var gameObject in gameObjects)
|
||||
{
|
||||
StatusStripUpdate($"Exporting {gameObject.Text}");
|
||||
StatusStripUpdate($"Exporting {gameObject.m_Name}");
|
||||
try
|
||||
{
|
||||
ExportGameObject(gameObject, exportPath, animationList);
|
||||
StatusStripUpdate($"Finished exporting {gameObject.Text}");
|
||||
StatusStripUpdate($"Finished exporting {gameObject.m_Name}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -722,11 +697,11 @@ namespace AssetStudio
|
|||
|
||||
private static void GetSelectedParentNode(TreeNodeCollection nodes, List<GameObject> gameObjects)
|
||||
{
|
||||
foreach (TreeNode i in nodes)
|
||||
foreach (GameObjectTreeNode i in nodes)
|
||||
{
|
||||
if (i.Checked)
|
||||
{
|
||||
gameObjects.Add((GameObject)i);
|
||||
gameObjects.Add(i.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ using System.Text;
|
|||
|
||||
namespace AssetStudio
|
||||
{
|
||||
class Texture2DConverter
|
||||
public class Texture2DConverter
|
||||
{
|
||||
//Texture2D
|
||||
private int m_Width;
|
||||
|
@ -94,8 +94,8 @@ namespace AssetStudio
|
|||
m_Height = m_Texture2D.m_Height;
|
||||
m_TextureFormat = m_Texture2D.m_TextureFormat;
|
||||
var mMipMap = m_Texture2D.m_MipMap;
|
||||
version = m_Texture2D.preloadData.sourceFile.version;
|
||||
var platform = m_Texture2D.preloadData.sourceFile.platform;
|
||||
version = m_Texture2D.sourceFile.version;
|
||||
var platform = m_Texture2D.sourceFile.platform;
|
||||
|
||||
if (version[0] < 5 || (version[0] == 5 && version[1] < 2))//5.2 down
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue