XSharp

Native sound-call capture

tools/parity/capture_native_sound_calls.py replays original X1/X2 movies using their installed BizHawk 2.11 / BSNESv115+ core and embedded starting state. It validates the ROM/movie SHA1, uses private movie/config/path copies and registers only two queue-entry callbacks. No ROM/WRAM/input edits, per-instruction callback, PCM dump or per-frame memory image is used. Source ROM/movie/config hashes must remain unchanged after execution. Use the existing portable capture installation when the main executable is marked RUNASADMIN; see the original workflow. No UAC or installed compatibility settings are changed by this tool.

python tools/parity/capture_native_sound_calls.py --movie '<Penguin Fight.bk2>' --rom '<matching X1 Rev 1 ROM>' --bizhawk '<portable BizHawk>/EmuHawk.exe' --output '<empty directory>' --frames 300

--frames 0 (default) captures the complete movie; nonzero values select its unaltered prefix. CSV retains frame, queue PC, command, D/P/S, candidate return/ JSL site, stage, player coordinates/state and raw direct-page fields. Raw DP fields deliberately retain offset names: numeric object IDs are pool-specific, and a shared handler can contain several semantic roles. Native frame n is after input n-1; callbacks during that update are labelled n. The movie must start at frame zero; a missing starting frame is rejected rather than shifted.

Metadata records source movie/ROM, executable and compressed bsnes-core hashes, Lua script/CSV hashes, queue-entry count and statically validated JSL candidates. The stack candidate is checked against the original ROM opcode/target. Even a valid JSL does not establish preceding A data flow or the semantic actor owner; review the caller and its state/context. Tail-jump/other stack cases remain unverified candidates. This is not a full CPU or audio-waveform trace.

The first bounded X1 door observation replayed 300 unmodified inputs from Penguin Fight: opening 40 at frame 119, closing 41 at frame 247, both with D=1628 and subtype 89. Static source confirms the latter’s high-bit branch and the alternate 40 closing command for the first door. The movie uses USA Rev 1; imported assets use USA 1.0. Their native SPC banks 0/1/2 match exactly in targets/payloads, while CPU caller addresses differ. No whole-movie XSharp parity is implied.

A separate full Stag Final Climb capture collected 279 entries, all 279 stack candidates matching JSL targets. It includes player movement, Gas Pipe ignition/ pulses and shared enemy explosions, but no door transition. It cannot identify X2 door sounds by absence or by borrowing X1 IDs. Raw private captures remain in LOCALAPPDATA/XSharp/Research/NativeAudio; small source observations are versioned.

python -m unittest discover -s tools/parity -p test_capture_native_sound_calls.py checks readonly instrumentation, Lua delimiters and JSL validation including ROM mirrors, RAM, non-JSL opcodes and mismatching targets.