- [Core] Fix bug with loading some bundles from ZIP file.

- [CLI] added new options.
This commit is contained in:
Razmoth
2023-08-24 21:49:17 +04:00
parent 995b7ee58b
commit cde398e592
7 changed files with 15 additions and 2 deletions

View File

@@ -374,6 +374,7 @@ namespace AssetStudio
}
splitStream.Seek(0, SeekOrigin.Begin);
FileReader entryReader = new FileReader(basePath, splitStream);
entryReader = entryReader.PreProcessing(Game);
LoadFile(entryReader);
}
catch (Exception e)

View File

@@ -37,7 +37,7 @@ namespace AssetStudio
serializedType = reader.serializedType;
byteSize = reader.byteSize;
Logger.Verbose($"Attempting to read object {type} with {m_PathID} in file {assetsFile.fileName}, starting from offset 0x{reader.byteStart:X8} with expected size of 0x{byteSize:X8} !!");
Logger.Verbose($"Attempting to read object {type} with {m_PathID} in file {assetsFile.fileName}, starting from offset 0x{reader.byteStart:X8} with size of 0x{byteSize:X8} !!");
if (platform == BuildTarget.NoTarget)
{

View File

@@ -22,6 +22,8 @@
<add key="exportAllUvsAsDiffuseMaps" value="False" />
<add key="disableShader" value="False" />
<add key="disableRenderer" value="False" />
<add key="disableAnimationClip" value="False" />
<add key="enableFileLogging" value="False" />
<add key="minimalAssetMap" value="True" />
</appSettings>
</configuration>

View File

@@ -22,6 +22,7 @@ namespace AssetStudioCLI
var rootCommand = new RootCommand()
{
optionsBinder.Silent,
optionsBinder.Verbose,
optionsBinder.TypeFilter,
optionsBinder.NameFilter,
optionsBinder.ContainerFilter,
@@ -47,6 +48,7 @@ namespace AssetStudioCLI
public class Options
{
public bool Silent { get; set; }
public bool Verbose { get; set; }
public ClassIDType[] TypeFilter { get; set; }
public Regex[] NameFilter { get; set; }
public Regex[] ContainerFilter { get; set; }
@@ -67,6 +69,7 @@ namespace AssetStudioCLI
public class OptionsBinder : BinderBase<Options>
{
public readonly Option<bool> Silent;
public readonly Option<bool> Verbose;
public readonly Option<ClassIDType[]> TypeFilter;
public readonly Option<Regex[]> NameFilter;
public readonly Option<Regex[]> ContainerFilter;
@@ -87,6 +90,7 @@ namespace AssetStudioCLI
public OptionsBinder()
{
Silent = new Option<bool>("--silent", "Hide log messages.");
Verbose = new Option<bool>("--verbose", "Hide log messages.");
TypeFilter = new Option<ClassIDType[]>("--types", "Specify unity class type(s)") { AllowMultipleArgumentsPerToken = true, ArgumentHelpName = "Texture2D|Sprite|etc.." };
NameFilter = new Option<Regex[]>("--names", result => result.Tokens.Select(x => new Regex(x.Value, RegexOptions.IgnoreCase)).ToArray(), false, "Specify name regex filter(s).") { AllowMultipleArgumentsPerToken = true };
ContainerFilter = new Option<Regex[]>("--containers", result => result.Tokens.Select(x => new Regex(x.Value, RegexOptions.IgnoreCase)).ToArray(), false, "Specify container regex filter(s).") { AllowMultipleArgumentsPerToken = true };
@@ -175,6 +179,7 @@ namespace AssetStudioCLI
new()
{
Silent = bindingContext.ParseResult.GetValueForOption(Silent),
Verbose = bindingContext.ParseResult.GetValueForOption(Verbose),
TypeFilter = bindingContext.ParseResult.GetValueForOption(TypeFilter),
NameFilter = bindingContext.ParseResult.GetValueForOption(NameFilter),
ContainerFilter = bindingContext.ParseResult.GetValueForOption(ContainerFilter),

View File

@@ -40,10 +40,13 @@ namespace AssetStudioCLI
}
Studio.Game = game;
Logger.LogVerbose = o.Verbose;
Logger.Default = new ConsoleLogger();
Logger.FileLogging = Settings.Default.enableFileLogging;
AssetsHelper.Minimal = Settings.Default.minimalAssetMap;
Shader.Parsable = !Settings.Default.disableShader;
Renderer.Parsable = !Settings.Default.disableRenderer;
AnimationClip.Parsable = !Settings.Default.disableAnimationClip;
assetsManager.Silent = o.Silent;
assetsManager.Game = game;
ModelOnly = o.Model;

View File

@@ -69,6 +69,8 @@ namespace AssetStudioCLI.Properties {
public bool exportMiHoYoBinData => AppSettings.Get("exportMiHoYoBinData", true);
public bool disableShader => AppSettings.Get("disableShader", false);
public bool disableRenderer => AppSettings.Get("disableRenderer", false);
public bool disableAnimationClip => AppSettings.Get("disableAnimationClip", false);
public bool enableFileLogging => AppSettings.Get("enableFileLogging", false);
public bool minimalAssetMap => AppSettings.Get("minimalAssetMap", true);
}

View File

@@ -324,7 +324,7 @@ namespace AssetStudioCLI
break;
case Mesh _:
case TextAsset _:
case AnimationClip _:
case AnimationClip _ when AnimationClip.Parsable:
case Font _:
case Sprite _:
case Material _: