Files
Neutron/docs/checkpoint/retained-return-cleanup.md
T

7.1 KiB
Raw Blame History

RETURN cleanup and complete PostLoad route tail

Static C3/C7 continuation,2026-10-26. Read-only source is Neutron.exe SHA256 f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8. All preferred-base EXE VAs below map to raw file offset VA−400000 for these sites. The helper maps PE sections independently and emits actual offsets/bytes and virtual targets. No original code was executed; no runtime implementation changed in this investigation. This report supersedes the earlier prefix-only gadget availability interpretation in retained-character-reset.md.

Result: cleanup is selected-gadget policy, not a universal motion reset

RETURN457FED adjusts Jimmy's game interface−C0 to complete, then457FF7/9 invokes complete178. Table4A3BDC+178 resolves427FF0. After cleanup,458014 setscomplete954, 458028 sets9A5, and45815C dispatches complete168→43B5A0. Cleanup therefore runs before RETURN flags and ordinary transition staging.

427FF0 first updates the C2DInGameMenu at completeA18, if present. Provenance: Jimmy42238D calls401430,4223A6 stores its result inA18,401464 installs48D414; literal4EF05C identifies C2DInGameMenu. Cleanup calls its4B0(3) at42800C, then 4C4 at42801A; those resolve405FB0 (menu selection/resource visibility) and406590 (close/free menu resources). The receiver is not the owned C3DJetpackFire.

428020 loads signed WORD selected gadget4F0588. Unsigned bound428027..2A rejects values outside0..7, including−1, to the common epilogue. Table428844 has:

Selected gadget Case target Relevant distinction
0 428037 If completeA14 exists, explicitly writes movement mode7C4=0 at42804F and restores radius/support.
1 4284FB Writes mode7C4=1 at4286EA after companion/gadget cleanup.
2 42810C Other gadget/companion policy.
3 (jetpack) 42882F Directly the common epilogue: selected gadget4F0588=−1.
4 4281B3 Other gadget/companion policy.
5 4280CC Conditional companion/gadget policy.
6 42871D Other gadget/companion policy.
7 4287AC Other gadget/companion policy.

The jetpack/no-selection branch does not zero movement mode7C4, jump7E8, hold874 or owned fire6C0. This is a local caller projection, not proof that every later load callback preserves those fields. Generic cleanup must not be modeled as “clear all movement”; gadgets0/1 demonstrate different behavior.

Ordinary43B5A0 does not use this selected-gadget dispatch. It stages strings, clears7FC, conditionally copies departure root9A8 unless9A5, queues the scene request at43B7F1, then calls complete148 at43B7FB. That target429A00 only stops saved sound handleA44 via458A00 and writes−1. Practice Yes40470D uses this ordinary stage. Ordinary LOAD uses it at458276. RETURN adds its preceding cleanup/flags.

Critical correction: read the entire Jimmy PostLoad

The generic prefix423DEF..423E3F enables the eight group0 gadgets, then VR01..08 prefix423E71..423EC1 disables them. That is not the final state. Jimmy PostLoad continues through424557 and has level-specific overrides:

Destination Tail behavior and source call VAs
LV1B 423FBB..423FCB recognizes LV1A..LV1C.424108 disables group0 item1;424113 disables item7.
VR01 4242BB cleanup;4242C7 enables item0.
VR02 424319 cleanup;424325 enables item1.
VR03 4242F0 cleanup;4242FC enables item2;424408 selects item2.
VR04 424340 cleanup;42434C enables item3;42435A selects item3.
VR05 424380 enables item4;424394 cleanup.
VR06 4243A8 cleanup;4243B4 enables item5.
VR07 4243CA cleanup;4243D6 enables item6.
VR08 4243EE cleanup;4243FA enables item7;424408 selects item7.
LEV1 Falls through to common42440E without those per-level overrides.

VR05..08 branch424365 subtracts56523035, bounds0..3, then dispatches table424558 to42437A/42439C/4243BE/4243E0. Every enable call pushes (disabled=false,item,group0) in reverse argument order and targets403870; conversion remains only4→1. Thus every tutorial enables its corresponding practice gadget0..7 after disabling the others. Unknown/unowned wire values remain unchanged. LV1B owned items1/7 finish4. Source VR04 owned jetpack3 finishes1, not4; lab return leaves it1. The earlier port tests asserting VR04 jetpack4 validated an incomplete source prefix.

Other ordinary-level branches also exist in423EE1..42440E; their availability, selection and automatic save policies are outside this bounded route correction. Do not present a route-specific implementation as a full PostLoad reconstruction.

Remaining callback closure for retained fields

Common PostLoad42373E cleans selected gadget5 specifically, not every gadget. Jump state is separately cleared at42378B (interface728=complete7E8). The route tails above run after that reset. VR04's complete174(3) resolves428D50; its table 4298E8 is indexed item+1 and maps both−1 and3 to428DE0. That branch tests global inventory item9==2, conditionally schedules another practice level, and otherwise returns. It does not initialize movement/hold/fire time. Its UI prelude uses the same menu-selection405FB0 and does not own the effect timer.

The common tail424472 grants control through game118, then42447D invokes Jimmy410 →42AFC0. That calls43A750 (speed0/body velocity2C4(0,0,0), separately recovered by primary), stops sound148, then complete150(STOP) at42AFDE..E5. Complete150 is 43AFF0: a conditional animation/action request; it dispatches completeE0→40DD90, which updates morph selection/alias strings and animation flags through base targets. It contains no movement-mode/hold/owned-fire write. STOP is literal 4ED040, distinct from RUN4ECA64. This final control preparation does not mean movement mode is walking0.

Owned fire has its own subsequent tick421FB0. It queries owner support218 at421FDF, zeros interface600=complete6C0 only if grounded421FE9, then subtracts dt421FF3. This is an effect tick, not a loader reset. Takeoff separately zeros the timer at 438391. Initialization can preserve a timer that the first destination tick then changes; comparisons must observe the same phase.

Confidence: high for exact cleanup/table arguments and final route availability; high for absence of direct scalar reset in these resolved local paths. Mode/hold/ fire preservation through a complete transition additionally requires the sibling property-stream/Init proof and enclosing control/loader order. Retaining only these bounded scalars after that closure is justified for no-selection/jetpack route states; retaining arbitrary gadget modes, physics vectors or effect handles is not justified by object identity. Body reset, selected gadget and jump state must remain independent state dimensions. Original runtime comparison remains open.

Verification

python3 -m unittest discover -s tests -p test_retained_return_cleanup.py -v passes5 tests covering immutable source identity, exact instructions/vtables, cleanup table, all eight tutorial tail argument/dispatch sites, and a deliberately nondefault sentinel projection for selected jetpack/no-selection cleanup. The projection checks interpretation only; it does not execute the original routine. python3 tools/binary/retained_return_cleanup.py ../Original emits the evidence; local generated copy: artifacts/retained-return-cleanup.json. No originals modified.