Files
carlos 10c4a31d57 kernel: report missing game files once by name, with an exit summary
A dump that lacks some files gave no sign of it: opens failed and the title
went silent, skipped a movie, or drew its own "disc is damaged" screen. The
kernel now prints one "[FILE] missing <guest> -> <host>" line per unique
path, and a summary at every host-controlled exit (exit, HalReturnToFirmware,
KeBugCheck, window close, and counts only at the watchdog).

A title fails opens on purpose all the time (cache probes, numbered-file
scans, save metadata, archive fallbacks), so a miss counts only for a
read-only FILE_OPEN of a file in the game tree, and is high confidence only
when its directory exists. Once a path is reported, its repeated FAILED
lines are counted, not printed (a looping stream re-opens its file every
loop). NtOpenFile and IoCreateFile now log their failures through the same
wrapper as NtCreateFile. POSIX reports a missing directory as
PATH_NOT_FOUND, as Win32 does.

RECOMP_MISSING_FILES=0 turns it off (every FAILED line prints as before), =all
also lists low-confidence misses, probes and every attempt. Memory is one
static table of 1024 paths; misses past it are counted, not named.
RECOMP_MISSING_FILES_LIST=<path> writes the unique misses with their attempt
counts, once, at the first summary. The windows end with ExitProcess, which
skips atexit, so a small recomp_exit_hook library in platform lets the D3D
windows run the summary without linking the kernel.

Tests: tests/kernel_missing_report (classification, repeats, the list file,
the modes, the 1024-path table cap) and tests/kernel_file_status (the POSIX status
for a missing file versus a missing directory).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 15:35:04 -07:00
..