The chunk
The ID666 tag has fixed room for each field, so it cannot hold long names, a track number or
the length of an intro. The xid6 chunk is an optional block after the fixed part, at offset
$10200, that holds those as items. It starts with the four letters xid6 and a
32-bit little-endian size of the items that follow (not counting these eight bytes). The
items run to the end of the chunk, which is the end of the file when the size is right.
Items
An item begins with four bytes: an id, a type and a 16-bit number. What the number means depends on the type.
| Type | Kind | The 16-bit number | Data after the header |
|---|---|---|---|
| 0 | data in the header | the value itself | none |
| 1 | string | the length of the string, with its zero byte (4 to 256) | the text, ANSI, ended by a zero |
| 4 | integer | the length of the data: 4 | a 32-bit little-endian number |
Each item is padded with zero bytes so that it ends on a 32-bit boundary, counted from the start of the chunk. Some files do not pad, so a reader that finds no item at the padded position tries the next byte. An item whose id is not known is skipped, with its length.
Item ids
| Id | Type | Item |
|---|---|---|
| $01 | string | Song name |
| $02 | string | Game name |
| $03 | string | Artist |
| $04 | string | Dumper |
| $05 | integer | The date of the dump as a number, yyyymmdd |
| $06 | in the header | The emulator that made the dump: 0 unknown, 1 ZSNES, 2 Snes9x |
| $07 | string | Comments |
| $10 | string | The title of the official soundtrack the song is on |
| $11 | in the header | The disc of that soundtrack |
| $12 | in the header | The track: the upper byte is the number (0 to 99) and the lower byte an optional ASCII letter, as in 5b |
| $13 | string | The publisher |
| $14 | in the header | The copyright year |
| $30 | integer | The introduction length |
| $31 | integer | The loop length |
| $32 | integer | The end length; it may be negative |
| $33 | integer | The fade length |
| $34 | in the header | The muted channels: a bit set for each voice that is muted |
| $35 | in the header | The number of times to play the loop section |
| $36 | integer | An amplification to apply to the output, 65,536 being normal |
The four lengths ($30 to $33) are in ticks of 1/64,000 of a second, to at most 383,999,999 ticks. A player works out the playing time as the introduction plus the loop length times the loop count, then the end, and fades over the fade length. The explorer does this when the file has the items and otherwise uses the ID666 length and fade.
Item $36 is a 32-bit amplification in the original description, and the SNESdev wiki gives it as a one-byte mixing level. The explorer reads it as the 32-bit number.
In the explorer
The chunk is a node of the tree with its id and size, and each item a node with its id, type, length or value, data and padding. The Song tab lists the items with their values: strings as text, the date, track and lengths worked out. A size that reaches past the end of the file, an item that is cut off, and bytes after the fixed part that are not an xid6 chunk are listed as problems and the tree still covers every byte.
Sources
- SPC file format v0.30: the item table with the types, sizes and the note on lengths, ending with item $36.
- SPC and RSN file format (SNESdev wiki): the chunk layout and the padding to 32 bits.