Add oodle compression support (unofficial)

This commit is contained in:
VaDiM
2025-05-09 02:28:03 +03:00
parent 66229e564a
commit 876bafdda1
36 changed files with 430 additions and 125 deletions

View File

@ -82,6 +82,8 @@
<Copy SourceFiles="$(SolutionDir)AssetStudioFBXNative\bin\x64\$(Configuration)\AssetStudioFBXNative.dll" DestinationFolder="$(TargetDir)runtimes\win-x64\native" ContinueOnError="false" />
<Copy SourceFiles="$(ProjectDir)Libraries\x86\fmod.dll" DestinationFolder="$(TargetDir)runtimes\win-x86\native" ContinueOnError="false" />
<Copy SourceFiles="$(ProjectDir)Libraries\x64\fmod.dll" DestinationFolder="$(TargetDir)runtimes\win-x64\native" ContinueOnError="false" />
<Copy SourceFiles="$(ProjectDir)Libraries\x86\ooz.dll" DestinationFolder="$(TargetDir)runtimes\win-x86\native" ContinueOnError="false" />
<Copy SourceFiles="$(ProjectDir)Libraries\x64\ooz.dll" DestinationFolder="$(TargetDir)runtimes\win-x64\native" ContinueOnError="false" />
</Target>
<!-- Publishing an app as framework-dependent produces a cross-platform binary as a dll file, and a platform-specific executable that targets your current platform.
@ -94,6 +96,8 @@
<Copy SourceFiles="$(TargetDir)runtimes\win-x64\native\Texture2DDecoderNative.dll" DestinationFolder="$(PublishDir)runtimes\win-x64\native" ContinueOnError="false" />
<Copy SourceFiles="$(TargetDir)runtimes\win-x86\native\fmod.dll" DestinationFolder="$(PublishDir)runtimes\win-x86\native" ContinueOnError="false" />
<Copy SourceFiles="$(TargetDir)runtimes\win-x64\native\fmod.dll" DestinationFolder="$(PublishDir)runtimes\win-x64\native" ContinueOnError="false" />
<Copy SourceFiles="$(TargetDir)runtimes\win-x86\native\ooz.dll" DestinationFolder="$(PublishDir)runtimes\win-x86\native" ContinueOnError="false" />
<Copy SourceFiles="$(TargetDir)runtimes\win-x64\native\ooz.dll" DestinationFolder="$(PublishDir)runtimes\win-x64\native" ContinueOnError="false" />
</Target>
<!-- No need to publish net472 build of AssetStudioGUI -->
@ -107,6 +111,7 @@
<Copy SourceFiles="$(SolutionDir)Texture2DDecoderNative\bin\Win32\$(Configuration)\Texture2DDecoderNative.dll" DestinationFolder="$(TargetDir)" ContinueOnError="false" />
<Copy SourceFiles="$(SolutionDir)AssetStudioFBXNative\bin\Win32\$(Configuration)\AssetStudioFBXNative.dll" DestinationFolder="$(TargetDir)" ContinueOnError="false" />
<Copy SourceFiles="$(ProjectDir)Libraries\x86\fmod.dll" DestinationFolder="$(TargetDir)" ContinueOnError="false" />
<Copy SourceFiles="$(ProjectDir)Libraries\x86\ooz.dll" DestinationFolder="$(TargetDir)" ContinueOnError="false" />
</Target>
<Target Name="CopyExtraFilesWin64" AfterTargets="AfterBuild" Condition=" '$(RuntimeIdentifier)' == 'win-x64' AND '$(TargetFramework)' != 'net472' ">
@ -114,6 +119,7 @@
<Copy SourceFiles="$(SolutionDir)Texture2DDecoderNative\bin\x64\$(Configuration)\Texture2DDecoderNative.dll" DestinationFolder="$(TargetDir)" ContinueOnError="false" />
<Copy SourceFiles="$(SolutionDir)AssetStudioFBXNative\bin\x64\$(Configuration)\AssetStudioFBXNative.dll" DestinationFolder="$(TargetDir)" ContinueOnError="false" />
<Copy SourceFiles="$(ProjectDir)Libraries\x64\fmod.dll" DestinationFolder="$(TargetDir)" ContinueOnError="false" />
<Copy SourceFiles="$(ProjectDir)Libraries\x64\ooz.dll" DestinationFolder="$(TargetDir)" ContinueOnError="false" />
</Target>
<Target Name="PublishExtraFilesWin" AfterTargets="Publish" Condition=" $(RuntimeIdentifier.Contains('win')) AND '$(TargetFramework)' != 'net472' ">
@ -121,6 +127,7 @@
<Copy SourceFiles="$(TargetDir)\AssetStudioFBXNative.dll" DestinationFolder="$(PublishDir)" ContinueOnError="false" />
<Copy SourceFiles="$(TargetDir)\Texture2DDecoderNative.dll" DestinationFolder="$(PublishDir)" ContinueOnError="false" />
<Copy SourceFiles="$(TargetDir)\fmod.dll" DestinationFolder="$(PublishDir)" ContinueOnError="false" />
<Copy SourceFiles="$(TargetDir)\ooz.dll" DestinationFolder="$(PublishDir)" ContinueOnError="false" />
</Target>
</Project>

View File

@ -47,8 +47,10 @@
this.useDumpTreeViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buildTreeStructureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.customCompressionTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.customCompressionZstdToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.customCompressionLZ4ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.blockInfoCompressionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.customBlockInfoCompressionComboBoxToolStripMenuItem = new System.Windows.Forms.ToolStripComboBox();
this.blockCompressionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.customBlockCompressionComboBoxToolStripMenuItem = new System.Windows.Forms.ToolStripComboBox();
this.toolStripMenuItem14 = new System.Windows.Forms.ToolStripMenuItem();
this.specifyUnityVersion = new System.Windows.Forms.ToolStripTextBox();
this.showExpOpt = new System.Windows.Forms.ToolStripMenuItem();
@ -359,33 +361,59 @@
// customCompressionTypeToolStripMenuItem
//
this.customCompressionTypeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.customCompressionZstdToolStripMenuItem,
this.customCompressionLZ4ToolStripMenuItem});
this.blockInfoCompressionToolStripMenuItem,
this.customBlockInfoCompressionComboBoxToolStripMenuItem,
this.blockCompressionToolStripMenuItem,
this.customBlockCompressionComboBoxToolStripMenuItem});
this.customCompressionTypeToolStripMenuItem.Name = "customCompressionTypeToolStripMenuItem";
this.customCompressionTypeToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
this.customCompressionTypeToolStripMenuItem.Text = "Custom compression type";
this.customCompressionTypeToolStripMenuItem.Text = "Bundle compression type";
//
// customCompressionZstdToolStripMenuItem
// blockInfoCompressionToolStripMenuItem
//
this.customCompressionZstdToolStripMenuItem.Checked = true;
this.customCompressionZstdToolStripMenuItem.CheckOnClick = true;
this.customCompressionZstdToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.customCompressionZstdToolStripMenuItem.Name = "customCompressionZstdToolStripMenuItem";
this.customCompressionZstdToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.customCompressionZstdToolStripMenuItem.Text = "Zstd";
this.customCompressionZstdToolStripMenuItem.ToolTipText = "If selected, Zstd-decompression will be used for assets with custom compression t" +
"ype";
this.customCompressionZstdToolStripMenuItem.CheckedChanged += new System.EventHandler(this.customCompressionZstd_CheckedChanged);
this.blockInfoCompressionToolStripMenuItem.Enabled = false;
this.blockInfoCompressionToolStripMenuItem.Name = "blockInfoCompressionToolStripMenuItem";
this.blockInfoCompressionToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.blockInfoCompressionToolStripMenuItem.Text = "BlockInfo Compression";
//
// customCompressionLZ4ToolStripMenuItem
// customBlockInfoCompressionComboBoxToolStripMenuItem
//
this.customCompressionLZ4ToolStripMenuItem.CheckOnClick = true;
this.customCompressionLZ4ToolStripMenuItem.Name = "customCompressionLZ4ToolStripMenuItem";
this.customCompressionLZ4ToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.customCompressionLZ4ToolStripMenuItem.Text = "Lz4/Lz4HC";
this.customCompressionLZ4ToolStripMenuItem.ToolTipText = "If selected, Lz4-decompression will be used for assets with custom compression ty" +
"pe";
this.customCompressionLZ4ToolStripMenuItem.CheckedChanged += new System.EventHandler(this.customCompressionLZ4_CheckedChanged);
this.customBlockInfoCompressionComboBoxToolStripMenuItem.DropDownHeight = 80;
this.customBlockInfoCompressionComboBoxToolStripMenuItem.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.customBlockInfoCompressionComboBoxToolStripMenuItem.IntegralHeight = false;
this.customBlockInfoCompressionComboBoxToolStripMenuItem.Items.AddRange(new object[] {
"Auto",
"Zstd",
"Oodle",
"Lz4/Lz4HC",
"Lzma"});
this.customBlockInfoCompressionComboBoxToolStripMenuItem.Name = "customBlockInfoCompressionComboBoxToolStripMenuItem";
this.customBlockInfoCompressionComboBoxToolStripMenuItem.Size = new System.Drawing.Size(100, 23);
this.customBlockInfoCompressionComboBoxToolStripMenuItem.ToolTipText = "Selected compression type will override detected type from asset bundle";
this.customBlockInfoCompressionComboBoxToolStripMenuItem.SelectedIndexChanged += new System.EventHandler(this.customBlockInfoCompressionComboBoxToolStripMenuItem_SelectedIndexChanged);
//
// blockCompressionToolStripMenuItem
//
this.blockCompressionToolStripMenuItem.Enabled = false;
this.blockCompressionToolStripMenuItem.Name = "blockCompressionToolStripMenuItem";
this.blockCompressionToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.blockCompressionToolStripMenuItem.Text = "Block Compression";
//
// customBlockCompressionComboBoxToolStripMenuItem
//
this.customBlockCompressionComboBoxToolStripMenuItem.DropDownHeight = 80;
this.customBlockCompressionComboBoxToolStripMenuItem.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.customBlockCompressionComboBoxToolStripMenuItem.IntegralHeight = false;
this.customBlockCompressionComboBoxToolStripMenuItem.Items.AddRange(new object[] {
"Auto",
"Zstd",
"Oodle",
"Lz4/Lz4HC",
"Lzma"});
this.customBlockCompressionComboBoxToolStripMenuItem.Name = "customBlockCompressionComboBoxToolStripMenuItem";
this.customBlockCompressionComboBoxToolStripMenuItem.Size = new System.Drawing.Size(100, 23);
this.customBlockCompressionComboBoxToolStripMenuItem.ToolTipText = "Selected compression type will override detected type from asset bundle";
this.customBlockCompressionComboBoxToolStripMenuItem.SelectedIndexChanged += new System.EventHandler(this.customBlockCompressionComboBoxToolStripMenuItem_SelectedIndexChanged);
//
// toolStripMenuItem14
//
@ -1746,8 +1774,6 @@
private System.Windows.Forms.ToolStripMenuItem l2DModelWithFadeListToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportL2DWithFadeLstToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem customCompressionTypeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem customCompressionZstdToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem customCompressionLZ4ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem useAssetLoadingViaTypetreeToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator assetLoadingToolStripSeparator;
private System.Windows.Forms.TreeView dumpTreeView;
@ -1763,6 +1789,10 @@
private System.Windows.Forms.ToolStripMenuItem colorThemeDarkToolStripMenuItem;
private System.Windows.Forms.Label FMODaudioChannelsLabel;
private System.Windows.Forms.ToolStripMenuItem autoPlayAudioAssetsToolStripMenuItem;
private System.Windows.Forms.ToolStripComboBox customBlockCompressionComboBoxToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem blockCompressionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem blockInfoCompressionToolStripMenuItem;
private System.Windows.Forms.ToolStripComboBox customBlockInfoCompressionComboBoxToolStripMenuItem;
}
}

View File

@ -145,6 +145,8 @@ namespace AssetStudioGUI
useAssetLoadingViaTypetreeToolStripMenuItem.Checked = Properties.Settings.Default.useTypetreeLoading;
useDumpTreeViewToolStripMenuItem.Checked = Properties.Settings.Default.useDumpTreeView;
autoPlayAudioAssetsToolStripMenuItem.Checked = Properties.Settings.Default.autoplayAudio;
customBlockCompressionComboBoxToolStripMenuItem.SelectedIndex = 0;
customBlockInfoCompressionComboBoxToolStripMenuItem.SelectedIndex = 0;
FMODinit();
listSearchFilterMode.SelectedIndex = 0;
if (string.IsNullOrEmpty(Properties.Settings.Default.fbxSettings))
@ -2422,16 +2424,50 @@ namespace AssetStudioGUI
}
}
private void customCompressionZstd_CheckedChanged(object sender, EventArgs e)
private void customBlockCompressionComboBoxToolStripMenuItem_SelectedIndexChanged(object sender, EventArgs e)
{
customCompressionLZ4ToolStripMenuItem.Checked = !customCompressionZstdToolStripMenuItem.Checked;
assetsManager.ZstdEnabled = customCompressionZstdToolStripMenuItem.Checked;
var selectedTypeIndex = customBlockCompressionComboBoxToolStripMenuItem.SelectedIndex;
switch (selectedTypeIndex)
{
case 0:
assetsManager.CustomBlockCompression = CompressionType.Auto;
break;
case 1:
assetsManager.CustomBlockCompression = CompressionType.Zstd;
break;
case 2:
assetsManager.CustomBlockCompression = CompressionType.Oodle;
break;
case 3:
assetsManager.CustomBlockCompression = CompressionType.Lz4HC;
break;
case 4:
assetsManager.CustomBlockCompression = CompressionType.Lzma;
break;
}
}
private void customCompressionLZ4_CheckedChanged(object sender, EventArgs e)
private void customBlockInfoCompressionComboBoxToolStripMenuItem_SelectedIndexChanged(object sender, EventArgs e)
{
customCompressionZstdToolStripMenuItem.Checked = !customCompressionLZ4ToolStripMenuItem.Checked;
assetsManager.ZstdEnabled = customCompressionZstdToolStripMenuItem.Checked;
var selectedTypeIndex = customBlockInfoCompressionComboBoxToolStripMenuItem.SelectedIndex;
switch (selectedTypeIndex)
{
case 0:
assetsManager.CustomBlockInfoCompression = CompressionType.Auto;
break;
case 1:
assetsManager.CustomBlockInfoCompression = CompressionType.Zstd;
break;
case 2:
assetsManager.CustomBlockInfoCompression = CompressionType.Oodle;
break;
case 3:
assetsManager.CustomBlockInfoCompression = CompressionType.Lz4HC;
break;
case 4:
assetsManager.CustomBlockInfoCompression = CompressionType.Lzma;
break;
}
}
private void useAssetLoadingViaTypetreeToolStripMenuItem_CheckedChanged(object sender, EventArgs e)

View File

@ -140,7 +140,7 @@ namespace AssetStudioGUI
var count = 0;
var bundleStream = new OffsetStream(reader);
var bundleReader = new FileReader(reader.FullPath, bundleStream);
var bundleFile = new BundleFile(bundleReader, assetsManager.ZstdEnabled, assetsManager.SpecifyUnityVersion);
var bundleFile = new BundleFile(bundleReader, assetsManager.CustomBlockInfoCompression, assetsManager.CustomBlockCompression, assetsManager.SpecifyUnityVersion);
var extractPath = Path.Combine(savePath, reader.FileName + "_unpacked");
if (bundleFile.fileList.Length > 0)
{
@ -157,7 +157,7 @@ namespace AssetStudioGUI
bundleReader.FileName = $"{reader.FileName}_0x{bundleStream.Offset:X}";
}
Logger.Info($"[MultiBundle] Decompressing \"{reader.FileName}\" from offset: 0x{bundleStream.Offset:X}..");
bundleFile = new BundleFile(bundleReader, assetsManager.ZstdEnabled, assetsManager.SpecifyUnityVersion);
bundleFile = new BundleFile(bundleReader, assetsManager.CustomBlockInfoCompression, assetsManager.CustomBlockCompression, assetsManager.SpecifyUnityVersion);
if (bundleFile.fileList.Length > 0)
{
count += ExtractStreamFile(extractPath, bundleFile.fileList);