Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
- [Core] Fix bug with loading some bundles from ZIP file.
Browse files Browse the repository at this point in the history
- [CLI] added new options.
  • Loading branch information
Razmoth committed Aug 24, 2023
1 parent 995b7ee commit cde398e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions AssetStudio/AssetsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ private void LoadZipFile(FileReader reader)
}
splitStream.Seek(0, SeekOrigin.Begin);
FileReader entryReader = new FileReader(basePath, splitStream);
entryReader = entryReader.PreProcessing(Game);
LoadFile(entryReader);
}
catch (Exception e)
Expand Down
2 changes: 1 addition & 1 deletion AssetStudio/Classes/Object.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Object(ObjectReader reader)
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)
{
Expand Down
2 changes: 2 additions & 0 deletions AssetStudioCLI/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -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>
5 changes: 5 additions & 0 deletions AssetStudioCLI/Components/CommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static RootCommand RegisterOptions()
var rootCommand = new RootCommand()
{
optionsBinder.Silent,
optionsBinder.Verbose,
optionsBinder.TypeFilter,
optionsBinder.NameFilter,
optionsBinder.ContainerFilter,
Expand All @@ -47,6 +48,7 @@ public static RootCommand RegisterOptions()
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; }
Expand All @@ -67,6 +69,7 @@ public class Options
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;
Expand All @@ -87,6 +90,7 @@ public class OptionsBinder : BinderBase<Options>
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 };
Expand Down Expand Up @@ -175,6 +179,7 @@ protected override Options GetBoundValue(BindingContext bindingContext) =>
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),
Expand Down
3 changes: 3 additions & 0 deletions AssetStudioCLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ public static void Run(Options o)
}

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;
Expand Down
2 changes: 2 additions & 0 deletions AssetStudioCLI/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public class Settings
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);

}
Expand Down
2 changes: 1 addition & 1 deletion AssetStudioCLI/Studio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public static void ProcessAssetData(Object asset, ClassIDType[] typeFilters, Reg
break;
case Mesh _:
case TextAsset _:
case AnimationClip _:
case AnimationClip _ when AnimationClip.Parsable:
case Font _:
case Sprite _:
case Material _:
Expand Down

0 comments on commit cde398e

Please sign in to comment.