nfl-instant-replay-static-recomp
NFL Instant Replay is a static recompilation of the Philips CD-i game for Windows, featuring a Direct3D 11 video presenter and Digital Video cartridge support.
- Type: PC port
- Game: NFL Instant Replay
- Runs on Windows
- By tools81
- Latest release v1.0.0, 2026-12-01
- Source: https://github.com/tools81/nfl-instant-replay-static-recomp
README
NFL Instant Replay: CD-i static recompilation
A native Windows build of NFL Instant Replay (Philips CD-i, Capitol Multimedia / NFL Films). You play an NFL referee: watch a real play, then make the call before the clock runs out.
The game's 68000 code is translated ahead of time into C. A runtime provides the parts of the player the code expects:
- the CD-RTOS (OS-9) kernel, including events;
- the CD file manager;
- the video decoder (Direct3D 11 presenter at any window size);
- the ADPCM audio processor;
- the Digital Video (FMV) cartridge, which provides the MPEG-1 video
(
/mv) and audio (/ma) drivers. Every play, and every referee scene, is MPEG video.
The project started from the CD-i recompilation template. The runtime and
tools were then taken from the Thunder in Paradise port, which added the
FMV cartridge. The recompiled build is bit-identical to a pure-interpreter run
(--interp): frame hashes compare equal over 14,000 fields of intro, menus
and gameplay.
Installing a release
Download from the releases page:
NFLInstantReplay-<version>-setup.exe: a single-file installer.- It installs per user, without administrator rights, to
%LOCALAPPDATA%\Programs\NFL Instant Replay. - It asks for the folder that holds your
.cue/.bin. - It adds Start menu and (optionally) desktop shortcuts.
- It installs per user, without administrator rights, to
NFLInstantReplay-<version>-portable.zip: unzip anywhere and runinstantreplay.exe. The first time, it asks you to select the.cueor.bin.
No game files are included: you need your own disc image of NFL Instant Replay.
The program is always portable. Everything it writes stays in saves\ next
to the executable: the game's save, quicksaves, settings.ini,
disc_path.txt (the disc location) and the log. Nothing goes to AppData or
the registry, apart from the installer's own uninstall entry. The shaders are
compiled in memory from source built into the executable, and the C runtime
is linked statically, so nothing else needs installing. The shortcuts pass
--portable; it is accepted but is already the default.
At start-up the program checks this repository's latest GitHub release. If
it's newer than the running version, the program offers to install it. The
*-portable.zip is downloaded and unpacked over the program folder, so
saves\ is kept, and the game restarts. Answering No skips that version.
--no-update-check turns the check off; headless and scripted runs never
check.
Making a release
powershell -ExecutionPolicy Bypass -File tools\package.ps1
This builds the interpreter-only executable (-DRECOMP_INTERP_ONLY=ON, in
build\release). That executable loads the program from the player's disc
and runs it in the 68000 interpreter, so it contains none of the game's code.
Its output is identical to the recompiled build: frame hashes match over
14,000 fields. It runs at about 136 displayed fields per second with 2 fields
of run-ahead, against 166 for the recompiled build.
The script writes dist\NFLInstantReplay-<version>-portable.zip. With Inno
Setup 6 (installer\instantreplay.iss), it also writes
dist\NFLInstantReplay-<version>-setup.exe. The version and the update
repository are set in runtime/version.h. Attach both files to a GitHub
release tagged v<version>. The updater looks for the *-portable.zip asset
of the latest release.
gen/, extracted/ and rom/ are made from the disc and are not in the
repository. Without gen/, CMake builds the interpreter-only version
automatically.
Building
Requirements: Windows 10+, Visual Studio 2022 (C compiler), CMake 3.19+ and Python 3.8+.
- Put the disc image in
rom/:NFL Instant Replay (USA).binand.cue, with raw 2352-byte sectors. - Run
build.bat. It extracts the program modules from the disc, recompiles them intogen/, builds with MSVC and copiesinstantreplay.exeto the project root. - Run
instantreplay.exe. It looks for the disc image inrom/next to the program, or you can pass the path of the.cueor.bin.
Saves go to saves/: the game's NVRAM file (nvr_nfl), quicksaves,
settings.ini and the log (recomp.log).
Controls
| Action | Keyboard | Gamepad (XInput) |
|---|---|---|
| Move the pointer / choose a direction | Arrow keys (Shift = faster) | Left stick or D-pad |
| Button 1 (select) | Z, Space, A or Enter | A |
| Button 2 | X, Ctrl or S | B or Y |
| Fast-forward while held | Tab | |
| Quicksave / next slot / load | F2 / F3 / F4 | |
| FMV upscaler on/off | F8 | |
| Aspect ratio / filter | F9 / F10 | |
| Fullscreen | F11 or Alt+Enter | |
| Quit | Esc |
Making a call. The four answers sit next to up, right, left and down arrows. Hold the direction of your answer and press button 1 while still holding it. The game reads the pointer as a joystick: it un-selects the answer as soon as the stick returns to the centre, so releasing the direction first and then pressing the button does nothing.
In the locker-room menu, the green arrow cursor follows the pointer and the label shows the choice under it (for example 1 PLAYER GAME, PLAY GAME and EXIT).
Command-line options: --fullscreen, --windowed, --size WxH,
--aspect N, --filter N, --upscale 0|1, --gdi (software presenter),
--runahead N (0–4 fields, default 2) and --no-smoothing.
Run-ahead and 60 fps cursor
- Run-ahead. Every field, the real field runs first, which keeps the game
and the audio exactly as normal. Then a snapshot is taken, N more fields run
with the current input, that picture is shown, and the snapshot is
restored. The game shows pointer movement 2 fields after the input and
reacts to a button after 4, so the default of 2 fields removes the whole
pointer delay and never shows a reaction early.
- Checked: with run-ahead 2, the picture shown at field k is bit-identical to field k+2 of a normal run over 14,000 fields. The only exceptions are the 7 fields where the input itself changed, which is the prediction run-ahead makes.
- Only the shown field is drawn. The real field and the earlier look-ahead fields run their display tables (the game counts their video interrupts) but skip the pixel work, which halves the cost.
- If the PC can't keep up with 60 Hz, run-ahead steps down to 1 field, then off, and says so on screen. It's skipped while fast-forwarding.
- Cursor at 60 fps. The game moves the hardware cursor irregularly, about
every 1.5 fields, in steps of 12 units with gaps. The cursor is drawn every
field, gliding from where it was shown to the new position over the usual
update interval. Measured on the menu: an even 6 units every field, against
12, 0, 6, 0 without smoothing.
--no-smoothingturns it off. The cursor is the only freely moving sprite in this game. Everything else is MPEG video (about 30 pictures per second) or pre-drawn DYUV animation frames, which have no positions to interpolate.
What this game needed beyond Thunder in Paradise
Tools
- Initialized data in a separate module.
cdi_replayhas no idata of its own. At start-up it loads the data modulecdi_replay_data, copies the idata block that the module's offset 0x30 points to, and applies the irefs that follow it.tools/analyze.pynow reads idata and irefs fromextracted/<program>_datawhen the program has none. That recovers the Microware a6 jump table (jsr d16(a6)intojmp abs.lstubs) and the function-pointer tables: 351 functions instead of 285. tools/cdi_extract.pylooks at the first 64 sectors of a file, not just the first, to decide whether it's a real-time stream.replay.rtf(630 MB) starts with a plain Form 1 data sector and was being dumped in full.tools/gen.pywrites a placeholder entry when no function names are known. An empty C initializer list made MSVC crash.
Kernel (runtime/os9.c)
F$Event: Ev$Link, Creat, Delet, Wait/WaitR, Read, Signl, Pulse, Set/SetR. The video driver'sline_eventis pulsed with the value 1 every field. The game waits on it (Ev$Wait 1..1) to pace its fades and animations. A wait is re-executed like F$Sleep and is satisfied by any pulse since it began.I$ChgDir,F$SUserandF$Julian./cd@(the raw CD device) opens as the device itself. SS_Enable and SS_Disable on it (the game's "ss_enable controls") succeed.
Video (runtime/video.c)
-
The first LCT line runs before the field control tables, as the display processor fetches each line's instructions during the previous line. The game leaves "both planes off" (
C0001010) in LCT line 0 and turns the planes on from the FCT (C0041513, plane B DYUV), which must win. Before this change every DYUV screen (the distribution logo, the main menu, the game screens) was black. -
Cursor blink.
GC_Blnktakes the on time in d3 and the off time in d4; the cursor blinks only when both are set. The game passes on 16, off 0 (a steady cursor). Reading both times from d3 hid the menu cursor for good.
FMV cartridge (runtime/mpeg.c)
- Stream selection. The gameplay clips multiplex two video streams (0xE0,
0xE1) and two audio streams (0xC0, 0xC1) on one channel. Only the selected
stream reaches each decoder:
MV_SelStrm(0x111, stream in d3), or stream 0 by default. The MPEG system header is used to choose when available, and a single-stream disc whose stream has another number is locked onto after a few packets. Feeding both streams to one decoder gave blocky garbage. - Audio triggers.
MA_Trigger(0x126) is implemented. At the end of the audio stream the trigger signal is sent with event 0x008 (and 0x010, if masked). The game waits for it before starting the next intro clip.
Layout
| Path | Contents |
|---|---|
game.json | Modules to recompile: cdi_drivers (boot) at 0xF0000, cdi_replay at 0x100000 |
tools/ | Disc extractor, 68000 decoder, OS-9 module reader, analyzer, C generator |
runtime/frontend.c | Top-level field loop: run-ahead, quicksave slots, on-screen messages |
runtime/state.c | Snapshots for quicksaves and run-ahead |
runtime/mpeg.c, pl_mpeg.h | FMV cartridge: /mv and /ma drivers, demultiplexer, clock; MPEG-1 decoder (MIT) |
runtime/os9.c | OS-9 kernel, CSD (with the cartridge's devices) and events |
runtime/cdfm.c, video.c, audio.c | CD file manager, video decoder and compositor, audio processor |
runtime/interp_only/ | Stand-ins for gen/ when building without the recompiled code |
docs/CDI_NOTES.md | CD-i, CD-RTOS and Digital Video facts worked out so far |
The disc
| File | What it is |
|---|---|
cdi_drivers | Boot program. Reads /nvr/csd; on some player models it loads a replacement CD/audio driver (.cdapdriv.605/.910/.220_37) and dspdriv. Then chains to cdi_replay. |
cdi_replay, cdi_replay_data | The game, and its initialized data |
cdi_driversd, cdi_replayd, cdi_replayd_data | A debug build of the same pair, with progress messages on stdout |
replay.rtf | All video, pictures and sound: MPEG on channel 15, DYUV/RL7 pictures on 16, data on 31, ADPCM on 13–15 |
The replacement drivers are not loaded on the emulated player and aren't needed: the runtime provides the devices itself.
Debugging
--trace/--trace3log syscalls with callers, signals, disc activity, MPEG driver activity and display-table writes. Unimplemented calls are always logged tosaves/recomp.log.--headless --frames N --dump K [--dump-from F]runs without a window and writes every Kth field as a BMP (python tools/bmp2png.py file.bmp).--script "field:key:dur,..."scripts input. Keys:1,2,L R U D(normal speed) andl r u d(fast). Entries may overlap. To make a call, hold the direction across the button press, for example12700:U:40,12720:1:6.--hashloglogs a checksum of every field. Comparing a recompiled run with an--interprun checks the translation.CDI_BP=addr,...(with--interp) logs the registers at those addresses.CDI_PLANES=1or2renders plane B or plane A alone.- The debug build on the disc explains a lot of what the game is doing
("Main menu init", "Here's pixmap 5", "AnswerSelected", "Input handler
now ..."). To run it, point
game.jsonatcdi_driversdandcdi_replaydwith a differentexe_name, runpython tools/gen.pyand build into a separate CMake folder (for examplebuild\dbg). Then restoregame.jsonand runpython tools/gen.pyagain. Its console output goes to the log as[console]lines.
Known limitations
- The game was tested by scripted, headless play: intro, main menu, game set-up, briefings, several plays with answers and time-outs, and Weeks 1–3 of the regular season. A complete season and the two-player mode have not been played through.
- The debug build reports "Can't get devname from CSD for ptr device 2": the emulated player's CSD lists only one pointer device. Two-player mode probably needs a second one; it hasn't been tried.
- The camera angle is always stream 0. If the game switches angles with
MV_SelStrmduring replays, the switch happens at once and may show a few damaged pictures until the next I-frame.