Cut-scene scripts
Every dialogue scene, and every “movie” a mission starts, is a cut-scene script. They are stored inside main.dol, with no files of their own on the disc.
- Where
- main.dol: offsets 0x8017AF80, commands 0x8017AFE8 (0x60D0 bytes), ids 0x801810B8
- Scripts
- 51 plus script -1
- Command kinds
- 21, fixed lengths
- Free space in the block
- 4 bytes
The block
Three tables sit back to back:
| Address | Content |
|---|---|
0x8017AF80 |
52 big-endian u16 offsets: entry 0 is the script played by number -1, entry n + 1 script n |
0x8017AFE8 |
the commands, 0x60D0 bytes; offsets in the table and in jumps count from here |
0x801810B8 |
51 u32 ids of the form group × 10000 + number |
The retail scripts use 24,780 of the 24,784 command bytes (5,909 commands, then four zero bytes). They lie in number order with no gaps; every script has exactly one end; scripts 35-37, the three story endings, share one subroutine.
Missions start scripts by id (an id not in the table plays nothing and the mission goes on). The code starts a few itself: -1 (the dialogue host of the mission scripts) and 0-1 (when a base’s cannon fires) from the map, 35-37 (the story endings) from the story hub, 45-50 from the battle when a God is summoned.
Commands
The first byte of a command picks its handler; 16-bit operands are big-endian byte pairs. Every operand byte is read, so the block can be rebuilt byte for byte from a listing.
| Op | Bytes | Command |
|---|---|---|
| 0 | 4 | load a model, image group, effect module or the map’s model |
| 1 | 2 | unload |
| 2 | 2 | wait (one frame, loads, curtain, picture, window, button A, model animation, n frames) |
| 3 | 4 | show a picture, or put a model into the scene |
| 4 | 4 | model animation |
| 5 | 3 | joint mask |
| 6 | 2 | camera animation of a model |
| 7 | 8 | start or stop an effect |
| 8 | 4 | talk: window, face, message |
| 9 | 9 | open a window: style flags, colour, position |
| 10-12 | 3, 4, 3 | colour curtain and picture fades |
| 13, 14 | 2, 6 | sound, sound fade |
| 15-18 | 2, 2, 0, 0 | jump, call, return, end |
| 19 | 2 | mark: stores a position nothing reads |
| 20 | 1 | no shadow pass |
The player has 16 dialogue windows, 10 full-screen pictures, 10 model slots, two colour curtains and a call stack of four. A load that fails leaves the script position empty, which crashes the console; a wait for 0 frames never ends.
Evidence
The cut-scene player is part of the decompiled code, and all 51 scripts were decoded and rebuilt byte for byte from their listings.