How it works · write-up
Final shop TV-off screen
After the last shop dialogue and the high-pitched shutdown sound, the original game clears the screen and displays a small grey/white dot. Sprite Stream previously kept showing the shop until Level 1 began loading.
Original routine and root cause
ReVa program /mydumpat0 contains the shared shop/ending code. The final branch
of ShopScreen_InitAndOpen at $10520 does the following:
| Address | Operation |
|---|---|
$107FA |
Fade the shop palette out |
$10800 |
Start sound command $2E |
$10806..$10824 |
Repeat the dot draw and buffer swap 150 times |
$1080A |
Call $108C4, now named Ending_ClearScreenAndDrawTvDot in ReVa |
$1080E |
Call the ordinary $28D4 VBL wait/buffer swap |
$1081A |
Install the grey palette at $10844 |
$10826 |
Fade the dot to black |
$1082C |
Stop the sound |
$10832..$10840 |
Swap the unchanged black buffers 80 times; swap call at $10836 |
$7EAA |
Load the next level; the completed campaign wraps to Level 1 |
$108C4 writes directly to the draw buffer pointed to by $406. It clears
8,000 longwords (32,000 bytes), then writes three ST bitplane rows at offset
$3ED0. It does not call the object dispatcher or sprite blitter, so the existing
sprite hooks captured neither the clear nor the dot. The persistent shop cache
continued replaying its old draws.
The offset is row 100, 16-pixel group 10. The four plane words are:
row 100: 000F 0006 000F 0000
row 101: 000F 000F 000F 0000
row 102: 000F 0006 000F 0000
This gives a 4x3 logical-pixel dot at X=172..175, Y=100..102. Its four corner
pixels use palette entry 5; the other eight use entry 7. The ending palette
sets these entries to ST $333 and $777. The draw routine's first longword
is $20780406, used to verify the shared code before activating the hook.
Capture fix
src/drawCommandStream.c recognizes $108C4, invalidates the retained shop,
logo and loading-text caches, and retains an ending-screen state. On each normal
buffer swap it emits a full-screen palette-0 rectangle and three overlapping
rectangles that reproduce the dot exactly. Live palette values supply the grey
colors and fade to black.
The state persists during the 80 swaps with no drawing. The $10836 hook also
restores it when loading a checkpoint in that pause. Loading the next level at
$7EAA, or resetting capture, clears the state.
The four rectangles use stable identities $FFF60000..$FFF60003 and the existing
flat-color draw format. Desktop and web replay already support that format;
there is no protocol or shader change. This adds four quads per ending frame,
one inexpensive inactive check per normal buffer swap, and no framebuffer scan
or allocation. Autopilot behavior is unchanged.
Reproduction and verification
Before-fix full campaign:
E:/xenon_runs/full-hd-highfps-20261008-r602.validation/
full-hd-highfps-20261008-r602.x2events
full-hd-highfps-20261008-r602-original.mp4
full-hd-highfps-20261008-r602-sprite.mp4
The dot is visible in the original at approximately 48:04..48:14, while the sprite recording retains the shop. The paired screenshot below shows the same ending interval, with both videos reduced to logical pixels before display.

The focused fix validation begins at this checkpoint before the final shop:
E:/xenon_runs/full-hd-highfps-20261008-r602.validation/checkpoints/f49838-periodic.sav
Both Release Hatari and the native replay DLL were rebuilt using the official
xenon_tools/hatari_dev.ps1 through validate_campaign.py native-run --build.
The emulator remained visible and both videos were recorded. To repeat the HD
validation from cmd.exe at the repository root:
python xenon_tools\validate_campaign.py native-run ending-dot-hd --output-root E:/xenon_runs --resume E:/xenon_runs/full-hd-highfps-20261008-r602.validation/checkpoints/f49838-periodic.sav --build --build-type Release --build-directory out/build/codex-validate --port 6946 --memory-trace off --fast-forward --high-fps --hd-sprites --sprite-scale 4 --record-format mp4 --record-encoder qsv --record-quality 18 --checkpoint-interval 150 --continue-after-stall
Run under E:/xenon_runs/ |
Verification |
|---|---|
ending-dot-hd-20261008-r603.validation |
1280x800 HD/high-FPS sprite MP4; correct dot, fade and black pause; playable Level 1 returned at frame 51350 |
ending-dot-standard-20261008-r604.validation |
640x400 lossless standard sprite AVI; all 230 canonical ending frames pixel-identical to the original after excluding the Sprite Stream menu icon |
ending-dot-restored-20261008-r605.validation |
Restored r603/checkpoints/f50974-periodic.sav during the black pause; all 61 remaining canonical ending frames pixel-identical; Level 1 returned normally |
Each recording basename matches its folder without .validation, followed by
.x2events, -original.avi / -sprite.avi, or -original.mp4 / -sprite.mp4.
All three runs ended with final_completion, finalized recording containers and
no cleanup errors.
The complete ending spans canonical frames 50808..51037, VBLs
186791..187743 in the focused runs. Comparison matches original VBL
capture_vbl + 2 against sprite VBL capture_vbl, as in the existing renderer
audit. Standard recordings are lossless, so pixel equality is meaningful. The
HD QSV recordings have small compression differences, while the dot has the
same 12-pixel footprint throughout the visible interval. Their menu icon and
touch-control overlays are excluded from game-pixel comparisons.
An additional comparison of all 956 ending VBLs in the standard AVI finds seven single-VBL brightness differences at the palette fade steps: the matched original has advanced one fade step before the sprite view. The dot geometry and black background remain identical. Palette changes act on the displayed screen immediately, whereas the +2-VBL comparison aligns double-buffered drawing; the canonical-frame equality above should not be read as equality at every intermediate VBL during the fade.

The enlarged inset shows the three-row shape. Both halves use logical pixels, then nearest-neighbor enlargement; the dot itself remains 4x3 in the game.
Uninterrupted full campaign after the fix
E:/xenon_runs/full-hd-highfps-ending-fixed-20261008-r606.validation contains a
new visible resident-C run from assets/xenonplay.sav, with both binaries rebuilt
through the official wrapper, fast-forward, HD sprites, high FPS, 1280x800 sprite
MP4 and checkpoints requested every 150 frames. The common file prefix is
full-hd-highfps-ending-fixed-20261008-r606.
It defeated the spaceship, entered the final shop at frame 49987, recorded
the complete TV-off sequence at 50814..51043, and returned to playable Level 1
at 51356. Recording finalized at 51372 with no errors. There were zero
lost lives and zero reported stalls. Its 16 shield-drop events, pickup outcomes,
cash collection and equipment changes match the previous r602 full run exactly.
The existing damage and missed pickups therefore remain; this was a renderer
validation, not a new combat-tactic change.
The folder contains incidents.md, shop-decisions.md, campaign-audit/,
ending-audit.json, ending-dot.png, ending-black-pause.png and the paired MP4s.
The ending audit checks all 230 canonical frames and confirms the 12-pixel dot
footprint and the retained black pause in the full run, not only in a checkpoint
probe. The final shop made no transactions; cash remained 6400.
video-audit.json passes for both MP4s: each has 174,892 continuous VBL-indexed
frames, approximately 60.0375 FPS and 48:33.047 duration. Both fully decode without
errors and contain identical nonsilent mono AAC audio at 44,100 Hz; audio/video
duration drift is 14 microseconds. The sprite recording is 1280x800 (2.49 GB),
and the original is 640x400 (391 MB).