The sort order chunk container a quick reference for Director to look up different cast members. In many places the cast members are referenced by a number, called a cast member reference id. Each entry in this chunk represent such a cast member reference, when the entry's index is the cast member reference id.
Each entry consists of a cast number CN
(1-indexed), referencing a cast defined inside
the cast assoc table (0-indexed). It also contains a cast member slot number, referencing in which slot
number the cast member is located. To use this cast member number, it needs to be used by the first needs to be offset
by the first occupied slot FOS
inside the cast assoc table referenced by the cast number CN
.
The FourCC of the chunk is Sord
.
The sort order chunk is saved in big-endian.
The structure is described by:
Ref. | Bytes | Description |
---|---|---|
HL |
Chunk header | |
EL × AAE |
Array data |
The structure of the chunk header is:
Ref. | Bytes | Type(s) | Name | Description |
---|---|---|---|---|
4 | uint32 | Unknown. | ||
4 | uint32 | Unknown. | ||
AAE |
4 | uint32 | allocated‑array‑elements | The number of allocated array slots. |
UAE |
4 | uint32 | used‑array‑elements | The number of array slots filled by entries. |
HL |
2 | uint16 | header‑length | Length of the header data. |
EL |
2 | uint16 | entry‑length | The length of a single entry. |
The array entries are simply stacked one after another. While AAE
array elements are allocated, only UAE
array
elements actually contains real entries, so we must not parse more than UAE
entries. However, it looks like this
particular table is always kept up to date so that AAE
= UAE
.
The structure of a sort order array entry is:
Ref. | Bytes | Type(s) | Name | Description |
---|---|---|---|---|
CN |
2 | uint16 | cast‑number | The number of the cast. |
2 | uint16 | cast‑member‑slot‑number | The number of the slot inside the cast CN where the referenced cast member is located. |