Files
Neutron/docs/checkpoint/dynamic-context.md
T

157 lines
9.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Dynamic box response and shared static context
2026-11-07. Continues [pair lifecycle](pair-lifecycle.md) and
[physical registration](physical-registration.md). This checkpoint executes the
complete original mode2 box query and composes existing C# source kernels in a
**test fixture**, without admitting dynamic pairs to live gameplay.
## Evidence and scope
Canonical Neutron.exe SHA-256:
`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
REA instruction Evidence:
`ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904`.
New REA/Ghidra mode2 pseudocode:
`ev_76827fca086933b7c48a9036a5a4a0a0f86d714935de6373eca4a3530fd231c5`.
Jeep PostLoad4217D0:
`ev_72e727e980c8ad114b46c1f23905088233e2925ff8bf8a9420d3b81bddccda27`.
The request for teardown46DFF0 remains an unrecognized-procedure error; no full
cleanup decompilation or execution is claimed. Complete replies, export and
closed-session snapshot are local under `artifacts/dynamic-context/rea/`.
`tools/binary/dynamic_context.py` guards11 copied bodies and102 relocated
operands, including the complete47A5E0..47B3DC query/switch-table span
(file7A5E0, lengthDFC, SHA-256
`9bb2c187d12f73a73f4ac2f31e19072d9010f919ce93fb6884e2be35b2fac894`).
It uses the prior dispatcher/kernel mapper and a copied original OMT2.dll.
Actor getters, contact callbacks, root setter and box point transform are
synthetic. The source static grid is empty, with a deliberately seeded old
polygon. This is original component execution under isolated Wine32, not an
original scene, live Jimmy callback or native Windows observation.
## Recovered call order and ownership
Text file offsets below equal VA−400000; the tools verify actual PE mapping.
The box query is reached from ordered pair47A430. Its other actor geometry gate,
source radius broadphase and other-mode2 shortcut precede triangle processing.
Those early paths preserve the seeded nearest/hit/last-polygon context.
| Original VA / file offset | Recovered operation |
|---|---|
|47AB3F / 7AB3F|Write sphere radius to edge limit5CFBE0.|
|47AB4B / 7AB4B|Set nearest face695D5C to−1. Do not clear hit5CFBE8 or last polygon695D4C.|
|47B277 / 7B277|Call47BD80 for each of12 transformed box triangles, updating the shared nearest state and local candidate.|
|47B29B / 7B29B|Each accepted kernel result invokes sphere virtual374 with a **null polygon**. This is not a normal-Y choice between370/374.|
|47B2EF / 7B2EF|Read box virtual1E0 after triangle callbacks. If inhibited, return contact without world reclip or sphere root setter.|
|47B364 / 7B364|Call47B4B0 from source previous root with candidate−previous displacement; edge checking is disabled. Reuse current hit/nearest/last state.|
|47B399 / 7B399|Publish the clipped local candidate through sphere314 after the static callback; there is no live-root comparison before publication.|
After all triangles, face−1 and edge>=radius means no contact. An accepted
query resets the nearest limits even when it misses, while old hit and last
polygon survive. The chained fixture verifies this across two successive calls.
Its callback/setter/pass counters are cumulative, not reset for the second call.
With an empty grid,47B4B0 can still issue its terminal callback for the seeded
old polygon, including when static geometry4F69E5 is disabled. An uninhibited
dynamic hit therefore gives a null-polygon dynamic callback followed by an
old-polygon static callback. A callback's live-root mutation is overwritten by
the final local candidate; inhibition leaves that mutation intact, including W2.
Do not replace this with a root-changed suppression rule.
The global primitive mode695D74 is a separate owner.47B6F4 sets it to1 around
an individual static primitive when sphere42C is set, then47B742 clears it.
Our empty-grid fixture starts and ends with mode0, including42C=true. That case
does not establish general mode reset, recursive queries or arbitrary callback
mutations. Parent static-body479D20 normally initializes its own query state;
the later dynamic phase can see another body's last polygon. Explicit seeding
tests state retention, not which real actor supplied it in a complete frame.
## Kernel winding: a meaningful failed comparison
The first C# composition used `DynamicSceneCollision.Triangles` construction
order directly. Its first fixture reached the same root(0,0,20,1), but reported
face−1/edge5 instead of original face40/edge10. The passing interpretation uses
kernel arguments **A,C,B**, with the normal retained from construction A,B,C.
To test that interpretation, the generated private mapped kernel entry is
instrumented to record its first12 triangle/normal arguments. The hook restores
the original five bytes before invoking the actual source kernel and reinstalls
it afterward. All12 complete arguments match the C# fixture; each captured
cross(B−A,C−A) points opposite its supplied normal. The original files and copied
on-disk EXE are not patched. This validates the kernel boundary, not a blanket
change to construction topology or the provisional live collision adapter.
The intentionally wrong construction-winding run remains a failing diagnostic
(`--construction-winding`), with its first divergence and nonzero exit saved in
`artifacts/dynamic-context/construction-winding-failure.json`. Matching final
positions alone would have missed the shared-state error.
## Implemented comparison and verification
`tests/GamePort.DynamicContextTests` composes the existing source sphere and
static kernels with this bounded control flow. No production solver or gameplay
actor is added. Fixed references run without generated artifacts; `--native`
also compares every emitted field and all12 captured kernel arguments.
The17 observations cover old/null polygon, inhibition, geometry-off and
broadphase rejection, other-box overlap/rejection, triangle miss, root-mutating
callbacks with/without inhibition, static-geometry-off,42C force-static flag,
Y45 face contact, translated/90-degree box and a two-call hit→away sequence.
Each compares contact, XYZW, nearest face/edge/hit, retained polygon identity,
dynamic/static callback counts, setter count, static passes and global mode.
The Y45 case is not proof of a successful geometric edge/corner response.
Verification: all17 full native/C# observations and12 kernel arguments match;
fixed references pass;345 Python tests,11 static-dispatcher groups,10 dynamic-box
groups and28 pair lifecycle cases pass. All539 original files remain unchanged.
Both packaged DLLs and BUILD-INFO remain identical to the924ad2f baseline.
No new GPU, audible, whole-original or native Windows comparison is claimed.
Reproduction from GamePort (probe execution uses a separate copied game):
```sh
python3 tools/binary/dynamic_context.py ../Original --output artifacts/dynamic-context/native
i686-w64-mingw32-gcc -O0 -Wall -Wextra -Wno-unused-function -o artifacts/dynamic-context/native/probe.exe artifacts/dynamic-context/native/dynamic_context_probe.c
python3 tools/recon/reference_capture.py --asset-probe --probe-executable artifacts/dynamic-context/native/probe.exe --probe-success DYNAMIC_CONTEXT_COMPLETE --seconds 12 --output artifacts/dynamic-context/probe
python3 tools/binary/dynamic_context.py ../Original --output artifacts/dynamic-context/native --capture artifacts/dynamic-context/probe
source scripts/env.sh
dotnet run --project tests/GamePort.DynamicContextTests -- --native artifacts/dynamic-context/native/observations.json
```
## Helper teardown follow-up
`tools/binary/helper_teardown.py` guards13 sites and5 Jeep bindings at table
4A2AEC (fileA2AEC). Constructor42129A (file2129A) pushes1, and4212A8 calls
470F40: authored predicate+11 is stored and dispatched through204 to live+139.
Generic Init4705B3/4705BC restores the authored predicate through8C→204.
Table slots8C/200/204 target470F30/4719B0/4719C0. Default Jeep is therefore
eligible for ordinary deletion, unlike the retained Jimmy default; pointer
clearing in Jimmy PostLoad is not itself evidence of a retained old Jeep.
Teardown re-reads200 at46E032,46E06F and46E0AC (files6E032/6E06F/6E0AC),
with virtual20/34 cleanup between reads, then marks+6 at46E0CA before the
473710 sweep. Jeep20 targets4213E0→462390;34 targets458C50, whose game+4B0
condition can invoke430. Callback/active-vehicle mutations can affect those
re-reads. This closes the **default eligibility** question, not complete active
cleanup, child deletion, sweep execution or final retained registry order.
## Remaining admission gates and next chunk
Follow-up: [populated reclip](dynamic-reclip.md) now executes real synthetic static
walls/ceiling and matches14 full observations/12 kernel steps after directly
evidenced rounding corrections. The first gate below is closed for that bounded
composition; real actors, ordered-body provenance and reentrancy remain separate.
1. Exercise static geometry after a dynamic hit, rather than only empty-grid
reclip. Compare shared nearest/last ownership across two real primitive
candidates and ordered bodies, including face/edge ties and flag transitions.
2. Trace actual Jimmy/door/VR04 actor callbacks and their root, mode, activation
and polygon requirements. Synthetic callbacks do not establish these owners.
3. Finish constructor-only helper re-entry/deletion and physical order across
ordinary LOAD/RETURN, including cleanup mutations between the three reads.
Then implement a bounded shared-context response component and integrate only
the evidenced VR04 actor set. Keep lab/outside capsule and current playable
movement while these gates remain. Preserve ordinary landing bank; this report
adds no rotation reset and does not reopen the completed TSK-entry order fix.