Some other fixes

This commit is contained in:
VaDiM
2025-08-27 05:23:50 +03:00
parent 521e2f3bbc
commit ae3b5169df
13 changed files with 204 additions and 196 deletions

View File

@@ -15,7 +15,7 @@ namespace AssetStudio
{ {
public class AssetsManager public class AssetsManager
{ {
public bool LoadingViaTypeTreeEnabled = true; public bool LoadViaTypeTree = true;
public ImportOptions Options = new ImportOptions(); public ImportOptions Options = new ImportOptions();
public readonly List<Action<OptionsFile>> OptionLoaders = new List<Action<OptionsFile>>(); public readonly List<Action<OptionsFile>> OptionLoaders = new List<Action<OptionsFile>>();
public readonly List<SerializedFile> AssetsFileList = new List<SerializedFile>(); public readonly List<SerializedFile> AssetsFileList = new List<SerializedFile>();
@@ -154,6 +154,8 @@ namespace AssetStudio
importFilesHash.Clear(); importFilesHash.Clear();
noexistFiles.Clear(); noexistFiles.Clear();
assetsFileListHash.Clear(); assetsFileListHash.Clear();
if (AssetsFileList.Count == 0)
return;
ReadAssets(); ReadAssets();
ProcessAssets(); ProcessAssets();
@@ -188,6 +190,9 @@ namespace AssetStudio
case FileType.ZipFile: case FileType.ZipFile:
LoadZipFile(reader); LoadZipFile(reader);
break; break;
case FileType.ResourceFile when !fromZip:
reader.Dispose();
break;
} }
return true; return true;
} }
@@ -277,7 +282,7 @@ namespace AssetStudio
catch (NotSupportedException e) catch (NotSupportedException e)
{ {
Logger.Error(e.Message); Logger.Error(e.Message);
resourceFileReaders.TryAdd(reader.FileName, reader); reader.Dispose();
return false; return false;
} }
catch (Exception e) catch (Exception e)
@@ -648,7 +653,7 @@ namespace AssetStudio
obj = new Animation(objectReader); obj = new Animation(objectReader);
break; break;
case ClassIDType.AnimationClip: case ClassIDType.AnimationClip:
obj = objectReader.serializedType?.m_Type != null && LoadingViaTypeTreeEnabled obj = objectReader.serializedType?.m_Type != null && LoadViaTypeTree
? new AnimationClip(objectReader, TypeTreeHelper.ReadTypeByteArray(objectReader.serializedType.m_Type, objectReader), jsonOptions, objectInfo) ? new AnimationClip(objectReader, TypeTreeHelper.ReadTypeByteArray(objectReader.serializedType.m_Type, objectReader), jsonOptions, objectInfo)
: new AnimationClip(objectReader); : new AnimationClip(objectReader);
break; break;
@@ -680,7 +685,7 @@ namespace AssetStudio
obj = new GameObject(objectReader); obj = new GameObject(objectReader);
break; break;
case ClassIDType.Material: case ClassIDType.Material:
obj = objectReader.serializedType?.m_Type != null && LoadingViaTypeTreeEnabled obj = objectReader.serializedType?.m_Type != null && LoadViaTypeTree
? new Material(objectReader, TypeTreeHelper.ReadTypeByteArray(objectReader.serializedType.m_Type, objectReader), jsonOptions) ? new Material(objectReader, TypeTreeHelper.ReadTypeByteArray(objectReader.serializedType.m_Type, objectReader), jsonOptions)
: new Material(objectReader); : new Material(objectReader);
break; break;
@@ -728,12 +733,12 @@ namespace AssetStudio
obj = new TextAsset(objectReader); obj = new TextAsset(objectReader);
break; break;
case ClassIDType.Texture2D: case ClassIDType.Texture2D:
obj = objectReader.serializedType?.m_Type != null && LoadingViaTypeTreeEnabled obj = objectReader.serializedType?.m_Type != null && LoadViaTypeTree
? new Texture2D(objectReader, TypeTreeHelper.ReadTypeByteArray(objectReader.serializedType.m_Type, objectReader), jsonOptions) ? new Texture2D(objectReader, TypeTreeHelper.ReadTypeByteArray(objectReader.serializedType.m_Type, objectReader), jsonOptions)
: new Texture2D(objectReader); : new Texture2D(objectReader);
break; break;
case ClassIDType.Texture2DArray: case ClassIDType.Texture2DArray:
obj = objectReader.serializedType?.m_Type != null && LoadingViaTypeTreeEnabled obj = objectReader.serializedType?.m_Type != null && LoadViaTypeTree
? new Texture2DArray(objectReader, TypeTreeHelper.ReadTypeByteArray(objectReader.serializedType.m_Type, objectReader), jsonOptions) ? new Texture2DArray(objectReader, TypeTreeHelper.ReadTypeByteArray(objectReader.serializedType.m_Type, objectReader), jsonOptions)
: new Texture2DArray(objectReader); : new Texture2DArray(objectReader);
break; break;

View File

@@ -102,7 +102,7 @@ namespace AssetStudio
{ {
if (typeDict != null) if (typeDict != null)
{ {
return JsonSerializer.SerializeToDocument(typeDict); return JsonSerializer.SerializeToDocument(typeDict, jsonOptions);
} }
return JsonSerializer.SerializeToDocument(this, GetType(), jsonOptions); return JsonSerializer.SerializeToDocument(this, GetType(), jsonOptions);
} }

View File

@@ -6,7 +6,6 @@ namespace AssetStudio
{ {
public string Name { get; set; } public string Name { get; set; }
public string Container { get; set; } public string Container { get; set; }
public bool IsRoot { get; set; }
public MonoBehaviour CubismModelMono { get; set; } public MonoBehaviour CubismModelMono { get; set; }
public MonoBehaviour PhysicsController { get; set; } public MonoBehaviour PhysicsController { get; set; }
public MonoBehaviour FadeController { get; set; } public MonoBehaviour FadeController { get; set; }
@@ -21,7 +20,6 @@ namespace AssetStudio
public CubismModel(GameObject m_GameObject) public CubismModel(GameObject m_GameObject)
{ {
Name = m_GameObject.m_Name; Name = m_GameObject.m_Name;
IsRoot = m_GameObject.m_Transform.m_Father.IsNull;
ModelGameObject = m_GameObject; ModelGameObject = m_GameObject;
RenderTextureList = new List<MonoBehaviour>(); RenderTextureList = new List<MonoBehaviour>();
ParamDisplayInfoList = new List<MonoBehaviour>(); ParamDisplayInfoList = new List<MonoBehaviour>();

View File

@@ -27,7 +27,7 @@ namespace AssetStudio
{ {
var stringData = reader.ReadBytes(length); var stringData = reader.ReadBytes(length);
var result = Encoding.UTF8.GetString(stringData); var result = Encoding.UTF8.GetString(stringData);
reader.AlignStream(4); reader.AlignStream();
return result; return result;
} }
return ""; return "";

View File

@@ -302,10 +302,11 @@ namespace AssetStudio
case "TypelessData": case "TypelessData":
{ {
var size = reader.ReadInt32(); var size = reader.ReadInt32();
var offset = size > 0 ? reader.BaseStream.Position : 0;
var dic = new OrderedDictionary var dic = new OrderedDictionary
{ {
{ "Offset", reader.BaseStream.Position }, {"Offset", offset},
{ "Size", size } {"Size", size}
}; };
value = dic; value = dic;
reader.BaseStream.Position += size; reader.BaseStream.Position += size;

View File

@@ -107,19 +107,18 @@ namespace AssetStudioCLI
{ {
var m_TextAsset = (TextAsset)item.Asset; var m_TextAsset = (TextAsset)item.Asset;
var extension = ".txt"; var extension = ".txt";
var assetExtension = Path.GetExtension(m_TextAsset.m_Name);
if (!CLIOptions.f_notRestoreExtensionName.Value) if (!CLIOptions.f_notRestoreExtensionName.Value)
{ {
if (!string.IsNullOrEmpty(assetExtension)) if (Path.HasExtension(m_TextAsset.m_Name))
{ {
extension = ""; extension = "";
} }
else if (!string.IsNullOrEmpty(item.Container)) else
{ {
var ext = Path.GetExtension(item.Container); var extFromContainer = Path.GetExtension(item.Container);
if (!string.IsNullOrEmpty(item.Container)) if (!string.IsNullOrEmpty(extFromContainer))
{ {
extension = ext; extension = extFromContainer;
} }
} }
} }

View File

@@ -94,7 +94,7 @@ namespace AssetStudioCLI.Options
public static Option<FilenameFormat> o_filenameFormat; public static Option<FilenameFormat> o_filenameFormat;
public static Option<string> o_outputFolder; public static Option<string> o_outputFolder;
public static Option<bool> f_overwriteExisting; public static Option<bool> f_overwriteExisting;
public static Option<bool> o_displayHelp; public static Option<bool> f_displayHelp;
//logger //logger
public static Option<LoggerEvent> o_logLevel; public static Option<LoggerEvent> o_logLevel;
public static Option<LogOutputMode> o_logOutput; public static Option<LogOutputMode> o_logOutput;
@@ -264,13 +264,14 @@ namespace AssetStudioCLI.Options
optionHelpGroup: HelpGroups.General, optionHelpGroup: HelpGroups.General,
isFlag: true isFlag: true
); );
o_displayHelp = new GroupedOption<bool> f_displayHelp = new GroupedOption<bool>
( (
optionDefaultValue: false, optionDefaultValue: false,
optionName: "-h, --help", optionName: "-h, --help",
optionDescription: "Display help and exit", optionDescription: "Display help and exit",
optionExample: "", optionExample: "",
optionHelpGroup: HelpGroups.General optionHelpGroup: HelpGroups.General,
isFlag: true
); );
#endregion #endregion
@@ -533,7 +534,7 @@ namespace AssetStudioCLI.Options
( (
optionDefaultValue: false, optionDefaultValue: false,
optionName: "--decompress-to-disk", optionName: "--decompress-to-disk",
optionDescription: "(Flag) If not specified, only bundles larger than 2GB will be decompressed to disk\ninstead of memory\n", optionDescription: "(Flag) If not specified, only bundles larger than 2GB will be decompressed to disk\ninstead of RAM\n",
optionExample: "", optionExample: "",
optionHelpGroup: HelpGroups.Advanced, optionHelpGroup: HelpGroups.Advanced,
isFlag: true isFlag: true
@@ -577,7 +578,7 @@ namespace AssetStudioCLI.Options
if (args.Length == 0 || args.Any(x => x.ToLower() == "-h" || x.ToLower() == "--help" || x.ToLower() == "-?")) if (args.Length == 0 || args.Any(x => x.ToLower() == "-h" || x.ToLower() == "--help" || x.ToLower() == "-?"))
{ {
o_displayHelp.Value = true; f_displayHelp.Value = true;
return; return;
} }
@@ -1030,6 +1031,7 @@ namespace AssetStudioCLI.Options
case "monobehaviour": case "monobehaviour":
o_l2dMotionMode.Value = CubismLive2DExtractor.Live2DMotionMode.MonoBehaviour; o_l2dMotionMode.Value = CubismLive2DExtractor.Live2DMotionMode.MonoBehaviour;
break; break;
case "clip":
case "animationclip": case "animationclip":
case "animationclipv2": case "animationclipv2":
o_l2dMotionMode.Value = CubismLive2DExtractor.Live2DMotionMode.AnimationClipV2; o_l2dMotionMode.Value = CubismLive2DExtractor.Live2DMotionMode.AnimationClipV2;

View File

@@ -13,7 +13,7 @@ namespace AssetStudioCLI
{ {
CLIRun(); CLIRun();
} }
else if (CLIOptions.o_displayHelp.Value) else if (CLIOptions.f_displayHelp.Value)
{ {
CLIOptions.ShowHelp(); CLIOptions.ShowHelp();
} }

View File

@@ -30,7 +30,7 @@ namespace AssetStudioCLI
{ {
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
Progress.Default = new Progress<int>(ShowCurProgressValue); Progress.Default = new Progress<int>(ShowCurProgressValue);
assetsManager.LoadingViaTypeTreeEnabled = !CLIOptions.f_avoidLoadingViaTypetree.Value; assetsManager.LoadViaTypeTree = !CLIOptions.f_avoidLoadingViaTypetree.Value;
assetsManager.Options.CustomUnityVersion = CLIOptions.o_unityVersion.Value; assetsManager.Options.CustomUnityVersion = CLIOptions.o_unityVersion.Value;
assetsManager.Options.BundleOptions.CustomBlockInfoCompression = CLIOptions.o_bundleBlockInfoCompression.Value; assetsManager.Options.BundleOptions.CustomBlockInfoCompression = CLIOptions.o_bundleBlockInfoCompression.Value;
assetsManager.Options.BundleOptions.CustomBlockCompression = CLIOptions.o_bundleBlockCompression.Value; assetsManager.Options.BundleOptions.CustomBlockCompression = CLIOptions.o_bundleBlockCompression.Value;

View File

@@ -395,6 +395,7 @@
this.specifyUnityVersionTextBox.Font = new System.Drawing.Font("Segoe UI", 9F); this.specifyUnityVersionTextBox.Font = new System.Drawing.Font("Segoe UI", 9F);
this.specifyUnityVersionTextBox.Name = "specifyUnityVersionTextBox"; this.specifyUnityVersionTextBox.Name = "specifyUnityVersionTextBox";
this.specifyUnityVersionTextBox.Size = new System.Drawing.Size(100, 23); this.specifyUnityVersionTextBox.Size = new System.Drawing.Size(100, 23);
this.specifyUnityVersionTextBox.ToolTipText = "Specify full Unity version, including letters at the end\r\nExample: 2017.4.39f1";
// //
// bundleDecompressionToolStripMenuItem // bundleDecompressionToolStripMenuItem
// //
@@ -411,7 +412,7 @@
this.alwaysDecompressToDiskToolStripMenuItem.ShowShortcutKeys = false; this.alwaysDecompressToDiskToolStripMenuItem.ShowShortcutKeys = false;
this.alwaysDecompressToDiskToolStripMenuItem.Size = new System.Drawing.Size(217, 22); this.alwaysDecompressToDiskToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.alwaysDecompressToDiskToolStripMenuItem.Text = "Always decompress to disk"; this.alwaysDecompressToDiskToolStripMenuItem.Text = "Always decompress to disk";
this.alwaysDecompressToDiskToolStripMenuItem.ToolTipText = "If not selected, any bundles less than 2GB will be decompressed to memory"; this.alwaysDecompressToDiskToolStripMenuItem.ToolTipText = "If not selected, any bundles less than 2GB will be decompressed to RAM";
this.alwaysDecompressToDiskToolStripMenuItem.Click += new System.EventHandler(this.alwaysDecompressToDiskToolStripMenuItem_Click); this.alwaysDecompressToDiskToolStripMenuItem.Click += new System.EventHandler(this.alwaysDecompressToDiskToolStripMenuItem_Click);
// //
// blockInfoCompressionTypeToolStripMenuItem // blockInfoCompressionTypeToolStripMenuItem

View File

@@ -317,9 +317,9 @@ namespace AssetStudioGUI
allToolStripMenuItem.Checked = true; allToolStripMenuItem.Checked = true;
var log = $"Finished loading {assetsManager.AssetsFileList.Count} file(s) with {assetListView.Items.Count} exportable assets"; var log = $"Finished loading {assetsManager.AssetsFileList.Count} file(s) with {assetListView.Items.Count} exportable assets";
var unityVer = assetsManager.AssetsFileList[0].version; var unityVer = assetsManager.AssetsFileList[0].version;
var m_ObjectsCount = unityVer > 2020 ? var m_ObjectsCount = unityVer > 2020
assetsManager.AssetsFileList.Sum(x => x.m_Objects.LongCount(y => y.classID != (int)ClassIDType.Shader)) : ? assetsManager.AssetsFileList.Sum(x => x.m_Objects.LongCount(y => y.classID != (int)ClassIDType.Shader))
assetsManager.AssetsFileList.Sum(x => x.m_Objects.Count); : assetsManager.AssetsFileList.Sum(x => x.m_Objects.Count);
var objectsCount = assetsManager.AssetsFileList.Sum(x => x.Objects.Count); var objectsCount = assetsManager.AssetsFileList.Sum(x => x.Objects.Count);
if (m_ObjectsCount != objectsCount) if (m_ObjectsCount != objectsCount)
{ {
@@ -483,16 +483,14 @@ namespace AssetStudioGUI
{ {
case ClassIDType.Texture2D: case ClassIDType.Texture2D:
case ClassIDType.Sprite: case ClassIDType.Sprite:
if (enablePreview.Checked && imageTexture != null)
{ {
if (enablePreview.Checked && imageTexture != null) previewPanel.Image = imageTexture.Bitmap;
{ }
previewPanel.Image = imageTexture.Bitmap; else
} {
else previewPanel.Image = Properties.Resources.preview;
{ previewPanel.SizeMode = PictureBoxSizeMode.CenterImage;
previewPanel.Image = Properties.Resources.preview;
previewPanel.SizeMode = PictureBoxSizeMode.CenterImage;
}
} }
break; break;
case ClassIDType.Shader: case ClassIDType.Shader:
@@ -504,34 +502,28 @@ namespace AssetStudioGUI
fontPreviewBox.Visible = !fontPreviewBox.Visible; fontPreviewBox.Visible = !fontPreviewBox.Visible;
break; break;
case ClassIDType.AudioClip: case ClassIDType.AudioClip:
FMODpanel.Visible = !FMODpanel.Visible;
if (sound.hasHandle() && channel.hasHandle())
{ {
FMODpanel.Visible = !FMODpanel.Visible; var result = channel.isPlaying(out var playing);
if (result == FMOD.RESULT.OK && playing)
if (sound.hasHandle() && channel.hasHandle())
{ {
var result = channel.isPlaying(out var playing); channel.stop();
if (result == FMOD.RESULT.OK && playing) FMODreset();
{
channel.stop();
FMODreset();
}
} }
else if (FMODpanel.Visible)
{
PreviewAsset(lastSelectedItem);
}
break;
} }
else if (FMODpanel.Visible)
{
PreviewAsset(lastSelectedItem);
}
break;
} }
} }
else if (lastSelectedItem != null && enablePreview.Checked) else if (lastSelectedItem != null && enablePreview.Checked)
{ {
PreviewAsset(lastSelectedItem); PreviewAsset(lastSelectedItem);
} }
Properties.Settings.Default.enablePreview = enablePreview.Checked; Properties.Settings.Default.enablePreview = enablePreview.Checked;
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
} }
@@ -546,7 +538,6 @@ namespace AssetStudioGUI
{ {
assetInfoLabel.Visible = false; assetInfoLabel.Visible = false;
} }
Properties.Settings.Default.displayInfo = displayInfo.Checked; Properties.Settings.Default.displayInfo = displayInfo.Checked;
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
} }
@@ -756,42 +747,40 @@ namespace AssetStudioGUI
assetListView.SelectedIndices.Clear(); assetListView.SelectedIndices.Clear();
selectedIndicesPrevList.Clear(); selectedIndicesPrevList.Clear();
selectedAnimationAssetsList.Clear(); selectedAnimationAssetsList.Clear();
if (sortColumn == 4) //FullSize switch (sortColumn)
{ {
visibleAssets.Sort((a, b) => case 4: //FullSize
{ visibleAssets.Sort((a, b) =>
var asf = a.FullSize; {
var bsf = b.FullSize; var asf = a.FullSize;
return reverseSort ? bsf.CompareTo(asf) : asf.CompareTo(bsf); var bsf = b.FullSize;
}); return reverseSort ? bsf.CompareTo(asf) : asf.CompareTo(bsf);
} });
else if (sortColumn == 3) // PathID break;
{ case 3: //PathID
visibleAssets.Sort((x, y) => visibleAssets.Sort((x, y) =>
{ {
long pathID_X = x.m_PathID; long pathID_X = x.m_PathID;
long pathID_Y = y.m_PathID; long pathID_Y = y.m_PathID;
return reverseSort ? pathID_Y.CompareTo(pathID_X) : pathID_X.CompareTo(pathID_Y); return reverseSort ? pathID_Y.CompareTo(pathID_X) : pathID_X.CompareTo(pathID_Y);
}); });
} break;
else if (sortColumn == 0) // Name case 0: //Name
{ visibleAssets.Sort((a, b) =>
visibleAssets.Sort((a, b) => {
{ var at = a.SubItems[sortColumn].Text;
var at = a.SubItems[sortColumn].Text; var bt = b.SubItems[sortColumn].Text;
var bt = b.SubItems[sortColumn].Text; return reverseSort ? alphanumComparator.Compare(bt, at) : alphanumComparator.Compare(at, bt);
return reverseSort ? alphanumComparator.Compare(bt, at) : alphanumComparator.Compare(at, bt); });
}); break;
} default:
else visibleAssets.Sort((a, b) =>
{ {
visibleAssets.Sort((a, b) => var at = a.SubItems[sortColumn].Text.AsSpan();
{ var bt = b.SubItems[sortColumn].Text.AsSpan();
var at = a.SubItems[sortColumn].Text.AsSpan(); return reverseSort ? bt.CompareTo(at, StringComparison.OrdinalIgnoreCase) : at.CompareTo(bt, StringComparison.OrdinalIgnoreCase);
var bt = b.SubItems[sortColumn].Text.AsSpan(); });
break;
return reverseSort ? bt.CompareTo(at, StringComparison.OrdinalIgnoreCase) : at.CompareTo(bt, StringComparison.OrdinalIgnoreCase);
});
} }
assetListView.EndUpdate(); assetListView.EndUpdate();
} }
@@ -813,20 +802,17 @@ namespace AssetStudioGUI
lastSelectedItem = (AssetItem)e.Item; lastSelectedItem = (AssetItem)e.Item;
if (!e.IsSelected) if (!e.IsSelected)
return; return;
switch (tabControl2.SelectedIndex) switch (tabControl2.SelectedIndex)
{ {
case 0: //Preview case 0 when enablePreview.Checked: //Preview
if (enablePreview.Checked) PreviewAsset(lastSelectedItem);
if (displayInfo.Checked && lastSelectedItem.InfoText != null)
{ {
PreviewAsset(lastSelectedItem); assetInfoLabel.Text = lastSelectedItem.InfoText;
if (displayInfo.Checked && lastSelectedItem.InfoText != null) assetInfoLabel.Visible = true;
{
assetInfoLabel.Text = lastSelectedItem.InfoText;
assetInfoLabel.Visible = true;
}
} }
break; break;
case 1: //Dump case 1: //Dump
@@ -955,7 +941,7 @@ namespace AssetStudioGUI
private void PreviewTexture2DArray(AssetItem assetItem, Texture2DArray m_Texture2DArray) private void PreviewTexture2DArray(AssetItem assetItem, Texture2DArray m_Texture2DArray)
{ {
assetItem.InfoText = assetItem.InfoText =
$"Width: {m_Texture2DArray.m_Width}\n" + $"Width: {m_Texture2DArray.m_Width}\n" +
$"Height: {m_Texture2DArray.m_Height}\n" + $"Height: {m_Texture2DArray.m_Height}\n" +
$"Graphics format: {m_Texture2DArray.m_Format}\n" + $"Graphics format: {m_Texture2DArray.m_Format}\n" +
@@ -970,7 +956,11 @@ namespace AssetStudioGUI
{ {
var bitmap = new DirectBitmap(image); var bitmap = new DirectBitmap(image);
image.Dispose(); image.Dispose();
assetItem.InfoText = $"Width: {m_Texture2D.m_Width}\nHeight: {m_Texture2D.m_Height}\nFormat: {m_Texture2D.m_TextureFormat}";
assetItem.InfoText =
$"Width: {m_Texture2D.m_Width}" +
$"\nHeight: {m_Texture2D.m_Height}" +
$"\nFormat: {m_Texture2D.m_TextureFormat}";
switch (m_Texture2D.m_TextureSettings.m_FilterMode) switch (m_Texture2D.m_TextureSettings.m_FilterMode)
{ {
case 0: assetItem.InfoText += "\nFilter mode: Point "; break; case 0: assetItem.InfoText += "\nFilter mode: Point "; break;
@@ -984,8 +974,8 @@ namespace AssetStudioGUI
case 1: assetItem.InfoText += "\nWrap mode: Clamp"; break; case 1: assetItem.InfoText += "\nWrap mode: Clamp"; break;
} }
assetItem.InfoText += "\nChannels: "; assetItem.InfoText += "\nChannels: ";
int validChannel = 0; var validChannel = 0;
for (int i = 0; i < 4; i++) for (var i = 0; i < 4; i++)
{ {
if (textureChannels[i]) if (textureChannels[i])
{ {
@@ -998,10 +988,10 @@ namespace AssetStudioGUI
if (validChannel != 4) if (validChannel != 4)
{ {
var bytes = bitmap.Bits; var bytes = bitmap.Bits;
for (int i = 0; i < bitmap.Height; i++) for (var i = 0; i < bitmap.Height; i++)
{ {
int offset = Math.Abs(bitmap.Stride) * i; var offset = Math.Abs(bitmap.Stride) * i;
for (int j = 0; j < bitmap.Width; j++) for (var j = 0; j < bitmap.Width; j++)
{ {
bytes[offset] = textureChannels[0] ? bytes[offset] : validChannel == 1 && textureChannels[3] ? byte.MaxValue : byte.MinValue; bytes[offset] = textureChannels[0] ? bytes[offset] : validChannel == 1 && textureChannels[3] ? byte.MaxValue : byte.MinValue;
bytes[offset + 1] = textureChannels[1] ? bytes[offset + 1] : validChannel == 1 && textureChannels[3] ? byte.MaxValue : byte.MinValue; bytes[offset + 1] = textureChannels[1] ? bytes[offset + 1] : validChannel == 1 && textureChannels[3] ? byte.MaxValue : byte.MinValue;
@@ -1012,7 +1002,9 @@ namespace AssetStudioGUI
} }
} }
var switchSwizzled = m_Texture2D.m_PlatformBlob.Length != 0; var switchSwizzled = m_Texture2D.m_PlatformBlob.Length != 0;
assetItem.InfoText += assetItem.Asset.platform == BuildTarget.Switch ? $"\nUses texture swizzling: {switchSwizzled}" : ""; assetItem.InfoText += assetItem.Asset.platform == BuildTarget.Switch
? $"\nUses texture swizzling: {switchSwizzled}"
: "";
PreviewTexture(bitmap); PreviewTexture(bitmap);
StatusStripUpdate("'Ctrl'+'R'/'G'/'B'/'A' for Channel Toggle"); StatusStripUpdate("'Ctrl'+'R'/'G'/'B'/'A' for Channel Toggle");
@@ -1173,7 +1165,10 @@ namespace AssetStudioGUI
_ = system.getMasterChannelGroup(out var channelGroup); _ = system.getMasterChannelGroup(out var channelGroup);
result = system.playSound(sound, channelGroup, paused, out channel); result = system.playSound(sound, channelGroup, paused, out channel);
if (ERRCHECK(result)) return; if (ERRCHECK(result)) return;
if (!paused) { timer.Start(); } if (!paused)
{
timer.Start();
}
FMODpanel.Visible = true; FMODpanel.Visible = true;
@@ -1182,7 +1177,7 @@ namespace AssetStudioGUI
FMODinfoLabel.Text = frequency + " Hz"; FMODinfoLabel.Text = frequency + " Hz";
FMODtimerLabel.Text = $"00:00.00 / {(FMODlenms / 1000 / 60):00}:{(FMODlenms / 1000 % 60):00}.{(FMODlenms / 10 % 100):00}"; FMODtimerLabel.Text = $"00:00.00 / {(FMODlenms / 1000 / 60):00}:{(FMODlenms / 1000 % 60):00}.{(FMODlenms / 10 % 100):00}";
sound.getFormat(out _, out _, out var audioChannels, out _); sound.getFormat(out _, out _, out var audioChannels, out _);
switch (audioChannels) switch (audioChannels)
{ {
@@ -1206,7 +1201,7 @@ namespace AssetStudioGUI
sb.AppendLine($"Frame rate: {m_VideoClip.m_FrameRate:.0##}"); sb.AppendLine($"Frame rate: {m_VideoClip.m_FrameRate:.0##}");
sb.AppendLine($"Split alpha: {m_VideoClip.m_HasSplitAlpha}"); sb.AppendLine($"Split alpha: {m_VideoClip.m_HasSplitAlpha}");
assetItem.InfoText = sb.ToString(); assetItem.InfoText = sb.ToString();
StatusStripUpdate("Only supported export."); StatusStripUpdate("Only supported export.");
} }
@@ -1316,6 +1311,7 @@ namespace AssetStudioGUI
if (m_Mesh.m_VertexCount > 0) if (m_Mesh.m_VertexCount > 0)
{ {
viewMatrixData = Matrix4.CreateRotationY(-MathF.PI / 4) * Matrix4.CreateRotationX(-MathF.PI / 6); viewMatrixData = Matrix4.CreateRotationY(-MathF.PI / 4) * Matrix4.CreateRotationX(-MathF.PI / 6);
#region Vertices #region Vertices
if (m_Mesh.m_Vertices == null || m_Mesh.m_Vertices.Length == 0) if (m_Mesh.m_Vertices == null || m_Mesh.m_Vertices.Length == 0)
{ {
@@ -1359,6 +1355,7 @@ namespace AssetStudioGUI
float d = Math.Max(1e-5f, dist.Length); float d = Math.Max(1e-5f, dist.Length);
modelMatrixData = Matrix4.CreateTranslation(-offset) * Matrix4.CreateScale(2f / d); modelMatrixData = Matrix4.CreateTranslation(-offset) * Matrix4.CreateScale(2f / d);
#endregion #endregion
#region Indicies #region Indicies
indiceData = new int[m_Mesh.m_Indices.Count]; indiceData = new int[m_Mesh.m_Indices.Count];
for (int i = 0; i < m_Mesh.m_Indices.Count; i = i + 3) for (int i = 0; i < m_Mesh.m_Indices.Count; i = i + 3)
@@ -1368,6 +1365,7 @@ namespace AssetStudioGUI
indiceData[i + 2] = (int)m_Mesh.m_Indices[i + 2]; indiceData[i + 2] = (int)m_Mesh.m_Indices[i + 2];
} }
#endregion #endregion
#region Normals #region Normals
if (m_Mesh.m_Normals != null && m_Mesh.m_Normals.Length > 0) if (m_Mesh.m_Normals != null && m_Mesh.m_Normals.Length > 0)
{ {
@@ -1386,6 +1384,7 @@ namespace AssetStudioGUI
} }
else else
normalData = null; normalData = null;
// calculate normal by ourself // calculate normal by ourself
normal2Data = new Vector3[m_Mesh.m_VertexCount]; normal2Data = new Vector3[m_Mesh.m_VertexCount];
int[] normalCalculatedCount = new int[m_Mesh.m_VertexCount]; int[] normalCalculatedCount = new int[m_Mesh.m_VertexCount];
@@ -1414,6 +1413,7 @@ namespace AssetStudioGUI
normal2Data[i] /= normalCalculatedCount[i]; normal2Data[i] /= normalCalculatedCount[i];
} }
#endregion #endregion
#region Colors #region Colors
if (m_Mesh.m_Colors != null && m_Mesh.m_Colors.Length == m_Mesh.m_VertexCount * 3) if (m_Mesh.m_Colors != null && m_Mesh.m_Colors.Length == m_Mesh.m_VertexCount * 3)
{ {
@@ -1433,10 +1433,10 @@ namespace AssetStudioGUI
for (int c = 0; c < m_Mesh.m_VertexCount; c++) for (int c = 0; c < m_Mesh.m_VertexCount; c++)
{ {
colorData[c] = new Vector4( colorData[c] = new Vector4(
m_Mesh.m_Colors[c * 4], m_Mesh.m_Colors[c * 4],
m_Mesh.m_Colors[c * 4 + 1], m_Mesh.m_Colors[c * 4 + 1],
m_Mesh.m_Colors[c * 4 + 2], m_Mesh.m_Colors[c * 4 + 2],
m_Mesh.m_Colors[c * 4 + 3]); m_Mesh.m_Colors[c * 4 + 3]);
} }
} }
else else
@@ -1448,6 +1448,7 @@ namespace AssetStudioGUI
} }
} }
#endregion #endregion
glControl1.Visible = true; glControl1.Visible = true;
CreateVAO(); CreateVAO();
StatusStripUpdate("Using OpenGL Version: " + GL.GetString(StringName.Version) + "\n" StatusStripUpdate("Using OpenGL Version: " + GL.GetString(StringName.Version) + "\n"
@@ -1503,7 +1504,7 @@ namespace AssetStudioGUI
{ {
if (InvokeRequired) if (InvokeRequired)
{ {
BeginInvoke(new Action(() => BeginInvoke(new Action(() =>
{ {
progressBar1.Value = value; progressBar1.Value = value;
progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.Style = ProgressBarStyle.Continuous;
@@ -1515,7 +1516,7 @@ namespace AssetStudioGUI
progressBar1.Value = value; progressBar1.Value = value;
} }
BeginInvoke(new Action(() => BeginInvoke(new Action(() =>
{ {
var max = progressBar1.Maximum; var max = progressBar1.Maximum;
taskbar.SetProgressValue(value, max); taskbar.SetProgressValue(value, max);
@@ -1589,7 +1590,7 @@ namespace AssetStudioGUI
{ {
switch (tabControl2.SelectedIndex) switch (tabControl2.SelectedIndex)
{ {
case 0: //Preview case 0 when enablePreview.Checked: //Preview
if (lastPreviewItem != lastSelectedItem) if (lastPreviewItem != lastSelectedItem)
{ {
PreviewAsset(lastSelectedItem); PreviewAsset(lastSelectedItem);
@@ -1657,11 +1658,11 @@ namespace AssetStudioGUI
break; break;
} }
} }
exportAnimatorWithSelectedAnimationClipMenuItem.Visible = (selectedTypes & SelectedAssetType.Animator) !=0 && (selectedTypes & SelectedAssetType.AnimationClip) != 0; exportAnimatorWithSelectedAnimationClipMenuItem.Visible = (selectedTypes & SelectedAssetType.Animator) != 0 && (selectedTypes & SelectedAssetType.AnimationClip) != 0;
exportAsLive2DModelToolStripMenuItem.Visible = (selectedTypes & SelectedAssetType.MonoBehaviourMoc) != 0; exportAsLive2DModelToolStripMenuItem.Visible = (selectedTypes & SelectedAssetType.MonoBehaviourMoc) != 0;
exportL2DWithFadeLstToolStripMenuItem.Visible = (selectedTypes & SelectedAssetType.MonoBehaviourMoc) !=0 && (selectedTypes & SelectedAssetType.MonoBehaviourFadeLst) != 0; exportL2DWithFadeLstToolStripMenuItem.Visible = (selectedTypes & SelectedAssetType.MonoBehaviourMoc) != 0 && (selectedTypes & SelectedAssetType.MonoBehaviourFadeLst) != 0;
exportL2DWithFadeToolStripMenuItem.Visible = (selectedTypes & SelectedAssetType.MonoBehaviourMoc) != 0 && (selectedTypes & SelectedAssetType.MonoBehaviourFade) !=0; exportL2DWithFadeToolStripMenuItem.Visible = (selectedTypes & SelectedAssetType.MonoBehaviourMoc) != 0 && (selectedTypes & SelectedAssetType.MonoBehaviourFade) != 0;
exportL2DWithClipsToolStripMenuItem.Visible = (selectedTypes & SelectedAssetType.MonoBehaviourMoc) !=0 && (selectedTypes & SelectedAssetType.AnimationClip) != 0; exportL2DWithClipsToolStripMenuItem.Visible = (selectedTypes & SelectedAssetType.MonoBehaviourMoc) != 0 && (selectedTypes & SelectedAssetType.AnimationClip) != 0;
} }
var selectedElement = assetListView.HitTest(new Point(e.X, e.Y)); var selectedElement = assetListView.HitTest(new Point(e.X, e.Y));
@@ -1733,7 +1734,7 @@ namespace AssetStudioGUI
saveDirectoryBackup = saveFolderDialog.Folder; saveDirectoryBackup = saveFolderDialog.Folder;
var exportPath = Path.Combine(saveFolderDialog.Folder, "GameObject") + Path.DirectorySeparatorChar; var exportPath = Path.Combine(saveFolderDialog.Folder, "GameObject") + Path.DirectorySeparatorChar;
List<AssetItem> animationList = null; List<AssetItem> animationList = null;
if(animation && selectedAnimationAssetsList.Count > 0) if (animation && selectedAnimationAssetsList.Count > 0)
{ {
animationList = selectedAnimationAssetsList; animationList = selectedAnimationAssetsList;
} }
@@ -1960,6 +1961,7 @@ namespace AssetStudioGUI
{ {
visibleAssets = exportableAssets; visibleAssets = exportableAssets;
} }
if (listSearch.Text != " Filter ") if (listSearch.Text != " Filter ")
{ {
var mode = (ListSearchFilterMode)listSearchFilterMode.SelectedIndex; var mode = (ListSearchFilterMode)listSearchFilterMode.SelectedIndex;
@@ -1986,14 +1988,10 @@ namespace AssetStudioGUI
var regexOptions = RegexOptions.IgnoreCase | RegexOptions.Singleline; var regexOptions = RegexOptions.IgnoreCase | RegexOptions.Singleline;
try try
{ {
if (mode == ListSearchFilterMode.RegexName) visibleAssets = mode == ListSearchFilterMode.RegexName
{ ? visibleAssets.FindAll(x => Regex.IsMatch(x.Text, pattern, regexOptions))
visibleAssets = visibleAssets.FindAll(x => Regex.IsMatch(x.Text, pattern, regexOptions)); : visibleAssets.FindAll(x => Regex.IsMatch(x.SubItems[1].Text, pattern, regexOptions));
}
else
{
visibleAssets = visibleAssets.FindAll(x => Regex.IsMatch(x.SubItems[1].Text, pattern, regexOptions));
}
listSearch.BackColor = SystemInformation.HighContrast ? listSearch.BackColor : System.Drawing.Color.PaleGreen; listSearch.BackColor = SystemInformation.HighContrast ? listSearch.BackColor : System.Drawing.Color.PaleGreen;
listSearch.ForeColor = isDarkMode ? System.Drawing.Color.Black : listSearch.ForeColor; listSearch.ForeColor = isDarkMode ? System.Drawing.Color.Black : listSearch.ForeColor;
} }
@@ -2045,8 +2043,8 @@ namespace AssetStudioGUI
var tex2dArrayImgPathIdSet = toExportAssets.FindAll(x => x.Type == ClassIDType.Texture2DArrayImage).Select(x => x.m_PathID).ToHashSet(); var tex2dArrayImgPathIdSet = toExportAssets.FindAll(x => x.Type == ClassIDType.Texture2DArrayImage).Select(x => x.m_PathID).ToHashSet();
foreach (var pathId in tex2dArrayImgPathIdSet) foreach (var pathId in tex2dArrayImgPathIdSet)
{ {
toExportAssets = toExportAssets.Where(x => toExportAssets = toExportAssets.Where(x =>
x.Type != ClassIDType.Texture2DArray x.Type != ClassIDType.Texture2DArray
|| (x.Type == ClassIDType.Texture2DArray && x.m_PathID != pathId)) || (x.Type == ClassIDType.Texture2DArray && x.m_PathID != pathId))
.ToList(); .ToList();
} }
@@ -2338,24 +2336,25 @@ namespace AssetStudioGUI
var selectedClips = new List<AnimationClip>(); var selectedClips = new List<AnimationClip>();
foreach (var assetItem in selectedAssets) foreach (var assetItem in selectedAssets)
{ {
if (assetItem.Asset is MonoBehaviour m_MonoBehaviour && m_MonoBehaviour.m_Script.TryGet(out var m_Script)) switch (assetItem.Asset)
{ {
if (m_Script.m_ClassName == "CubismMoc") case MonoBehaviour m_MonoBehaviour when m_MonoBehaviour.m_Script.TryGet(out var m_Script):
{ switch (m_Script.m_ClassName)
selectedMocs.Add(m_MonoBehaviour); {
} case "CubismMoc":
else if (m_Script.m_ClassName == "CubismFadeMotionData") selectedMocs.Add(m_MonoBehaviour);
{ break;
selectedFadeMotions.Add(m_MonoBehaviour); case "CubismFadeMotionData":
} selectedFadeMotions.Add(m_MonoBehaviour);
else if (m_Script.m_ClassName == "CubismFadeMotionList") break;
{ case "CubismFadeMotionList":
selectedFadeLst = m_MonoBehaviour; selectedFadeLst = m_MonoBehaviour;
} break;
} }
else if (assetItem.Asset is AnimationClip m_AnimationClip) break;
{ case AnimationClip m_AnimationClip:
selectedClips.Add(m_AnimationClip); selectedClips.Add(m_AnimationClip);
break;
} }
} }
if (selectedMocs.Count == 0) if (selectedMocs.Count == 0)
@@ -2501,7 +2500,7 @@ namespace AssetStudioGUI
private void useAssetLoadingViaTypetreeToolStripMenuItem_CheckedChanged(object sender, EventArgs e) private void useAssetLoadingViaTypetreeToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
{ {
var isEnabled = useAssetLoadingViaTypetreeToolStripMenuItem.Checked; var isEnabled = useAssetLoadingViaTypetreeToolStripMenuItem.Checked;
assetsManager.LoadingViaTypeTreeEnabled = isEnabled; assetsManager.LoadViaTypeTree = isEnabled;
Properties.Settings.Default.useTypetreeLoading = isEnabled; Properties.Settings.Default.useTypetreeLoading = isEnabled;
Properties.Settings.Default.Save(); Properties.Settings.Default.Save();
} }
@@ -2729,7 +2728,7 @@ namespace AssetStudioGUI
_ = system.getMasterChannelGroup(out var channelGroup); _ = system.getMasterChannelGroup(out var channelGroup);
timer.Start(); timer.Start();
var result = channel.isPlaying(out var playing); var result = channel.isPlaying(out var playing);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
} }
@@ -2748,14 +2747,14 @@ namespace AssetStudioGUI
{ {
result = system.playSound(sound, channelGroup, false, out channel); result = system.playSound(sound, channelGroup, false, out channel);
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
FMODstatusLabel.Text = "Playing";
FMODstatusLabel.Text = "Playing";
if (FMODprogressBar.Value > 0) if (FMODprogressBar.Value > 0)
{ {
uint newms = FMODlenms / 1000 * (uint)FMODprogressBar.Value; uint newms = FMODlenms / 1000 * (uint)FMODprogressBar.Value;
result = channel.setPosition(newms, FMOD.TIMEUNIT.MS); result = channel.setPosition(newms, FMOD.TIMEUNIT.MS);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
} }
@@ -2769,7 +2768,7 @@ namespace AssetStudioGUI
if (sound.hasHandle() && channel.hasHandle()) if (sound.hasHandle() && channel.hasHandle())
{ {
var result = channel.isPlaying(out var playing); var result = channel.isPlaying(out var playing);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
} }
@@ -2778,6 +2777,7 @@ namespace AssetStudioGUI
{ {
result = channel.getPaused(out var paused); result = channel.getPaused(out var paused);
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
result = channel.setPaused(!paused); result = channel.setPaused(!paused);
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
@@ -2802,7 +2802,7 @@ namespace AssetStudioGUI
if (channel.hasHandle()) if (channel.hasHandle())
{ {
var result = channel.isPlaying(out var playing); var result = channel.isPlaying(out var playing);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
} }
@@ -2811,6 +2811,7 @@ namespace AssetStudioGUI
{ {
result = channel.stop(); result = channel.stop();
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
//channel = null; //channel = null;
//don't FMODreset, it will nullify the sound //don't FMODreset, it will nullify the sound
timer.Stop(); timer.Stop();
@@ -2837,13 +2838,13 @@ namespace AssetStudioGUI
if (channel.hasHandle()) if (channel.hasHandle())
{ {
result = channel.isPlaying(out var playing); result = channel.isPlaying(out var playing);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
} }
result = channel.getPaused(out var paused); result = channel.getPaused(out var paused);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
} }
@@ -2851,7 +2852,7 @@ namespace AssetStudioGUI
if (playing || paused) if (playing || paused)
{ {
result = channel.setMode(loopMode); result = channel.setMode(loopMode);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
} }
@@ -2889,18 +2890,21 @@ namespace AssetStudioGUI
uint newms = FMODlenms / 1000 * (uint)FMODprogressBar.Value; uint newms = FMODlenms / 1000 * (uint)FMODprogressBar.Value;
var result = channel.setPosition(newms, FMOD.TIMEUNIT.MS); var result = channel.setPosition(newms, FMOD.TIMEUNIT.MS);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
} }
result = channel.isPlaying(out var playing); result = channel.isPlaying(out var playing);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
if (ERRCHECK(result)) { return; } if (ERRCHECK(result)) { return; }
} }
if (playing) { timer.Start(); } if (playing)
{
timer.Start();
}
} }
} }
@@ -2913,19 +2917,19 @@ namespace AssetStudioGUI
if (channel.hasHandle()) if (channel.hasHandle())
{ {
var result = channel.getPosition(out ms, FMOD.TIMEUNIT.MS); var result = channel.getPosition(out ms, FMOD.TIMEUNIT.MS);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
ERRCHECK(result); ERRCHECK(result);
} }
result = channel.isPlaying(out playing); result = channel.isPlaying(out playing);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
ERRCHECK(result); ERRCHECK(result);
} }
result = channel.getPaused(out paused); result = channel.getPaused(out paused);
if ((result != FMOD.RESULT.OK) && (result != FMOD.RESULT.ERR_INVALID_HANDLE)) if (result != FMOD.RESULT.OK && result != FMOD.RESULT.ERR_INVALID_HANDLE)
{ {
ERRCHECK(result); ERRCHECK(result);
} }
@@ -3002,9 +3006,9 @@ namespace AssetStudioGUI
GL.GenBuffers(1, out vboAddress); GL.GenBuffers(1, out vboAddress);
GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress); GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress);
GL.BufferData(BufferTarget.ArrayBuffer, GL.BufferData(BufferTarget.ArrayBuffer,
(IntPtr)(data.Length * Vector3.SizeInBytes), (IntPtr)(data.Length * Vector3.SizeInBytes),
data, data,
BufferUsageHint.StaticDraw); BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(address, 3, VertexAttribPointerType.Float, false, 0, 0); GL.VertexAttribPointer(address, 3, VertexAttribPointerType.Float, false, 0, 0);
GL.EnableVertexAttribArray(address); GL.EnableVertexAttribArray(address);
} }
@@ -3014,9 +3018,9 @@ namespace AssetStudioGUI
GL.GenBuffers(1, out vboAddress); GL.GenBuffers(1, out vboAddress);
GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress); GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress);
GL.BufferData(BufferTarget.ArrayBuffer, GL.BufferData(BufferTarget.ArrayBuffer,
(IntPtr)(data.Length * Vector4.SizeInBytes), (IntPtr)(data.Length * Vector4.SizeInBytes),
data, data,
BufferUsageHint.StaticDraw); BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(address, 4, VertexAttribPointerType.Float, false, 0, 0); GL.VertexAttribPointer(address, 4, VertexAttribPointerType.Float, false, 0, 0);
GL.EnableVertexAttribArray(address); GL.EnableVertexAttribArray(address);
} }
@@ -3032,9 +3036,9 @@ namespace AssetStudioGUI
GL.GenBuffers(1, out address); GL.GenBuffers(1, out address);
GL.BindBuffer(BufferTarget.ElementArrayBuffer, address); GL.BindBuffer(BufferTarget.ElementArrayBuffer, address);
GL.BufferData(BufferTarget.ElementArrayBuffer, GL.BufferData(BufferTarget.ElementArrayBuffer,
(IntPtr)(data.Length * sizeof(int)), (IntPtr)(data.Length * sizeof(int)),
data, data,
BufferUsageHint.StaticDraw); BufferUsageHint.StaticDraw);
} }
private void CreateVAO() private void CreateVAO()

View File

@@ -89,19 +89,18 @@ namespace AssetStudioGUI
{ {
var m_TextAsset = (TextAsset)item.Asset; var m_TextAsset = (TextAsset)item.Asset;
var extension = ".txt"; var extension = ".txt";
var assetExtension = Path.GetExtension(m_TextAsset.m_Name);
if (Properties.Settings.Default.restoreExtensionName) if (Properties.Settings.Default.restoreExtensionName)
{ {
if (!string.IsNullOrEmpty(assetExtension)) if (Path.HasExtension(m_TextAsset.m_Name))
{ {
extension = ""; extension = "";
} }
else if (!string.IsNullOrEmpty(item.Container)) else
{ {
var ext = Path.GetExtension(item.Container); var extFromContainer = Path.GetExtension(item.Container);
if (!string.IsNullOrEmpty(item.Container)) if (!string.IsNullOrEmpty(extFromContainer))
{ {
extension = ext; extension = extFromContainer;
} }
} }
} }

View File

@@ -33,28 +33,27 @@ namespace AssetStudio
public TypeDefinition GetTypeDefinition(string assemblyName, string fullName) public TypeDefinition GetTypeDefinition(string assemblyName, string fullName)
{ {
moduleDic.TryGetValue(assemblyName, out var module); if (!moduleDic.TryGetValue(assemblyName, out var module) && !assemblyName.EndsWith(".dll"))
if (module == null && !assemblyName.Contains(".dll"))
{ {
moduleDic.TryGetValue(assemblyName + ".dll", out module); assemblyName += ".dll";
moduleDic.TryGetValue(assemblyName, out module);
} }
if (module != null) if (module == null)
return null;
var typeDef = module.GetType(fullName);
if (typeDef == null && assemblyName == "UnityEngine.dll")
{ {
var typeDef = module.GetType(fullName); foreach (var pair in moduleDic)
if (typeDef == null && assemblyName == "UnityEngine.dll")
{ {
foreach (var pair in moduleDic) typeDef = pair.Value.GetType(fullName);
if (typeDef != null)
{ {
typeDef = pair.Value.GetType(fullName); break;
if (typeDef != null)
{
break;
}
} }
} }
return typeDef;
} }
return null; return typeDef;
} }
public void Clear() public void Clear()