XSharp

PauseMenuExtractor

A portable .NET 9 console tool that packages verified native menu graphics and bounded original data tables for use without a runtime ROM. It references XSharpShared and the existing revision-aware EnemyExtractor ROM reader; it does not initialize graphics, audio or an engine host.

dotnet run --project tools/PauseMenuExtractor -c Release -- <base-capture-directory> <matching-original-ROM> <output.xmenu> [armor-capture-directory] [weapon-preview-capture-directory] [X2-Zero-part-capture-directory] [restore-workload-capture-directory] [Escape-workload-capture-directory]

The base directory comes from tools/parity/capture_pause_menu.py. ROM SHA-1 must match its manifest. Each referenced captured binary is checksum-validated. For X1/X2/X3 runtime compositors, use a matching minimal-inventory base (initial HP capacity, buster cursor, no special weapons/reserves), the 16 armor projections and the 9/11/10 weapon-preview palettes respectively. The private inventory experiments are generated by:

python tools/parity/capture_pause_menu.py --rom <X2-ROM> --state <native-before-menu.State> --wait-frames 2 --bizhawk <EmuHawk.exe> --output <armor-capture> --full-inventory --probe-armor
python tools/parity/capture_pause_menu.py --rom <X2-ROM> --state <native-before-menu.State> --wait-frames 2 --bizhawk <EmuHawk.exe> --output <preview-capture> --full-inventory --probe-preview
dotnet run --project tools/PauseMenuExtractor -c Release -- <empty-X2-base-capture> <X2-ROM> XSharp.Assets.X2/Menus/equipment.xmenu <armor-capture> <preview-capture>

All capture paths are private and muted. The original ROM, config, movie and source state remain hash-checked and unchanged. The captures change inventory in the private emulator; they are not controller-only gameplay routes. Full WRAM snapshots and save states are research inputs and are excluded from the output package.

The ZIP-based .xmenu contains a versioned manifest, VRAM, CGRAM, OAM, decoded scanline window bounds, and optional armor/preview projections. Each payload has its own SHA-256. Original table addresses refer to their data bank: X1’s $80:CA96..CDB6 reads $86:Axxx; X2’s $00:C838..CB04 and X3’s $00:D113..D5B8 read $06:9xxx/$06:Axxx, not $00:9xxx code. Those bounded tables provide original label tiles, icon/bar positions, tank geometry and selection windows. Palette previews are assets; no CPU assembly, ROM or emulator state is loaded by the engine. The tool validates the finished package before replacing a distinct .xmenu output. Existing ROMs cannot be the output.

The committed X1/X2/X3 packages are about 42/49/43 KiB and are embedded by their data assemblies. X3 uses the unavailable-Zero equipment projection; its dynamic tables and nine usable special-weapon slots are extracted separately from X2.

X2 also requires the eight recovered-Zero-part OAM projections. Generate them with capture_pause_menu.py --probe-zero-parts --full-inventory from a matching native pre-menu state, then pass that capture directory as the sixth argument. The extractor verifies flags, story gate, palette and the preloaded OBJ tile region against the base menu. It does not copy stage graphics into the menu. The compositor prepares all armor/part combinations during precache. The 32 part-display fixtures cover partial and complete recovery both before and after obtaining the eight Maverick weapons, with naked/full X armor.

For X1/X3, pass - as the sixth argument. The optional seventh directory contains restore-contexts.csv and its matching capture manifest from capture_pause_menu.py --probe-restore-contexts. The extractor requires two agreeing repetitions per resource context, checks the ROM/game and bounded frame range, and packages the normal-close timings in the .xmenu manifest. This preserves the original decompression/NMI/transfer cost without runtime ROM access. The committed packages include 140 X1 pairs, 122 X2 pairs and 131 X3 pairs, each measured twice. X3 stage 2 requires the saved brightness header normally written during pause admission; the probe supplies full brightness when reusing an already-open intro menu. These controlled restore transactions are not scene/palette references or proof of stage gameplay parity. See native-pause-menus.md for the independent native stage traces and remaining Escape timing work.

The optional eighth directory contains exit-restore-contexts.csv from --probe-exit-restore-contexts, with a matching ROM/game and CSV hash in its capture manifest. Both repetitions must agree for the mapped-input handoff and cleanup frame, and each Escape entry must match a normal resource context. These exact values take priority over the older normal-close offset estimate; the wider audit found one-frame differences in three X1 contexts. Both normal and Escape CSV hashes are checked before replacing the output package. Older packages without the optional Escape fields retain their existing clock. Long private emulator sweeps may use --timeout-seconds 1200; a timed-out capture is not a completed evidence packet.

Validation:

dotnet test XSharp.Tests --filter FullyQualifiedName~X2PauseMenu
dotnet test XSharp.Tests --filter FullyQualifiedName~X1PauseMenu
dotnet test XSharp.Tests --filter FullyQualifiedName~X3PauseMenu
dotnet run --project tools/PauseMenuRasterProbe -c Release -- --verify-x1 <equipment.xmenu> <native-capture-directory> [frame-label]
dotnet run --project tools/PauseMenuRasterProbe -c Release -- --verify-x2 <equipment.xmenu> <native-capture-directory> [frame-label]
dotnet run --project tools/PauseMenuRasterProbe -c Release -- --verify-x3 <equipment.xmenu> <native-capture-directory> [frame-label]

The checked-in native fixture hashes cover 72 X1, 98 X2 and 96 X3 display states, including all armor masks, intermediate meter values, cursor panes and preview colors. These checks prove the covered static pixels; they do not prove native pause/unpause transition timing or complete movie parity.

To regenerate the display fixtures from private captures, use tools/parity/build_pause_menu_fixtures.py --game X1 --preview-capture <variants> --capture <base> --capture <variants> --output <fixture.json> (or --game X2). The generator records native WRAM-derived view values and expected pixel hashes; it does not embed captured pixels in the compositor. For X1, the same capture runner also supports --probe-navigation and --probe-reserve, which record the cursor transitions and HP-indexed reserve activation experiment separately.