### Unity version example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify Unity version. ```text --unity-version 2022.3.2f1 ``` -------------------------------- ### Install logger and progress UI Source: https://github.com/aelurum/assetstudiomod Shows how to install a custom ILogger and a progress reporter. The ConsoleLogger writes log messages to the console, and Progress.Default is set to a Progress that prints the percentage. After setting up, call Progress.Reset() before loading and Progress.Report(5, 100) to report progress. ```csharp class ConsoleLogger : ILogger { public void Log(LoggerEvent level, string message, bool ignoreLevel = false) { Console.WriteLine($"[{level}] {message}"); } } Logger.Default = new ConsoleLogger(); Logger.Info("Starting export"); Progress.Default = new Progress(value => Console.WriteLine($"Progress: {value}%")); Progress.Reset(); // ... loading ... Progress.Report(5, 100); ``` -------------------------------- ### Filter by name multiple example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify multiple names separated by ',' or ';' without spaces. ```text --filter-by-name char,bg ``` -------------------------------- ### Filter by container multiple example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify multiple containers separated by ',' or ';' without spaces. ```text --filter-by-container arts,icons ``` -------------------------------- ### Export asset list example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify the format in which you want to export asset list. Value is none (default) or xml. ```text --export-asset-list xml ``` -------------------------------- ### Filter by text multiple example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify multiple values separated by ',' or ';' without spaces. ```text --filter-by-text portrait,art ``` -------------------------------- ### BlockInfo compression example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify the compression type of bundle's blockInfo data. Auto is default; other options are zstd, oodle, lz4, lzma. ```text --blockinfo-comp lz4 ``` -------------------------------- ### Filter by container example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify the container or regexp by which assets should be filtered. Multiple containers can be separated by ',' or ';' without spaces. ```text --filter-by-container arts ``` -------------------------------- ### Strip path prefix example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify a path prefix to be stripped from exported asset paths. ```text --strip-path-prefix assets/models/char/ ``` -------------------------------- ### Block compression example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify the compression type of bundle's block data. Auto is default; other options are zstd, oodle, lz4, lzma. ```text --block-comp zstd ``` -------------------------------- ### Progress.Default Source: https://github.com/aelurum/assetstudiomod Sets or gets the default progress reporter. Used to install a custom progress UI. ```APIDOC ## Progress.Default ### Description Sets or gets the default progress reporter. Used to install a custom progress UI. ### Property `public static IProgress Default { get; set; }` ### Example ```csharp Progress.Default = new Progress(value => Console.WriteLine($"Progress: {value}%")); ``` ``` -------------------------------- ### CLI usage examples Source: https://github.com/aelurum/assetstudiomod Shows basic invocations of AssetStudioModCLI for info, export, splitObjects, and live2d modes. The -m flag selects the work mode; -t filters asset types; --image-format sets output format; --filter-by-name and --fbx-scale-factor apply to splitObjects; --l2d-search-by-filename applies to live2d. ```bash AssetStudioModCLI "C:\Game\bundles" -m info ``` ```bash AssetStudioModCLI "C:\Game\bundles" -t tex2d,sprite --image-format webp -o out ``` ```bash AssetStudioModCLI "C:\Game\bundles" -m splitObjects --filter-by-name model --fbx-scale-factor 10 ``` ```bash AssetStudioModCLI "C:\Game\bundles" -m live2d --l2d-search-by-filename ``` -------------------------------- ### Filter by name example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify the name or regexp by which assets should be filtered. Multiple names can be separated by ',' or ';' without spaces. ```text --filter-by-name char ``` -------------------------------- ### ResourceReader class declaration Source: https://github.com/aelurum/assetstudiomod Provides access to resource data. The (string path, SerializedFile, ...) constructor resolves referenced .resS/.resource files lazily by file-name search; for Unity ≥ 6000.6, paths starting cah:/ without extension get .resource appended for AudioClip/VideoClip, else .resS. The (EndianBinaryReader, ...) constructor handles inline data inside an object. GetData(byte[] buff) populates buff from Offset; Endian reports the source reader's byte order (needed by Texture2DConverter for PPC big-endian data). ```csharp public class ResourceReader { public int Size { get; set; } // setter casts to long internally public long Offset { get; set; } [JsonConverter(typeof(JsonStringEnumConverter))] public EndianType Endian { get; } public ResourceReader(); public ResourceReader(string path, SerializedFile assetsFile, long offset, long size, ClassIDType type); public ResourceReader(EndianBinaryReader reader, long offset, long size); public byte[] GetData(); // returns Size bytes public void GetData(byte[] buff); // fills buff public long GetSize(); // size as long public void SetSize(long value); } ``` -------------------------------- ### Filter by PathID example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify the PathID by which assets should be filtered. Multiple PathIDs can be separated by ',' or ';' without spaces. ```text --filter-by-pathid 7238605633795851352,-2430306240205277265 ``` -------------------------------- ### Sprite cropping example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify the sprite cropping mode. Value is spriteRect (default) or textureRect. ```text --sprite-cropping textureRect ``` -------------------------------- ### DummyLogger class Source: https://github.com/aelurum/assetstudiomod No-op implementation of ILogger; used as Logger.Default until a real logger is installed. ```csharp public sealed class DummyLogger : ILogger { public void Log(LoggerEvent loggerEvent, string message, bool ignoreLevel) { } } ``` -------------------------------- ### Filter by text example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify the text or regexp by which assets should be filtered. Looks for assets that contain the specified text in their names or containers. Multiple values can be separated by ',' or ';' without spaces. ```text --filter-by-text portrait ``` -------------------------------- ### Max export tasks example Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Specify the number of parallel tasks for asset export. Value is an integer from 1 to max number of cores (default=max). ```text --max-export-tasks 8 ``` -------------------------------- ### Load all assets and show info with --load-all Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Loads assets of all types and shows them, similar to the GUI's 'Display all assets' option, using -m info --load-all. ```bash AssetStudioModCLI -m info --load-all ``` -------------------------------- ### Logger.Default Source: https://github.com/aelurum/assetstudiomod Sets or gets the default logger instance. Used to install a custom logger for logging messages. ```APIDOC ## Logger.Default ### Description Sets or gets the default logger instance. Used to install a custom logger for logging messages. ### Property `public static ILogger Default { get; set; }` ### Example ```csharp Logger.Default = new ConsoleLogger(); Logger.Info("Starting export"); ``` ``` -------------------------------- ### Load all assets and dump Material assets Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Loads assets of all types and dumps Material assets using -m dump -t material --load-all. ```bash AssetStudioModCLI -m dump -t material --load-all ``` -------------------------------- ### Program.Main entry point Source: https://github.com/aelurum/assetstudiomod Entry point of the CLI application. Parses arguments, shows help if requested, sets up logging, and dispatches to Studio methods based on work mode. Uncaught exceptions are logged and cleanup is performed in finally. ```csharp class Program { public static void Main(string[] args); } ``` -------------------------------- ### Catch exceptions and handle loader-level failures in consumer code Source: https://github.com/aelurum/assetstudiomod Shows how to catch NotSupportedException from LoadFilesAndFolders, handle stripped Unity versions by setting CustomUnityVersion, and continue after loader-level failures that do not throw. Also demonstrates version parsing fallback with UnityVersion.TryParse. ```csharp var manager = new AssetsManager(); try { manager.LoadFilesAndFolders(@"C:\Game\bundles"); } catch (NotSupportedException e) { // 1) stripped Unity version without CustomUnityVersion, or // 2) serialized format version 1 (Unsupported) if (e.Message.Contains("stripped")) { manager.Options.GameSpecific.CustomUnityVersion = new UnityVersion("2019.4.40f1"); manager.LoadFilesAndFolders(@"C:\Game\bundles"); } else { Logger.Error($"Unsupported file format: {e.Message}"); } } // loader-level failures do not throw: keep going foreach (var assetsFile in manager.AssetsFileList) { foreach (var obj in assetsFile.Objects) { if (obj is Texture2D tex) { if (!tex.TryConvertToImage(false, out var img)) { Logger.Warning($"Convert failed for {tex.m_Name}"); // null image, no exception continue; } using (img) { /* ... */ } } } } // version-parsing boundary if (!UnityVersion.TryParse("not a version", out _)) { Logger.Warning("Falling back to manual version"); } ``` -------------------------------- ### Show asset type counts with -m info Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Lists the number of assets of each type available for export. Use the -m info mode. ```bash AssetStudioModCLI -m info ``` -------------------------------- ### Export MonoBehaviour assets with assembly folder and log output Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Exports MonoBehaviour assets that require an assembly folder to read and creates a log file using --assembly-folder and --log-output both. ```bash AssetStudioModCLI -t monobehaviour --assembly-folder --log-output both ``` -------------------------------- ### Progress.Reset Source: https://github.com/aelurum/assetstudiomod Resets the progress reporter to its initial state. Used before starting a new operation. ```APIDOC ## Progress.Reset ### Description Resets the progress reporter to its initial state. Used before starting a new operation. ### Method Reset ### Signature `public static void Reset()` ### Example ```csharp Progress.Reset(); ``` ``` -------------------------------- ### Export all supported asset types Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Exports assets of all supported for export types. Run without additional options. ```bash AssetStudioModCLI ``` -------------------------------- ### ImportHelper static class methods Source: https://github.com/aelurum/assetstudiomod Provides utilities for merging split assets and decompressing GZip/Brotli streams. MergeSplitAssets rejoins .split0..N parts, skipping if the base file exists. DecompressGZip and DecompressBrotli return a new FileReader over the decompressed stream, or null on failure after logging a warning and disposing the input. ```csharp public static class ImportHelper { public static void MergeSplitAssets(string path, bool allDirectories = false); public static string[] ProcessingSplitFiles(List selectFile); public static FileReader DecompressGZip(FileReader reader); public static FileReader DecompressBrotli(FileReader reader); } ``` -------------------------------- ### ColorConsoleHelper.BrightRed Source: https://github.com/aelurum/assetstudiomod Gets the ANSI escape code for bright red. Used by the CLI for help text and option descriptions. ```APIDOC ## ColorConsoleHelper.BrightRed ### Description Gets the ANSI escape code for bright red. Used by the CLI for help text and option descriptions. ### Property `public static string BrightRed { get; }` ### Returns - **string** - The ANSI escape code. ``` -------------------------------- ### ColorConsoleHelper.BrightCyan Source: https://github.com/aelurum/assetstudiomod Gets the ANSI escape code for bright cyan. Used by the CLI for help text and option descriptions. ```APIDOC ## ColorConsoleHelper.BrightCyan ### Description Gets the ANSI escape code for bright cyan. Used by the CLI for help text and option descriptions. ### Property `public static string BrightCyan { get; }` ### Returns - **string** - The ANSI escape code. ``` -------------------------------- ### Export assets with specified Unity version Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Exports assets that require specifying a Unity version using --unity-version. ```bash AssetStudioModCLI --unity-version 2022.3.2f1 ``` -------------------------------- ### ColorConsoleHelper.BrightYellow Source: https://github.com/aelurum/assetstudiomod Gets the ANSI escape code for bright yellow. Used by the CLI for help text and option descriptions. ```APIDOC ## ColorConsoleHelper.BrightYellow ### Description Gets the ANSI escape code for bright yellow. Used by the CLI for help text and option descriptions. ### Property `public static string BrightYellow { get; }` ### Returns - **string** - The ANSI escape code. ``` -------------------------------- ### Static helper methods for legacy raw WAV Source: https://github.com/aelurum/assetstudiomod Static helpers for legacy raw WAV handling: generates a 44-byte WAV header and swaps endianness for 16-bit samples. Used when converting legacy raw WAV data. ```csharp public static byte[] LegacyRawWavGenerateHeader(AudioClip m_AudioClip, ref string debugLog); public static void LegacyRawWavSwapEndian(byte[] audioData, int audioSize, LegacyAudioType legacyType); ``` -------------------------------- ### Count audio assets with 'voice' in name Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Shows the number of audio assets that have 'voice' in their names using -m info and --filter-by-name. ```bash AssetStudioModCLI -m info -t audio --filter-by-name voice ``` -------------------------------- ### FileIdentifier class definition Source: https://github.com/aelurum/assetstudiomod Defines the FileIdentifier class with guid, type, pathName, and fileName fields. fileName is Path.GetFileName(pathName) and is used for external dependency resolution by AssetsManager.LoadAssetsFile. ```csharp public class FileIdentifier { public Guid guid; public int type; //enum { kNonAssetType = 0, kDeprecatedCachedAssetType = 1, kSerializedAssetType = 2, kMetaAssetType = 3 }; public string pathName; public string fileName; } ``` -------------------------------- ### Export images as webp with --image-format webp Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Exports image assets (sprite, tex2d) converted to webp format to a specified output folder. ```bash AssetStudioModCLI -o -t sprite,tex2d --image-format webp ``` -------------------------------- ### Export audio assets with 'music' or 'voice' in name Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Exports audio assets that have 'music' or 'voice' in their names. Two equivalent ways are shown: comma-separated values or repeated --filter-by-name flags. ```bash AssetStudioModCLI -t audio --filter-by-name music,voice ``` ```bash AssetStudioModCLI -t audio --filter-by-name music --filter-by-name voice ``` -------------------------------- ### Error handling for missing assemblies/types Source: https://github.com/aelurum/assetstudiomod Attempts to get a TypeDefinition for a specific type. If null, prints a message indicating the assembly folder may be incorrect, noting that Il2Cpp builds need dummy dlls. ```csharp var typeDef = assemblyLoader.GetTypeDefinition("Assembly-CSharp", "MyGame.UI.HudPanel"); if (typeDef == null) { Console.WriteLine("Type not found — is the assembly folder correct? (Il2Cpp builds need dummy dlls)"); } ``` -------------------------------- ### AddOptionsLoader Source: https://github.com/aelurum/assetstudiomod Registers a callback that is invoked for every .asmo options file discovered in loaded folders. The callback receives the parsed OptionsFile instance. ```APIDOC ## AddOptionsLoader ### Description Registers a callback that is invoked for every .asmo options file discovered in loaded folders. ### Method AddOptionsLoader ### Signature ```csharp public void AddOptionsLoader(Action loader) ``` ### Parameters - `loader` (Action) - Required - Callback invoked for every `.asmo` options file discovered in loaded folders ``` -------------------------------- ### Read streamed texture data with ResourceReader Source: https://github.com/aelurum/assetstudiomod Reads texture image data that may point to a .resS sidecar. Uses Texture2DConverter to get BGRA32 pixel data, with a flip option set to false. ```csharp // Texture2D.image_data points either into the object blob or to a .resS sidecar var data = new byte[texture.image_data.Size]; texture.image_data.GetData(data); var converter = new Texture2DConverter(texture); var raw = new byte[converter.GetImageDataSize()]; if (converter.GetBgra32RawImageData(raw, flip: false)) { // raw is BGRA32 pixel data } ``` -------------------------------- ### Fbx.Settings.Init Source: https://github.com/aelurum/assetstudiomod Initializes the settings to their default values. This method sets all properties to their default values as defined in the property table. ```APIDOC ## [METHOD] Fbx.Settings.Init ### Description Initializes the settings to their default values. This method sets all properties to their default values as defined in the property table. ### Method Instance method ### Signature ```csharp public void Init(); ``` ### Parameters None. ### Response No return value. ``` -------------------------------- ### AnimationClip sealed class definition Source: https://github.com/aelurum/assetstudiomod Defines the AnimationClip class with fields for animation curves, events, and clips. The EqComparer compares clips by (m_Name, m_PathID, assetsFile.fileName) and is used by ModelConverter for deduplication. Field availability is version-dependent; for example, m_EulerCurves is exposed in clips from 2020 and later. ```csharp public sealed class AnimationClip : NamedObject { public float m_Length; public AnimationCurve m_PositionCurves; // per-binding wrapper public AnimationCurve m_RotationCurves; public AnimationCurve m_ScaleCurves; public AnimationCurve m_EulerCurves; // "Euler" bindings public AnimationCurve m_FloatCurves; // generic float "Curves" public string m_Events; // serialized events (v2: m_Events is string) public List m_QuaternionCurves; // older rotation curves public List m_StreamedClips; // version-dependent public List m_DenseClips; public List m_ValueConstantList; public AnimationClipBindingConstant m_BindingConstant; public PPtr m_Avatar; ... public AnimationClip(ObjectReader reader); public AnimationClip(ObjectReader reader, JsonSerializerOptions jsonOptions); public class EqComparer : IEqualityComparer; } ``` -------------------------------- ### Raw BGRA32 buffer pipeline with GetBgra32RawImageData Source: https://github.com/aelurum/assetstudiomod Gets raw BGRA32 image data for use by sprite cutters and FBX texture export. Returns 0 from GetImageDataSize for invalid/unsupported textures; GetBgra32RawImageData returns false on decode failure. Also prints the texture hash. ```csharp var converter = new Texture2DConverter(tex); int dataSize = converter.GetImageDataSize(); if (dataSize == 0) return; // invalid/unsupported texture var raw = new byte[dataSize]; if (!converter.GetBgra32RawImageData(raw, flip: false)) return; // decode failure SaveBgra(raw, tex.m_Width, tex.m_Height); // own consumer Console.WriteLine($"hash = {converter.GetTextureHash()}"); ``` -------------------------------- ### WebFile Constructor Source: https://github.com/aelurum/assetstudiomod Parses the UnityWebData1.0/TuanjieWebData1.0 format from a binary reader, creating in-memory StreamFile entries for each data block. ```APIDOC ## WebFile Constructor ### Description Parses the `UnityWebData1.0`/`TuanjieWebData1.0` format: forced little-endian, a null-terminated signature, head length, then a sequence of `(dataOffset, dataLength, path)` entries. Each entry becomes a `StreamFile` (in-memory copy). ### Method Constructor ### Endpoint `public WebFile(EndianBinaryReader reader)` ### Parameters #### Constructor Parameters - **reader** (EndianBinaryReader) - Required - The binary reader positioned at the start of the web file data. ### Response No return value; the constructed WebFile object contains the parsed StreamFile entries. ``` -------------------------------- ### Packed vector storage: PackedFloatVector, PackedIntVector, PackedQuatVector Source: https://github.com/aelurum/assetstudiomod Packed (compressed) vector storage used by clips and meshes. UnpackFloats decodes bit-packed floats given the chunk layout; negative numChunks means 'all remaining' (m_NumItems / itemCountInChunk - start). PackedQuatVector has per-version bit sizes and 3- or 4-component unpacking depending on version. ```csharp public class PackedFloatVector { public uint m_NumItems; public float m_Range; public float m_Start; public byte[] m_Data; public byte m_BitSize; public PackedFloatVector() { } public PackedFloatVector(ObjectReader reader); public float[] UnpackFloats(int itemCountInChunk, int chunkStride, int start = 0, int numChunks = -1); } public class PackedIntVector { public uint m_NumItems; public byte[] m_Data; public byte m_BitSize; public PackedIntVector() { } public PackedIntVector(ObjectReader reader); public int[] UnpackInts(); } public class PackedQuatVector { public uint m_NumItems; // per-version bit sizes public PackedQuatVector() { } public PackedQuatVector(ObjectReader reader); public Quaternion[] UnpackQuats(); // 3- or 4-component unpacking depending on version } ``` -------------------------------- ### AssetStudioModCLI command-line usage Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Shows the full command-line syntax for AssetStudioModCLI, including all available options. The mode defaults to 'export' and asset type defaults to 'all'. Use this as a reference for constructing CLI invocations. ```text AssetStudioModCLI [-m, --mode ] [-t, --asset-type ] [-g, --group-option ] [-f, --filename-format ] [-o, --output ] [-r, --overwrite-existing] [-h, --help] [--log-level ] [--log-output ] [--image-format ] [--audio-format ] [--l2d-group-option ] [--l2d-motion-mode ] [--l2d-smooth-motions] [--l2d-search-by-filename] [--l2d-filter-textures] [--fbx-scale-factor ] [--fbx-bone-size ] [--fbx-animation] [--fbx-dump-materials] [--fbx-uvs-as-diffuse] [--fbx-ascii-format] [--filter-by-name ] [--filter-by-container ] [--filter-by-pathid ] [--filter-by-text ] [--filter-with-regex] [--filter-exclude-mode] [--unity-version ] [--cache-dir ] [--blockinfo-comp ] [--block-comp ] [--decompress-to-disk] [--max-export-tasks ] [--export-asset-list ] [--assembly-folder ] [--strip-path-prefix ] [--sprite-cropping] [--not-restore-extension] [--ignore-typetree] [--raw-array] [--load-all] ``` -------------------------------- ### AudioClipConverter Constructor Source: https://github.com/aelurum/assetstudiomod Initializes a new AudioClipConverter instance with the given AudioClip and raw audio data. It opens a memory stream and queries the sound format to determine if conversion is supported. ```APIDOC ## Constructor ### Description Initializes a new AudioClipConverter instance with the given AudioClip and raw audio data. It opens a memory stream and queries the sound format to determine if conversion is supported. ### Signature ```csharp public AudioClipConverter(AudioClip audioClip, byte[] audioBuff) ``` ### Parameters - **audioClip** (AudioClip) - Required - Source asset; supplies `m_Size`, `m_Format`, `m_Channels`, `m_Frequency` - **audioBuff** (byte[]) - Required - Raw audio bytes (from `AudioClip.m_AudioData`) ### Remarks Opens a memory stream (`MODE.OPENMEMORY | MODE.LOWMEM | MODE.MPEGSEARCH`), adding `MODE.OPENRAW` with `SOUND_FORMAT.PCM8`/`PCM16` + channel/frequency when `audioClip.IsLegacyRawWav()`. Then queries the sound format; `IsSupport` is true when the format sits inside the playable range (`soundFormat > SOUND_FORMAT.NONE && soundFormat < SOUND_FORMAT.BITSTREAM`). Failure to `createStream` leaves `IsSupport == false` (no exception). ``` -------------------------------- ### BundleFile class declaration Source: https://github.com/aelurum/assetstudiomod BundleFile extends FileArchive. Constructor parameters: reader (positioned at bundle header), studioOptions (supplies DecompressToDisk, CustomCachePath, and game-specific block compression), isMultiBundle (default false), useSharedStream (default true). ```csharp public class BundleFile : FileArchive { public readonly bool IsDataAfterBundle; public Header m_Header; // private: m_BlocksInfo, m_DirectoryInfo public BundleFile(FileReader reader, AssetsManagerOptions studioOptions, bool isMultiBundle = false, bool useSharedStream = true); } ``` -------------------------------- ### Fbx static partial class conversion methods Source: https://github.com/aelurum/assetstudiomod Static partial class exposing quaternion/euler conversion helpers that delegate to native FBX SDK functions. On net472 the static constructor preloads the native DLL via DllLoader.PreloadDll(FbxDll.DllName). ```csharp public static partial class Fbx { public static Vector3 QuaternionToEuler(Quaternion q); public static Quaternion EulerToQuaternion(Vector3 v); } ``` -------------------------------- ### LoadOptionFiles Source: https://github.com/aelurum/assetstudiomod Loads option files from the specified list of paths. These files are used to configure the manager. ```APIDOC ## LoadOptionFiles ### Description Loads option files from the specified list of paths. These files are used to configure the manager. ### Method Method ### Signature `public void LoadOptionFiles(List pathList)` ### Parameters - **pathList** (List) - Required - List of paths to option files. ``` -------------------------------- ### Export to specified output folder with -o Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Exports assets to a specified output folder using the -o option. ```bash AssetStudioModCLI -o ``` -------------------------------- ### Dump assets to output folder with -m dump Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Dumps assets to a specified output folder using the -m dump mode and -o option. ```bash AssetStudioModCLI -m dump -o ``` -------------------------------- ### Fbx.Settings Constructor (Parameterized) Source: https://github.com/aelurum/assetstudiomod Initializes a new instance of the Fbx.Settings class with the specified export options. This constructor allows full control over the FBX export settings. ```APIDOC ## [CONSTRUCTOR] Fbx.Settings(bool, float, bool, bool, bool, bool, bool, bool, float, bool, float, int, int, Dictionary) ### Description Initializes a new instance of the Fbx.Settings class with the specified export options. This constructor allows full control over the FBX export settings. ### Method Constructor ### Signature ```csharp public Settings(bool eulerFilter, float filterPrecision, bool exportAllNodes, bool exportSkins, bool exportAnimations, bool exportBlendShape, bool dumpMaterials, bool castToBone, float boneSize, bool exportAllUvsAsDiffuseMaps, float scaleFactor, int fbxVersionIndex, int fbxFormat, Dictionary uvBindings); ``` ### Parameters - **eulerFilter** (bool) - Required - Applies euler filtering to animation curves. - **filterPrecision** (float) - Required - Euler filter precision. - **exportAllNodes** (bool) - Required - Export all scene nodes. - **exportSkins** (bool) - Required - Export skinning (bind poses / bones). - **exportAnimations** (bool) - Required - Export ImportedKeyframedAnimation list. - **exportBlendShape** (bool) - Required - Export morph targets. - **dumpMaterials** (bool) - Required - Write material assets next to the model. - **castToBone** (bool) - Required - Cast dummy nodes to bones. - **boneSize** (float) - Required - Bone size value. - **exportAllUvsAsDiffuseMaps** (bool) - Required - Bind every UV channel as a diffuse map (Blender UV visibility workaround). - **scaleFactor** (float) - Required - Model scale factor. - **fbxVersionIndex** (int) - Required - FBX SDK version index to write. - **fbxFormat** (int) - Required - 0 = binary, 1 = ASCII (IsAscii). - **uvBindings** (Dictionary) - Required - UV channel → FBX UV index map. ### Response No return value. ``` -------------------------------- ### AssetsManager Constructor Source: https://github.com/aelurum/assetstudiomod Initializes a new instance of the AssetsManager class. Registers an options loader that picks up .asmo game-options files during loading. ```APIDOC ## AssetsManager Constructor ### Description Initializes a new instance of the AssetsManager class. Registers an options loader that picks up .asmo game-options files during loading. ### Method Constructor ### Signature `public AssetsManager()` ### Parameters None ### Remarks Registers one options loader: `Options.LoadGameSpecificOptionsFromFile`. ``` -------------------------------- ### Fbx.Settings sealed class Source: https://github.com/aelurum/assetstudiomod Configuration settings for FBX export. Includes properties for animation, skinning, materials, UV bindings, and format. Defaults are set by Init(). IsAscii returns true when FbxFormat equals 1. FromBase64/ToBase64 serialize via System.Text.Json. ```csharp public sealed class Settings { public bool EulerFilter { get; set; } public float FilterPrecision { get; set; } public bool ExportAllNodes { get; set; } public bool ExportSkins { get; set; } public bool ExportAnimations { get; set; } public bool ExportBlendShape { get; set; } public bool DumpMaterials { get; set; } public bool CastToBone { get; set; } public float BoneSize { get; set; } public bool ExportAllUvsAsDiffuseMaps { get; set; } public float ScaleFactor { get; set; } public int FbxVersionIndex { get; set; } public int FbxFormat { get; set; } public Dictionary UvBindings { get; set; } public bool IsAscii => FbxFormat == 1; public Settings(); public Settings(bool eulerFilter, float filterPrecision, bool exportAllNodes, bool exportSkins, bool exportAnimations, bool exportBlendShape, bool dumpMaterials, bool castToBone, float boneSize, bool exportAllUvsAsDiffuseMaps, float scaleFactor, int fbxVersionIndex, int fbxFormat, Dictionary uvBindings); public void Init(); public static Settings FromBase64(string base64String); public string ToBase64(); } ``` -------------------------------- ### TryConvertToBgra32Image method Source: https://github.com/aelurum/assetstudiomod Rents a pooled buffer, decodes, wraps via Image.LoadPixelData, flips if requested, and returns the image. image is null on failure. flip has same DXT3 exception. ```csharp public bool TryConvertToBgra32Image(bool flip, out Image image) ``` -------------------------------- ### Direct SerializedFile usage with custom loader Source: https://github.com/aelurum/assetstudiomod Shows how to create a SerializedFile directly using FileReader and AssetsManager, add it to the manager's AssetsFileList, read the object table without fully parsing objects, and dump a specific object. Requires a custom loader; normally SerializedFile is created via AssetsManager.LoadFilesAndFolders. ```csharp var reader = new FileReader(@"C:\Game\GameAssembly\Resources\sharedassets0.assets"); var assetsFile = new SerializedFile(reader, manager); manager.AssetsFileList.Add(assetsFile); // read the object table without fully parsing objects foreach (var objectInfo in assetsFile.m_Objects) { Console.WriteLine($"{objectInfo.m_PathID}: classid={objectInfo.classID} @0x{objectInfo.byteStart:X} size={objectInfo.byteSize}"); } var obj = assetsFile.ObjectsDic[objectInfo_m_PathID]; if (obj != null) Console.WriteLine(obj.DumpObject()); ``` -------------------------------- ### LoadOptionFiles Source: https://github.com/aelurum/assetstudiomod Parses each path ending with .asmo and invokes every registered options loader. The input list is modified to remove consumed .asmo entries. ```APIDOC ## LoadOptionFiles ### Description Parses each path ending with `OptionsFile.Extension` (`.asmo`) via `OptionsFile(FileReader)`, then invokes every registered options loader. Files failing to parse log `Error while loading options file "..."` and yield `null` (skipped). ### Method LoadOptionFiles ### Signature ```csharp public void LoadOptionFiles(List pathList) ``` ### Parameters - `pathList` (List) - Required - In/out list of paths; `.asmo` entries are consumed and removed from the list. ``` -------------------------------- ### Fbx.Settings Constructor Source: https://github.com/aelurum/assetstudiomod Initializes a new instance of the Fbx.Settings class with default values. This constructor sets up the default export options for FBX export. ```APIDOC ## [CONSTRUCTOR] Fbx.Settings() ### Description Initializes a new instance of the Fbx.Settings class with default values. This constructor sets up the default export options for FBX export. ### Method Constructor ### Signature ```csharp public Settings(); ``` ### Parameters None. ### Response No return value. ``` -------------------------------- ### Export audio assets with 'voice' in name and 'char' in container Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Exports audio assets that have 'voice' in their names and 'char' in their containers using both --filter-by-name and --filter-by-container. ```bash AssetStudioModCLI -t audio --filter-by-name voice --filter-by-container char ``` -------------------------------- ### TryConvertToWav method signature Source: https://github.com/aelurum/assetstudiomod Signature for converting AudioClip data to WAV. Returns true and a complete .wav byte array on success; on failure returns false and null, appending 'FMOD error! {result} - {Error.String(result)}' to debugLog. No exceptions escape. ```csharp public bool TryConvertToWav(out byte[] wavBuffer, ref string debugLog) ``` -------------------------------- ### Error-handling variant with dependency search Source: https://github.com/aelurum/assetstudiomod Loads a bundle with automatic external dependency search. Catches NotSupportedException when the Unity version is stripped and no CustomUnityVersion is set, then retries with a custom version. Clears the manager in a finally block. ```csharp var manager = new AssetsManager(); try { manager.LoadFilesAndFolders(out var parentPath, @"C:\Game\bundles\main.unity3d"); // parentPath contains the bundle's directory; externals are auto-searched from there } catch (NotSupportedException e) // thrown when the bundle's Unity version is stripped and no CustomUnityVersion is set { Console.WriteLine($"Stripped version — set options: {e.Message}"); manager.Options.GameSpecific.CustomUnityVersion = new UnityVersion("2019.4.40f1"); manager.LoadFilesAndFolders(@"C:\Game\bundles\main.unity3d"); } finally { manager.Clear(); } ``` -------------------------------- ### General options for AssetStudioModCLI Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/AssetStudioCLI/ReadMe.md Lists the general command-line options for AssetStudioModCLI, including mode, asset type, grouping, and filename format. The mode option supports values like 'extract', 'export' (default), 'exportRaw', 'dump', 'jsonDump', 'info', 'live2d', 'splitObjects', and 'animator'. Asset types can be specified as comma- or semicolon-separated values without spaces, and the default is 'all'. Grouping options include 'none', 'type', 'container' (default), 'containerFull', 'fileName', and 'sceneHierarchy'. Filename formats include 'assetName' (default), 'assetName_pathID', 'pathID', and 'assetName_hash' (images only). ```text General Options: -m, --mode Specify working mode Extract - Extract(Decompress) asset bundles Export - Convert and export assets ExportRaw - Export raw assets Dump - Generate txt dumps of loaded asset JsonDump - Generate json dumps of loaded asset Info - Load file(s) and show the number of available for export assets Live2D - Export Live2D Cubism models SplitObjects - Export all model objects (split) (fbx) Animator - Export Animator assets (fbx) Example: "-m info" -t, --asset-type Specify asset type(s) to export All - Export all asset types listed in the values *To specify multiple asset types, write them separated by ',' or ';' without spaces Examples: "-t sprite" or "-t tex2d,sprite,audio" or "-t tex2d;sprite;font" -g, --group-option Specify the way in which exported assets should be grouped None - Do not group exported assets Type - Group exported assets by type name Container - Group exported assets by container path ContainerFull - Group exported assets by full container path (e.g. with prefab name) FileName - Group exported assets by source file name SceneHierarchy - Group exported assets by their node path in scene hierarchy Example: "-g containerFull" -f, --filename-format Specify the file name format for exported assets AssetName - Asset file names will look like "assetName.extension" AssetName_pathID - Asset file names will look like "assetName @pathID.extension" PathID - Asset file names will look like "pathID.extension" AssetName_hash - (images only) image names will look like "assetName @hash.extension" Example: "-f assetName_pathID" ``` -------------------------------- ### LegacyRawWavGenerateHeader Source: https://github.com/aelurum/assetstudiomod Generates a 44-byte WAV header for legacy raw WAV audio data. ```APIDOC ## LegacyRawWavGenerateHeader ### Description Generates a 44-byte WAV header for legacy raw WAV audio data. ### Signature ```csharp public static byte[] LegacyRawWavGenerateHeader(AudioClip m_AudioClip, ref string debugLog) ``` ### Parameters - **m_AudioClip** (AudioClip) - Required - The audio clip to generate the header for. - **debugLog** (ref string) - Required - Append-only diagnostic log. ### Returns - **byte[]** - 44-byte WAV header (PCM, 8-bit for `RawWavU8Mono`, else 16-bit) sized to `m_AudioData.Size`. ``` -------------------------------- ### ImportHelper.MergeSplitAssets Source: https://github.com/aelurum/assetstudiomod Rejoins split asset files (e.g., *.split0, *.split1) into the base file. Skips merging if the base file already exists. ```APIDOC ## [STATIC METHOD] MergeSplitAssets ### Description Rejoins `*.split0..N` parts into the base file (skips if base already exists). ### Method Static method ### Signature `public static void MergeSplitAssets(string path, bool allDirectories = false)` ### Parameters - **path** (string) - Required - The path to the split file or base file. - **allDirectories** (bool) - Optional - Whether to search all directories for split parts. ### Returns void ``` -------------------------------- ### Reading with EndianBinaryReader Source: https://github.com/aelurum/assetstudiomod Shows how to open a file and use EndianBinaryReader to read various data types, including alignment-aware strings and Vector3. ```csharp using var fs = File.OpenRead("data.bin"); using var reader = new EndianBinaryReader(fs, EndianType.LittleEndian); var u32 = reader.ReadUInt32(); var str = reader.ReadAlignedString(); // alignment aware var vec = reader.ReadVector3(); ``` -------------------------------- ### Studio internal static class members and methods Source: https://github.com/aelurum/assetstudiomod Internal static class exposing shared managers and methods for extraction, loading, parsing, filtering, and exporting assets. Options are wired from CLIOptions before LoadAssets. Live2D mode requires assembly folder and builds tree structure. ```csharp internal static class Studio { public static AssetsManager assetsManager = new AssetsManager(); public static List parsedAssetsList = new List(); public static List gameObjectTree = new List(); public static AssemblyLoader assemblyLoader = new AssemblyLoader(); public static L2DAssetsManager l2dAssetsManager = new L2DAssetsManager(); public static void ExtractBundles(); public static int ExtractFile(string fileName, string savePath); public static bool LoadAssets(); public static void ParseAssets(); public static void BuildTreeStructure(Dictionary objectAssetItemDic); public static void ShowExportableAssetsInfo(); public static void Filter(); public static void ExportAssets(); public static void ExportAssetList(); public static void ExportSplitObjects(); public static void ExportAnimator(); public static void ExportLive2D(); public static void Clear(); } ``` -------------------------------- ### Extract bundle members with FileReader and BundleFile Source: https://github.com/aelurum/assetstudiomod Mirrors Studio.ExtractFile in the CLI. Opens a bundle file, checks its type, and extracts each member to disk. Uses AssetsManagerOptions with DecompressToDisk set to false. ```csharp using var reader = new FileReader(@"C:\Game\bundles\ui.unity3d"); if (reader.FileType != FileType.BundleFile) return; var options = new AssetsManagerOptions { DecompressToDisk = false }; var bundle = new BundleFile(reader, options); foreach (var file in bundle.FileList) { file.stream.Position = 0; using var outStream = File.Create(Path.Combine(outDir, file.fileName)); file.stream.CopyTo(outStream); Console.WriteLine($"{file.fileName} ({file.stream.Length} bytes, flags={bundle.m_Header.flags})"); } ``` -------------------------------- ### CustomOption abstract class Source: https://github.com/aelurum/assetstudiomod Base class for CustomBundleOptions and CustomMeshOptions. SetOption logs '- {option}: {value}' when the value changes and returns the new value; no-op when unchanged. ```csharp public abstract class CustomOption { protected static T SetOption(string option, T value, T curValue); } ``` -------------------------------- ### ImportedHelpers static class lookups Source: https://github.com/aelurum/assetstudiomod Provides first-match lookup helpers for imported meshes, materials, and textures. FindTexture returns null for empty names. ```csharp public static class ImportedHelpers { public static ImportedMesh FindMesh(string path, List importedMeshList); public static ImportedMaterial FindMaterial(string name, List importedMats); public static ImportedTexture FindTexture(string name, List importedTextureList); } ``` -------------------------------- ### SerializedFile Constructor Source: https://github.com/aelurum/assetstudiomod Creates a new SerializedFile instance by parsing the serialized file header, metadata, type tree, object table, and external references from the provided reader. The assetsManager is used for shared file lookups and typetree resource resolution. ```APIDOC ## [CONSTRUCTOR] SerializedFile(FileReader reader, AssetsManager assetsManager) ### Description Creates a new SerializedFile instance by parsing the serialized file header, metadata, type tree, object table, and external references from the provided reader. The assetsManager is used for shared file lookups and typetree resource resolution. ### Method Constructor ### Signature ```csharp public SerializedFile(FileReader reader, AssetsManager assetsManager) ``` ### Parameters - `reader` (FileReader) - Required - Actual bytes of a serialized file - `assetsManager` (AssetsManager) - Required - Owner used for typetree resource lookups ### Throws - `NotSupportedException` - header version `SerializedFileFormatVersion.Unsupported` (value 1) - `IOException` - a shared subtree referenced by a type node cannot be found (`Can't find a shared subtree for the "{type}" type`); the failing type's `m_Type` is set to `null` and a `[SubTree]` warning is logged. ``` -------------------------------- ### Export audio assets with 'voice' in name Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Exports audio assets that have 'voice' in their names using --filter-by-name. ```bash AssetStudioModCLI -t audio --filter-by-name voice ``` -------------------------------- ### Export audio assets with 'char' in name or container Source: https://github.com/aelurum/assetstudiomod/blob/AssetStudioMod/README.md Exports audio assets that have 'char' in their names or containers using --filter-by-text. ```bash AssetStudioModCLI -t audio --filter-by-text char ```