XSharp

X2 walking release and stored velocity

The X2 preset now reads horizontal walking input on the current update and stops displacement immediately when that input is released. The stop update retains the incoming stored velocity. The next ordinary idle update clears it. Other presets retain their existing input delay and stop behavior.

Original evidence

On frame 664 of the user’s Gap Jumps.bk2, X2 changes from walking $04/02 to idle $00/00, leaves X/Y unchanged and retains stored VX 376/256. On 665 the original accepts Dash, selects VX 885/256 and moves. The engine’s former one-update ground input delay incorrectly moved another 376/256 on 664, shifting subsequent player and camera coordinates.

Read-only CPU callbacks show $08:9803 calling $08:B96A, which tests current held horizontal input $37. With neither direction held, $08:9808..980C enters $08:B9B4, clears the movement state/substate and returns without calling the walking-motion path or clearing VX. The earlier pre-walk controller at $08:9798..979D uses the same direction test and idle return. Native write-time PCs can follow the instruction issuing the write.

parity/gap-walking-stop-source.json pins the USA ROM, original movie and hashes of the native writes and selected control-flow CSV. The capture uses private configuration/movie copies and does not alter original input or RAM. The focused gap-walking-stop.json fixture contains original collision cells and three observed release sequences: frames 661–664, 1668–1673 and 3055–3060. They include both directions and the following ordinary idle update. Nonmovement buttons are excluded only from these isolated movement tests; the continuous comparator applies every recorded button.

Engine policy and validation

UseOriginalWalkingStopTiming, enabled in the X2 preset, uses zero horizontal input latency while pre-walking/walking on the ground. Entering idle retains the previous speed and suppresses this update’s requested motion. The suppression is transient, consumed in the same tick and omitted from save-state fields. A subsequent jump/dash/ladder action can replace the idle state; it does not inherit an unconditional motion pause. Idle-speed clearing works independently of UseOriginalDashStopTiming.

Production player/world tests cover the three native sequences, pre-walk and full walk in both directions, the following idle update, Jump on the release update, independent policy selection, and the previous behavior in legacy/X1/X3 presets. These tests initialize no video/audio devices.

The complete 4,186-input run in parity/gap-jumps-walking-stop.json has:

Observable First difference
Player X/Y 1434
Stored player VX/VY and observed acceleration 715
Camera position, displacement and derived acceleration 1443
RNG seed and call count 1
Player health 2488

Thus all four player motion values agree through 714, player positions through 1433, and camera motion through 1442. The next stored-speed difference is landing-animation handling at 715. A state captured at 663 restores 20 subsequent updates of observed player/camera/RNG and engine entities exactly, across walking release, Dash and Jump. The host still returns exit code 2: entity semantics remain unmapped and RNG cadence differs. No per-frame trajectory or seed corrections are applied.

Ground support loss

The native walking controller also returns into falling without moving when support was lost on the preceding update. At movie frame 2581, $08:C666/C668 writes state 08/00, retaining X/Y/VX/VY; 2582 initializes falling and starts gravity/motion. UseOriginalGroundSupportLossTiming selects this behavior for X2. Legacy presets keep their existing policy. Scripted/forced states and teleportation are excluded.

The device-free regression first reproduced the frame-2581 early movement, then matched all 15 recorded states with original ROM collision cells. The source write log and metadata are retained in parity/gap-walking-support-loss-*. Its position in a continuous display-frame comparison depends separately on the original loading stall at 2185.

Standing turn before walking

Frames 2619..2623 cover stopping leftward movement and restarting to the right. The native controller selects walking without displacement on 2620 and moves at 0178 on 2621. With the existing buffered standing input, an additional facing-turn pause delayed XSharp’s movement until 2622. PauseOnGroundTurn is now independently configurable and disabled in the X2 preset; other presets retain it. The recorded geometry/motion regression covers all six states, including the retained velocity at the stop and the zero velocity before restart.

Facing before the idle gun request

The stationary walking-entry update still accepts a facing change from current X2 input. At 2620, the original charged shot faces right while the player’s position/velocity remain unchanged. Standing movement uses its existing entry delay, but native facing is updated before the gun request. The standing-turn fixture now checks direction as well as X/Y/VX/VY.

Walking jump dispatch

X2 USA $08:97DB..97EA checks the pressed Jump bit before the walking-release branch, calls $08:B9C8, then jumps directly into $08:9827 on the same update. The walking branch of the initializer retains the incoming horizontal speed magnitude and chooses the jump impulse before air control. Standing/dash jumps keep their separate prepared update. LaunchWalkingJumpImmediately selects this behavior only for the X2 profile.

The original Gap Jumps states 2951..2962 and the original collision cells are captured in XSharp.Tests/Fixtures/X2/gap-walking-jump.json. On 2952, Y moves upward by 0513 (the 0553 impulse minus 40 gravity); X advances by 0178. The production device-free player test compares X/Y/VX/VY through the ensuing wall contact. A separate controlled BizHawk movie copy removes Right on 2952..2954 while retaining Jump: the original immediately launches with the same Y curve and VX zero, then resumes VX 0178 when Right returns at 2955. The original movie and ROM remain unchanged. The regression for jumping on walking release now checks this immediate launch and current horizontal input.

The native gun-pose clock preserves the walking shooting family on entry, and advances its airborne clock immediately when jump motion already occurred. This avoids applying the standing preparation pause to a walking jump. Full-movie validation remains tracked separately in the scene parity report.

Grounded walking resume window

X2’s idle controller $08:96FB..9717 decrements $4F, selects pre-walking, and skips directly to full walking only while the counter remains nonzero. The walking release path $08:9808..980C sets this counter to ten; the final landing update $08:99AE clears it. Recent movement in the air alone does not create a fast restart window. Native +4F is also reused for wall-kick direction (00/40); a later wall slide can return directly to idle without the landing completion that normally clears it. The Stag calibration preserves that controller-dependent value; see physics-stag-calibration.md. UseOriginalWalkingResumeTiming keeps a serialized grounded counter for this rule, independently of the legacy recent-VX heuristic. It is enabled only in the X2 profile.

gap-walking-after-landing.json covers original states 3007..3024 (landing then slow start), 3032..3048 (quick grounded restart) and 3372..3403 (expired restart window and first full-walk release). It pins the original movie/ROM and collision cells. The five-update pre-walking animation already used by the production player is reflected in the device-free test resources. The source capture places the first slow step at 3016, the no-motion full-walk transition at 3020, and ordinary 0178 walking at 3021. These regressions compare all four motion values, not just a chosen terminal position.

The immediate jump path applies only to native state 04 (full walking), as checked at $08:B9C8; native pre-walking state 02 keeps its prepared impulse. gap-prewalking-jump.json compares original states 3280..3292: frame 3281 keeps position unchanged and prepares VY 0553, then 3282 begins motion at 0178 / 0513. The engine distinguishes WalkingOnly from its broader Walking predicate, which also includes pre-walking. Both original clips are covered by the same production player regression.

The expired-window clip extends through 3403 to cover releasing Left on the first full-walking update. Native $04/00 calls $08:BE74 before checking release: at 3400 it retains VX -0178 without displacement, despite the prior slow-walk transition retaining -0100 on 3399. A serialized pending initialization now applies this base velocity on the following update, before release/support/jump decisions. This keeps the transition pause and the original stored-speed distinction separate.

Idle reversal beside a wall

At 3715, the original idle controller selects Right in $69, but $08:D60C still tests the previous sprite orientation in $11 and sees the left wall. Its sprite facing then changes. At 3716 it can request full walking, without displacement or stored VX; motion starts at 3717. The engine retains its existing idle input buffer and stores this rejected turn as a pending request, so the successful following entry gets its own stationary initialization instead of moving one update early. The pending state is serialized. This applies to the X2 walking policy and a real blocked prior facing, not a movie frame number. The original trace in gap-dash-expiry.json extends through 3725 to cover the reversal, resume-window timer and retained-speed release.

Shooting on the idle-request update

Stag 1532 releases Left and newly presses Shot. $08:B9BC..B9BE requests idle without displacement and preserves VX FE88; the following idle initialization clears it on 1533. The engine’s movement path already retained this speed, but its later standing shooting-pose refresh called SetStandState() again and cleared it. Both new-shot and charged-release refreshes now preserve speed when the existing idle-request latch is pending. No extra controller phase or serialized field is introduced. The native fixture compares all four motion fields through 1529–1534 with the real Shot input. Six additional left/right tests cover new lemon, semi-charged and fully charged release paths using handled weapon allocation requests without graphics/audio devices.

Dash admission and the optional held-button extension

Stag 1577 presses Dash while facing a wall. Executed $08:D60C rejects the request; the player remains idle, dash-origin +55 is zero, and the air-control speed +5C remains 0178. The jump request on 1578 executes $08:B9C8/$08:B9D8, without $08:BA14. The first moving update on 1579 therefore uses VX 0178, not 0375.

The engine intentionally supports dash-speed ground jumps while Dash remains held. PlayerPhysicsProfile.AllowHeldDashGroundJumps preserves that feature by default. Original-movie comparisons disable it explicitly. With the extension disabled, the prepared jump captures an active/newly accepted dash rather than the held button and retains that admission decision on launch. Immediate walking jumps retain their own native input-frame timing. Controlled tests cover held Dash from idle/full walking, new Dash+Jump, both directions, and accepted/blocked requests with the extension enabled and disabled. The recorded trace checks +5C only in the native jump state: the engine’s base speed is also reused for ground pre-walking and is not semantically equivalent to native air-only +5C while idle.

Source instruction/write windows are linked in Stag calibration. They are read-only full original replays with the same frame-trace hash as the baseline. This corrects admission/speed policy; full-scene parity and native CPU pacing remain separate pending work.

Landing completion takes priority over walking and Jump

The read-only Stag 2406–2412 executed window shows $08:9989..998B initializing landing timer +4E to four. $08:99AA decrements it on every landing update. At zero, $08:99AC..99B0 clears the resume byte and requests idle through $08:B9B4, before the Jump check at $08:99B3 or horizontal-input check at $08:99BC. Thus new Left on 2409 must not move X or clear VY FA40; idle initialization clears speed on 2410, requests slow walking without movement, initializes/moves at 0100 on 2411 and requests full walking on 2415 while retaining its final slow speed. The next update moves at 0178.

UseOriginalLandingTiming now drives a serialized controller countdown, with positive LandingDuration defaulting to four. Visual landing animation completion cannot dispatch a second state change. The existing pending walking-initialization flag preserves the stationary request after idle entry; a slow-walking request starts its visual clock on initialization, avoiding one prematurely consumed frame. The 2404–2416 fixture compares native coordinates, stored velocities, landing state and the state-specific timer. Controlled tests cover completion versus Left/Right/Jump and controller durations 1/2/4/6 with and without visual animation updates. Earlier landing input remains immediately interruptible. This changes no default held-Dash policy.

First-slide wall kick retains initialized contact speeds

At Stag 2984, falling requests slide $12/00. On 2985, $08:9BB9 calls speed initialization before the slide tests Jump at $08:9C20. VX/VY change from 0375/ FEC0 to 0100/FE00, then $08:BA47..BA54 requests wall kick $10/00 without displacement. Those contact speeds remain through 2989; the impulse is prepared on 2990 and first moves on 2991.

XSharp accepted Jump before its ordinary slide-update method, bypassing this first-update side effect. The accepted first-slide kick now uses the same speed-preparation helper as the existing slide-to-floor path. Later slide kicks and other wall-kick origins retain their established behavior. The raw original 2982–2999 fixture compares all four motion fields through the impulse and ensuing movement. Controlled left/right cases verify the five stationary updates preserve the initialized contact speeds and the next prepares the away-from-wall walking-speed impulse. No per-frame recorded state is injected.