diff --git a/docs/checkpoint/control-phase-implementation.md b/docs/checkpoint/control-phase-implementation.md index 7abfd7c..9e15f4b 100644 --- a/docs/checkpoint/control-phase-implementation.md +++ b/docs/checkpoint/control-phase-implementation.md @@ -15,9 +15,11 @@ the following body pass. Neither control loss nor restoration invents a key flus PlayerSceneBinding connects raw-owner preparation events to speed/velocity and supported gadget cleanup, and publishes the simulated root while uncontrolled. Authored AI transforms update the body too, preventing a later physics publish -from overwriting the script's teleport. Destination yaw is preserved. Pitch/roll -remain director-owned; Jimmy's render/controller still uses the existing yaw -adapter. Initial MCA preparation occurs once, with its first-name guard; later +from overwriting the script's teleport. Authored current writes preserve the +facing destination. The later full-Euler bridge publishes all axes; CAM/MCA +preparation now replaces destinationXYZ with the upright current heading too. +See [rotation feedback](../gameplay/jimmy-rotation-handoff.md). +Initial MCA preparation occurs once, with its first-name guard; later shots do not repeat it. AI and CAM use their own callback order. STOP notification follows physical preparation. DEFAULT grants control without preparation. diff --git a/docs/checkpoint/coverage.md b/docs/checkpoint/coverage.md index cbc02e8..9c388b7 100644 --- a/docs/checkpoint/coverage.md +++ b/docs/checkpoint/coverage.md @@ -1,5 +1,11 @@ # Core architecture coverage map +2026-11-05 handoff correction: CAM/MCA destination state at game+274 is now reset +along with current Euler (20 original-component cases; managed/native Linux +handoff checks). Neutral ground input separately retains residual bank in seven +original trajectories; whole-frame landing comparison remains open. See +[rotation handoffs](../gameplay/jimmy-rotation-handoff.md). + Checkpoint scope: lab → tutorial VR04 → lab → outside, including intro, explanation, pickup/practice, RETURN, Carl conversation and exit. This compares source contracts with the current port and preserved playable baseline69d0187, diff --git a/docs/checkpoint/cutscene-preparation.md b/docs/checkpoint/cutscene-preparation.md index 3831750..b4ade4c 100644 --- a/docs/checkpoint/cutscene-preparation.md +++ b/docs/checkpoint/cutscene-preparation.md @@ -9,8 +9,8 @@ corrected its sign-extended byte−1 comparison anchor and added tests/report. | Boundary | Proven order and source sites | |---|---| -|CAM with PlayerControlled=NULL|Guard prior raw owner416635;43841665D→41041666B→flatten logical/cached Euler(0,yaw,0)41667E..4166E5→game118(NULL)4166F4. Target lookup occurs later416754. Preparation can precede a missing target/sound failure.| -|Initial MCA activation|First target name `none` guard431300 exits before preparation. A non-none name reaches initial target/animation prelude; missing lookup can continue. Prior owner guard431502;410431512→flatten Euler431525..431578→438431598→game118(NULL)4315A7. Per-shot helper invoked431600.| +|CAM with PlayerControlled=NULL|Guard prior raw owner416635;43841665D→41041666B→flatten current/destination Euler(0,currentYaw,0)41667E..4166E5→game118(NULL)4166F4. Target lookup occurs later416754. Preparation can precede a missing target/sound failure.| +|Initial MCA activation|First target name `none` guard431300 exits before preparation. A non-none name reaches initial target/animation prelude; missing lookup can continue. Prior owner guard431502;410431512→flatten current/destination Euler431525..43158D→438431598→game118(NULL)4315A7. Per-shot helper invoked431600.| |Later MCA shot|CompleteE0→431750; target/sound/animation work, no410/438 or raw control clear. The sound−1 check431771 sign-extends one immediate byte, not a four-byte immediate.| |AI PlayerControlled=NULL|Prior raw owner guard40C4AD→41040C4B9→game118(NULL)40C527; no438 or flatten. Named AI ownership remains an older port interpretation requiring broader proof.| |DEFAULT|447D5C checks whether Jimmy already owns raw control;447E27 restores via118 without410/438. No new key-release boundary is implemented. Music uses authored ownership independently of debug force.| @@ -38,3 +38,10 @@ animation prelude, all other class virtual effects and full shared camera state are not certified by this chunk. Existing named control behavior is preserved, not newly recovered here. Three byte/projection tests and coupled managed director/body tests guard the implemented ordering and boundaries. + +2026-11-05 correction: game+274 is the facing destination, not an independent +render cache. CAM/MCA copy `(0,currentYaw,0,currentW)` into both current and +destination vectors without touching dirty. See +[exact rotation handoff](../gameplay/jimmy-cutscene-rotation-source.md) for20 +isolated original-code cases and the recovered fix. STOP alone, AI NULL and +DEFAULT retain their existing separate policies. diff --git a/docs/compatibility.md b/docs/compatibility.md index 51591c4..238f058 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -1,5 +1,12 @@ # Compatibility and validation +Rotation handoff feedback (2026-11-05): CAM/MCA clear both live and destination +pitch/bank while preserving current yaw/dirty.20 isolated original cases compare; +managed real banked-jump handoffs and native Linux control restoration pass. +Seven source grounded-input/facing trajectories reproduce residual idle tilt, +so no generic landing snap was introduced. Whole-original frame/native Windows +comparison remains open. See [handoff](gameplay/jimmy-rotation-handoff.md). + Turning/fire feedback (2026-11-05): source left/right turn clips restored for low-speed grounded turning; jetpack fire now shares full owner pitch/yaw/roll and visual alignment. Player visual/movement/data/director/jetpack/Python checks diff --git a/docs/decisions.md b/docs/decisions.md index 2b2b8d0..5413ac2 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -347,3 +347,12 @@ assets and generated packages stay excluded. translation branch. Preserve inactive-path context. Retain the lab/outside capsule until real Jimmy callbacks and multi-frame/dynamic ownership are proven. See checkpoint/body-contact-implementation.md. + +51. **Camera orientation preparation replaces the facing destination too.** + Source CAM/MCA flatten current and game+274 destination to current yaw with + pitch/roll0; direct writes preserve facing dirty. Reset both on that existing + preparation boundary, not on every input lock/STOP/DEFAULT.20 isolated native + cases verify this state ownership. Neutral grounded input instead retains + residual destination bank in seven source trajectories; no unproven universal + landing snap is added. Another whole-frame writer or original quirk remains + open. See gameplay/jimmy-rotation-handoff.md and its two source reports. diff --git a/docs/gameplay/jimmy-cutscene-rotation-source.md b/docs/gameplay/jimmy-cutscene-rotation-source.md new file mode 100644 index 0000000..3d9da88 --- /dev/null +++ b/docs/gameplay/jimmy-cutscene-rotation-source.md @@ -0,0 +1,102 @@ +# Jimmy cutscene rotation: source ownership + +2026-11-05. User reports that jumping at an angle into cutscene triggers retains +Jimmy's airborne tilt. This investigation identifies a direct source mismatch, +not a new global "cutscenes upright" policy. + +## Source and provenance + +Original Neutron.exe SHA256 +`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`. +REA retained complete instruction Evidence +`ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904`, +artifacts/jimmy-movement-audit/rea-original-disassembly.json, supplies the exact +instruction windows. `tools/binary/jimmy_cutscene_rotation.py` independently +checks original identity and seven complete instruction-range hashes; optional +`--rea-disassembly` retains matching extracts in its generated source.json. +Preferred VA400000; raw offsets below are VA minus400000, independently checked +against PE section mapping. This uses existing REA evidence rather than repeating +the previously unsupported native selectors. + +## Recovered facts + +Jimmy game interface is complete+C0. Current Euler is game224/228/22C/230, +complete2E4/2E8/2EC/2F0. Destination Euler is game274/278/27C/280, +complete334/338/33C/340. Byte game+A is facing dirty; byte+5 is facing enabled. + +| Original boundary | Current and destination ownership | +|---|---| +|CAM NULL control:416671..4166EB, file16671..166EB|Read current full Euler through328 at41667E→4723F0. Build `(0,current.Y,0,current.W)`. Direct-write destination at4166A0..4166C9, then full current setter32C at4166E5→472450. Neither operation writes dirty or calls destination setter36C.| +|Initial MCA:431518..431590, file31518..31590|Read328 at431525; build the same flat Vec4; write current32C at431565, then direct-write destination431578..43158D. Preserve dirty.| +|Current full setter32C→472450, file72450|Copies all four values to game224..230; does not touch destination/dirty. Distinct from current XYZ setter330→472420.| +|Destination XYZ setter36C→472660, file72660|Writes destinationXYZ and sets dirty+A=1. Camera suffixes bypass this setter; using it would introduce a dirty-state change absent from source.| +|Facing43A420, file3A420|Global-ready475CA0, enabled+5, dirty+A gate. On acceptance, clears dirty first, compares before-step current/target axes, marks dirty for any unequal axis, adds per-axis angular deltas through334. Runs before Jimmy's raw-control gate437A1B.| + +The old [preparation report](../checkpoint/cutscene-preparation.md) called +game274 a "cached Euler". The later [target-state recovery](jimmy-air-target-state.md) +identifies this same storage as the live facing destination. These camera writes +therefore replace the **whole destination**, including Y with current Y; they do +not merely cache an independent render rotation. Full W is copied too, though the +port currently models orientationXYZ only. + +CAM's broader order remains438 cleanup→410 stop→orientation writes→clear raw +control. MCA starts410 stop→orientation writes→438 cleanup→clear raw control. +Their prior-owner guards still apply. Initial MCA's first-name `none` guard exits +before this path; subsequent shots do not repeat it. Generic AI NULL ownership +40C4AD..40C527 only stops motion and clears control: **no flattening**. DEFAULT +restores control without flattening/preparation. Animation STOP is also separate +from these orientation writes. Do not flatten on every input lock, shot, action +change, or missing controller tick. + +## Port mismatch and implementation contract + +At investigation start, LabSimulation.FlattenOrientation only set Pitch=Roll=0; +it left destinationEuler at the airborne target. The newly restored full-Euler +facing bridge legitimately runs while uncontrolled. Its next step therefore +interpolates Jimmy back toward the stale airborne pitch/bank and possibly old +heading. The source camera path overwrites that stale target at the handoff. + +Replace currentXYZ and destinationXYZ with `(0,currentYaw,0)` on this existing +FlattenOrientation boundary, preserving facingDirty/facingEnabled and all motion, +impulse, jump/hold/fire and pitch seeds. Preserve named-authored/current writes as +separate ownership; do not make arbitrary current setter writes reset destination. +The existing CAM/MCA order and prior-owner guards remain authoritative. Parent +owns integration and managed/native port checks. + +## Verification boundary + +The source guard passes against authoritative bytes. The bounded native probe +executes the copied original orientation suffixes with the actual328/32C leaves, +then the actual43A420 facing leaf and334 Euler-add chain, using synthetic owner +storage/vtables and a forced-ready global facing gate. It does not execute game +entrypoints, camera activation, actor registry, body, inputs, gadget cleanup or +renderer. All execution is in the generated copy with Original unmounted and +network disabled. All20 native cases pass (CAM/MCA × five initial Euler pairs × dirty0/1). +Each suffix changes exactly the full current/destination vectors in the synthetic +object; all other sentinel bytes, including enabled/dirty, are preserved. Before +facing, current and target both equal `(0,oldCurrent.Y,0,oldCurrent.W)`; after +one real facing pass dirty is0, and after30 passes the same upright vectors +remain. Cases cover positive tilt, actual powered-flight-style wrapped tilt, +negative tilt, heading359 with target1, and heading360 with target0. Initial +current/targetW differ, proving the source copies currentW into both. + +Artifacts: artifacts/jimmy-cutscene-rotation/build/source.json, +probe/wine.log, probe/capture.json, native-observations.json. The JSON retains all +before/prepared/after-facing/after30 vectors and dirty bytes for managed +comparison. First3s capture only created the Wine prefix; repeating with12s allowed +initialization and completed with exit0 and the required marker. This is a native +original-component execution under Wine32, not whole-game/runtime Windows parity. + +```sh +python3 tools/binary/jimmy_cutscene_rotation.py ../Original \ + --rea-disassembly artifacts/jimmy-movement-audit/rea-original-disassembly.json \ + --generate-probe artifacts/jimmy-cutscene-rotation/build +i686-w64-mingw32-gcc -O0 -Wall -Wextra -Wl,--image-base,0x10000000 \ + -I tools/binary artifacts/jimmy-cutscene-rotation/build/jimmy_cutscene_rotation_probe.c \ + -o artifacts/jimmy-cutscene-rotation/build/probe.exe +python3 tools/recon/reference_capture.py --asset-probe \ + --probe-executable artifacts/jimmy-cutscene-rotation/build/probe.exe \ + --probe-success JIMMY_CUTSCENE_ROTATION_COMPLETE --seconds 12 \ + --output artifacts/jimmy-cutscene-rotation/probe +``` + diff --git a/docs/gameplay/jimmy-landing-rotation-source.md b/docs/gameplay/jimmy-landing-rotation-source.md new file mode 100644 index 0000000..14ad4cb --- /dev/null +++ b/docs/gameplay/jimmy-landing-rotation-source.md @@ -0,0 +1,118 @@ +# Jimmy landing → idle orientation ownership + +2026-11-05. User reports a slight bank/pitch can remain after landing without +further movement. This investigation tests the original paths rather than +assuming that support implies an upright snap. Parent owns runtime integration. + +## Evidence and coordinate owners + +Original Neutron.exe SHA256 +`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`. +Retained complete REA instruction Evidence +`ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904`, +artifacts/jimmy-movement-audit/rea-original-disassembly.json. This report reuses +that observation; it does not claim a new Ghidra decompile. VA-to-file mapping +below is checked through PE sections (these EXE text offsets equal VA−400000). +JN-Engine's original C3DJimmy/C3DPlayer decompiler notes supplied leads only. + +Current Euler is game224/228/22C (complete2E4/2E8/2EC). Destination Euler is +game274/278/27C (complete334/338/33C); game+A (completeCA) is facing dirty. +Destination setter36C→472660 storesXYZ and sets dirty. Jimmy facing43A420 +reads current/destination independently and runs before controlled-player gating. +There is no small-error snap in that recovered interpolator. + +## Grounded and idle transitions + +| Original VA / file offset | Recovered behavior | +|---|---| +|438A60..438B9E /38A60..38B9E|Input dispatch uses retained movement mode game704. Mode0 selects ordinary ground handler438BC0; mode1/2 selects439900. It does not itself reset current/destination Euler.| +|438BC0..43915D /38BC0..3915D|Complete ground handler prefix samples input, support/root, idle animation/sounds and camera-vector angles. No330/32C/36C Euler dispatch or direct current/destination Euler store occurs in this bounded prefix.| +|438F66 /38F66|Ground accepted-heading flag ESI starts0. Keyboard/accepted analog directions set it; neutral input need not do so.| +|43951E..439520 /3951E..39520|If ESI remains0, jump4395CF, skipping all destination writes. This preserves old destination pitch/roll/yaw and dirty state.| +|43957C,439599,4395C9 /3957C,39599,395C9|Accepted steering publishes pitch0/roll0 and the selected destination yaw through36C. Input, rather than the mere fact of standing, owns these upright destinations.| +|437AEA,437B12 /37AEA,37B12|Grounded/released wrapper calls complete140 when prior movement mode1, before the animation decision and resetting mode0/turn0 at437B9E..437BAC.| +|429910..429962 /29910..29962|Complete140 clears complete1E64/1E68, hides the A18 menu indicator except rawmode2 and stops A3C sound if valid. No current/destination Euler write occurs. The menu488 target403700 only hides two UI resources.| +|43B28A..43B2EB /3B28A..3B2EB|Accepted STOP selection uses generic animationE0 and clears acceleration278. It does not reset current/destination Euler; same-animation request returns earlier43AFF8..43B010.| +|40DD90..40DF79 /DD90..DF79|Generic animation start resolves the named morph, starts it and sets shape/timing. No Euler destination/current setter is dispatched in the resolved routine.| +|game37C→472970 /72970|Jimmy's body landing callback binding is the bare no-op/log stub, not an upright reset.| + +The derived Jimmy input hook426030 also has a separate impact latch. Its support +query is4260AA, falling gate uses vertical thresholds at4260EF/4261B1 and sets +**game1D98** at4261C5 (complete1E58). On support42622D..42625E, it clears that +latch, plays soundC0 and calls complete1A0(-10,-10,5), the camera effect path. +This is not a rotation reset. Offset names in the friend's mixed-interface notes +must not be copied without the C0 adjustment. The pickup-halo AddEuler4264F8 +writes the effect object1D94, not Jimmy. The426F47 Euler copy likewise targets +an attached action objectA10 from Jimmy's current Euler. + +Ordinary air input439900 independently accepts support for speed decay, but +turn return439989..439A58 has no supported-axis reset. Its ordinary destination +439DB7..439E2D is `(acceptedPitch,currentYaw,-storedTurn)`. The last accepted air +input can therefore leave a small bank destination after turn0 is subsequently +written by the grounded wrapper. Neutral ground input alone does not replace it. +Earlier [Bubble recovery](bubble-motion.md) already records the analogous +no-input retention; this is not evidence for introducing a cleanup timer or snap. + +## Rendering and scope + +473540 converts current degrees to source14-bit angle units. The existing +JimmyRenderTransform already performs that quantization. The OMT hierarchy +retains full pitch/roll. The final OMT model-matrix decomposition remains its +previous precision gate; none of these static paths establishes a general +"grounded means upright" policy. + +**Recovered:** the local writes, dispatch order and retention contracts above. +**Inference:** stale last-air bank can explain the reported freeze in the port +and is also possible through these source components. A full original frame +trace is still required to prove whether another scene writer intervenes in the +reported route. A component result is not that whole-game observation. +**Implementation:** parent owns any runtime change; do not silently insert a +landing snap and label it original behavior. The independently recovered CAM/MCA +flattening writes both current and destination and has a different owner. + +## Guard and finite component verification + +`tools/binary/jimmy_landing_rotation.py` guards original SHA, seven branch/field +anchors, five virtual bindings and eleven bounded range hashes. Optional retained +REA input verifies Evidence identity and lists all ground-prefix calls. +`jimmy_landing_rotation_probe.c` executes the original43915D..4395CF keyboard +suffix and actual43A420/458F90/472480 facing leaves with real472660 destination +setter and4723F0 getter. A synthetic actor/input phase replaces body, camera, +animation resources and full scheduling. It seeds a supported neutral-input +boundary after the last airborne destination publication, then records one and +300 input/facing passes; it does not execute full landing or whole gameplay. + +All seven finite original-component cases complete successfully inside the +network/filesystem-isolated Wine32 generated copy. The final capture records +wineExit0 and `JIMMY_LANDING_ROTATION_COMPLETE`. Example observations: + +- Neutral last-air target `(0,155,-5)` retains that destination; after300 passes, + current is approximately `(0,155,355)`. The five-degree bank survives. +- Neutral last-air forward target `(-40,290,-25)` retains it and settles to + `(320.000183,290,335.000183)`, rather than upright. +- Dirty0 with current `(10,155,15)` leaves that rotation unchanged for300 passes. +- Active Up publishes `(0,290,0)` and levels via the original interpolator; + Left likewise publishes zero destination pitch/roll while changing yaw. + +The neutral suffix does not query support itself: caller selection of the ground +input path is the fixture boundary, not a newly observed whole landing callback. +`tools/binary/jimmy_landing_rotation_reference.json` retains all7 observations, +source range/byte/virtual guards, generated C/executable/shared harness/log hashes, +and capture exit metadata. Raw logs, generated source and executable are retained +under artifacts/jimmy-landing-rotation/. NoOriginal directory is mounted for the +probe and no original entrypoint executes. This confirms retention in the +specific original components and leaves another whole-frame writer explicitly +unresolved; it supplies no evidence-based justification for a universal land snap. + +Reproduce static preparation: + +``` +python3 tools/binary/jimmy_landing_rotation.py ../Original \ + --generate-probe artifacts/jimmy-landing-rotation \ + --rea-disassembly artifacts/jimmy-movement-audit/rea-original-disassembly.json +``` + +Compile generated C with local i686-w64-mingw32-gcc and `-Itools/binary`; execute +only through tools/recon/reference_capture.py's `--asset-probe` boundary with +`--probe-success JIMMY_LANDING_ROTATION_COMPLETE`. Parent owns regression-test +placement and runtime decisions; no shared/runtime file was edited by this agent. diff --git a/docs/gameplay/jimmy-rotation-handoff.md b/docs/gameplay/jimmy-rotation-handoff.md new file mode 100644 index 0000000..677cfd5 --- /dev/null +++ b/docs/gameplay/jimmy-rotation-handoff.md @@ -0,0 +1,68 @@ +# Jimmy rotation at script and ground handoffs + +2026-11-05. User reports jumping at an angle into cutscene triggers leaves Jimmy +tilted, and a slight tilt can also remain after landing and standing still. + +## Recovered cutscene correction + +[Original camera ownership](jimmy-cutscene-rotation-source.md) records REA +Evidence, original addresses/file offsets, callers, vectors and native execution. +CAM416671..4166EB and initial MCA431518..431590 explicitly flatten both current +Euler and facing destination, preserving current yaw and the dirty flag. Their +direct game+274 writes were previously described as a render cache; the air +bridge correctly identified them as destination state but missed this handoff. +The port only flattened current Euler. Control-independent facing then consumed +the stale airborne target and restored the tilt (and sometimes the prior yaw). + +LabSimulation.FlattenOrientation now replaces currentXYZ and destinationXYZ with +`(0,currentYaw,0)` without calling the dirty-setting destination setter. Existing +CAM/MCA preparation ordering, prior-owner guards, AI NULL/DEFAULT differences, +held input, queued motion and fire lifecycle remain intact. Authored transforms +still change current Euler independently of destination; no generic control-loss +or per-frame orientation clamp is introduced. Original orientation W is verified +by the probe but remains outside the port's XYZ orientation model. + +## Landing investigation + +[Landing source investigation](jimmy-landing-rotation-source.md) records its +separate boundary. Neutral ground input retains its prior destination; ground +apply, STOP, the landing notification and the derived impact latch do not supply +a proven leveling reset. This differs from the directly evidenced camera reset. +Do not invent an unconditional grounded snap from this symptom. Seven copied-original300-tick ground-input/facing trajectories reproduce +retention: destination `(0,155,-5)` retains roll355 after300 neutral passes; +active Up/Left replaces X/Z targets and levels. The managed ground tests compare +all seven source trajectories. These are component observations, not a whole +original frame trace: another unobserved frame writer or an original quirk remains +open. No landing policy is changed without that evidence. + +## Verification + +The old implementation fails the new director regression at the pending target. +Eight integrated cases cover CAM/original lab Carl MCA, both input/player orders, +and clean/dirty facing. They enter real banked jumps, verify immediate current/ +destination flattening and unchanged dirty/impulse, then run120 locked body ticks +without reintroducing tilt. Additional checks compare20 saved native camera +preparation/facing XYZ/dirty outputs, including negative/wrapped Euler and yaw +seams. These comparisons seed dirty through live input; the native probe's whole +object comparison separately proves independence from the old destination and W. +The saved fixture includes original range and probe provenance hashes. + +Native Linux SDL/Vulkan --smoke-control-phases now first creates a real8-tick +banked jump before triggering the original Carl MCA. It asserts both current and +destination are leveled while dirty survives the handoff, verifies they remain +upright through15 locked body/fire/energy ticks, and checks held-input resumption. +It saves locked-start/locked-fall GPU captures. The Carl lock and powered VR04 +replays remain regression checks. Artifacts: artifacts/jimmy-rotation-handoff/. +28 movement groups, extended Director tests, original25 ground observations plus +seven trajectories,14 jetpack groups and both visual groups pass. Build passes +with zero warnings/errors using NuGetAudit=false (the first default-audit attempt +reported unavailable network metadata). Native Linux banked handoff/Carl lock/ +powered jetpack runs pass with zero Vulkan validation errors. The jetpack replay +requires explicit VR04; an initial default-lab invocation was rejected by its +existing argument guard before rendering and the corrected replay passes. +All336 Python tests pass, including new camera/landing source and native-fixture +provenance guards. The initial managed fixture name collision was corrected +before the final Director run. Package results follow below. + +These are static-source, isolated original-component and port-runtime checks. +They do not establish whole-original frame scheduling or native Windows parity. diff --git a/docs/progress.md b/docs/progress.md index d2285f1..7b7c0b0 100644 --- a/docs/progress.md +++ b/docs/progress.md @@ -3,6 +3,21 @@ Workflow update: the user authorizes pushing completed, verified commits to the existing `Gitea/main` upstream from now on. See docs/decisions.md and AGENTS.md. +## Jump tilt at cutscene and landing handoffs + +Recovered CAM/MCA direct writes flatten both current and destination Euler to +(0,currentYaw,0), preserving dirty; the old port cleared current only, allowing +uncontrolled facing to restore the airborne tilt. Fixed that existing boundary, +with20 isolated original-code cases, eight integrated handoff cases, and the +native banked Carl/control-restoration replay passing. Input, body and fire +ownership remain separate; see [handoff](gameplay/jimmy-rotation-handoff.md). + +The separate idle-after-landing report has seven original ground-input/facing +trajectories: neutral input retains residual bank; active input levels normally. +No universal grounded snap is supported by those recovered paths, so no landing +policy was invented. Whole-original frame ownership remains an explicit question; +see [landing evidence](gameplay/jimmy-landing-rotation-source.md). + ## Turning animation and jetpack attachment feedback Restored supplied six-frame jimleft/jimright clips to default preparation and diff --git a/docs/tasks.md b/docs/tasks.md index 2d126bf..558e109 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -46,6 +46,16 @@ compile, runtime and original-fidelity verification are separate. ## Immediate continuation +- [x] User airborne cutscene tilt: reproduce and recover CAM/MCA current plus + destination reset with dirty preserved; implement and verify20 original native + cases, both player/input orders and native Carl handoff/resumption. See + gameplay/jimmy-rotation-handoff.md. +- [x] Investigate landing-idle tilt: seven original-component trajectories retain + neutral residual bank and active steering levels. No supported universal snap. +- [ ] Whole-original landing-to-idle frame comparison: determine whether any other + writer levels the actor or residual bank is an original quirk. Preserve the + documented component evidence and keep this separate from the camera fix. + - [x] User feedback: restore original left/right turning animations and fix jetpack fire following pitch/roll as well as yaw. Source guards, visual/pose tests and native Linux rendering pass; see gameplay/jimmy-turn-fire-fixes.md. diff --git a/src/GamePort/Game/LabSimulation.cs b/src/GamePort/Game/LabSimulation.cs index 2c5ca9f..198e1a1 100644 --- a/src/GamePort/Game/LabSimulation.cs +++ b/src/GamePort/Game/LabSimulation.cs @@ -362,7 +362,14 @@ public sealed class LabSimulation bubbleLoop=false; InteractionRadius=60; BodyFactor=OriginalBodySupport.JimmyFactor; } - public void FlattenOrientation() { Pitch=Roll=0; } + public void FlattenOrientation() + { + //CAM4166A0..4166E5 / MCA431565..43158D copy (0,currentYaw,0) + //to both live Euler and destination274. This is a direct destination + //write: unlike36C, it preserves the existing facing-dirty byte. + Pitch=Roll=targetPitch=targetRoll=0; + targetYaw=Yaw; + } private void StepFloorPolicy() { diff --git a/src/GamePort/Program.cs b/src/GamePort/Program.cs index 60217af..3a8a260 100644 --- a/src/GamePort/Program.cs +++ b/src/GamePort/Program.cs @@ -681,11 +681,22 @@ internal static class Program if (gadgetWindowSmoke) { interactions!.Inventory.SetState(0,3,1); interactions.Inventory.SelectGadget(3); } if (controlPhaseSmoke) { + //Enter with real airborne steering/destination state, rather + //than an upright fixture that cannot detect stale jump tilt. + for (var tick = 0; tick < 8; tick++) + playerBinding!.Step(new(true, false, true, false, true)); + if (simulation.Grounded || !simulation.FacingDirty || simulation.FacingTarget.X >= 0 || simulation.FacingTarget.Z >= 0) + throw new InvalidOperationException("Control-phase fixture did not establish a banked jump"); + var enteredRotation = simulation.Rotation; interactions.Inventory.SetState(0, 3, 1); interactions.Inventory.SelectGadget(3); simulation.ApplyRetainedLevelState(new("LV1B", 3, 1, .625f, 6.125f)); simulation.RestoreReturnRoot(simulation.ActorRoot + Vector3.UnitY * 200); director.SyncActor(level.Player!.Tag!, simulation.ActorRoot, simulation.Rotation); director.Trigger("neutron1a"); + var preparedRotation = new Vector3(0, enteredRotation.Y, 0); + if (simulation.Rotation != preparedRotation || simulation.FacingTarget != preparedRotation || !simulation.FacingDirty) + throw new InvalidOperationException("MCA did not copy upright current/destination Euler while retaining dirty"); + Console.WriteLine($"Control-phase banked entry: Euler={enteredRotation}, prepared={simulation.Rotation}, destination={simulation.FacingTarget}, dirty={simulation.FacingDirty}."); } if (practiceReturnSmoke && level.Code == "VR04") { @@ -844,6 +855,12 @@ internal static class Program var toolsPaused = false; var toolsMoved = false; var toolsStopped = false; var toolsSaved = false; var toolsSystems = false; var toolsEntry = simulation?.ActorRoot ?? Vector3.Zero; var controlEntry = simulation?.ActorRoot ?? Vector3.Zero; + var controlRotation = simulation?.Rotation ?? Vector3.Zero; + var controlControllers = simulation?.ControllerSteps ?? 0; + var controlPhysics = simulation?.PhysicsSteps ?? 0; + var controlEffects = simulation?.EffectSteps ?? 0; + var controlJumps = simulation?.Jumps ?? 0; + var controlTurn = simulation?.TurnRate ?? 0; var phasesLocked = false; var phasesResumed = false; var gadgetChecks = new bool[7]; var gadgetEntry = simulation?.ActorRoot ?? Vector3.Zero; @@ -1483,16 +1500,21 @@ internal static class Program diagnostics.ObserveFrame(presentedAt - lastPresentedAt); lastPresentedAt = presentedAt; count++; + if (controlPhaseSmoke && (count == 1 || count == 15) && Option(args, "--screenshot") is { } phaseCapture) + renderer.SavePpm(Path.ChangeExtension(phaseCapture, count == 1 ? ".locked-start.ppm" : ".locked-fall.ppm")); if (controlPhaseSmoke && count == 15) { phasesLocked = director is { Controlled: false, Playing: true } - && simulation is { ControllerSteps: 0, PhysicsSteps: 15, EffectSteps: 15, Jumps: 0, Speed: 0, TurnRate: 0 } + && simulation!.ControllerSteps == controlControllers && simulation.PhysicsSteps == controlPhysics + 15 + && simulation.EffectSteps == controlEffects + 15 && simulation.Jumps == controlJumps + && simulation.Speed == 0 && simulation.TurnRate == controlTurn + && simulation.Rotation == controlRotation && simulation.FacingTarget == controlRotation && !simulation.FacingDirty && simulation.ActorRoot.Y < controlEntry.Y && simulation.JetpackRemaining is > 0 and < 6.125f && simulation.Energy < 20 && Vector2.Distance(new(simulation.ActorRoot.X, simulation.ActorRoot.Z), new(controlEntry.X, controlEntry.Z)) < .001f; director!.Skip(); } if (controlPhaseSmoke && count == 30) - phasesResumed = director!.Controlled && simulation!.ControllerSteps == 15 && simulation.Travel > 1; + phasesResumed = director!.Controlled && simulation!.ControllerSteps == controlControllers + 15 && simulation.Travel > 1; audio?.Pump(); sceneAudio?.Pump(); if (toolsSmoke) @@ -1723,7 +1745,7 @@ internal static class Program } if (controlPhaseSmoke) { - Console.WriteLine($"Control-phase fixture: locked input with body/fire/energy continuing={phasesLocked}; held-input resumption={phasesResumed}."); + Console.WriteLine($"Control-phase fixture: upright current/destination with locked input and body/fire/energy continuing={phasesLocked}; held-input resumption={phasesResumed}."); if (!phasesLocked || !phasesResumed) return 2; } if (objectiveSmoke) Console.WriteLine($"Objective panel: time={objectivePanel!.Elapsed:F3}, pad={objectivePanel.PadVisible}, content={objectivePanel.ContentVisible}, offset={objectivePanel.YOffset:F3}."); diff --git a/tests/GamePort.DirectorTests/GamePort.DirectorTests.csproj b/tests/GamePort.DirectorTests/GamePort.DirectorTests.csproj index e7720fb..1d1ccad 100644 --- a/tests/GamePort.DirectorTests/GamePort.DirectorTests.csproj +++ b/tests/GamePort.DirectorTests/GamePort.DirectorTests.csproj @@ -1,4 +1,5 @@ Exenet10.0enableenablefalse + diff --git a/tests/GamePort.DirectorTests/Program.cs b/tests/GamePort.DirectorTests/Program.cs index 5acc5cf..43078f0 100644 --- a/tests/GamePort.DirectorTests/Program.cs +++ b/tests/GamePort.DirectorTests/Program.cs @@ -1,5 +1,6 @@ using System.Buffers.Binary; using System.Numerics; +using System.Text.Json; using GamePort.Assets; using GamePort.Game; using GamePort.Application; @@ -200,6 +201,79 @@ foreach (var kind in new[] { "3CAM", "3MCA", "3AIT" }) } Console.WriteLine("PASS ordered CAM/MCA/AI preparations, body continuation, raw-owner force override and held-input restoration"); +foreach (var retained in new[] { false, true }) +foreach (var dirty in new[] { false, true }) +foreach (var kind in new[] { "3CAM", "3MCA" }) +{ + var scene = kind == "3MCA" + ? new SceneDirector(level, new TaskStates(save.Tasks), (_, _) => 10) + : new SceneDirector(new("LV1B", [Entity("3JIM", "JIM1"), + Entity("3CAM", "camera", ("PlayerControlled", "NULL"), ("CameraTarget", "JIM1"), + ("SoundDatabase", "voice"), ("SoundIndex", 1))]), new TaskStates([]), (_, _) => 10); + var body = ControlBody(); + body.InputAfterPlayerUpdate = retained; + using var binding = new PlayerSceneBinding(scene, body, new SceneInventory(new int[19]), "JIM1"); + if (dirty) + { + for (var tick = 0; tick < 8; tick++) binding.Step(new(true, false, true, false, true)); + Check(!body.Grounded && body.FacingDirty && body.FacingTarget.X < 0 && body.FacingTarget.Z < 0, + "Cutscene regression enters with a real banked jump and pending airborne destination"); + } + // A direct authored yaw must replace the old destination Y at preparation too. + body.ApplyAuthoredTransform(body.ActorRoot, new Vector3(345, body.Yaw + 37, 12)); + scene.SyncActor("JIM1", body.ActorRoot, body.Rotation); + var yaw = body.Yaw; + var controllers = body.ControllerSteps; + var physics = body.PhysicsSteps; + var impulse = body.PendingImpulse; + scene.Trigger(kind == "3MCA" ? "neutron1a" : "camera"); + Near(body.Rotation, new(0, yaw, 0), "Camera preparation levels current Euler immediately"); + Near(body.FacingTarget, new(0, yaw, 0), "Camera preparation also replaces every pending destination axis"); + Check(body.FacingDirty == dirty && body.PendingImpulse == impulse && !scene.Controlled, + "Direct destination copy preserves facing dirty, queued impulse and source control lock"); + for (var tick = 0; tick < 120; tick++) + { + binding.Step(new(true, false, true, false, true)); + Near(body.Rotation, new(0, yaw, 0), "Uncontrolled facing cannot restore the old jump tilt or yaw"); + Near(scene.FindActor("JIM1")!.Rotation, body.Rotation, "Director and rendered player share the prepared rotation"); + } + Check(!body.FacingDirty && body.ControllerSteps == controllers && body.PhysicsSteps == physics + 120, + "Facing clears equal targets while locked body updates continue without player input"); +} +Console.WriteLine("PASS CAM and original Carl MCA banked-jump preparation, destination yaw/dirty ownership and sustained control lock"); + +using (var reference = JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "original-camera-rotation-reference.json")))) +{ + var cases = 0; + foreach (var observation in reference.RootElement.GetProperty("cases").EnumerateArray()) + { + var initialOrientation = observation.GetProperty("before"); + var dirty = initialOrientation.GetProperty("dirty").GetInt32() != 0; + var body = ControlBody(); + if (dirty) body.Step(new(true, false, true, false, false)); + //Camera preparation ignores the old target; actual banked-target + //ownership and the full scene callback chain are exercised above. + body.ApplyAuthoredTransform(body.ActorRoot, Euler(initialOrientation, "current")); + body.FlattenOrientation(); + Compare("prepared"); + body.Step(default, controlled: false); + Compare("after_facing"); + for (var tick = 1; tick < 30; tick++) body.Step(default, controlled: false); + Compare("after_30"); + cases++; + + void Compare(string stage) + { + var expected = observation.GetProperty(stage); + Near(body.Rotation, Euler(expected, "current"), "Copied-original camera current XYZ: " + stage); + Near(body.FacingTarget, Euler(expected, "target"), "Copied-original camera destination XYZ: " + stage); + Check(body.FacingDirty == (expected.GetProperty("dirty").GetInt32() != 0), "Copied-original camera dirty: " + stage); + } + } + Check(cases == 20, "Complete original CAM/MCA camera rotation reference"); +} +Console.WriteLine("PASS 20 copied-original camera preparation/facing XYZ and dirty outputs, including wrapped and negative Euler"); + { var jim = Entity("3JIM", "JIM1"); var command = Entity("3AIT", "move", ("PlayerControlled", "NULL"), ("AITarget", "JIM1"), @@ -371,6 +445,12 @@ static LabSimulation ControlBody() return new(new SceneCollision(floor), standing, new(0, 25, 0), 0); } +static Vector3 Euler(JsonElement state, string property) +{ + var values = state.GetProperty(property).EnumerateArray().Select(v => v.GetSingle()).ToArray(); + return new(values[0], values[1], values[2]); +} + static GamEntity Entity(string kind,string tag,params (string Name,object Value)[] values) { var properties=new Dictionary(); diff --git a/tests/GamePort.DirectorTests/original-camera-rotation-reference.json b/tests/GamePort.DirectorTests/original-camera-rotation-reference.json new file mode 100644 index 0000000..645080a --- /dev/null +++ b/tests/GamePort.DirectorTests/original-camera-rotation-reference.json @@ -0,0 +1,1346 @@ +{ + "source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8", + "scope": "Copied CAM/MCA orientation suffixes plus actual facing leaf; synthetic owner/vtables, forced global-ready gate.", + "cases": [ + { + "kind": "CAM", + "case": 0, + "before": { + "current": [ + 15, + 155, + 25, + 1 + ], + "target": [ + -40, + 151, + -25, + 101 + ], + "dirty": 0 + }, + "prepared": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 0 + }, + "after_facing": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 0 + } + }, + { + "kind": "CAM", + "case": 1, + "before": { + "current": [ + 15, + 155, + 25, + 1 + ], + "target": [ + -40, + 151, + -25, + 101 + ], + "dirty": 1 + }, + "prepared": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 1 + }, + "after_facing": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 0 + } + }, + { + "kind": "CAM", + "case": 2, + "before": { + "current": [ + 323.858002, + 293.333008, + 349.213989, + 7 + ], + "target": [ + 10, + 291, + -5, + 102 + ], + "dirty": 0 + }, + "prepared": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 0 + }, + "after_facing": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 0 + } + }, + { + "kind": "CAM", + "case": 3, + "before": { + "current": [ + 323.858002, + 293.333008, + 349.213989, + 7 + ], + "target": [ + 10, + 291, + -5, + 102 + ], + "dirty": 1 + }, + "prepared": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 1 + }, + "after_facing": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 0 + } + }, + { + "kind": "CAM", + "case": 4, + "before": { + "current": [ + -40, + 0, + -25, + 3 + ], + "target": [ + 23, + 315, + 12, + 103 + ], + "dirty": 0 + }, + "prepared": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 0 + }, + "after_facing": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 0 + } + }, + { + "kind": "CAM", + "case": 5, + "before": { + "current": [ + -40, + 0, + -25, + 3 + ], + "target": [ + 23, + 315, + 12, + 103 + ], + "dirty": 1 + }, + "prepared": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 1 + }, + "after_facing": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 0 + } + }, + { + "kind": "CAM", + "case": 6, + "before": { + "current": [ + 10, + 359, + 342.109985, + 9 + ], + "target": [ + 20, + 1, + 40, + 104 + ], + "dirty": 0 + }, + "prepared": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 0 + }, + "after_facing": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 0 + } + }, + { + "kind": "CAM", + "case": 7, + "before": { + "current": [ + 10, + 359, + 342.109985, + 9 + ], + "target": [ + 20, + 1, + 40, + 104 + ], + "dirty": 1 + }, + "prepared": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 1 + }, + "after_facing": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 0 + } + }, + { + "kind": "CAM", + "case": 8, + "before": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 10, + 0, + 10, + 105 + ], + "dirty": 0 + }, + "prepared": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 0 + }, + "after_facing": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 0 + } + }, + { + "kind": "CAM", + "case": 9, + "before": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 10, + 0, + 10, + 105 + ], + "dirty": 1 + }, + "prepared": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 1 + }, + "after_facing": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 0 + } + }, + { + "kind": "MCA", + "case": 0, + "before": { + "current": [ + 15, + 155, + 25, + 1 + ], + "target": [ + -40, + 151, + -25, + 101 + ], + "dirty": 0 + }, + "prepared": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 0 + }, + "after_facing": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 0 + } + }, + { + "kind": "MCA", + "case": 1, + "before": { + "current": [ + 15, + 155, + 25, + 1 + ], + "target": [ + -40, + 151, + -25, + 101 + ], + "dirty": 1 + }, + "prepared": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 1 + }, + "after_facing": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 155, + 0, + 1 + ], + "target": [ + 0, + 155, + 0, + 1 + ], + "dirty": 0 + } + }, + { + "kind": "MCA", + "case": 2, + "before": { + "current": [ + 323.858002, + 293.333008, + 349.213989, + 7 + ], + "target": [ + 10, + 291, + -5, + 102 + ], + "dirty": 0 + }, + "prepared": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 0 + }, + "after_facing": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 0 + } + }, + { + "kind": "MCA", + "case": 3, + "before": { + "current": [ + 323.858002, + 293.333008, + 349.213989, + 7 + ], + "target": [ + 10, + 291, + -5, + 102 + ], + "dirty": 1 + }, + "prepared": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 1 + }, + "after_facing": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 293.333008, + 0, + 7 + ], + "target": [ + 0, + 293.333008, + 0, + 7 + ], + "dirty": 0 + } + }, + { + "kind": "MCA", + "case": 4, + "before": { + "current": [ + -40, + 0, + -25, + 3 + ], + "target": [ + 23, + 315, + 12, + 103 + ], + "dirty": 0 + }, + "prepared": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 0 + }, + "after_facing": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 0 + } + }, + { + "kind": "MCA", + "case": 5, + "before": { + "current": [ + -40, + 0, + -25, + 3 + ], + "target": [ + 23, + 315, + 12, + 103 + ], + "dirty": 1 + }, + "prepared": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 1 + }, + "after_facing": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 0, + 0, + 3 + ], + "target": [ + 0, + 0, + 0, + 3 + ], + "dirty": 0 + } + }, + { + "kind": "MCA", + "case": 6, + "before": { + "current": [ + 10, + 359, + 342.109985, + 9 + ], + "target": [ + 20, + 1, + 40, + 104 + ], + "dirty": 0 + }, + "prepared": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 0 + }, + "after_facing": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 0 + } + }, + { + "kind": "MCA", + "case": 7, + "before": { + "current": [ + 10, + 359, + 342.109985, + 9 + ], + "target": [ + 20, + 1, + 40, + 104 + ], + "dirty": 1 + }, + "prepared": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 1 + }, + "after_facing": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 359, + 0, + 9 + ], + "target": [ + 0, + 359, + 0, + 9 + ], + "dirty": 0 + } + }, + { + "kind": "MCA", + "case": 8, + "before": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 10, + 0, + 10, + 105 + ], + "dirty": 0 + }, + "prepared": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 0 + }, + "after_facing": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 0 + } + }, + { + "kind": "MCA", + "case": 9, + "before": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 10, + 0, + 10, + 105 + ], + "dirty": 1 + }, + "prepared": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 1 + }, + "after_facing": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 0 + }, + "after_30": { + "current": [ + 0, + 360, + 0, + 11 + ], + "target": [ + 0, + 360, + 0, + 11 + ], + "dirty": 0 + } + } + ], + "rea_evidence_id": "ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904", + "ranges": [ + { + "name": "CAM orientation suffix", + "va": "0x416671", + "file_offset": "0x16671", + "length": 122, + "sha256": "ded5dc3a2eeb96b8a970ade5193f98c6fcfd565e031efb9ce807348c821f854b" + }, + { + "name": "MCA orientation suffix", + "va": "0x431518", + "file_offset": "0x31518", + "length": 120, + "sha256": "abfb135a13645f0388da3c44f592053a2738eb6c4399e8e66cade6d86c1892ab" + }, + { + "name": "current Euler getter", + "va": "0x4723f0", + "file_offset": "0x723f0", + "length": 42, + "sha256": "f576bd9ce9d110bc9f6228ad84351add5aa2ce0a5fd2bcbb6ac1873a69d588e8" + }, + { + "name": "current Euler full setter", + "va": "0x472450", + "file_offset": "0x72450", + "length": 36, + "sha256": "28a62af15c1ebffac1313d212fc3279d73b6cab8a37aca55bf0b4c48ccc76e32" + }, + { + "name": "Jimmy facing", + "va": "0x43a420", + "file_offset": "0x3a420", + "length": 429, + "sha256": "1080773fae9170a107488528780efcd349cb930ca8a33fc8a845358b95f9ad38" + }, + { + "name": "Euler-add thunk", + "va": "0x458f90", + "file_offset": "0x58f90", + "length": 32, + "sha256": "f63412bcbafc82323cff26c093e41a457e40a5b60afd2ed5fed02340a4405b1a" + }, + { + "name": "Euler-add leaf", + "va": "0x472480", + "file_offset": "0x72480", + "length": 475, + "sha256": "77e017813241344ff0f6fdde80102d08774dd044ae65f29f48f999ccd1e03d3d" + } + ], + "provenance_sha256": { + "tools/binary/jimmy_cutscene_rotation.py": "2b09b15894a0a4f3d26332085f1cd6b1e1177fcc5d65112391ec47ec4ca0475f", + "tools/binary/jimmy_cutscene_rotation_probe.c": "e4661ca44fb7aa64cc66b8fd25e1fea6d1a2cc625fe1dd777e2b71749e4ca676", + "tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810", + "artifacts/jimmy-cutscene-rotation/build/probe.exe": "2bf17a4c037f29e9196d1ea91834c19c38e8c4fc36e6d7e56c0f88acf80accc3", + "artifacts/jimmy-cutscene-rotation/probe/wine.log": "6f2e42fa51a7a66329dde34f208b965fd3ff630d646401be24d0a20dfbd0cc39", + "artifacts/jimmy-cutscene-rotation/probe/capture.json": "16593e360afa6059145062ee53b4c4412111e65e4b9501d599554a2b709f2cdd" + } +} diff --git a/tests/GamePort.JimmyGroundTests/GamePort.JimmyGroundTests.csproj b/tests/GamePort.JimmyGroundTests/GamePort.JimmyGroundTests.csproj index fe6a5d2..bdafe1f 100644 --- a/tests/GamePort.JimmyGroundTests/GamePort.JimmyGroundTests.csproj +++ b/tests/GamePort.JimmyGroundTests/GamePort.JimmyGroundTests.csproj @@ -3,5 +3,6 @@ + diff --git a/tests/GamePort.JimmyGroundTests/Program.cs b/tests/GamePort.JimmyGroundTests/Program.cs index 45fea02..cf3fd2f 100644 --- a/tests/GamePort.JimmyGroundTests/Program.cs +++ b/tests/GamePort.JimmyGroundTests/Program.cs @@ -25,5 +25,45 @@ var idle=JimmyGroundMotion.Input(new(100,130),90,default);Check(idle.State.Targe var fire=JimmyGroundMotion.Input(new(100,90),90,new(false,true,false,false,false,Fire:true),blockBackward:true); Check(fire.State.Speed==65&&!fire.HeadingUpdated,"source parent fire acceptance gate suppresses backward"); Console.WriteLine("PASS heading publication and caller-owned backward/fire gate"); +using var landing = JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-landing-rotation-reference.json"))); +int trajectories = 0; +foreach (var c in landing.RootElement.GetProperty("cases").EnumerateArray()) +{ + var initial = c.GetProperty("before"); + var current = Euler(initial,"current"); + var target = Euler(initial,"target"); + var dirty = initial.GetProperty("dirty").GetInt32()!=0; + var input = new PlayerInput(c.GetProperty("up").GetInt32()!=0,false,c.GetProperty("left").GetInt32()!=0,false,false); + var state = new JimmyGroundState(0,target.Y); + for (var tick=0;tick<300;tick++) + { + var ground = JimmyGroundMotion.Input(state,current.Y,input); + state = ground.State; + if (ground.HeadingUpdated) { target=new(0,state.TargetYaw,0);dirty=true; } + if (tick==0) Compare("after_input"); + var prior = current; + current = JimmyOrientation.Step(current,target,1f/60,dirty:dirty); + if (dirty) dirty=prior!=target; + if (tick==0) Compare("after_facing"); + } + Compare("after_300"); + trajectories++; + + void Compare(string stage) + { + var expected=c.GetProperty(stage); + var e=Euler(expected,"current");var t=Euler(expected,"target"); + Near(current.X,e.X,stage+" pitch");Near(current.Y,e.Y,stage+" yaw");Near(current.Z,e.Z,stage+" roll"); + Near(target.X,t.X,stage+" target pitch");Near(target.Y,t.Y,stage+" target yaw");Near(target.Z,t.Z,stage+" target roll"); + Check(dirty==(expected.GetProperty("dirty").GetInt32()!=0),stage+" dirty"); + } +} +Check(trajectories==7,"complete seven original grounded-input/facing trajectories"); +Console.WriteLine("PASS7 original grounded-input/facing trajectories: neutral destination retention, dirty ownership and active steering leveling"); +static Vector3 Euler(JsonElement state,string key) +{ + var values=state.GetProperty(key).EnumerateArray().Select(v=>v.GetSingle()).ToArray(); + return new(values[0],values[1],values[2]); +} static void Check(bool condition,string name){if(!condition)throw new Exception(name);} static void Near(float value,float expected,string name)=>Check(float.IsFinite(value)&&Math.Abs(value-expected)<.02f,$"{name}: {value} != {expected}"); diff --git a/tests/test_jimmy_cutscene_rotation.py b/tests/test_jimmy_cutscene_rotation.py new file mode 100644 index 0000000..7afb5a4 --- /dev/null +++ b/tests/test_jimmy_cutscene_rotation.py @@ -0,0 +1,43 @@ +from pathlib import Path +import hashlib +import json +import sys +import unittest + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'tools/binary')) +from jimmy_cutscene_rotation import collect, REA_ID + + +class JimmyCutsceneRotationTests(unittest.TestCase): + def test_original_ranges_and_native_fixture_identity(self): + source = collect(ROOT.parent / 'Original') + reference = json.loads((ROOT / 'tests/GamePort.DirectorTests/original-camera-rotation-reference.json').read_text()) + self.assertEqual(source['source_sha256'], reference['source_sha256']) + self.assertEqual(source['ranges'], reference['ranges']) + self.assertEqual(reference['rea_evidence_id'], REA_ID) + self.assertEqual(len(reference['cases']), 20) + for rel, expected in reference['provenance_sha256'].items(): + if not rel.startswith('artifacts/'): + self.assertEqual(hashlib.sha256((ROOT / rel).read_bytes()).hexdigest(), expected, rel) + + def test_native_observations_cover_both_cameras_and_dirty_states(self): + reference = json.loads((ROOT / 'tests/GamePort.DirectorTests/original-camera-rotation-reference.json').read_text()) + for kind in ('CAM', 'MCA'): + for dirty in (0, 1): + cases = [c for c in reference['cases'] if c['kind'] == kind and c['before']['dirty'] == dirty] + self.assertEqual(len(cases), 5) + for case in cases: + before = case['before'] + prepared = case['prepared'] + self.assertNotEqual(before['current'], before['target']) + self.assertNotEqual(before['current'][3], before['target'][3]) + self.assertEqual(prepared['dirty'], dirty) + self.assertEqual(prepared['current'], prepared['target']) + self.assertEqual(prepared['current'][1::2], before['current'][1::2]) + self.assertEqual(case['after_facing']['dirty'], 0) + self.assertEqual(case['after_30'], case['after_facing']) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_jimmy_landing_rotation.py b/tests/test_jimmy_landing_rotation.py new file mode 100644 index 0000000..579a566 --- /dev/null +++ b/tests/test_jimmy_landing_rotation.py @@ -0,0 +1,31 @@ +from pathlib import Path +import hashlib +import json +import sys +import unittest + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'tools/binary')) +from jimmy_landing_rotation import collect + + +class JimmyLandingRotationTests(unittest.TestCase): + def test_source_and_saved_native_trajectory_provenance(self): + reference = json.loads((ROOT / 'tools/binary/jimmy_landing_rotation_reference.json').read_text()) + for key, value in collect(ROOT.parent / 'Original').items(): + self.assertEqual(reference['source'][key], value, key) + self.assertEqual(hashlib.sha256((ROOT / 'tools/binary/grappler_scalar_probe.c').read_bytes()).hexdigest(), + reference['shared_harness_sha256']) + self.assertEqual(reference['capture']['captures'][0]['wineExit'], 0) + self.assertEqual(len(reference['cases']), 7) + cases = {c['name']: c for c in reference['cases']} + residual = cases['neutral_last_air_roll'] + self.assertEqual(residual['after_input']['target'], residual['before']['target']) + self.assertEqual(residual['after_300']['current'][2], 355) + for name in ('forward_levels', 'left_levels'): + self.assertEqual(cases[name]['after_input']['target'][0::2], [0, 0]) + self.assertEqual(cases['clean_tilt_retained']['before'], cases['clean_tilt_retained']['after_300']) + + +if __name__ == '__main__': + unittest.main() diff --git a/tools/binary/jimmy_cutscene_rotation.py b/tools/binary/jimmy_cutscene_rotation.py new file mode 100644 index 0000000..039db1f --- /dev/null +++ b/tools/binary/jimmy_cutscene_rotation.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Guard original camera orientation suffixes and prepare a separate native probe.""" +import argparse +import hashlib +import json +from pathlib import Path +import re + +from checkpoint_script_state import EXE_SHA256, find_case, read_va +from pe_inspect import PE + +REA_ID = 'ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904' +RANGES = ( + ('CAM orientation suffix', 0x416671, 0x4166eb, 'ded5dc3a2eeb96b8a970ade5193f98c6fcfd565e031efb9ce807348c821f854b'), + ('MCA orientation suffix', 0x431518, 0x431590, 'abfb135a13645f0388da3c44f592053a2738eb6c4399e8e66cade6d86c1892ab'), + ('current Euler getter', 0x4723f0, 0x47241a, 'f576bd9ce9d110bc9f6228ad84351add5aa2ce0a5fd2bcbb6ac1873a69d588e8'), + ('current Euler full setter', 0x472450, 0x472474, '28a62af15c1ebffac1313d212fc3279d73b6cab8a37aca55bf0b4c48ccc76e32'), + ('Jimmy facing', 0x43a420, 0x43a5cd, '1080773fae9170a107488528780efcd349cb930ca8a33fc8a845358b95f9ad38'), + ('Euler-add thunk', 0x458f90, 0x458fb0, 'f63412bcbafc82323cff26c093e41a457e40a5b60afd2ed5fed02340a4405b1a'), + ('Euler-add leaf', 0x472480, 0x47265b, '77e017813241344ff0f6fdde80102d08774dd044ae65f29f48f999ccd1e03d3d'), +) + + +def collect(original, rea_disassembly=None): + pe = PE(find_case(Path(original), 'Neutron.exe')) + if hashlib.sha256(pe.data).hexdigest() != EXE_SHA256: + raise ValueError('Unsupported original EXE identity') + rows = [] + for name, start, end, expected in RANGES: + actual = hashlib.sha256(read_va(pe, start, end-start)).hexdigest() + if actual != expected: + raise ValueError(f'Changed original {name}') + rows.append(dict(name=name, va=hex(start), file_offset=hex(pe.offset(start-pe.base)), + length=end-start, sha256=actual)) + result = dict(source_sha256=EXE_SHA256, rea_evidence_id=REA_ID, ranges=rows, + current_euler='game+224..230', destination_euler='game+274..280', + dirty='game+A; unchanged by both orientation suffixes', + scope='Static byte guard; generated probe executes bounded copied suffixes, not camera activation or the whole game.') + if rea_disassembly: + bundle = json.loads(Path(rea_disassembly).read_text()) + record = next(r for r in bundle['records'] if r['evidence_id'] == REA_ID) + assembly = record['raw_result']['stdout'] + extracts = {} + for name, start, end, _ in RANGES: + lines=[] + for line in assembly.splitlines(): + m = re.match(r'\s*([0-9a-f]+):', line) + if m and start <= int(m[1],16) < end: + lines.append(line) + if not lines: + raise ValueError(f'Retained REA misses {name}') + extracts[name]='\n'.join(lines)+'\n' + result['rea_extracts'] = extracts + return result + + +def generate(original, output, rea_disassembly=None): + original = Path(original).resolve() + output = Path(output).resolve() + if output.is_relative_to(original) or original.is_relative_to(output): + raise ValueError('Probe directory must be separate from originals') + result = collect(original, rea_disassembly) + output.mkdir(parents=True, exist_ok=True) + for name in ('jimmy_cutscene_rotation_probe.c', 'grappler_scalar_probe.c'): + (output/name).write_text(Path(__file__).with_name(name).read_text()) + (output/'source.json').write_text(json.dumps(result,indent=2)+'\n') + return result + + +if __name__ == '__main__': + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('original',type=Path) + parser.add_argument('--rea-disassembly',type=Path) + parser.add_argument('--generate-probe',type=Path) + args=parser.parse_args() + result=generate(args.original,args.generate_probe,args.rea_disassembly) if args.generate_probe else collect(args.original,args.rea_disassembly) + print(json.dumps(result,indent=2)) diff --git a/tools/binary/jimmy_cutscene_rotation_probe.c b/tools/binary/jimmy_cutscene_rotation_probe.c new file mode 100644 index 0000000..47d6b74 --- /dev/null +++ b/tools/binary/jimmy_cutscene_rotation_probe.c @@ -0,0 +1,56 @@ +/* Original copied CAM/MCA orientation suffixes and real Euler/facing leaves. + Synthetic controlled owner, forced-ready global facing gate, no activation, + game entrypoint, body, renderer, gadget cleanup or input execution. */ +#define main unused_grappler_main +#include "grappler_scalar_probe.c" +#undef main +typedef struct { float x,y,z,w; } Vec4; +static uintptr_t table[0x440/4]; +#define VEC(o) (*(Vec4*)(object+(o))) +static void fix(uint32_t start,uint32_t end){ + const uint32_t targets[]={0x5099e4,0x48d914,0x48e5b0,0x48e5c0,0x48e5c4,0x4afcf0,0x4afd38}; + for(uint32_t a=start;a+4<=end;a++){ + uint32_t v;memcpy(&v,AT(a),4); + for(unsigned i=0;i