Every xml must have a `<Root>` tag. It must have at least one `<File>` child.
## Resources types
The following is a list of the resources/tags supported by ZAPD, and the attributes needed by each one.
For most resources inside a `<File>` tag **you should also set an `Offset` attribute**. This is the offset (within the file) of the resource you are exporting. The `Offset` attribute is expected to be in hexadecimal, for example `Offset="0x41F0"`.
It's worth noting that every tag expects a `Name="gNameOfTheAsset"`. This is will be the name of the extracted variable in the output C code. Every asset must be prefixed with `g` and the suffix should represent the type of the variable.
Every tag can accept a `Static` attribute to specify if the asset should be marked as `static` or not.
There are 3 valid values (defaults to `Global`):
-`Global`: Mark static if the flag `--static` was used.
-`On`: Override the global config and **always mark** as `static`.
-`Off`: Override the global config and **don't mark** as `static`.
This table summarizes if the asset will be marked `static` (✅) or not (❌)
| `Static=""` attribute in XML | Without `--static` flag | With `--static` flag |
-`Name`: Required. The name of the file in `baserom/` which will be extracted.
-`OutName`: Optional. The output name of the generated C source file. Defaults to the value passed to `Name`.
-`Segment`: Optional. This is the segment number of the current file. Expects a decimal number between 0 and 15 inclusive, usually 6 if it is an object. If not specified, the file will use VRAM instead of segmented addresses.
-`BaseAddress`: Optional. RAM address of the file. Expects a hex number (with `0x` prefix). Default value: `0`.
-`RangeStart`: Optional. File offset where the extraction will begin. Hex. Default value: `0x000000000`.
-`RangeEnd`: Optional. File offset where the extraction will end. Hex. Default value: `0xFFFFFFFF`.
-`Name`: Required. Suxffixed by `Tex`, unless it is a palette, in that case it is suffixed by `TLUT`.
-`OutName`: Required. The filename of the extracted `.png` file.
-`Format`: Required. The format of the image. Valid values: `rgba32`, `rgba16`, `i4`, `i8`, `ia4`, `ia8`, `ia16`, `ci4` and `ci8`.
-`Width`: Required. Width in pixels of the image.
-`Height`: Required. Height in pixels of the image.
-`TlutOffset`: Optional. Specifies the tlut's offset used by this texture. This attribute is only valid if `Format` is either `ci4` or `ci8`, otherwise an exception would be thrown.
The following is a list of the texture formats the Nintendo 64 supports, with their gfxdis names and ZAPD format names.
| Format name | Typing in `gsDPLoadTextureBlock` | "Format" in xml |
If you want to know more about this formats, you can check [`gsDPLoadTextureBlock`](http://n64devkit.square7.ch/n64man/gdp/gDPLoadTextureBlock.htm) for most formats, or [`gDPLoadTextureBlock_4b`](http://n64devkit.square7.ch/n64man/gdp/gDPLoadTextureBlock_4b.htm) for the 4-bit formats.
-`OutName`: Required. The filename of the extracted `.jpg` file.
※ Explicit use of this tag isn't often necesary because it would probably be extracted automatically by another extracted element. You can use this to name them if you don't like the autogenerated name.
-------------------------
### Blob
Blob are binary data that will be extracted as `.bin` files.
A data type exclusive to Majora's Mask, that has scrolling, color changing, and texture changing capabilities. Declaring the main array will generate everything else; textures for the TextureCycle type must be declared manually in the XML to use symbols. (If it does reference any undeclared textures, ZAPD will warn and give the their offsets.)
`Scene`s and `Room`s are a bit special, because `Room`s usually needs assets declared in their respective `Scene` (which is in a different file), so they need to be extracted together.
To accomplish this, the scene and each of their rooms must be declared in the same XML.
- Example:
```xml
<Root>
<FileName="spot12_scene"Segment="2">
<CutsceneName="gSpot12Cs_006490"Offset="0x6490"/>
<SceneName="spot12_scene"Offset="0x0"/>
</File>
<FileName="spot12_room_0"Segment="3">
<RoomName="spot12_room_0"Offset="0x0"/>
</File>
<FileName="spot12_room_1"Segment="3">
<RoomName="spot12_room_1"Offset="0x0"/>
</File>
</Root>
```
- Attributes:
-`HackMode`: Optional. This is a simple non-hardcoded way to handle some edge cases. Valid values: `syotes_room`.
-------------------------
### AltHeader
Like `Scene`s and `Room`s, `AltHeader`s is special too. It should always be declared in the same `File` as a `Scene` or a `Room`.
-`LimbType`: Required. Valid values: `Standard`, `LOD`, `Skin`, `Curve` and `Legacy`.
-------------------------
### Symbol
A special element that allows declaring a variable without actually extracting it from the current file. Useful when a resource references an element from another file. The symbol will be declared as `extern`.
-`Type`: The type of the declared variable. If missing, it will default to `void*`.
-`TypeSize`: The size in bytes of the type. If missing, it will default to `4` (the size of a word and a pointer). Integer or hex value.
-`Count`: Optional. If it is present, the variable will be declared as an array instead of a plain variable. The value of this attribute specifies the length of the array. If `Count` is present but it has no value (`Count=""`), then the length of the array will not be specified either in the declared variable. Integer or hex value.
-`Static`: This attribute can't be enabled on a Symbol node. A warning will be showed in this case.