WP-022: Movies through Video::BinkDecoder (Gen 1)
Status: ✅ Done (2026-11-14) Phase: 3 (resource loading: video) Depends on: WP-019 ✅ (sound), WP-020 ✅ (the exit transition, which names a movie) Companion EC: none (inline checklist under Exit criteria) Estimated effort: Half-day Pre-flight: pre-flight-WP-022-2026-11-14
Result (2026-11-14)
| Exit criterion | Result |
|---|---|
1. Every movie decodes and matches ffmpeg |
✅ At script level 3 the engine decodes every BK.* to its last frame: 42 on Showdown, 56 on Phantom, none bad. ffprobe and ffmpeg decode the same files independently. Frame counts and sizes match on all 98, and lengths agree within 2 ms. Of 882 per-channel mean colours (three frames × three channels × 98 movies), 615 agree within half a level, 253 within 1, and 14 within 2. The 2-level ones are saturated colours, such as a pure-red frame at 255 against ffmpeg’s 253: the two decoders convert YUV to RGB slightly differently. |
| 2. Live: an exit’s movie | ✅ In Showdown’s Railroad Station, start_movie=32 played the first viewing. A click 2 s in didn’t skip it, and all 107 frames played in 8,931 ms; its length is 8,916 ms. The movie’s sound was playing on the SFX channel. Then OBJ_P09_TO_P40’s walk-off ended in movie 32 again. That viewing was skippable, a click stopped it after 32 frames, and ROOM_P33_Chase_C1 loaded. |
| 3. Missing or damaged movie | ✅ start_movie=24 (Showdown has no BK.024) logs Movie 24: cannot open BK.024 and the room runs on. A scratch folder held a BK.032 truncated to 64 KB. At first this hung Video::BinkDecoder inside a call. The engine now checks the Bink header’s size field, which matches the file on all 98 genuine movies, before opening the file. It logs BK.032 is damaged (header says 4276344 bytes, file has 65536) and the room runs on. |
| 4. Build and diff | ✅ Scooby-only build: 0 errors, 0 warnings. Fork commit b45a790126 stages its 6 files by name, inside engines/scooby/, and is pushed. The exit and click checks still pass. |
Deviations:
- Skip keys. The original skips on two DirectInput slots whose keys weren’t traced, or a mouse button. The fork uses Escape, Space and the mouse buttons.
- Seen movies last for the session. The original keeps them in the save’s
MovieHistoryentries, so they persist across sessions. - Title movies (ids 0 and 25–28) and the title flow are not wired up.
Goal
Play the Gen 1 movies with ScummVM’s own Bink decoder, and play an exit’s
movie= between its walk-off and the next room, as the original does.
Background
WP-020’s exits log their movie= and go on. In Scooby.exe:
- The request (game vtable
+0x08,0x42DE10). An exit’s walk-off passes the movie id and the next room. An id outside 0–74 means no movie. Ids 0 and 25–28 are title movies, gated byGBHTitleMoviesinScooby.ini. Any other id plays every time. The first viewing can’t be skipped unlessSettings/AbortMoviesinScooby.iniis on; later viewings always can (+0x290, read through game vtable+0x3C). - The file (
0x4362E0, “Playing movie (%i)”). The name is%sBK.%.3d: movie 32 isBK.032in the game folder, tried on the hard disk and then the disc. The engine stops its sounds, clears the screen, and hands the file to the Bink manager (0x4422F0,BinkOpen). - Skipping. While a movie plays, input slot 5 or 4, or either mouse
button, stops it if it may be skipped (
0x4424F0,BinkClose). The slots are the input layer’s (DirectInput); which keys they hold was not traced. - Then the next room loads.
The discs carry 42 movies (Showdown) and 56 (Phantom), all Bink
(BIKi), 640 × 480, at 8, 12 or 24 frames per second.
Scope
In scope (fork, engines/scooby/ only):
ScoobyEngine::playMovie(id): openBK.NNNwithVideo::BinkDecoder, decode to the screen’s RGB565, play its sound on the mixer’s SFX channel, and stop on its last frame, on quit, or on a skip.- Skipping: Escape, Space or a mouse click, once the movie has been seen
this session, or always with an
abort_moviesconfig key (the original’sAbortMovies). - An exit with
movie=plays it after the walk-off, then loads the room. The engine’s sounds stop first, as the original’s do. - A console command,
movie <id>, and astart_movieconfig key, for testing. - Checks:
scriptlevel 3 decodes every movie to its last frame and logs its frame count, size and length, and the mean colour of its first, middle and last frames. - A movie whose Bink header disagrees with its file size is refused before the decoder opens it.
Out of scope:
- The title movies (0, 25–28) and the title screen flow.
MovieHistoryin the save.- The input slots 4 and 5: the fork’s keys are a stand-in.
Exit criteria
- Every
BK.*on both discs decodes to its last frame in the engine. Frame count, size and rate matchffprobe. The mean colour of the first, middle and last frames matchesffmpeg’s decode to within 2 levels per channel. - Live, an exit with
movie=plays the movie with its sound after the walk-off, then loads the room; the movie’s length matches its frame count over its rate. A second viewing can be skipped, the first can’t. - A missing or damaged movie file logs a warning and the room loads anyway.
- Scooby-only build: 0 errors and 0 warnings. The fork diff stays
inside
engines/scooby/, staged by name.
Deliverables
- Fork commit on
scooby-engine. - Integration §7 implementation notes.
- scooby-exe: the movie functions.