128 lines
8.0 KiB
Markdown
128 lines
8.0 KiB
Markdown
# Retained Goddard and shadow: ordinary-load reset trace
|
||
|
||
Static investigation,2026-10-26. Original EXE SHA256
|
||
`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
|
||
All VAs below are in this EXE at preferred base400000; inspected raw offsets are
|
||
**VA−400000**, independently PE-mapped by `tools/binary/retained_companion.py`.
|
||
No original code was executed. No runtime implementation was changed.
|
||
|
||
## Identity, caller and property boundary
|
||
|
||
Goddard complete vtable49F920 is installed at41C866; its game-interface table
|
||
49F480 is installed at41C883 with complete+C0 receiver. Shadow complete table
|
||
4B3C1C/game-interface4B37B8 are installed at43F6A0/43F6AD, interface complete+C8.
|
||
Constructor retention/reuse writes remain as recovered in scene-loader.md:
|
||
Goddard41C99B..41C99E passes0 to470F40, and41C9C0 sets complete+C9=1.
|
||
These are constructor facts, not repeated initialization.
|
||
|
||
The route GAMs level1b.gam/LV1B, VR04.gam/VR04 and level1.gam/LEV1 contain **no
|
||
3DOG or3SHA serialized records**. Their bounded GAM parses/hashes are emitted by
|
||
the helper. Consequently ordinary reuse on this route does not stream a new
|
||
Goddard/shadow property record. The app's per-object Init28→PostLoad40C registry
|
||
pass still runs on their retained interfaces (scene-loader.md). A fresh companion
|
||
is dynamically constructed by Jimmy PostLoad when his interface95C pointer is
|
||
null:423C6A tests it;423C98 calls Goddard constructor41C810;423CAE stores it.
|
||
Existing pointer takes423CD4..423CE2 instead, discussed below. Exact same-pass
|
||
handling of a newly appended companion remains a registry-order question.
|
||
|
||
## Goddard Init and PostLoad
|
||
|
||
49F480+28→41E6A0 tail-jumps407EB0. At407EB3 it calls generic4587F0;407EB8 sets
|
||
interface byteA=1;407EBC..407EC2 copies authored87C→current AIstate608;
|
||
407EC8 clears current waypoint800. Complete offsets add C0. This replaces current
|
||
AI state and waypoint, not all AI fields. In constructor41C90E/41C914, current
|
||
complete6C8 and authored complete93C both start4.
|
||
|
||
49F480+40C→41E590 calls shared actor409480 at41E593. Its local work, in order:
|
||
|
||
| Source VA / raw coordinate | Reset or refresh |
|
||
|---|---|
|
||
|409486 /9486|Call generic40E7B0 visibility/animation policy; not a constructor.|
|
||
|40948B..40949A /948B..949A|Resolve tag string interface6AC through474070; always assign resulting pointer to600.|
|
||
|4094A0..4094FD /94A0..94FD|Only if pointer nonnull: refresh610 from target+404 (identity) and828/82C/830 from target logical root310. Null pointer leaves those cached fields untouched locally.|
|
||
|409503..40951E /9503..951E|Snapshot current608→authored87C; invoke complete124(current608), target4089B0.|
|
||
|40952D..409552 /952D..9552|Read authored Euler via interface170→4716A0 (FC/100/104/108), write logical Euler via32C→472450 (224/228/22C/230).|
|
||
|409561..409580 /9561..9580|Read authored Euler again and copy all four words into interface274/278/27C/280. This is an Euler-cache write, not sufficient evidence to name274 a queued physical impulse.|
|
||
|
||
The state setter4089B0 is not an unconditional state-entry callback. After its
|
||
special complete970 guard for requested states0/6,4089F8 copies current6C8 to
|
||
previous6CC and assigns requested6C8;408A18 skips transition cases when equal.
|
||
Init has already assigned current from authored, and PostLoad passes that exact
|
||
current value back. Therefore this chain does not justify replaying arbitrary AI
|
||
state-entry side effects at scene load. Intervening source callbacks could change
|
||
state; those require their own ordered fixture.
|
||
|
||
Goddard's derived41E590 then applies level policy:
|
||
|
||
| Source | Normal LV1B/VR04/LEV1 branch |
|
||
|---|---|
|
||
|41E598|interface918=1500 (range; exact consumer semantics remain separate). VR06 substitutes3500 at41E5EE.|
|
||
|41E608..41E613|If render attachment exists, set complete70=1 and dispatch complete58(0), the existing show/unhide path.|
|
||
|41E618/41E624|interfaceD0(1) and214(1); setters4710C0→471A40 and471A00 write authored/live movement/collision flags.|
|
||
|41E632|interface2C initialization/sync dispatch42AB50, which gates4623D0 on interface49E. Body re-registration internals remain in the physics investigation.|
|
||
|41E637..41E63B|complete17C(0)→41CC30: select submode0, copy globals4F8200/204/208 into complete6D4/6D8/6DC, set WORD complete9A0=0. These are table-sourced resets; do not invent numerical values from uninitialized file storage.|
|
||
|41E641/41E64A..651|interface914=1; interface110(130)→471240 writes authored34 and264→471B40 writes live15C.|
|
||
|41E657|interface928=0.|
|
||
|
||
Hidden branch41E661 applies to LEV6,LEV7,LV1C,LV1D,LV4A,LV6A. It calls complete58(1),
|
||
interfaceD0(0),214(0), and sets928=1. It does **not** locally assign130 radius or
|
||
submode0; carrying an old radius is not equivalent to resetting it to0. The helper
|
||
includes exact comparison immediates and a bounded branch oracle, with neighbors
|
||
tested. These later-level predicates are recovered locally, not proof of those
|
||
levels' full behavior.
|
||
|
||
## Existing companion174: rotation, not velocity
|
||
|
||
Jimmy423CD4 addsC0 to the existing companion pointer and passes three zeroes to
|
||
its interface174 at423CE2. 49F480+174→4716D0 writes authored EulerFC/100/104,
|
||
dispatches330→472420 to logical Euler224/228/22C, then3E0→4624F0→473540 to convert
|
||
logical Euler and dispatch render angle sync3E4. It is a rotation reset. Calling
|
||
it a velocity reset would conflate distinct coordinate fields.
|
||
|
||
Thus the source can zero Goddard's authored orientation before his own retained
|
||
PostLoad later copies authored→logical/cache. This report establishes both local
|
||
mutations; precise registry placement must determine their temporal order. Jimmy's
|
||
separate STRT/RETURN root placement still owns companion position, as already
|
||
documented. No broad body-velocity reset is inferred from174.
|
||
|
||
## Shadow PostLoad and resource lifetime
|
||
|
||
4B37B8+28→4587F0 generic Init;40C→43F810 first calls4354C0 at43F814. That base:
|
||
|
||
-4354C3..4354CA resolves authored database name interface4BC using46ACC0.
|
||
-If found,4354D6..4354F5 calls completeC8→464430 with resolved database,
|
||
authored interface4B8 resource selector and float-converted4B4. If a resulting
|
||
attached object exists at complete8C (interface−3C),435503..435513 sets its60/64
|
||
to1 and calls its embedded interface24 slot10.
|
||
-If the first database lookup fails,435518 tries literal4F02C0
|
||
`permanenticons.omt`; if found43553F..435542 attaches selector3 with the same
|
||
float-converted4B4. If both fail, no attachment dispatch occurs locally.
|
||
|
||
43F819..43F844 then converts signed authored WORDs interface520/522 into complete
|
||
AC/B0 runtime size;43F84A/43F854 resets completeB4=2 andB8=0. If global509A13 is
|
||
set,43F867..43F86B calls complete58(1) to hide. This refreshes visual-resource
|
||
references and size/flags, so retained identity does not mean retaining the old
|
||
scene's texture/database handle. No local owner-pointer reset is proven; full
|
||
database teardown/reattachment internals are separate.
|
||
|
||
## Implementation and remaining gates
|
||
|
||
Current port reconstructs companion/animation/patrol objects on scene continuation
|
||
and explicitly restores RETURN roots. It does not model this complete retained
|
||
Goddard/shadow lifecycle. Existing patrol remains a subset: state4 follow, source
|
||
angle/render sync, shadow resource identity and per-object ordering are incomplete.
|
||
|
||
Direct fixture contracts now supported: no route property reload for companion;
|
||
Init restores AIstate/clears waypoint; target caches refresh conditionally;
|
||
authored rotation controls PostLoad and174; normal route reapplies130/flags/
|
||
submode0; shadow resources/sizes refresh. Unknown fields must remain unknown,
|
||
not be silently copied or zeroed. Full body registration4623D0 and exact newly
|
||
appended/retained registry callback timing gate live retained-container integration.
|
||
|
||
Validation: `python3 -m unittest discover -s tests -p test_retained_companion.py -v`
|
||
checks EXE identity, exact instruction/vtable targets, route record absence,
|
||
rotation-setter provenance and level-branch boundaries. Helper JSON:
|
||
`python3 tools/binary/retained_companion.py ../Original`. This is immutable static
|
||
evidence plus an interpretation oracle, not original runtime execution or port
|
||
gameplay validation.
|