Some other fixes

This commit is contained in:
VaDiM
2026-04-24 12:03:58 +03:00
parent c728d0349d
commit bd93a9f5d6
11 changed files with 23 additions and 21 deletions
+8 -6
View File
@@ -118,9 +118,9 @@ namespace AssetStudio
{ {
if (!unityVer.IsStripped && customUnityVer != unityVer) if (!unityVer.IsStripped && customUnityVer != unityVer)
{ {
Logger.Warning($"Detected Unity version is different from the specified one ({customUnityVer.FullVersion.Color(ColorConsole.BrightCyan)}).\n" + Logger.Warning($"Detected Unity version [{unityVer.FullVersion.Color(ColorConsole.BrightCyan)}] is different from the specified one [{customUnityVer.FullVersion.Color(ColorConsole.BrightCyan)}].\n" +
$"Assets may load with errors.\n" + "Assets may load with errors.\n" +
$"It is recommended to specify the detected Unity version: {unityVer.FullVersion.Color(ColorConsole.BrightCyan)}"); "It is recommended not to specify a Unity version for this file.");
} }
unityVer = customUnityVer; unityVer = customUnityVer;
} }
@@ -359,12 +359,13 @@ namespace AssetStudio
case CompressionType.Lzham: case CompressionType.Lzham:
throw new IOException($"Unsupported blockInfo compression type: {compressionType}.\n"); throw new IOException($"Unsupported blockInfo compression type: {compressionType}.\n");
default: default:
throw new IOException($"Unknown blockInfo compression type: {compressionType}.\nYou may try to specify the compression type manually.\n"); throw new IOException($"Unknown blockInfo compression type: {compressionType}.\nYou may try to specify the compression type manually in the options.\n");
} }
if (numWrite != uncompressedSize) if (numWrite != uncompressedSize)
{ {
var msg = $"{compressionType} blockInfo decompression error. {errorMsg}\nWrite {numWrite} bytes but expected {uncompressedSize} bytes."; var type = compressionType == CompressionType.None ? "Uncompressed" : compressionType.ToString();
var msg = $"{type} blockInfo decompression error. {errorMsg}\nWrite {numWrite} bytes but expected {uncompressedSize} bytes.";
var exMsg = compressionType > CompressionType.Lz4HC || customBlockInfoCompression != CompressionType.Auto var exMsg = compressionType > CompressionType.Lz4HC || customBlockInfoCompression != CompressionType.Auto
? "Wrong compression type or blockInfo data might be encrypted." ? "Wrong compression type or blockInfo data might be encrypted."
: "BlockInfo data might be encrypted."; : "BlockInfo data might be encrypted.";
@@ -491,7 +492,8 @@ namespace AssetStudio
if (numWrite != blockInfo.uncompressedSize) if (numWrite != blockInfo.uncompressedSize)
{ {
var msg = $"{compressionType} block decompression error. {errorMsg}\nWrite {numWrite} bytes but expected {blockInfo.uncompressedSize} bytes."; var type = compressionType == CompressionType.None ? "Uncompressed" : compressionType.ToString();
var msg = $"{type} block decompression error. {errorMsg}\nWrite {numWrite} bytes but expected {blockInfo.uncompressedSize} bytes.";
var exMsg = compressionType > CompressionType.Lz4HC || customBlockCompression != CompressionType.Auto var exMsg = compressionType > CompressionType.Lz4HC || customBlockCompression != CompressionType.Auto
? "Wrong compression type or block data might be encrypted." ? "Wrong compression type or block data might be encrypted."
: "Block data might be encrypted."; : "Block data might be encrypted.";
+1 -1
View File
@@ -87,7 +87,7 @@ namespace AssetStudio.CustomOptions
{ {
throw new NotSupportedException("Specified Unity version is not in a correct format.\n" + throw new NotSupportedException("Specified Unity version is not in a correct format.\n" +
"Specify full Unity version, including letters at the end.\n" + "Specify full Unity version, including letters at the end.\n" +
"Example: 2017.4.39f1"); "Example: 2022.3.2f1");
} }
_customUnityVer = value; _customUnityVer = value;
UnityVersionChanged?.Invoke(this, EventArgs.Empty); UnityVersionChanged?.Invoke(this, EventArgs.Empty);
+1 -2
View File
@@ -98,8 +98,7 @@ namespace AssetStudio
return; return;
} }
version = assetsManager.Options.CustomUnityVersion; version = assetsManager.Options.CustomUnityVersion;
reader.Position = versionPos; reader.Position = versionPos + version.ToString().Length + 1;
reader.ReadBytes(version.ToString().Length + 1);
} }
} }
if (header.m_Version >= SerializedFileFormatVersion.Unknown_8) if (header.m_Version >= SerializedFileFormatVersion.Unknown_8)
+1 -1
View File
@@ -41,7 +41,7 @@ namespace AssetStudio
} }
if (readed != reader.byteSize) if (readed != reader.byteSize)
{ {
Logger.Info($"Failed to read type, read {readed} bytes but expected {reader.byteSize} bytes"); Logger.Info($"Failed to read type, read {reader.Position - reader.byteStart} bytes but expected {reader.byteSize} bytes");
} }
return sb.ToString(); return sb.ToString();
+2 -2
View File
@@ -500,7 +500,7 @@ namespace AssetStudioCLI.Options
( (
optionDefaultValue: "temp", optionDefaultValue: "temp",
optionName: "--cache-dir <path>", optionName: "--cache-dir <path>",
optionDescription: "Specify a directory for storing temporary files. Default: <program folder>.\n", optionDescription: "Specify a directory for storing temporary files (default: program folder)\n",
optionExample: "", optionExample: "",
optionHelpGroup: HelpGroups.Import optionHelpGroup: HelpGroups.Import
); );
@@ -574,7 +574,7 @@ namespace AssetStudioCLI.Options
); );
o_stripPathPrefix = new GroupedOption<string> o_stripPathPrefix = new GroupedOption<string>
( (
optionDefaultValue: "", optionDefaultValue: null,
optionName: "--strip-path-prefix <path>", optionName: "--strip-path-prefix <path>",
optionDescription: "Specify a path prefix to be stripped from exported asset paths\n", optionDescription: "Specify a path prefix to be stripped from exported asset paths\n",
optionExample: "Example: \"--strip-path-prefix assets/models/char/\"\n", optionExample: "Example: \"--strip-path-prefix assets/models/char/\"\n",
+1
View File
@@ -96,6 +96,7 @@ namespace AssetStudioCLI
return true; return true;
} }
} }
Logger.Error($"Failed to convert sprite \"{item.Text}\" into image");
return false; return false;
} }
+5 -5
View File
@@ -1456,18 +1456,18 @@
// //
// unityVersionStatusLabel // unityVersionStatusLabel
// //
this.unityVersionStatusLabel.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.unityVersionStatusLabel.BackColor = System.Drawing.Color.Transparent; this.unityVersionStatusLabel.BackColor = System.Drawing.Color.Transparent;
this.unityVersionStatusLabel.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top) this.unityVersionStatusLabel.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom;
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
this.unityVersionStatusLabel.BorderStyle = System.Windows.Forms.Border3DStyle.Etched; this.unityVersionStatusLabel.BorderStyle = System.Windows.Forms.Border3DStyle.Etched;
this.unityVersionStatusLabel.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.unityVersionStatusLabel.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.unityVersionStatusLabel.DoubleClickEnabled = true; this.unityVersionStatusLabel.DoubleClickEnabled = true;
this.unityVersionStatusLabel.Margin = new System.Windows.Forms.Padding(0, 3, 6, 0); this.unityVersionStatusLabel.Margin = new System.Windows.Forms.Padding(0, 2, 6, 1);
this.unityVersionStatusLabel.Name = "unityVersionStatusLabel"; this.unityVersionStatusLabel.Name = "unityVersionStatusLabel";
this.unityVersionStatusLabel.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
this.unityVersionStatusLabel.Size = new System.Drawing.Size(40, 19); this.unityVersionStatusLabel.Size = new System.Drawing.Size(40, 19);
this.unityVersionStatusLabel.Text = "None"; this.unityVersionStatusLabel.Text = "None";
this.unityVersionStatusLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.unityVersionStatusLabel.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.unityVersionStatusLabel.ToolTipText = "Custom Unity version\r\n- Double click to reset"; this.unityVersionStatusLabel.ToolTipText = "Custom Unity version\r\n- Double click to reset";
this.unityVersionStatusLabel.DoubleClick += new System.EventHandler(this.unityVersionStatusLabel_DoubleClick); this.unityVersionStatusLabel.DoubleClick += new System.EventHandler(this.unityVersionStatusLabel_DoubleClick);
// //
-1
View File
@@ -2544,7 +2544,6 @@ namespace AssetStudioGUI
if (isDarkMode) if (isDarkMode)
{ {
assetListView.GridLines = false; assetListView.GridLines = false;
unityVersionStatusLabel.BorderStyle = Border3DStyle.SunkenInner;
} }
else else
{ {
+1
View File
@@ -95,6 +95,7 @@ namespace AssetStudioGUI
return true; return true;
} }
} }
Logger.Warning($"Failed to convert sprite \"{item.Text}\" into image");
return false; return false;
} }
+2 -2
View File
@@ -675,11 +675,11 @@ namespace AssetStudioGUI
if (GUILogger.ShowDebugMessage) if (GUILogger.ShowDebugMessage)
{ {
Logger.Debug(debugLog); Logger.Debug(debugLog);
StatusStripUpdate($"[{exportedCount}/{toExportCount}] Exporting {asset.TypeString}: {asset.Text}"); StatusStripUpdate($"[{exportedCount}/{toExportCount}] Exported {asset.TypeString}: {asset.Text}");
} }
else else
{ {
Logger.Info($"[{exportedCount}/{toExportCount}] Exporting {asset.TypeString}: {asset.Text}"); Logger.Info($"[{exportedCount}/{toExportCount}] Exported {asset.TypeString}: {asset.Text}");
} }
} }
Interlocked.Increment(ref i); Interlocked.Increment(ref i);