From b4b362902c8482b50c55bdc1c3bd648821e84596 Mon Sep 17 00:00:00 2001 From: nesquack Date: Thu, 27 Jan 2022 22:42:38 -0600 Subject: [PATCH] bug fixes from various reports --- .../Extra/AssetsManager/AssetsFileInstance.cs | 6 ++++++ .../Standard/AssetTypeClass/AssetTypeValueField.cs | 2 ++ AssetsView/Winforms/GameObjectViewer.cs | 11 +++++++++-- AssetsView/Winforms/TextureViewer.cs | 8 ++++++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/AssetTools.NET/Extra/AssetsManager/AssetsFileInstance.cs b/AssetTools.NET/Extra/AssetsManager/AssetsFileInstance.cs index 6b93880..65626bb 100644 --- a/AssetTools.NET/Extra/AssetsManager/AssetsFileInstance.cs +++ b/AssetTools.NET/Extra/AssetsManager/AssetsFileInstance.cs @@ -47,6 +47,12 @@ public AssetsFileInstance GetDependency(AssetsManager am, int depIdx) if (dependencies[depIdx] == null) { string depPath = file.dependencies.dependencies[depIdx].assetPath; + + if (depPath == string.Empty) + { + return null; + } + int instIndex = am.files.FindIndex(f => Path.GetFileName(f.path).ToLower() == Path.GetFileName(depPath).ToLower()); if (instIndex == -1) { diff --git a/AssetTools.NET/Standard/AssetTypeClass/AssetTypeValueField.cs b/AssetTools.NET/Standard/AssetTypeClass/AssetTypeValueField.cs index 5508347..5c5c8fc 100644 --- a/AssetTools.NET/Standard/AssetTypeClass/AssetTypeValueField.cs +++ b/AssetTools.NET/Standard/AssetTypeClass/AssetTypeValueField.cs @@ -100,6 +100,8 @@ public static EnumValueTypes GetValueTypeByTypeName(string type) return EnumValueTypes.Double; case "bool": return EnumValueTypes.Bool; + case "typelessdata": + return EnumValueTypes.ByteArray; default: return EnumValueTypes.None; } diff --git a/AssetsView/Winforms/GameObjectViewer.cs b/AssetsView/Winforms/GameObjectViewer.cs index 0650936..3a8f59b 100644 --- a/AssetsView/Winforms/GameObjectViewer.cs +++ b/AssetsView/Winforms/GameObjectViewer.cs @@ -214,8 +214,7 @@ private void PopulateDataGrid(AssetTypeValueField atvf, PGProperty node, AssetFi node.Add(prop); PopulateDataGrid(atvfc, prop, info, category); } - else if (evt == EnumValueTypes.Array || - evt == EnumValueTypes.ByteArray) + else if (evt == EnumValueTypes.Array) { PGProperty childProps = new PGProperty("child", null, $"[size: {atvfc.childrenCount}]"); PGProperty prop = new PGProperty(key, childProps, $"[size: {atvfc.childrenCount}]"); @@ -224,6 +223,14 @@ private void PopulateDataGrid(AssetTypeValueField atvf, PGProperty node, AssetFi node.Add(prop); PopulateDataGrid(atvfc, childProps, info, category, true); } + else if (evt == EnumValueTypes.ByteArray) + { + PGProperty childProps = new PGProperty("child", null, $"[bytes size: {atvfc.GetValue().AsByteArray().size}]"); + PGProperty prop = new PGProperty(key, childProps, $"[bytes size: {atvfc.GetValue().AsByteArray().size}]"); + prop.category = category; + SetSelectedStateIfSelected(info, prop); + node.Add(prop); + } } } else diff --git a/AssetsView/Winforms/TextureViewer.cs b/AssetsView/Winforms/TextureViewer.cs index 5496a51..c7ec1e6 100644 --- a/AssetsView/Winforms/TextureViewer.cs +++ b/AssetsView/Winforms/TextureViewer.cs @@ -32,9 +32,13 @@ public TextureViewer(AssetsFileInstance inst, AssetTypeValueField baseField) //bundle resS TextureFile.StreamingInfo streamInfo = tf.m_StreamData; - if (streamInfo.path != null && streamInfo.path.StartsWith("archive:/") && inst.parentBundle != null) + if (streamInfo.path != null && inst.parentBundle != null) { - string searchPath = streamInfo.path.Substring(9); + string searchPath = streamInfo.path; + + if (streamInfo.path.StartsWith("archive:/")) + searchPath = searchPath.Substring(9); + searchPath = Path.GetFileName(searchPath); AssetBundleFile bundle = inst.parentBundle.file;