Implement Bubble controller, sprite and VR01 body behavior

This commit is contained in:
UnixNight committed 2026-11-02 16:57:54 -05:00
1 parent 9ea578492d
commit 1ae5f4251c
51 files changed
+2811 -54

No files matched your search

+242
View File
@@ -0,0 +1,242 @@
# Bubble movement mode2
2026-11-02. Completes the static movement/input/bounce contract needed after
[Bubble equip/effect](bubble.md), with a pure C# arithmetic component. This
investigator ran no original gameplay. Source projections and component tests
remain separate from live port integration and original runtime comparison.
EXE SHA-256 `f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
All VAs below PE-map to file offsets VA−400000 in these original ranges.
`tools/binary/bubble_motion.py` verifies identity,11 complete bounded span hashes,
17 decisive instruction sites,8 virtual bindings and11 constants. Generated
`artifacts/bubble-motion/source-contract.json` records bytes, offsets and hashes.
## REA and source coverage
Local REA6.8.0/Ghidra12.1.4 used generated
`artifacts/uncontrolled-phases/rea/Neutron.exe`. Complete replies, Evidence bundle
and closed snapshot are under `artifacts/bubble-motion/rea-native/`:
| Routine | Evidence |
| --- | --- |
|438A60 dispatch|`ev_e645423e5ad809add30e5c0c5893df7ffda0b885988f9cf438d2d2b117502c56`,02.json|
|437940 frame|`ev_de7097867d129a4232318e667e9496c6868cdb1da4b37a1f3304c94b0b101677`,03.json|
|429A00 refresh148|`ev_0028e3f28c5aed508fab954fe8da6170690efa742614dab2044408ddd0062180`,06.json|
4387E0,439900,42A720,4378D0 numeric VA queries did not return pseudocode: the
profile failed to match a procedure and then interpreted the number as an
unmapped file offset. Corrected file-offset selectors387E0,39900,2A720,378D0 and
72B10 are retained separately under `rea-offsets/`: all explicitly report that
no procedure matches the identifier. That session exported its complete empty
Evidence bundle and closed/snapshotted. These are provider coverage gaps.
The first sandboxed batch (`rea-movement/`) encountered the known Unix-socket
`Operation not permitted` host restriction. Its worker was interrupted and its
owned session closed/snapshotted; it contains zero successful Evidence. This was
not a target execution or analysis-completeness success. An explicitly allowed
local static invocation resolved IPC without configuration changes.
Supplementary fixed-range objdump source is saved as frame.asm,input.asm,
callback.asm,pose.asm,transform.asm. Unsupported decompiler routines are recovered
from these guarded instructions/virtual bindings, not invented REA successes.
Profile digest is `e1ad533d4cc0333c2136fe0894217de2d61feea098240326e78633f9e4ddcbf9`.
## Owners, dispatch and phases
Jimmy complete object has game interface+C0; complete vtable4A3BDC and game
vtable4A373C. Input438A60/frame437940 receive interface;439900/4387E0 receive
complete object. Relevant complete fields:
| Offset | Meaning |
| --- | --- |
|6BC/6C0/6C4/6C8|Per-input increment30 / decay35 / current maximum / scalar speed|
|6D4/6D8|Turn rate / copied apply turn rate|
|6E4/6E5/6E6|Forward/backward/keyboard turn flags|
|7C4|Movement mode, not equipped raw gadget|
|7EC/7F0|Forward/backward destination pitch; apply writes−10/+10 every call|
Game2BC→471F10 gets live body velocity,2C4→471F40 sets it; game38C→472B10
rotates a local vector by current Euler. These are separate from pending impulse
2CC and acceleration. Complete128→439900 input;13C→4387E0 Bubble apply;
154→42A720 landing hook;158→4378D0 jump held;15C→42A7A0 fire held.
437940 calls40E050 before control identity/suppression/menu checks. Only afterward
437A49..437A79 dispatches mode2 directly to13C. Mode2 bypasses every ordinary
ground/air mode0/1 landing reset and jetpack jump-state table. After13C returns,
437C22..437C2D publishes controller scalar to game26C body speed. Landing keeps
movementmode2. No new radius, jump state, pending impulse or acceleration write
occurs in4387E0; do not clear those on equip/apply without another source owner.
Prior queued impulse/acceleration may therefore survive equip until another body
phase replaces them. Generic gravity/support behavior belongs to the body report.
426030 input first checks407060 false,475CA0 true, nonnull controlled5099E4,
4F8430 false and interface1D2D false. Its order is:
1.426084 calls438A60; modes1/2 share439900 (438B60 fall-through438B6D).
This changes steering, destination Euler and camera eye before Bubble placement.
2.426098 calls complete188→429D00. Raw Bubble0 fails that handler's raw7 guard
at429DBB, returns false42A652 and does not consume the callback.
3.Unsupported Bubble skips jetpack input at4260D3; supported input passes the
existing grounded path (including any pre-existing fall-impact flag handling).
4.426264 tests movementmode2, drains−.5dt and calls cleanup178 if energy<=0.
5.Even if cleanup switched mode0,4262A5 still positions Bubble from **the current
camera eye after439900**, using the formula already recovered in bubble.md.
Shared later menu/fire phases follow. Beam suppression does not suppress the
steering use of the fire predicate.
## Input439900
Keyboard subset, in source order:
| Rule | Exact source behavior |
| --- | --- |
|Turn|Left precedes Right; ±100dt. Release moves toward0 by100dt, clamped crossing. Mode2 caps±50 at439CB2..439CFB, ordinary air caps±30. Turning adds no speed.|
|Throttle|Up **or held primary fire in mode2** sets6E4; adds30 per call when below max, capped at current6C4=1350. Fire predicate is15C, not jump158.|
|Coast|Without throttle, speed>max×float.909090936 subtracts17.5; otherwise retained.|
|Supported decay|439BA2..439BED: if grounded and speed>0 subtract17.5, with **no clamp crossing0**; if grounded and speed<=0 set0. Applies even with throttle.|
|Brake|Down sets6E5. Positive speed subtracts35 if supported,17.5 otherwise, clamped to0. Negative speed adds35, clamped to0. Does not start reverse.|
|Destination Euler|For mode2 set(−10,currentYaw,−.25×turn) with throttle;(+10,currentYaw,−.25×turn) with brake; otherwise(0,currentYaw,−.25×turn). Forward takes priority over backward.|
Example source composition while supported: speed100+Up→130−17.5=112.5 in input;
later released-jump apply computes XZ from112.5, then publishes56.25. These two
grounded reductions have distinct owners and must not be collapsed into one.
At small positive speed5 the supported input decay yields−12.5; next supported
input zeroes it. This intermediate sign is a source fact, not a clamp omission.
Mouse/analog extensions are also statically bounded:46A460 supplies signed16
mouse axes. Nonzero horizontal mouse overrides keyboard turn and adds mouseX×dt
to turn; absent mouse, analogX<−.5 selects left, analogX>.5 selects right. Vertical
rate is mouseY/dt. Up, analogY>.5, rate>40 or mode2 fire selects throttle; fixed30
is used for keyboard/analog/fire, otherwise the positive rate is added. Down,
analogY<−.5 or rate<−40 selects brake. Strict inequalities are at439A97..439AE6
and439BF5..439C1D. Projections deliberately accept only keyboard flags; no mouse
or analog runtime implementation is claimed here. Zero dt division is not modeled
as safe input; actual frame contract is0<dt<1.
## Apply4387E0 and supported bounces
Every apply writes7EC=−10 and7F0=+10. It reads **incoming live body velocity**.
Only when its magnitude is nonzero does it copy turn6D4→6D8, add yaw+=turn×dt
through game334, and compute the side term:
```
sideSpeed = turn * (1-friction) * speed * float(1/55)
```
Zero incoming velocity skips direct yaw and produces sideSpeed0, but still
constructs forward velocity. Friction getter game248 supplies the existing.8;
factor.415 is a different body property. Unlike ground apply there is no extra
dt in this side speed. Source yaw uses degree-to-index float45.5111122,
truncate47F940 and mask3FFF, then the16384-entry float sine/cosine tables.
472B10 transforms local(0,0,speed), producing
`(-sin(yaw)*cos(pitch)*speed, sin(pitch)*speed, cos(yaw)*cos(pitch)*speed)`.
Roll has no effect for this particular local vector.438950..438976 uses only
transformed X/Z plus the yaw-only side vector and preserves incoming velocityY.
Pitch therefore changes horizontal forward magnitude, **not** vertical velocity.
Full transform source is guarded; host continuous trig in the projection is an
explicit precision approximation. The existing destination Euler interpolator
43A420 uses4.5/sec for pitch/roll and3.7/sec for wrapped yaw; this investigation
does not re-claim all its enable/dirty/base-transform phase ownership.
After composing XZ,43899A calls grounded218. If false, return. If true:
-Call complete154→42A720, which loadsA14 and jumps472970.472970 is a single RET;
it has no landing-effect mutation in this shipped EXE.
-Call complete158→4378D0 current jump-held predicate. It reads the same five
source jump inputs (50993A,509865,509848,509898,509AC5). Its raw6 exception
requires fire+support; raw Bubble0 has no extra denial.
-Held jump: directly set live velocityY900, retaining freshly composed XZ;
play SFX106 (`bubble_boing`) at4389F8. No edge latch: each supported apply can
invoke this sound/velocity write. Scalar speed is retained.
-Released jump: **after XZ composition**, halve scalar6C8 and directly set live
velocityY300. There is no SFX106 in this path. The reduced scalar is then
published by437C22, while current live XZ still represents the pre-half scalar.
These are automatic repeated bounces, not ordinary550 queued jump impulses.
Movementmode2 persists after both branches; ordinary jetpack JumpState/held-clock
logic is not called. Unsupported apply preserves liveY and the mode.
The Jimmy wrapper separately tests support42469B. For raw Bubble0 it restores
live radius160 and directly requests completeE0("STOP",1) at4246CD..4246D4.
The string is4ED040. Unsupported wrapper makes no action request at this site.
4387E0 and439900 contain no JUMP/FLY/RUN selection. Equip's refresh148→429A00
only stops A44 sound; it does not reset Euler or select a flying animation. Retain
these proven boundaries instead of inventing a Bubble flight pose.
## Camera dependency and verification limits
439900 retains shared camera destination calls120/384 and scalar16C→43B820.
Mode2 branch439F4D..43A03A scales horizontal follow by1.8×dt×that scalar.
Vertical follow uses1.5 outside the close-height branch; when
abs(truncate(rootY−eyeY))<=800 and rootY+20<=eyeY, its scale is.8 when
abs(truncate(deltaY−eyeY))>550, else.2. That second expression uses the existing
target-minus-eye delta before subtracting eyeY; do not simplify it into a more
plausible height expression. Shared complete851 overrides all axes with.1dt.
Exact scalar16C, destination geometry and native camera clipping retain their
separate existing camera gates. Sprite placement order after this handler is
closed even when that modern camera adapter remains approximate.
Ten Python groups pass (`artifacts/bubble-motion/tests.log`): original span/
binding/constants guards; fire throttle; turn/pose priorities; supported input
reduction and negative crossing; coast/brake; pitch-forward/liveY preservation;
direct900/300 bounce, sound and scalar/XZ ordering; zero-velocity yaw gate and
bounded inputs. These are static/projection checks, not original runtime probes.
`src/GamePort/Game/BubbleMotion.cs` implements the keyboard input and apply
component using the port's quantized `LabSimulation.Trig` for current pitch/yaw.
Its public results are `BubbleSteering(Speed,TurnRate,TargetPitch,TargetRoll)` and
`BubbleApply(Velocity,Yaw,Speed,Boing)`; methods are `StepInput` and `StepApply`.
Eleven C# numeric/bounds groups pass in `artifacts/bubble-motion/csharp-tests.log`,
including112.5 XZ versus56.25 publication and quantized pitch cosine. Run with
`dotnet run --project tests/GamePort.BubbleMotionTests --no-restore` after local
restore. It changes no normal-air component and performs no body integration,
impulse, acceleration, gadget lifetime, sprite, sound playback or mode writes.
Primary owns live C# integration and its port checks. Remaining broader gates are
original/native Windows gameplay comparison, shared base/rotation/camera state,
full mouse/analog integration and dynamic/special collision coverage; source body
radius/factor/support is coordinated in bubble-body.md. No universal immunity or
entire-game completion is implied.
## Cleanup Euler handoff and A20 search boundary
Follow-up2026-11-02. Cleanup428037..4280CC writes Jimmy completeA20=.5 at428045;
it contains no Euler or destination-Euler setter. Do not interpret.5 as an
upright timer without a recovered consumer. Source constructor4226CF initializes
A20=0; another gadget cleanup42821A writes.5. A complete raw DWORD search of EXE
`.text` VA401000, raw length573440, finds six little-endian `200A0000` occurrences:
4226D1,428047,42821C are the displacements of those three MOV writes;45CFE3,
45D024,45D035 are unrelated PUSH immediates. A direct objdump operand search for
completeA20 and game960 found no read. This is a bounded negative search:
derived pointers, bulk access or other interface aliases have not been ruled out;
the consumer remains **unknown**, not proven absent or dead. The helper's
`handoff` block guards the complete search boundary and six supporting spans.
Normal ground438BC0 does provide a source destination handoff, conditional on
accepted steering. ESI initializes0 at438F66. Right4391BB, Left439239,
Forward4392BA and accepted backward4393D5/4393EE set it nonzero. At43951E, if ESI
remains0, execution skips **all** destination setters to4395CF. Thus no-input
ground behavior preserves the prior Bubble target, including pitch/roll.
For accepted steering, each destination setter43957C,439599,4395C9 passes
**pitch0 and roll0**, retaining its separately computed destination yaw.
Ordinary keyboard Left/Right/Forward/Backward all reach this handoff when their
direction is accepted. Backward specifically has the prior438F9A..438FBB gate:
raw−1 or3 with fire held rejects reverse, so Backward+Fire without another
accepted direction need not produce ESI. Raw6 and other special-gadget gates
must retain their own boundaries.
Normal air mode1 always reaches439D81..439E2B and requests destination
`(pitch0,currentYaw,roll−turn)`; Bubble mode2 instead requests its±10 pitch and
−.25turn roll described above. Normal air release eventually reduces turn to0,
so its requested roll also becomes0. This is an input destination update, not
an immediate Euler reset. Shared43A420's active branch interpolates pitch and
roll error×dt×double4.5, yaw error×dt×double3.7 (with angle wrap and dirty flags).
No cleanup-specific A20 ownership is visible in that routine. This follow-up
does not newly close all scheduling/enable/transform ownership for that shared
interpolator or require an invented blend during cleanup.
REA queries43A420 and438BC0 in `artifacts/bubble-motion/rea-upright/` did not
match recognized procedures; their numeric VA requests then returned the
provider's unmapped-file-offset fallback diagnostics. Complete failures, empty
Evidence export and closed snapshot are retained. Supporting conclusions use
the guarded disassembly `normal-input-tail.asm`, `normal-apply.asm` and
`rotation.asm`. Two added Python groups guard A20's bounded search and the
conditional ground/normal-air destination handoff; C# BubbleMotion was unchanged.