From 346d35017614e08e4ee540d0199bd0c02709b86c Mon Sep 17 00:00:00 2001 From: Cristian Cerroni Date: Fri, 6 Nov 2026 22:56:38 -0500 Subject: [PATCH] Trace VR04 physical registration and generated helper lifetimes --- AGENTS.md | 5 + docs/architecture.md | 6 + docs/checkpoint/body-root-registration.md | 9 +- docs/checkpoint/coverage.md | 8 +- docs/checkpoint/next-work-plan.md | 7 + docs/checkpoint/physical-registration.md | 138 +++++++++++++++++ docs/checkpoint/vr04-generated-bodies.md | 77 ++++++++++ docs/compatibility.md | 11 ++ docs/decisions.md | 9 ++ docs/gameplay/main-menu-player-lifetime.md | 2 +- docs/progress.md | 25 +++ docs/reverse-engineering.md | 5 + docs/tasks.md | 7 + tests/test_physical_registration.py | 49 ++++++ tools/binary/physical_registration.py | 169 +++++++++++++++++++++ tools/binary/physical_registration_probe.c | 90 +++++++++++ tools/binary/vr04_generated_bodies.py | 104 +++++++++++++ 17 files changed, 718 insertions(+), 3 deletions(-) create mode 100644 docs/checkpoint/physical-registration.md create mode 100644 docs/checkpoint/vr04-generated-bodies.md create mode 100644 tests/test_physical_registration.py create mode 100644 tools/binary/physical_registration.py create mode 100644 tools/binary/physical_registration_probe.c create mode 100644 tools/binary/vr04_generated_bodies.py diff --git a/AGENTS.md b/AGENTS.md index 4f213ef..d5aced3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -57,6 +57,11 @@ collision. Gated pairs retain contacts; sphere exclusions use the earlier actor. Both packages identify clean924ad2f; standalone Linux Carl return passes with4 readbacks identical to ea04210. Current Windows is cross-published/resource- verified; earlier Wine64 runtime evidence belongs to ea04210, native Windows open. +Registration continuation: docs/checkpoint/physical-registration.md and +vr04-generated-bodies.md cover72 records/13 classes,12 original component cases +and21 helper edges. Runtime/packages remain924ad2f. Common append is not deduped; +Jimmy49E guards the whole bridge. Per-node Init/PostLoad visits new registry tails. +Full retained helper membership/cleanup/activation and shared reclip remain open. 2026-11-06 continuation: the earlier292 original component cases plus50 derived- caller cases and body/visual-sync audit supply no extra reset. Startup diagnostics diff --git a/docs/architecture.md b/docs/architecture.md index b0ba938..edaf409 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -99,6 +99,12 @@ mode2 solver, and preserves contacts when eligibility skips a pair.28 complete original-component comparisons support it. It is not connected to the grouped SceneInteractions loop: full registration/activation, real actor responses and shared dynamic reclip state remain prerequisites. See checkpoint/pair-lifecycle.md. +Registration has separate ordinary registry50999C, physical list695D3C and own +49E flag. Common4623D0/464210 can append duplicates even when49E is already set; +Jimmy42AB50 guards the whole call.479A40 invokes Init before node append, while +46E570 runs Init then PostLoad per node and visits same-pass registry appends. +12 original-component cases support these boundaries; the full VR04 helper/ +activation sequence remains open. See checkpoint/physical-registration.md. Source root and modern feet/sole rendering are distinct adapters; F3 exit still uses modern capsule occupancy. See checkpoint/collision-body-implementation.md. The source-root upward ray is supplied separately from the camera debug query: diff --git a/docs/checkpoint/body-root-registration.md b/docs/checkpoint/body-root-registration.md index d21a894..5409258 100644 --- a/docs/checkpoint/body-root-registration.md +++ b/docs/checkpoint/body-root-registration.md @@ -10,7 +10,7 @@ object identity can survive in registry50999C.46E131 explicitly clears surviving interfaces'49E registration flag. Jimmy PostLoad4238B4 invokes interface2C→42AB50: false49E jumps to4623D0 InitPhysics. Identity retention is not physical-list retention. -4623D0 invokes base458910 (470A00 allocation/49E=true), copies current render XYZ +4623D0 invokes base458910 (one-time470A00 logging/49E=true), copies current render XYZ complete44/48/4C through16C→471630, copies angular-unit Euler through174→4716D0, then calls479A40.479A65 invokes interface150(0,0,0);479A6F invokes Init28 AGAIN, resolving to Jimmy437890. Only then does it append a12-byte body-list node with @@ -19,6 +19,13 @@ final control preparation have their own order; registration's Init is not a blanket post-placement reset. Existing retained scalar conclusions remain bounded by the closed437890/generic Init chain, not by an assumption that Init runs once. +Follow-up: [physical registration](physical-registration.md) executes12 bounded +original registration/loader cases.470A00 is a logging hook, not an allocator; +the12-byte body node is allocated inside479A40. The common polygon/sprite bridges +can append repeated actor pointers; Jimmy's outer49E guard supplies the distinct +skip boundary. The per-object Init/PostLoad order and same-pass registry appends +are now covered by original-component execution, not solely static reading. + | REA routine | Evidence ID | |---|---| |4623D0|ev_d60cfc7d2ff8266e19176052e1466ba98f09e7b10b92db828566fbc28d36d281| diff --git a/docs/checkpoint/coverage.md b/docs/checkpoint/coverage.md index 20b630e..281d87e 100644 --- a/docs/checkpoint/coverage.md +++ b/docs/checkpoint/coverage.md @@ -67,6 +67,12 @@ callback-mutated roots/membership and enter/stay/leave. The component has explic mode2 injection and is not admitted to live scenes. VR04's6 inspected actor records and20 bindings do not yet constitute the full physical/helper registration list. +[Physical registration](physical-registration.md) now inventories all72 VR04 +records/13 actual interfaces and executes12 original registration/loader cases. +Common append versus Jimmy49E guard, nested Init and live per-object registry +traversal are verified.21 helper edges/12 RTTI identities are catalogued; actual +retained helper membership, deletion/activation and shared reclip remain open. + | ID / system | Recovered contract / anchors | Port implementation | Evidence / remaining gap | Next bounded action | |---|---|---|---|---| | LOOP | Viewport47E4F0 physics before registry473740, including input44DF80; second sync473770; construction order and selective retained-character/new-game ordering. Separate engine morph clock. | Player now integrates prior body state, then fresh input/player/fire or retained player/fire/input. Uncontrolled body/fire now continue while movement/input are gated. Other systems remain grouped; fixed60Hz policy. | S/M/R. Controlled player partial order implemented; bounded raw-owner preparation implemented; full wrapper/registry/cadence open. | C3 continue other callbacks and morph/control phases; C4 support/response remains separate. | @@ -80,7 +86,7 @@ and20 bindings do not yet constitute the full physical/helper registration list. | CAMERA | Shared viewport eye is recaptured by ground/air follow after scripts; strict>1000 DEFAULT snap; aim uses pre-update eye; source ray/gain and per-level far planes. | Static source query integrated for the three route scenes; other scenes use provisional sweep. Separate chase/script eyes and merged clip maximum remain. | S/M/R. Handoff source bytes/projections recovered, not implemented; full follow/input/quantization and visual comparison open. | C5 shared viewport eye/aim and DEFAULT transition; preserve source phase boundary. | | AUDIO | CAM416776..E1 stops music; DEFAULT447F12..45 restarts; bank696008 / gate4F8434; handle47D890 polls inherited software duration and repeat+30. | Separate SDL streams, floating-file-duration cutscene completion, independent per-file SFX. | S/M/R (dummy streams). Source duration/allocation/play-failure/bank/attenuation lifecycle incomplete; speakers/native Windows timing not verified. | C6: explicit bank owner and software channel-clock tests; SDL queue-empty is not the source oracle. | | UI |406F50 selector/timer;4043D9 controlled clock;407070/O edge;404D97 practice resume.44 objective flags distinct from selector. | Timed objective subset, modal practice, modern UiViewport/debug. | S/M/R. Other flags/gadgets/highlights/cursor/energy/layout transitions open; source widescreen not recovered. | Keep modern scale policy separate; recover UI dispatcher/mode gates before expanding. | -| LOAD | Deferred scene request; selective reuse; Init stored+11→live+139; Jimmy/Goddard retained. Physical49E clears and re-registration repeats Init before STRT placement. RETURN root/flags and28→40C. | Reconstructed scene with retained input order and bounded mode/hold/fire; app-owned presentation. | S/P/M/R. Physical registration chain source-guarded; full helper/body allocation/order and fades remain.50988A is editor R input. | Integrate physical list/helper traversal alongside C4; other gadget/level branches remain gated. | +| LOAD | Deferred request/selective reuse; Init stored+11→live+139; retained Jimmy/Goddard.49E clears; registration repeats Init before STRT. Per-object28→40C and same-pass appends; RETURN root/flags. | Reconstructed scene with retained input order and bounded state; app-owned presentation. | S/P/M/R.12 original registration/loader cases now pass; all72 serialized VR04 records mapped. Helper lifetime/activation and full ordering still open;50988A is editor R input. | Close helper reuse/removal and physical sequence alongside C4; other gadget/level branches remain gated. | | INVENTORY | PostLoad common prefix enables eight owned gadgets4→1, then VR01..08 disables1→4; full tail re-enables the practice gadget. LV1B disables1/7; other wire values preserved. | Availability pass now applied at level entry and verified across TSK tutorial/return; snapshots preserve raw values. | S/M/R. Full selected-gadget/UI and other level tails remain incomplete; bounded route mode/hold/fire carry is implemented. | Keep availability separate from ownership, task changes and arbitrary state carry. | | SAVE | TSK45FEE0 writer /4603F0 reader; records, arrays, return strings, stored departure root; queued460E70→460EA0. | Original-format round-trip and CLI save, scene snapshots; no full source save UI/load lifecycle. | S/M. Source reader duplicates matching task callback then all-entity420 post-task hook; this is distinct from Jimmy placement PostLoad423A90. Current fresh-director path differs. | C7 after C1/C2; test repeated callbacks before adopting loader behavior. | | CHECKPOINT | Pickup42AF00 stores+1E38 root/+1E48 level separately from+9A8 RETURN root. | Capture exposed, not used for return; source capture consumers unknown. | S/M. Do not interpret as death/respawn until read consumer found. | Track unresolved consumer; no speculative gameplay. | diff --git a/docs/checkpoint/next-work-plan.md b/docs/checkpoint/next-work-plan.md index 6e148a3..b03cf64 100644 --- a/docs/checkpoint/next-work-plan.md +++ b/docs/checkpoint/next-work-plan.md @@ -28,6 +28,13 @@ original/C# comparisons,6 new REA pseudocode results and20 guarded VR04 class bindings. The pair component is verified separately; scene admission remains gated on full physical registration/activation, real callbacks and shared reclip. +Registration continuation now covers all72 serialized VR04 records/13 interfaces +and12 original registration/loader cases, plus21 guarded helper edges. This closes +the bounded common registration and per-object loader contracts, not complete +fresh/retained helper membership. See [registration](physical-registration.md). +Next resolve helper re-entry/deletion/activation and dynamic shared reclip state; +keep live scene admission unchanged until those dependencies close. + ## Objective Establish the original ownership and timing of player state across gameplay, diff --git a/docs/checkpoint/physical-registration.md b/docs/checkpoint/physical-registration.md new file mode 100644 index 0000000..8b22139 --- /dev/null +++ b/docs/checkpoint/physical-registration.md @@ -0,0 +1,138 @@ +# VR04 physical registration and initialization boundaries + +2026-11-06. Extends the existing [registration trace](body-root-registration.md) +and [pair contract](pair-lifecycle.md) with complete serialized-class coverage and +12 executed original-component cases. No runtime gameplay code or scene admission +changes in this checkpoint. The playable/package baseline remains924ad2f. + +## Identity and evidence + +Canonical Neutron.exe SHA256: +`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`. +`physical_registration.py` verifies that identity,6 bounded source hashes, +13 RTTI interface identities,11 own-registration sites and78 method bindings. +It inventories every one of VR04's72 records with source GAM offsets/activation +fields. Original instruction Evidence is +`ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904`; +bounded extracts, offsets, hashes and10 private-memory relocation operands are +retained in artifacts/physical-registration/native/source.json. + +New local REA/Ghidra results: + +- 464210 sprite bridge: + `ev_4d39cc1aaad564de60bb801c08dfeb740d52e507227e630de9b0570e3e1bc43d`. +- 436B80 derived AI/pickup gate: + `ev_95baf27f6c5f2949dcc5f03f77f3c45bcd14852595b0cc207b9ee27c1dbb02f9`. + +Requests for46E570,40E1F0 and45F2B0 had no recognized procedure in this analysis; +complete errors are retained. Their instructions remain available in the earlier +full REA disassembly. No retry is counted as successful decompilation. Successful +results/export and closed snapshot are in artifacts/physical-registration/rea/. +The prior4623D0/458910/479A40 Evidence remains linked in body-root-registration.md. + +## What registration actually owns + +| VA / PE file offset | Recovered behavior | +|---|---| +|4623D0 /623D0|3D-object interface at complete+C0. Calls458910; copies current complete44/48/4C through16C; converts signed14-bit Euler fields through174; calls479A40.| +|464210 /64210|Sprite interface at complete+C8. Same registration shape with the corresponding−84/−80/−7C render-root offsets; converts Euler units by360/16384; calls479A40.| +|458910 /58910|Tests interface49E. When false invokes470A00 and sets49E=true. This gates the base hook, **not the later append in either bridge**.| +|470A00 /70A00|Logging hook ending at472970; it does not allocate a physical body node. This corrects an earlier allocation label.| +|479A40 /79A40|Calls own150(0,0,0), then own28 Init, then allocates/appends a12-byte physical node and increments695D40. The payload is the game-interface pointer. No identity deduplication or pair/integration gate occurs here.| +|42AB50 /2AB50|Jimmy/Rocketship outer49E guard: true returns; false jumps to4623D0. This is a distinct guard around the whole registration path.| +|46E570..46E69F /6E570..6E69F|Live registry traversal: own28 Init, attached-render handling, own40C PostLoad, attached-render handling, next node. Then app10C cleanup and47E470 timer reset.| + +The physical list695D3C and ordinary registry50999C have separate ownership. +Common registration reads the current render transform, which is not a promise +that authored GAM properties have already been streamed. Constructor registration +can precede that streaming; later Init/PostLoad work owns later state publication. + +The12-case copied-code probe establishes: + +- Repeated direct4623D0 or464210 calls append the same interface again, repeating + transform/zero/Init callbacks even with49E already true. This is a function + contract, not evidence that every real actor naturally acquires duplicate nodes. +- Jimmy's guarded entry skips all that work when49E is set. Clearing49E admits + another append. Clearing a flag is not equivalent to clearing the list. +- A child registered from the supplied Init callback is appended before its + parent's append, because479A40 calls Init before allocating the parent's node. + The child callback is synthetic; no claim is made that all real Init methods do so. +- Pair flag140 and integration13E false do not prevent registration. Membership, + active integration and pair eligibility must stay independent. +- The previously recovered per-object Init/PostLoad order is confirmed by actual + 46E570 execution. Nodes appended from either callback are visited later in that + same traversal. A snapshot/two-global-pass model would differ in these fixtures. + +## All serialized VR04 classes + +The following is a source inventory of **own registration sites**, not a complete +runtime body count. Constructor rows assume that constructor is actually invoked +and succeeds; reuse, nested helpers, later calls and scene state remain separate. + +| GAM kind / records | Actual interface | Own registration site / phase | +|---|---|---| +|3JIM /1|C3DJimmy4A373C, complete+C0|4238B4 virtual2C during matching-start PostLoad; guarded42AB50| +|3ROC /1|C3DRocketShip4B25AC, complete+C0|43DB22 virtual2C in PostLoad; guarded42AB50| +|STRT /1|C3DStartPoint4B7654, complete+C8|Constructor44249D→464210| +|3PHO /2|C3DPhoneBooth4ADF6C, complete+C0|Constructor4356A0→4623D0| +|3PAT /34|C3DPatrolPoint4ACEE4, complete+C8|Constructor434D44→464210| +|3PIC /11|C3DPickupItem4AE548, complete+C8|Constructor435A37→464210| +|3SOL /3|C3DYokianSoldier4C19C4, complete+C0|Constructor44BFA4→4623D0| +|3TRO /1|C3DVRTrophy4BE404, complete+C0|Constructor448D33→4623D0| +|3AIT /2|C3DAITrigger48F8C0, complete+C8|Constructor40BE5B→464210| +|3CHK /1|C3DCheckPoint4959A8, complete+C8|Constructor414323→464210| +|LOAD /2|CLoadLevel4D025C, complete+C8|Constructor457CCA→464210| +|3CAM /12|C3DCutSceneCamera497BFC, complete+C8|No own registration call in the inspected constructor/base/PostLoad chain| +|3SM1 /1|C3DSmoke4B4F08, complete+C8|No own call in that chain; it creates a separately registered SmokePuff helper| + +Thus57 serialized records map to own constructor sites,2 to PostLoad sites and13 +to no own call in the inspected chain. These numbers partition records; they +are **not a claim of59 actual bodies**. All these interfaces expose InitPhysics, +including the two negative own-call classes. Having that method is insufficient +evidence that it is invoked.3CAM's class is the cutscene-camera subclass, not the +base C3DCamera. Source RTTI verifies the distinction. + +Authored HasCollision/task/range values are retained per record. Generic activation +40E1F0, task callback40E340, pickup45F2B0 and derived436B80 have different ownership. +The recovered436B80 first calls40E340, then may hide an acquired optional pickup; +it does not establish an independent universal body-list removal policy. Current +live flags, deletion, exclusions and child activation still require tracing. + +## Execution, reproduction and limits + +`physical_registration_probe.c` executes copied4623D0/464210/458910/470A00/479A40, +42AB50 and46E570. Explicit adapters supply actor vtables/transforms, Init/PostLoad +callbacks, logging, allocation, app cleanup and timer. Render-presence byte8 is +false in loader fixtures, so attached-render branches are not exercised. No real +actor constructor, original game entry point, script/task world or renderer runs. + +All12 cases verify full emitted callback/order/count/flag/Init/XYZ/Euler outputs +under isolated Wine32, with Original unmounted and network disabled. The helper +checks copied EXE hash, observed probe identity, exit0 and completion marker; +provenance and validated observations are retained locally. This is original +component execution, not native Windows or full original gameplay verification. + +```sh +python3 tools/binary/physical_registration.py ../Original \ + --output artifacts/physical-registration/native \ + --rea artifacts/jimmy-movement-audit/rea-original-disassembly.json +i686-w64-mingw32-gcc -O0 -Wall -Wextra -Wno-unused-function \ + -o artifacts/physical-registration/native/probe.exe \ + artifacts/physical-registration/native/physical_registration_probe.c +python3 tools/recon/reference_capture.py --asset-probe \ + --probe-executable artifacts/physical-registration/native/probe.exe \ + --probe-success PHYSICAL_REGISTRATION_COMPLETE --seconds 12 \ + --output artifacts/physical-registration/probe +python3 tools/binary/physical_registration.py ../Original \ + --output artifacts/physical-registration/native --capture artifacts/physical-registration/probe +``` + +The short capture uses a copied initialized generated Wine32 prefix; this scalar +probe needs no OMT DLL load. No runtime implementation or package identity changes +follow from these observations alone. [Generated helpers](vr04-generated-bodies.md) +records21 verified creation/registration calls and the remaining lifetime gaps. + +Next: close helper reuse/removal and activation enough to reconstruct the actual +physical sequence for fresh and retained VR04; then integrate dynamic response +with original nearest/last-polygon reclip ownership. Keep the playable collision +baseline and separate OriginalPairCollision component until that boundary closes. diff --git a/docs/checkpoint/vr04-generated-bodies.md b/docs/checkpoint/vr04-generated-bodies.md new file mode 100644 index 0000000..ee8e912 --- /dev/null +++ b/docs/checkpoint/vr04-generated-bodies.md @@ -0,0 +1,77 @@ +# VR04 generated helpers: bounded registration catalogue + +2026-11-06. Complements [serialized registration](physical-registration.md). +This is source recovery, not a complete observed helper/body count. No gameplay +change, native actor constructor execution or package refresh is claimed. + +`tools/binary/vr04_generated_bodies.py` verifies the canonical EXE hash,21 direct +calls,9 instruction sites and12 helper RTTI identities/36 method targets. Optional +`--rea` retains13 bounded instruction excerpts, PE offsets and hashes under +artifacts/physical-registration/helpers.json. Source Evidence is +`ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904`. +EXE text offsets cited here are VA−400000; the guard uses actual PE mapping. +JN-Engine documentation supplied navigation leads; canonical instructions and RTTI +establish the following identities. No JN replacement movement is used. + +## Positive creation/registration chains + +| Owner / original VA | Helper and physical-registration evidence | +|---|---| +|Jimmy422610/422633|Loop counter20, ctor40FC50; complete+AB4..B00 stores20 C3DBaseball pointers. Table49141C+40C→410000 invokes2C at41000C→464210. The loop disables each ball's integration214; sleeping does not remove registration.| +|Player4374DF; Jimmy4238EF|C3DJetpackFire ctor421D80, table4A3160, created from the Player constructor. Its own40C→40E7B0 supplies no registration call, but Jimmy's matching-start PostLoad configures the owned fire and explicitly invokes its2C at4238EF. Owner-driven registration is essential.| +|Jimmy42243F|Owned C3DRocketShip ctor43D840, distinct from a separately created serialized3ROC instance unless the loader's reuse policy selects an existing one. Its43DB22 PostLoad invokes guarded42AB50. Do not collapse nodes by kind name.| +|Rocketship43D9BC|C3DFireStrato ctor4192E0, table49BDD4. Common40E7B0 PostLoad alone is not a registration edge; other owner/lifecycle calls remain separate.| +|Jimmy42232C|C3DBubble ctor410840; direct registration410992→464210. Its410A80 PostLoad sets up retained artwork and does not itself establish repeated registration.| +|Jimmy4225BE|C3DPointCursor ctor43BC70;43BD67→4623D0. Generic40E7B0 PostLoad supplies no own registration.| +|Jimmy422800|C3DGraplingHook (original RTTI spelling), ctor41EEB0;41EFB4→4623D0. Its generic40E7B0 likewise is not a retained re-registration proof.| +|Smoke4406B1|C3DSmokePuff ctor440980;440ACC→464210. The serialized Smoke object's own negative registration result does not exclude its helper's node.| +|Goddard41CA9C/41CB09|Two C3DCursor constructors415760, each415857→4623D0. RTTI/table497620 identifies Cursor; these are not C3DFlag helpers.| + +Common registration can append an interface more than once, while the Jimmy/ +Rocketship outer49E guard prevents a repeated call when set. The new native +registration cases verify that distinction; this catalogue does not assert a +natural duplicate node for every positive chain above. + +## Helpers whose interface does not prove body membership + +- Jimmy42250C creates C3DShadow43F640, table4B37B8. Yokian44A88F creates the same + type conditionally on the source shadow flag. Their retained-canvas PostLoad + 43F810→4354C0 is not itself a2C call. Terrain projection is a separate consumer. +- Jimmy42255B creates **C3DTargetCursor**4453B0, table4B9F48. It is distinct from + C3DMovingTarget/table4A8A10 and the target consumers used in VR07. Shared FourCC + 3TAR or misleading class-registration strings are insufficient type evidence. + Its445580 retained-canvas setup does not establish body registration. +- Yokian44A826 creates C3DYokianShield44B510, table4C0E24. Its44B6C0 PostLoad calls + 464810 canvas setup; exposing2C→464210 alone proves no physical-list membership. + +The catalogue is bounded: additional Jimmy allocations (including ray/pod paths), +conditional helpers and owner callbacks still need their own lifetime inventory. +The12 listed RTTI identities are not an assertion that only12 helper types exist. + +## Retained loads and late companion construction + +Ordinary scene teardown clears the physical list; it also clears surviving +interfaces'49E flag. A retained registry identity is not a retained physical node. +Baseballs' explicit PostLoad and Jimmy-owned fire invocation give positive re-entry +edges. Constructor-only helper registration cannot silently be treated as a +PostLoad edge; gadget activation, later owner calls, reuse/removal and shutdown +must be followed before assigning retained membership. + +Jimmy PostLoad423C98 constructs Goddard only on its observed pointer-null path. +The Jeep path is different: EDI is zeroed at4236FA and stored into game+970 at +423792, before the later null test423CEE and constructor4211A0 at423D1A. Therefore +the later null test alone is not evidence that this pointer is retained. Source +421552 invokes Jeep2C→421570, whose49E guard enters465070→4623D0. Jimmy423D75 +then calls the wheel-construction hook; existing Scooter documentation covers its +four wheel objects. Old Jeep teardown/deletion and complete retained ordering +remain open; no leak or new carry/reset policy is inferred. + +## Implementation consequence + +The live port reconstructs selected actors and bounded body records per scene. +It does not yet reproduce this complete helper/physical-list lifecycle. The pair +component must receive source physical order with real actor callbacks, not a +filtered list of visible GAM actors or a dictionary containing one actor per kind. +No helper is added to live collision merely because a vtable exposes InitPhysics. +Resolve remaining constructor-only re-entry, deletion and activation edges before +changing that boundary. All source/probe work remains local and originals unchanged. diff --git a/docs/compatibility.md b/docs/compatibility.md index 32806b8..d5cf661 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -1,5 +1,16 @@ # Compatibility and validation +2026-11-06 physical-registration continuation:12 copied-code registration/loader +cases pass with complete emitted callback/order/count/flag/transform checks. +All72 VR04 records/13 class interfaces are inventoried, with a bounded catalogue +of21 helper creation/registration edges and12 verified helper RTTI identities. +These are source/component results, not a complete observed physical list or +whole-original/native Windows gameplay.342 Python checks and the existing28-case +managed pair regression pass;539 originals remain unchanged. Runtime code and +924ad2f packages are unchanged. See [registration](checkpoint/physical-registration.md) +and [helpers](checkpoint/vr04-generated-bodies.md). Helper retained lifetime, +activation and dynamic shared reclip state remain open before live admission. + 2026-11-06 pair lifecycle checkpoint:28 copied-original pair/sphere/exclusion/ base-contact cases match the C# dispatch component's complete callbacks, contact masks, integration/enabled flags and roots. Fixed reference tests also pass without diff --git a/docs/decisions.md b/docs/decisions.md index 49634c4..9eb0809 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -394,3 +394,12 @@ assets and generated packages stay excluded. real actor callbacks and shared reclip dependencies close. Render visibility and raw-control flags are not substitutes for physical eligibility. See checkpoint/pair-lifecycle.md. +56. **Keep physical membership,49E and active collision as separate state.** + Common4623D0/464210 only use49E to gate the base hook; they can append the + same pointer again. Jimmy42AB50 guards the whole bridge. Registration runs + Init before physical append, while loading runs Init then PostLoad per live + registry node and visits new tails. Twelve original component cases confirm + these boundaries. Inventory actual constructor/owner-driven helper edges; + neither visibility nor an exposed InitPhysics method establishes membership. + Do not synthesize a full live body count or retained re-entry from the72-record + serialized partition. See checkpoint/physical-registration.md. diff --git a/docs/gameplay/main-menu-player-lifetime.md b/docs/gameplay/main-menu-player-lifetime.md index 84427b4..a47393c 100644 --- a/docs/gameplay/main-menu-player-lifetime.md +++ b/docs/gameplay/main-menu-player-lifetime.md @@ -22,7 +22,7 @@ the helper PE-maps file offsets independently (these text offsets equal VA−400 |46BF2F..46C00A|Stage1 advances to2, clears elapsed and dispatches app114(`level1d.gam`) at46C004. This is the previously omitted positive background-load edge.| |app114→46DFB0;46BEDF;app104→46DFF0|Queues filename+74D with signed callback countdown+7FA=2; underflow sets pending+74C; the application then invokes ordinary selective teardown/load.| |Level1D GAM|LV1D,54 records, first3JIM/JIM1 at raw8. SHA256276133d750eaa82724b35c12a91fce41a9e074224e3ef12c3624564ae8ed4d9e. Loading the supplied background creates Jimmy before a user story load.| -|46E570..46E67D|After GAM records, the whole surviving registry receives Init28 then PostLoad40C, including retained MAIN; Init is not limited to newly parsed records.| +|46E570..46E67D|After GAM records, each surviving registry node receives Init28 then PostLoad40C before advancing to the next node, including retained MAIN; Init is not limited to newly parsed records.| |MAIN/Level1D game28→44D4E0→4587F0→470540|Common Init restores stored+11 into live+139 through4705B3/4705BC. Both games' stored value is1. MAIN's constructor-default live0 therefore does not imply indefinite retention after background initialization. Their40C is44DF30, a noop call plus own game520=0 store, with no later lifetime reset.| |404B4F→460E70→460EA0/460EF0→4603F0|The NewGame action queues NewGame.tsk; the reader consumes that request. The request itself does not initialize Jimmy.| |460A50..460A6A;460BD1|The reader requests a destination GAM only through an existing non-null controlled receiver accepting **C3DJIMMY** at4ECB20. It dispatches Jimmy complete168→43B5A0 with the staged filename/start/root data. The no-Jimmy path does not supply that request.| diff --git a/docs/progress.md b/docs/progress.md index 05d9501..caf6060 100644 --- a/docs/progress.md +++ b/docs/progress.md @@ -7,6 +7,31 @@ Next-work plan: [recover interactions, then implement verified changes](checkpoi It defines the Carl source/differential gate, the bounded implementation step, movement/contact/animation recovery and the end-to-end platform checkpoint. +## VR04 registration and generated-helper continuation + +[Physical registration](checkpoint/physical-registration.md) now covers all72 +serialized VR04 records/13 actual class interfaces and adds12 executed original +registration/loader cases. Common bridges append repeated pointers; Jimmy's outer +49E guard is a separate boundary. The native cases confirm per-object Init→PostLoad, +same-pass registry appends and nested registration before parent append. They use +synthetic actors/callbacks, not full original scene construction. + +[Helper catalogue](checkpoint/vr04-generated-bodies.md) guards21 creation/ +registration calls,9 instruction sites and12 RTTI helper identities/36 bindings. +Baseball PostLoad and Jimmy-owned fire give positive re-entry edges; constructor- +only helpers, conditional children and old Jeep cleanup remain explicit unknowns. +The57 constructor/2 PostLoad/13 negative own-call record partition is not a live +body count. Earlier470A00 allocation wording is corrected: it logs;479A40 allocates +the physical node. Two new REA pseudocode results and retained original instructions +support the source trace; three unrecognized procedures remain recorded errors. + +All342 Python checks pass, as does the existing28-case managed pair regression. +The native capture verifies complete12-case callbacks/order/flags/transforms and +source/probe identities. All539 originals remain unchanged. No gameplay/runtime +source is changed; both924ad2f packages and their prior verification remain the +playable baseline. Actual helper reuse/removal/activation and shared dynamic +nearest/last-polygon reclip ownership remain next. Evidence: artifacts/physical-registration/. + ## Ordered physical pair contract [Pair lifecycle](checkpoint/pair-lifecycle.md) now records the original physical- diff --git a/docs/reverse-engineering.md b/docs/reverse-engineering.md index de8bf06..a02a5b4 100644 --- a/docs/reverse-engineering.md +++ b/docs/reverse-engineering.md @@ -5,6 +5,11 @@ offsets, virtual addresses, API symbols or observed behavior. Decompiled output evidence, not original source. Original gameplay has not yet been observed successfully; isolated original DLL probes and modern runtime checks are recorded separately. +- [Physical registration](checkpoint/physical-registration.md) and + [generated helpers](checkpoint/vr04-generated-bodies.md): all72 VR04 serialized + records/13 RTTI interfaces;12 original registration/loader cases;21 helper + creation/registration calls. Per-object Init/PostLoad and live appends are + executed component evidence. Full retained helper membership/cleanup is open. - [Ordered physical pairs](checkpoint/pair-lifecycle.md):6 REA pseudocode results, 8 guarded source ranges,20 VR04 class bindings and28 complete copied-code/C# comparisons. One-sided exclusions, gate-retained contacts, callback-mutated diff --git a/docs/tasks.md b/docs/tasks.md index 7c44770..172f2ff 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -74,6 +74,13 @@ Execution order and acceptance criteria: [next work plan](checkpoint/next-work-p - [ ] Complete VR04 physical registration/activation and generated-helper inventory, then dynamic nearest/last-polygon reclip ownership. Preserve existing scene collision admission until real actor/special callbacks are verified. +- [x] Inventory all72 serialized VR04 records/13 actual interfaces and execute12 + original registration/loader cases (duplicate append,49E guard, nested order, + per-object Init/PostLoad and same-pass registry additions). +- [x] Guard21 helper creation/registration edges and12 RTTI identities; separate + owner-driven fire/Baseball re-entry from constructor-only or conditional helpers. + Full live body counts and retained helper cleanup remain open. See + checkpoint/physical-registration.md and vr04-generated-bodies.md. - [x] Expand original lifecycle coverage:96 Carl contact,8 composed input/ controller/skip-prefix,48 task/objective and140 base/STOP cases; recover complete diff --git a/tests/test_physical_registration.py b/tests/test_physical_registration.py new file mode 100644 index 0000000..1680c3c --- /dev/null +++ b/tests/test_physical_registration.py @@ -0,0 +1,49 @@ +from pathlib import Path +import sys +import unittest + +ROOT=Path(__file__).resolve().parents[1] +sys.path.insert(0,str(ROOT/'tools/binary')) +from physical_registration import collect +from vr04_generated_bodies import collect as helpers + + +class PhysicalRegistrationTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.source=collect(ROOT.parent/'Original') + cls.helpers=helpers(ROOT.parent/'Original') + + def test_all_serialized_records_have_actual_class_interfaces(self): + self.assertEqual(len(self.source['records']),72) + self.assertEqual(len(self.source['classes']),13) + self.assertEqual(len({r['file_offset'] for r in self.source['records']}),72) + camera=self.source['classes']['3CAM'] + self.assertEqual(camera['name'],'C3DCutSceneCamera') + self.assertEqual(camera['game_table'],'0x497bfc') + self.assertEqual(camera['methods']['0x2c'],'0x464210') + + def test_own_registration_phases_do_not_claim_a_runtime_total(self): + self.assertEqual(self.source['serialized_phase_counts'], + dict(postload=2,constructor=57,no_own_call_in_inspected_chain=13)) + self.assertEqual(self.source['classes']['3JIM']['registration_site'],'0x4238b4') + self.assertEqual(self.source['classes']['3ROC']['registration_site'],'0x43db22') + self.assertTrue(all('unobserved' in r['runtime_membership'] for r in self.source['records'])) + + def test_registration_loop_and_append_source_ranges(self): + self.assertEqual(len(self.source['ranges']),6) + self.assertEqual(len(self.source['relocations']),10) + self.assertEqual(self.source['ranges'][-1]['file_offset'],'0x6e570') + + def test_generated_helpers_use_verified_types_and_separate_owner_calls(self): + self.assertEqual(len(self.helpers['calls']),21) + self.assertEqual(len(self.helpers['sites']),9) + types={c['name']:c for c in self.helpers['classes']} + self.assertEqual(len(types),12) + self.assertEqual(types['C3DTargetCursor']['table'],'0x4b9f48') + self.assertEqual(types['C3DBaseball']['methods']['0x40c'],'0x410000') + self.assertEqual(types['C3DJetpackFire']['methods']['0x40c'],'0x40e7b0') + self.assertEqual(types['C3DCursor']['table'],'0x497620') + + +if __name__=='__main__':unittest.main() diff --git a/tools/binary/physical_registration.py b/tools/binary/physical_registration.py new file mode 100644 index 0000000..01c6ae1 --- /dev/null +++ b/tools/binary/physical_registration.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python3 +"""Read-only VR04 serialized registration inventory and copied-code loop probe.""" +import argparse +from collections import Counter +import hashlib +import json +from pathlib import Path +import re +import struct +import sys + +from checkpoint_script_state import EXE_SHA256, find_case, read_va, rel_call_target +from pe_inspect import PE +from rtti_map import rtti_map +sys.path.insert(0, str(Path(__file__).resolve().parents[1]/'levels')) +from gam import parse + +REA_ID = 'ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904' +# Own registration sites, not counts of nested helpers or live runtime nodes. +# PostLoad sites dispatch virtual2C; constructor sites directly call the bridge. +CLASSES = ( + ('3JIM','C3DJimmy',0x422160,0x4a373c,0xc0,'postload',0x4238b4,None), + ('3ROC','C3DRocketShip',0x43d840,0x4b25ac,0xc0,'postload',0x43db22,None), + ('STRT','C3DStartPoint',0x4422d0,0x4b7654,0xc8,'constructor',0x44249d,0x464210), + ('3PHO','C3DPhoneBooth',0x4355a0,0x4adf6c,0xc0,'constructor',0x4356a0,0x4623d0), + ('3PAT','C3DPatrolPoint',0x434b30,0x4acee4,0xc8,'constructor',0x434d44,0x464210), + ('3PIC','C3DPickupItem',0x4358b0,0x4ae548,0xc8,'constructor',0x435a37,0x464210), + ('3SOL','C3DYokianSoldier',0x44bee0,0x4c19c4,0xc0,'constructor',0x44bfa4,0x4623d0), + ('3TRO','C3DVRTrophy',0x448c60,0x4be404,0xc0,'constructor',0x448d33,0x4623d0), + ('3SM1','C3DSmoke',0x440530,0x4b4f08,0xc8,'no_own_call_in_inspected_chain',None,None), + ('3CAM','C3DCutSceneCamera',0x415a00,0x497bfc,0xc8,'no_own_call_in_inspected_chain',None,None), + ('3AIT','C3DAITrigger',0x40ba70,0x48f8c0,0xc8,'constructor',0x40be5b,0x464210), + ('3CHK','C3DCheckPoint',0x414190,0x4959a8,0xc8,'constructor',0x414323,0x464210), + ('LOAD','CLoadLevel',0x457b10,0x4d025c,0xc8,'constructor',0x457cca,0x464210), +) +RANGES = ( + (0x4623d0,0x46246e,'51906b2746390b64d79865a4ea0cddd03733aa5625d562bbf57264b7fa9b3d63'), + (0x464210,0x46429f,'a99be3694789b6b6284b7e171eec0f2f26b59eef6a366265646bf6c8cbd92000'), + (0x458910,0x45892b,'9631a8979eaae01bbf611aa19759788fb03daa8888f753dc64a58b7b7982070e'), + (0x479a40,0x479aba,'cd3225de887694ae93f8ae226eeecf71322038438c7b587a81c14a504b10ae98'), + (0x42ab50,0x42ab5f,'faf97e04eb625de47a2541a07db3a483ca05cd9b9fee870c7ca33d272e6e7e7a'), + (0x46e570,0x46e69f,'ef42fea8b45653bbd21064e5d2da15011ddadc1790a7356997c2a7ba363d3c9c'), +) +TARGETS = (0x48e5b4,0x695d3c,0x695d40,0x50999c) + + +def collect(original): + original = Path(original) + pe = PE(find_case(original,'Neutron.exe')) + if hashlib.sha256(pe.data).hexdigest() != EXE_SHA256: + raise ValueError('Unsupported executable') + classes = {} + for kind,name,ctor,table,displacement,phase,site,target in CLASSES: + tables = rtti_map(pe,name)['vtables'] + if not any(int(t['va'],16)==table and int(t['object_displacement'],16)==displacement for t in tables): + raise ValueError('RTTI/table identity mismatch') + if site: + if target and rel_call_target(pe,site)!=target: + raise ValueError('Registration bridge call changed') + if target is None and read_va(pe,site,3)!=b'\xff\x50\x2c': + raise ValueError('PostLoad InitPhysics dispatch changed') + methods = {hex(slot):hex(struct.unpack('raw+0x100;} +static Actor*owner(void*g){for(int i=0;i<3;i++)if(game(&actors[i])==g)return &actors[i];require(0,"actor owner");return NULL;} +static void event(char code,Actor*a){used+=(unsigned)snprintf(events+used,sizeof(events)-used,"%c%d;",code,a->id);require(usedposition[0]=x;a->position[1]=y;a->position[2]=z;event('P',a);} +static void TC rotation(void*g,float x,float y,float z){Actor*a=owner(g);a->rotation[0]=x;a->rotation[1]=y;a->rotation[2]=z;event('R',a);} +static void TC zero(void*g,float x,float y,float z){require(x==0&&y==0&&z==0,"registration150 zero");event('Z',owner(g));} +static void list_init(Node*n){n->next=n->previous=n;n->value=NULL;} +static void add_registry(int id){ + Node*n=®istry_nodes[id];n->value=game(&actors[id]);n->next=®istry;n->previous=registry.previous; + registry.previous->next=n;registry.previous=n; +} +static void register_body(Actor*a,int guarded){ + unsigned entry=guarded?0x42ab50:a->family?0x464210:0x4623d0; + ((void(TC*)(void*))AT(entry))(game(a)); +} +static void TC init(void*g){ + Actor*a=owner(g);event('I',a);a->inits++; + if(a->nested){a->nested=0;register_body(&actors[1],0);} + if(a->id==0&&append_stage==1){append_stage=0;add_registry(2);} +} +static void TC post(void*g){Actor*a=owner(g);event('L',a);if(a->id==0&&append_stage==2){append_stage=0;add_registry(2);}} +static void logging(void*g,const char*label){(void)g;(void)label;} +static void TC cleanup(void*self){require(self==app,"app owner");events[used++]='C';events[used++]=';';events[used]=0;} +static void timer(void){events[used++]='T';events[used++]=';';events[used]=0;} +static void*allocate(size_t size){require(size==12,"body node bytes");return malloc(size);} +static void reset(void){ + if(bodies.next)while(bodies.next!=&bodies){Node*n=bodies.next;bodies.next=n->next;free(n);} + list_init(&bodies);list_init(®istry);memset(actors,0,sizeof(actors)); + memset(app,0,sizeof(app));*(void**)app=app_table;app_table[0x10c/4]=(uintptr_t)cleanup; + used=0;events[0]=0;append_stage=0;*(void**)AT(0x695d3c)=&bodies;*(unsigned*)AT(0x695d40)=0; + *(void**)AT(0x50999c)=®istry; + for(int i=0;i<3;i++){ + Actor*a=&actors[i];a->id=i;a->family=i==1;*(void**)game(a)=a->table; +#define SLOT(s,f) a->table[(s)/4]=(uintptr_t)(f) + SLOT(0x16c,position);SLOT(0x174,rotation);SLOT(0x150,zero);SLOT(0x28,init);SLOT(0x40c,post);SLOT(0x3f8,logging); +#undef SLOT + unsigned char*complete=(unsigned char*)game(a)-(a->family?0xc8:0xc0); + float xyz[]={1.25f+i,-2.5f-i,3.75f+i};short angles[]={1024,-2048,4096}; + memcpy(complete+0x44,xyz,sizeof(xyz));memcpy(complete+0x50,angles,sizeof(angles)); + } +} +static void snapshot(const char*name){ + printf("REG {\"name\":\"%s\",\"events\":\"%s\",\"order\":[",name,events);int first=1; + for(Node*n=bodies.next;n!=&bodies;n=n->next){printf("%s%d",first?"":",",owner(n->value)->id);first=0;} + printf("],\"count\":%u,\"flags\":[",*(unsigned*)AT(0x695d40)); + for(int i=0;i<3;i++)printf("%s%u",i?",":"",*((unsigned char*)game(&actors[i])+0x49e)); + printf("],\"inits\":[%d,%d,%d],\"positions\":[",actors[0].inits,actors[1].inits,actors[2].inits); + for(int i=0;i<3;i++)printf("%s[%.9g,%.9g,%.9g]",i?",":"",actors[i].position[0],actors[i].position[1],actors[i].position[2]); + printf("],\"rotations\":["); + for(int i=0;i<3;i++)printf("%s[%.9g,%.9g,%.9g]",i?",":"",actors[i].rotation[0],actors[i].rotation[1],actors[i].rotation[2]); + puts("]}"); +} +static void next(void){used=0;events[0]=0;} +int main(void){ + setbuf(stdout,NULL);map_source(); + static const struct{unsigned va,target;} relocations[]={/* RELOCATIONS */}; + for(unsigned i=0;i