XSharp

X2 resolved wall contact and bottom-edge exit

The subsequent top-ladder descent calibration records the latest continuous prefix. The results below preserve this wall-contact milestone.

The X2 player now retains the horizontal contact produced by collision resolution. It uses that history on the next controller update for wall-slide entry and continuation. A one-pixel adjacency query is still useful for geometry, but cannot substitute for the original contact mask.

Original sequence

Read-only BizHawk 2.11/BSNESv115+ execution of the unmodified USA ROM and the user’s Gap Jumps.bk2 establishes this sequence:

Frame Original behavior
1432 Move left without side pushout; side-contact mask remains zero despite adjacent geometry
1433 Resolve left collision, retain the new X fraction and record left contact
1434 Select wall-slide entry from that previous contact, still applying the incoming fall movement
1435–1442 Eight stationary slide updates
1443 Descend two pixels and move left one pixel past the wall’s bottom; side contact becomes zero
1444 Enter falling substate zero, preserving stored slide speeds and skipping motion
1445 Initialize ordinary falling, clear the old fall speed, then apply gravity 64/256

$08:CD6E..CD73 clears the old contact byte each update. $08:CE4C..CE57 compares integer X with the previous integer coordinate and skips side resolution when unchanged. The remaining side probes operate on the position after movement. The standing collision definition at $06:A158 has center (0,-1), half width 6, half height 17 and inset 8. $08:CF7D performs the integer horizontal pushout without replacing the new fractional byte.

The controller tests the previous mask at $08:9938..9946 when falling and $08:9C2C..9C3A when sliding. The slide’s ordinary descent is already part of the position tested by the collision probes. On 1443 the upper side probe is below the last wall row; testing at the old height would incorrectly retain the wall and block X. On 1445 falling entry at $08:98AB..98B8 calls $BE74, which clears the stored slide speed before gravity resumes.

parity/gap-left-wall-source.json pins the revision, original movie and scene capture, relevant ROM bytes, native writes and selected control-flow CSVs for 1431–1436 and 1442–1447. Inputs and original RAM/files were not altered. OriginalWallContactRomTests additionally checks the original mask/probe/fall-entry bytes against the SHA-1-verified local ROM when XSHARP_TEST_ROM_X2 is set.

Engine changes

Sprite.OnHorizontalCollision reports a resolved nonslope side sweep, parallel to its existing vertical-collision hook. The default hook does nothing. X2’s player collects that contact only when requested integer X changes, then saves the result for its next update. Adjacency alone and stationary vertical motion do not create resolved side contact. A newly pressed airborne direction also commands motion into an adjacent wall immediately; the legacy first-press stop no longer prevents the X2 contact sweep.

The generic ResolveHorizontalAtDestinationHeight policy defaults to false. X2 opts in only while descending in wall-slide state against the world: the side sweep previews the destination height, restores the collider’s previous Y, then the ordinary vertical sweep resolves floor contact once at the corrected X. This preserves vertical fraction/floor handling and avoids blocking against a wall already passed vertically. Other movement modes retain their existing sweep order.

The previous-contact mask and pending falling initialization are persistent simulation state. The per-sweep contact accumulator is transient. Falling initialization occurs one update after slide exit, so it neither erases the exit frame’s stored speed nor carries that speed into the next gravity update. The existing native-demo build-identity guard remains in place.

The device-free fixture gap-left-wall-slide.json compares frames 1431–1447, including motion, side masks, all eight hold updates, bottom-edge descent and fall initialization. The first right-wall fixture now explicitly imports its observed initial contact at 121 rather than deriving it from adjacency; later rows are simulated without correction. Existing right-wall, wall-kick, ceiling, ladder, landing and legacy tests remain active. Additional left/right tests start next to a wall with zero horizontal motion, then verify that a new direction first resolves contact and only subsequently enters the slide.

Continuous validation and remaining work

parity/gap-wall-contact-state-replay.json records a 1,500-input run with matching player/camera motion and a 20-update restoration from 1434, where resolved left contact must survive the save. parity/gap-jumps-wall-contact.json records the complete 4,186-input run and another 20-update restoration from 1444, where pending fall initialization must survive. These checks compare observed player/camera/RNG and engine-entity state after restoration.

The complete run matches X/Y/VX/VY through 1580, camera position/derived motion through 1587. The next difference on 1581 is an early top-ladder descent while the original is still in its landing animation. RNG still first differs at 1, health at 2488, and source/engine entity semantics remain unmapped. The comparator remains divergent/incomplete; this is not certification of all collision types, all original actors or full-scene playback.