- [GUI] fix bug when building CABMap with stripped version.

- [CLI] add option to set unity version when stripped.
This commit is contained in:
Razmoth
2023-09-17 14:49:12 +04:00
parent 31734c20d3
commit 96079d4906
3 changed files with 12 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ namespace AssetStudioCLI
optionsBinder.MapOp, optionsBinder.MapOp,
optionsBinder.MapType, optionsBinder.MapType,
optionsBinder.MapName, optionsBinder.MapName,
optionsBinder.UnityVersion,
optionsBinder.GroupAssetsType, optionsBinder.GroupAssetsType,
optionsBinder.Model, optionsBinder.Model,
optionsBinder.Key, optionsBinder.Key,
@@ -57,6 +58,7 @@ namespace AssetStudioCLI
public MapOpType MapOp { get; set; } public MapOpType MapOp { get; set; }
public ExportListType MapType { get; set; } public ExportListType MapType { get; set; }
public string MapName { get; set; } public string MapName { get; set; }
public string UnityVersion { get; set; }
public AssetGroupOption GroupAssetsType { get; set; } public AssetGroupOption GroupAssetsType { get; set; }
public bool Model { get; set; } public bool Model { get; set; }
public byte Key { get; set; } public byte Key { get; set; }
@@ -78,6 +80,7 @@ namespace AssetStudioCLI
public readonly Option<MapOpType> MapOp; public readonly Option<MapOpType> MapOp;
public readonly Option<ExportListType> MapType; public readonly Option<ExportListType> MapType;
public readonly Option<string> MapName; public readonly Option<string> MapName;
public readonly Option<string> UnityVersion;
public readonly Option<AssetGroupOption> GroupAssetsType; public readonly Option<AssetGroupOption> GroupAssetsType;
public readonly Option<bool> Model; public readonly Option<bool> Model;
public readonly Option<byte> Key; public readonly Option<byte> Key;
@@ -99,6 +102,7 @@ namespace AssetStudioCLI
MapOp = new Option<MapOpType>("--map_op", "Specify which map to build."); MapOp = new Option<MapOpType>("--map_op", "Specify which map to build.");
MapType = new Option<ExportListType>("--map_type", "AssetMap output type."); MapType = new Option<ExportListType>("--map_type", "AssetMap output type.");
MapName = new Option<string>("--map_name", () => "assets_map", "Specify AssetMap file name."); MapName = new Option<string>("--map_name", () => "assets_map", "Specify AssetMap file name.");
UnityVersion = new Option<string>("--version", "Specify Unity version.");
GroupAssetsType = new Option<AssetGroupOption>("--group_assets", "Specify how exported assets should be grouped."); GroupAssetsType = new Option<AssetGroupOption>("--group_assets", "Specify how exported assets should be grouped.");
Model = new Option<bool>("--models", "Enable to export models only"); Model = new Option<bool>("--models", "Enable to export models only");
AIFile = new Option<FileInfo>("--ai_file", "Specify asset_index json file path (to recover GI containers).").LegalFilePathsOnly(); AIFile = new Option<FileInfo>("--ai_file", "Specify asset_index json file path (to recover GI containers).").LegalFilePathsOnly();
@@ -188,6 +192,7 @@ namespace AssetStudioCLI
MapOp = bindingContext.ParseResult.GetValueForOption(MapOp), MapOp = bindingContext.ParseResult.GetValueForOption(MapOp),
MapType = bindingContext.ParseResult.GetValueForOption(MapType), MapType = bindingContext.ParseResult.GetValueForOption(MapType),
MapName = bindingContext.ParseResult.GetValueForOption(MapName), MapName = bindingContext.ParseResult.GetValueForOption(MapName),
UnityVersion = bindingContext.ParseResult.GetValueForOption(UnityVersion),
GroupAssetsType = bindingContext.ParseResult.GetValueForOption(GroupAssetsType), GroupAssetsType = bindingContext.ParseResult.GetValueForOption(GroupAssetsType),
Model = bindingContext.ParseResult.GetValueForOption(Model), Model = bindingContext.ParseResult.GetValueForOption(Model),
Key = bindingContext.ParseResult.GetValueForOption(Key), Key = bindingContext.ParseResult.GetValueForOption(Key),

View File

@@ -47,8 +47,11 @@ namespace AssetStudioCLI
Shader.Parsable = !Settings.Default.disableShader; Shader.Parsable = !Settings.Default.disableShader;
Renderer.Parsable = !Settings.Default.disableRenderer; Renderer.Parsable = !Settings.Default.disableRenderer;
AnimationClip.Parsable = !Settings.Default.disableAnimationClip; AnimationClip.Parsable = !Settings.Default.disableAnimationClip;
AssetsHelper.SetUnityVersion(o.UnityVersion);
assetsManager.Silent = o.Silent; assetsManager.Silent = o.Silent;
assetsManager.Game = game; assetsManager.Game = game;
assetsManager.SpecifyUnityVersion = o.UnityVersion;
ModelOnly = o.Model; ModelOnly = o.Model;
o.Output.Create(); o.Output.Create();

View File

@@ -2110,6 +2110,7 @@ namespace AssetStudioGUI
} }
} }
var version = assetsManager.SpecifyUnityVersion;
var openFolderDialog = new OpenFolderDialog(); var openFolderDialog = new OpenFolderDialog();
openFolderDialog.Title = "Select Game Folder"; openFolderDialog.Title = "Select Game Folder";
if (openFolderDialog.ShowDialog(this) == DialogResult.OK) if (openFolderDialog.ShowDialog(this) == DialogResult.OK)
@@ -2117,6 +2118,7 @@ namespace AssetStudioGUI
Logger.Info("Scanning for files..."); Logger.Info("Scanning for files...");
var files = Directory.GetFiles(openFolderDialog.Folder, "*.*", SearchOption.AllDirectories).ToArray(); var files = Directory.GetFiles(openFolderDialog.Folder, "*.*", SearchOption.AllDirectories).ToArray();
Logger.Info($"Found {files.Length} files"); Logger.Info($"Found {files.Length} files");
AssetsHelper.SetUnityVersion(version);
await Task.Run(() => AssetsHelper.BuildCABMap(files, name, openFolderDialog.Folder, Studio.Game)); await Task.Run(() => AssetsHelper.BuildCABMap(files, name, openFolderDialog.Folder, Studio.Game));
} }
InvokeUpdate(miscToolStripMenuItem, true); InvokeUpdate(miscToolStripMenuItem, true);
@@ -2164,6 +2166,7 @@ namespace AssetStudioGUI
} }
} }
var version = assetsManager.SpecifyUnityVersion;
var openFolderDialog = new OpenFolderDialog(); var openFolderDialog = new OpenFolderDialog();
openFolderDialog.Title = "Select Game Folder"; openFolderDialog.Title = "Select Game Folder";
if (openFolderDialog.ShowDialog(this) == DialogResult.OK) if (openFolderDialog.ShowDialog(this) == DialogResult.OK)
@@ -2187,6 +2190,7 @@ namespace AssetStudioGUI
} }
} }
saveDirectoryBackup = saveFolderDialog.Folder; saveDirectoryBackup = saveFolderDialog.Folder;
AssetsHelper.SetUnityVersion(version);
await Task.Run(() => AssetsHelper.BuildBoth(files, name, openFolderDialog.Folder, Studio.Game, saveFolderDialog.Folder, exportListType)); await Task.Run(() => AssetsHelper.BuildBoth(files, name, openFolderDialog.Folder, Studio.Game, saveFolderDialog.Folder, exportListType));
} }
} }