XSharp

X2 flat-floor acquisition and the first Gap Jumps landing

The first landing mismatch in Gap Jumps.bk2 is corrected for the X2 profile. The continuous comparison now matches X/Y/VX/VY through movie frame 121. The next mismatch is horizontal speed at 122, then position at 123, at wall contact/entry to wall sliding. Full-movie parity still fails. parity/gap-jumps-floor-fix.json records another complete 4,186-input run and a successful 20-update save-state replay from the landing’s pending-contact frame 105.

Original-game evidence

This analysis uses the unmodified X2 USA ROM, SHA-1 637079014421563283CDED6AEAA0604597B2E33C, and the user’s original movie in BizHawk 2.11/BSNESv115+. It combines the full frame trace with CPU register/WRAM write callbacks on frames 103–107. The instrumented full capture has the same frame CSV SHA-256 935C26EC7EF309376CC3B8248D252C7B21E2820447612F280D523A02B4EBAD0C as the uninstrumented reference. Instrumentation changes neither memory nor inputs.

Frame Original Y, 8 fractional bits Floor-contact bit Stored downward speed Behavior
103 01AB.DF 0 03C0 Falling
104 01AF.DF 0 0400 Still falling; nearby floor is not an acquired contact
105 01AF.1F 4 0440 Motion first produces 01B4.1F; collision pushes integer Y back to 01AF
106 01AF.1F 4 0000 Player controller consumes the acquired contact and switches to grounded motion

The original stores vertical speed with the opposite sign; the table expresses downward speed as positive for comparison with XSharp. The controller retains dash-inherited horizontal speed 0375 through frame 105 and uses walking speed 0178 on frame 106.

The executed ROM instructions explain both timing and precision:

The callback reports the core’s write-time PC, normally the instruction’s following address (for example 08D263 for the write at 08D261). parity/gap-first-landing-writes.csv retains these writes and registers; gap-first-landing-source.json records hashes and the original instruction bytes. CSV bytes are preserved by the local .gitattributes file.

A second controlled experiment restores the same private frame-104 state between variants. Holding Jump from frame 105 does not launch X: contact is not yet available to that input update, and the held press is not buffered. Pressing Jump for the first time on frame 106 prepares VY=0553, then moves upward with 0513 on 107. The input differences and original observations are recorded in parity/gap-first-landing-jump-controls.json and its CSV. No user movie or state is modified.

Engine change

PlayerPhysicsProfile.DeferFlatFloorContact is enabled by the X2 preset. For normal movement against flat world blocks, the player uses the previous resolved-contact latch instead of acquiring support from an adjacent pixel probe. The vertical sweep marks contact after actual floor resolution, preserves the attempted movement’s fractional Y, and leaves stored falling speed intact for that update. The next player update consumes the contact and performs the grounded transition.

The implementation reuses Sprite’s existing serialized lastLanded field through a protected property. It adds no serialized contact state. A snapshot at frame 105 therefore retains the acquired contact and still-falling speed; its next 20 updates reproduce exactly after restoration. This is same-build restoration evidence, not a claim about every historical save file.

The policy is selected for flat world-block support. Spawning, teleporting, boss-door crossing, slopes, ladder tops and support from solid sprites retain their existing paths. Legacy/X1/X3 presets keep their prior contact timing. This milestone does not establish parity for every other contact type, animation or actor.

Reproduce

python tools/parity/capture_bizhawk_movie.py `
    --movie 'C:\Program Files\BizHawk\Movies\Gap Jumps.bk2' `
    --rom 'C:\path\to\Megaman X2 (USA).sfc' `
    --bizhawk 'C:\path\to\portable-BizHawk-2.11\EmuHawk.exe' `
    --output "$env:TEMP\xsharp-gap-floor-source" --trace-floor 103 107

dotnet test XSharp.Tests/XSharp.Tests.csproj
dotnet build tools/XSharp.MovieParity/XSharp.MovieParity.csproj

Run the comparison host with the source movie, ROM, matching frames.csv, a fresh output directory and --verify-state-at 105. It captures the entire continuous timeline first, then separately restores the saved frame and verifies 20 following updates. --frames 180 --verify-state-at 105 is a shorter diagnostic run. Resources are resolved relative to the executable; argument paths are resolved relative to the caller’s original directory.

Regression coverage includes the original landing observations, new fractional carries, early versus newly pressed Jump, unchanged legacy/X1/X3 contact timing, the existing ladder-gap and vertical traces, and native state restoration. The full run still reaches the dying state later; subsequent wall-contact errors remain pending and must not be described as faithful playback.