Files
Neutron/docs/checkpoint/level-game-lifetime.md
T

5.7 KiB
Raw Blame History

C3/C7: old level-game deletion is restored by ordinary initialization

Static source recovery,2026-10-25. Original Neutron.exe SHA256 f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8. Preferred VAs below are EXE addresses. Their physical offsets are VA−400000; the read-only helper independently uses PE section mapping and emits both. No original was modified or executed. No modern runtime code was edited here.

Resolved distinction: stored defaults versus live state

The prior loader report correctly found the lab class-default initializer's virtual204(0) at44D472, but that writes live interface+139 only. The constructor-reachable class-default stage is not the final lifetime state. The normal initialization pass subsequently restores live state from a separate stored field, interface+11. This resolves the apparent preserved-old-game contradiction without inferring destruction from overwriting509948.

Stage Original instruction / function Effect
Generic constructor 46FDB3 pushes1;46FDB7 →470F40 Setter writes stored+11 and dispatches204 to set live+139
Class defaults 44D456 pushes0;44D472 invokes204 Live+139 becomes0, stored+11 remains1
Normal per-object initialization 46E5C3 invokes slot28 Lab/tutorial/outside game slot28 is44D4E0
Game base initialization 44D4E0 jumps4587F0;4587F3 calls470540 Enters the common initialization bridge
Restore effective lifecycle state 4705B3 invokes8C getter470F30, pushes result4705B9,4705BC invokes204 setter4719C0 Reads stored+11 and writes live+139
PostLoad 46E61A invokes40C after28 for each object Game has already restored its ordinary live teardown predicate1
Ordinary departure 46E032/46E06F/46E0AC call200 getter4719B0 Getter reads live+139; game qualifies for all three teardown passes

This common initializer also copies other stored/editor configuration fields to live fields. Do not generalize every corresponding field as persisted gameplay state: the +11→+139 bridge is specifically proven here.

Route game interface tables:

  • Lab4C386C, tutorial VR04 4CE4AC, outside4C561C all resolve28→44D4E0, 8C→470F30 and204→4719C0.
  • 470F30 reads byte[interface+11].4719C0 writes byte[interface+139] from its argument.4719B0 reads that live field for the teardown predicate.
  • The usual game interface is complete+8C for level-game objects, unlike Jimmy's complete+C0. Pointer bases must remain explicit.

Actual deletion and registry removal

For initialized old level games with live+139=1, ordinary transition46DFF0:

  1. Calls slot20 in the first filtered traversal at46E054.
  2. Calls slot34 in the second filtered traversal at46E091.
  3. Sets interface+6=1 in the third traversal at46E0CA.
  4. Calls473710 at46E0D9. That sweep finds marked objects, invokes interface slot0 with argument1 at473733..737, then restarts the global list scan.

Lab slot0 at4C386C points44F610: subtract5C converts game interface+8C to the destructor's complete+30 subobject, then jumps44F3F0. That scalar deleting wrapper calls44F420; its base call44F499→44D390 jumps44D3C2→4746E0. The game destructor calls4587E0 at47476A with its game interface, and4587E0 jumps470060, the common interface destructor.

The common destructor explicitly scans registry50999C at4700E5, matches the dying interface against node+8 at4700F2, and erases matching nodes using 469490 at470106 with list object509998. This is the actual old-game registry removal edge. It precedes allocation/registration of the destination game in 46E170. Existing current-game pointer509948 can temporarily refer to the old object during teardown; destination construction overwrites it later, but that overwrite is not the operation responsible for deletion.

There is no need to model accumulating old level-game input callbacks for the normal route: the initialized live flag selects ordinary deletion. Abnormal paths that bypass normal Init or mutate the stored/live flags require separate evidence and are outside this successful-load case.

Why Jimmy and Goddard differ

Jimmy4226B5..BF and Goddard41C99B..9E invoke470F40 with0. Unlike the game's class-default virtual204(0), this updates both stored+11 and live+139. Common Init therefore restores0 for these retained characters, and their positive reusable+9 fields allow GAM/object lookup reuse without re-appending their nodes. Those constructor values, their reuse flag and any later field resets are separate concepts.

Fresh lab order game→Jimmy→fire remains proven by lab-registry.md. On a successful later ordinary load the old game is deleted, retained nodes keep their order, and the new game is appended afterward. Thus relative input versus Jimmy order can differ from fresh construction. Complete retained helper-node and per-field reset coverage is still needed before claiming all callback ordering or all transition state is recovered.

Verification and implementation consequence

checkpoint_level_game_lifetime.py ../Original checks the binary identity, decisive stored/live flag, initialization, teardown and destructor/unlink bytes, plus route vtable targets. Its tests guard the actual source contract rather than a speculative lifecycle simulation. This is static evidence, not observed original gameplay.

The normal old-level-game removal gate is now closed. C3 can preserve retained object insertion order while deleting/replacing the level-game callback owner, instead of freezing fresh game-before-Jimmy order for every transition. Keep the port's application-owned window/Vulkan session as the authorized modern presentation policy. Remaining source gates are per-field character/helper reset rules, exact timer/event-pump behavior and original runtime comparison.