This document describes the expected structure of xml files describing assets.
# Top elements
## `Root`
```xml
...
```
This is the root element in the file, containing exclusively `` and `` elements as direct children.
## `File`
```xml
...
```
A `` contains resources elements as children.
- Required attributes: `Name`
- Optional attributes: `Segment`
`Name` is the name of the baserom file from which the data is to be extracted.
`Segment` (decimal) is the segment number for the file.
## `ExternalFile`
```xml
```
Declare the ``s in the xml may reference symbols from an external file.
The external file is located by matching its name against the list of assets in the version's `config.yml`.
For example, `baseroms/gc-eu/config.yml` contains
```yml
assets:
- name: objects/gameplay_keep
xml_path: assets/xml/objects/gameplay_keep_pal.xml
```
then `` refers to that gameplay_keep entry, which uses the `gameplay_keep_pal.xml` xml file when extracting assets for version gc-eu.
# Resource elements
Resource elements describe resources. Resources are pieces of data corresponding to a symbol each.
One attribute is required on all resource elements: `Name`.
- `Name` is the name of the symbol associated to the resource.
Another attribute, optional, is common to all resource elements: `Offset`.
If `Offset` is set to a (hexadecimal) number such as `Offset="0x421"`, it specifies the location of the resource in bytes from the start of the file data.
If `Offset` is not set, the resource is assumed to start where the previous resource ended, or at 0 if the resource is the first in the ``.
`Offset` can also be set to be a relative offset like `Offset=".+0x421"`, which makes the resource location be that many bytes after the end of the previous resource.
## `Blob`
```xml
```
Unstructured binary data.
- Required attributes: `Size`
`Size` is the size of the binary blob in bytes.
## `DList`
```xml
```
A display list.
- Optional attributes: `Length`, `Ucode`, `RawPointers`
`Length` can be set to indicate the length (amount of `Gfx` double-words) of the dlist. If not set, the dlist length is automatic.
`Ucode` (defaults to `f3dex2`) picks the graphics microcode for which to disassemble the dlist. It may be `f3dex` or `f3dex2`.
`RawPointers` (defaults to an empty value) is a comma-separated list of values the display list uses as raw pointers ("hex" instead of a symbol). The purpose of this attribute is to silence extraction warnings.
## `Mtx`
```xml
```
A fixed-point matrix.
## `Texture`
```xml
```
A texture, an image in one of the native N64 formats.
- Required attributes for all formats: `Format`, `Width`, `Height`
- Required attributes for CI formats (`ci4`, `ci8`): `TlutOffset`, or `ExternalTlut` and `ExternalTlutOffset`
`Format` is the format of the texture, one of `rgba32`, `rgba16`, `i4`, `i8`, `ia4`, `ia8`, `ia16`, `ci4` or `ci8`.
`Width` and `Height` specify the dimensions of the texture.
For CI formats, the TLUT (Texture Look Up Table, or palette) must be specified with either `TlutOffset` if the TLUT is in the same file as the texture, or both of `ExternalTlut` and `ExternalTlutOffset` if the TLUT is in a different file. `ExternalTlut` is the name of the baserom file where the TLUT is. In both cases, the TLUT must also be declared as a resource.
## `Array`
```xml
```
An array of vertices, vectors or scalars. The child element determines the array's element type.
- Required attributes: `Count`
`Count` is the length of the array.
The child element may be one of `` (for `Vtx[]`), `` (for `Vec3s[]`) or `` (for `s16[]`).
## `Scene`
```xml
```
Scene commands.
## `Room`
```xml
```
Room commands.
## `Collision`
```xml
```
Collision header.
## `Cutscene`
```xml
```
Cutscene script.
## `Path`
```xml
```
Path list.
- Required attributes: `NumPaths`
`NumPaths` is the length of the path list.
## `Skeleton`
```xml
```
Skeleton header.
- Required attributes: `Type`, `LimbType`
- Optional attributes: `LimbNone`, `LimbMax`, `EnumName`
`Type` is the type of the skeleton, one of `Normal`, `Flex` or `Curve`.
`LimbType` is the type of limb used in the skeleton, one of `Standard`, `LOD`, `Skin`, `Curve` or `Legacy`.
Not all skeleton types are compatible with all limb types:
`LimbType` | Compatible skeleton `Type`
-----------|---------------------------
`Standard` | `Normal`, `Flex`
`LOD` | `Normal`, `Flex`
`Skin` | `Normal`
`Curve` | `Curve`
`Legacy` | none
`LimbNone`, `LimbMax`, `EnumName` can be set to override the corresponding names in the generated limb enum:
```c
typedef enum NameLimb {
NAME_LIMB_NONE,
...
NAME_LIMB_MAX
} NameLimb;
```
## `LimbTable`
```xml
```
Limb table.
- Required attributes: `LimbType`, `Count`
`LimbType` is one of `Standard`, `LOD`, `Skin`, `Curve` or `Legacy`.
`Count` is the amount of limbs.
## `Limb`
```xml
```
Limb of a skeleton.
- Required attributes: `LimbType`
- Optional attributes: `EnumName`
`LimbType` is one of `Standard`, `LOD`, `Skin`, `Curve` or `Legacy`.
`EnumName` can be set to override the limb name in the generated limb enum.
## `Animation`
```xml
```
Animation header.
## `CurveAnimation`
```xml
```
Curve animation header.
- Required attributes: `SkelOffset`
`SkelOffset` is the offset of the skeleton which uses this animation. The skeleton must also be declared as a resource.
## `LegacyAnimation`
```xml
```
Legacy animation header.
## `PlayerAnimation`
```xml
```
Player animation header.
## `PlayerAnimationData`
```xml
```
Player animation data.
- Required attributes: `FrameCount`
`FrameCount` is the amount of frames in the animation.