diff --git a/AGENTS.md b/AGENTS.md index 5e22d7b..68e75ab 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -35,10 +35,19 @@ other agents' active changes. Keep updates concise, save detailed evidence to di Use bounded endian-aware parsers, portable paths, clear C#, deterministic tests, and explicit unmanaged ownership. Build frequently. Update `docs/progress.md`, `docs/tasks.md`, `docs/decisions.md`, and compatibility evidence before transitions. -Current mode is user-requested gameplay/gadget implementation. On2026-10-27 the -user parked collision recovery and requested gadgets. This overrides the earlier -feature-expansion pause; retain evidence before gameplay assumptions. Preserve -the35a2a66 body milestone/0272f7b release notes and remaining C4/C5 gates for return. +Current priority (2026-11-05): user pauses gadget expansion and returns to Jimmy +movement stabilization. Preserve current movement as baseline; do not substitute +JN-Engine native/Godot movement. Use its original decompiler index only as leads, +verified with REA/authoritative originals. See docs/gameplay/jimmy-movement-stabilization.md. +The prior collision work is resumed where needed for movement; preserve the +35a2a66/0272f7b checkpoints and their source gates before broader body admission. +Controller checkpoint integrates108 native ground/air/facing/jump comparisons; +13 Jimmy source guards,26 movement/20 body groups and all five native SDL jump +aliases pass. Source pressure requires a real support polygon; lab/outside keep +capsule compatibility. Next: ordinary air destination Euler plus the actor-root +render bridge, then special/root-changing/dynamic contracts.27 contact-dispatch +and12 air-target observations are evidence, not live implementation claims. +No Remote/new-gadget implementation until this movement priority is handled. The initial architecture checkpoint is documented in docs/checkpoint/review.md; use the playable 69d0187 baseline as a comparison tool. Read docs/checkpoint/README.md, coverage.md and implementation-plan.md before gameplay diff --git a/README.md b/README.md index 0067780..7e6135c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,11 @@ using C#/.NET 10, Silk.NET.Vulkan (Vulkan 1.3), and SDL3. Original files remain untouched in `../Original`. Work is local; no remote operations or runtime online services are used. -**Current direction: gameplay gadgets; collision recovery is parked.** The +**Current direction: stabilize Jimmy movement before more gadgets.** Keep our +playable movement baseline; JN-Engine's original decompiler index supplies leads, +verified with REA and authoritative component probes. The +[movement checkpoint](docs/gameplay/jimmy-movement-stabilization.md) records +controller/facing/jump corrections and remaining render/body gates. The [checkpoint review](docs/checkpoint/review.md), [coverage map](docs/checkpoint/coverage.md) and [implementation plan](docs/checkpoint/implementation-plan.md) compare source owners, update order and lifecycles with the port. Clean69d0187 and its packages diff --git a/docs/architecture.md b/docs/architecture.md index 2661455..4f1936c 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -113,6 +113,15 @@ speed/yaw/impulse/airborne/camera formulas. `FixedStepClock` supplies a delibera unverified. SDL events feed held keyboard/mouse state; focus/minimize clear input and pause simulation, while C pauses for inspection and R resets the start area. +The Jimmy movement checkpoint uses `JimmyGroundMotion`/`JimmyAirMotion` for +source input and velocity publication, `JimmyOrientation` in the base phase +before control gating, and `JetpackBurst` for the controller/effect state tables. +Keyboard-turn latch and destination Euler are retained independently of current +Euler. Ground pressure requires a real source-body support polygon; the capsule +does not manufacture one. Ordinary air destination pitch and the complete +actor-root render bridge remain a paired implementation gate. See +[movement stabilization](gameplay/jimmy-movement-stabilization.md). + `SceneCollision` sweeps/slides a vertical capsule against retained original scene triangles, including invisible proxies, and clips the chase camera with a sphere sweep. Solver/masks/radius/pivot are explicit approximations. The physical position diff --git a/docs/checkpoint/coverage.md b/docs/checkpoint/coverage.md index bc98b58..2508ab2 100644 --- a/docs/checkpoint/coverage.md +++ b/docs/checkpoint/coverage.md @@ -10,6 +10,14 @@ Address details/PE offsets and source-byte extractors are in the linked reports. **M**=managed port regression, **R**=port runtime. No row has full original-game runtime comparison. Coverage does not mean implementation completeness. +2026-11-05 movement continuation: [Jimmy stabilization](../gameplay/jimmy-movement-stabilization.md) +supersedes MOVE/JET arithmetic details below. Ground, air and control-independent +full-axis facing now have108 native component comparisons including the jump +suffix. COLL keeps its admission gate: real support polygon pressure is live in +the source body, while lab/outside retain capsule compatibility.27 special +contact dispatch and12 air-target observations expose remaining gates; they do +not certify special callbacks or the ordinary air-pitch visual bridge. + | ID / system | Recovered contract / anchors | Port implementation | Evidence / remaining gap | Next bounded action | |---|---|---|---|---| | LOOP | Viewport47E4F0 physics before registry473740, including input44DF80; second sync473770; construction order and selective retained-character/new-game ordering. Separate engine morph clock. | Player now integrates prior body state, then fresh input/player/fire or retained player/fire/input. Uncontrolled body/fire now continue while movement/input are gated. Other systems remain grouped; fixed60Hz policy. | S/M/R. Controlled player partial order implemented; bounded raw-owner preparation implemented; full wrapper/registry/cadence open. | C3 continue other callbacks and morph/control phases; C4 support/response remains separate. | diff --git a/docs/checkpoint/jimmy-special-contact.md b/docs/checkpoint/jimmy-special-contact.md new file mode 100644 index 0000000..68b9aee --- /dev/null +++ b/docs/checkpoint/jimmy-special-contact.md @@ -0,0 +1,130 @@ +# Jimmy special contacts: movement-stability audit + +2026-11-04. Static recovery plus27 isolated original-dispatch observations; no +runtime solver change. Current playable fccc0b9 remains the baseline. The user +returned priority to Jimmy movement and explicitly allowed JN-Engine as a guide. +JN-Engine's prototype movement is not imported or treated as an oracle. + +## Result and immediate implementation boundary + +The lab/outside capsule bypasses material callbacks entirely: SceneCollision's +private triangles retain geometric positions/normals but no linked material ID, +and LabSimulation.StepPhysics receives only grounded/wall/ceiling flags. This is +a concrete missing interaction layer, not evidence that changing walk constants +or adding universal wall reflection will fix collision fidelity. + +**Do not globally admit lab/outside to OriginalBodyPhysics yet.** Besides dynamic +pairs, three directly evidenced contracts are missing: material-driven hazard/ +climb actions, world-response1D0 state during special animation, and contact-owned +root publication. The existing ordinary sphere composition assumes no +root-changing callbacks. Its wallContact hook alone does not establish the +source's fresh previous/live Vec4 equality or special-animation lifecycle. +For example, it currently adds the old falling displacement.Y after the hook +returns a root, whereas the original can skip that entire candidate publication +when the contact changed live/previous root. A root-changing callback cannot be +made faithful simply by returning a different OrdinaryBodyState.Position. + +The smallest safe movement implementation chunk is ordinary ground/air arithmetic +and phase stability while preserving the current route solver. For collision: +first preserve/report actual contacted shape/polygon/3DMa identity in a diagnostic +path; next implement the state-owning callbacks and source body modes with +regressions; only then enable a bounded real lab/outside source-body route. Do not +silently classify a special contact as ordinary to make scene admission succeed. + +## Original identity and source map + +Neutron.exe SHA256: +f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8. +Every code VA below maps to raw offset VA−400000, independently checked by PE. +`tools/binary/jimmy_special_contact.py` records five bounded spans with hashes, +raw offsets and four live virtual bindings. Existing material loader/source +coverage is in collision-contact-callbacks.md and its guarded helper. + +| Code VA / raw offset | Observed contract | +|---|---| +|43AA40 /3AA40|Player contact handler takes **game interface** (Jimmy complete+C0), supplied Vec4 normal and polygon. First requires elapsed game774>3; missing polygon/material/chunk yields no special policy. Reads signed archive3DMa ID through polygon+4→material+C→chunk+8.| +|43AA7E..43AAD5 /3AA7E..3AAD5|IDs120..129 call **complete virtual160**, IDs110..119 call **complete164**. These dispatches precede the movement-mode check and therefore still occur in nonzero modes.160/164 are slot offsets, not material IDs.| +|43AAD5..43AAF9 /3AAD5..3AAF9|Fence IDs60..69 and ladder180 require mode game704==0. Other metadata returns without generic reflection/projection. The handler contains no raw controlled-pointer gate.| +|43AB17..43ABBF /3AB17..3ABBF|Ladder first requires game338→472570 retained support polygon pointer (live234), then a47C210 probe. This is not the same predicate as current grounded218. A missing retained polygon prevents even the ray attempt.| +|43ACD4..43AE19 /3ACD4..3AE19|Fence requires first probe to miss and subsequent side probes to hit. Miss-only synthetic probes make exactly two calls then reject. Different ray outcome sequences are not equivalent to a single wall hit.| +|43AC29..43ACC5 /3AC29..3ACC5;43AF54..43AFDB /3AF54..3AFDB|Successful branches derive yaw from negative supplied normal through original angles, set destination/live orientation, transform local offsets, publish root314 and request LADDER/FENCE through complete150. Full successful-ray traces remain unexecuted.| +|42A7E0 /2A7E0|Jimmy complete160 requires splat cooldown1E60<=0 and !1DED latch. Requests SPLAT via150, sets latch, clears impact clock1DE8 and controller scalar complete6C8/game608, stores supplied normal at1DF0..1DFC, requests−5 energy/score through42A920/42ADC0, and SFX37. Those helpers retain their own tutorial/global policies.| +|42A8D0 /2A8D0|Jimmy complete164 requires !1DEC latch and raw gadget4F0588!=0 (Bubble0 immunity). Sets latch, clears1DE8, requests−5 energy/score, calls complete1E0→425120 (mode1 jump/effect cancellation). It does not share160's cooldown gate.| +|437953..43796A /37953..3796A|Increment game774 elapsed **before** base40E050 and later raw ownership gate. Physics contact reads the preceding phase's elapsed. Omitting this timer would permanently suppress source policies; gating it only on Jimmy input is also wrong.| +|43B408..43B4B4 /3B408..3B4B4;43B4BE..43B58A /3B4BE..3B58A|FENCE/LADDER animation entry owns saved destination Vec4 complete838..844/game778..784. Respective local offsets(0,320,150)/(0,800,150), velocity0, gameA8(false), action helper148, global busy4F83E0=true, duration complete888=4/6, fallback timer868=5, elapsed834=0, nonloop animation and SFX146/143.| +|43A900 /3A900|AnimEnded handler returns FENCE/LADDER to STOP, clears busy/duration, calls Jimmy game410→42AFC0, clears action flag complete6E4/game624 and controller speed complete6C8/game608, restores saved full Vec4 root314, then gameA8(true). SPLAT/HIT branches differ.| +|437988..437A15 /37988..37A15|Fallback timer game7A8 is decremented before input ownership gate. Expiry while busy can restore the saved root/response state too. Source duration4/6 and fallback5 are distinct; do not invent one universal fixed climb timer.| +|47A123..47A1C4 /7A123..7A1C4|Body publication rereads previous2F8/live310 and compares all four components. A contact-owned root change skips candidate clamp/publication. Vector3-only stale equality is not this boundary.| + +Bindings independently checked: Jimmy complete4A3BDC+160→42A7E0,+164→42A8D0; +Jimmy game4A373C+374→42A660→Player43AA40; Player game4AF6C4+374→43AA40. +Game338→472570 returns retained polygon234, not a boolean grounded query. +GameA8→470FD0 changes **world-response** getter1D0/live13C. It does not disable +integration210, support1C8, raw control118 or global geometry4F69E5. Consequently +`geometryEnabled=false` in the current managed body is not an implementation of +this transition: that parameter follows global geometry-off gravity cancellation. + +The pose setter's exact callback acceptance, source morph/event cadence, impact +latch/impulse updater4255C0, successful ladder/fence ray offsets/filters and reset +interactions need component/runtime closure before actual mechanics are enabled. +The stored impact normal is consumed later; immediate arbitrary velocity reflection +would replace that state machine with a different behavior. + +## REA and JN-Engine evidence + +JN-Engine docs/decomp/C3DPlayer.md, C3DJimmy.md and original decompiler bodies +in docs/decomp/evidence/c3dplayer_movement_target3.md/c3djimmy_target6.md supplied +function/field leads. Shared EXE identity is verified; its prototype movement and +its different declared OMT2.dll build are not numeric/runtime authorities here. +Class reports mix game and complete bases in places; the offsets above follow +authoritative instructions and the independently established+C0 interface. + +Configured REA/Ghidra12.1.4 batch at artifacts/jimmy-special-contact/rea used the +existing generated target copy and exported Evidence/closed snapshot: + +- 42A7E0: ev_801bbf1e21eb341f126f5e57e3efbfca42bb1c799680b2429c7f05dfdda3d625. +- 42A8D0: ev_889e1c63d50f8e6da7e451ba0b821396f884fb7d7961dcdede3c4f3ca0e54af3. +- 43A900: ev_0c030c12f6beb0790a6be2c53d3c4ac6591c8c2bd6552e8ea888f8de13455c7f. + +43AFF0 returned an explicit procedure-recognition error; retained reply03.json +is not successful decompilation and the unchanged selector was not repeated. +Its supporting instruction extract is saved as special-animation.asm; the JN +body is only a lead. Reused43AA40 Evidence: +ev_4f2a6aa666451db831efd46f5c587573e22d8072315626b8bc2f844f9c6f0cae +under artifacts/collision-integration/contacts/rea-callbacks. REA x87/return-address +aliases are imperfect; reviewed call signatures/bytes settle the normal payload. + +## Isolated original execution and tests + +The new generated probe executes copied43AA40 with synthetic game/complete +vtables, linked polygon/material/chunk records, no-op160/164 callbacks and a +miss-only ray stub. It **does not** execute real damage, successful climb, +animation, body integration, collision traversal or the original game entrypoint. +An initialized local Wine32 prefix runs the copied code in the project's separate +network/filesystem sandbox; Wine exit0 and JIMMY_SPECIAL_CONTACT_COMPLETE are +retained in artifacts/jimmy-special-contact/probe/{wine.log,capture.json}. + +27 observations cover signed metadata and all dispatch boundaries, strict elapsed +3/above3, nonzero movement modes, null polygon/material/chunk, missing retained +support polygon, and both hazard dispatch/fence ray attempts with raw controlNULL. +Normal Vec4 reaches160 unchanged. Miss-only fence performs two probes; ladder one +when support pointer exists. These are branch/gate observations, not terrain +success or original end-to-end movement traces. + +`tests/test_jimmy_special_contact.py` commits the observations, original source +span/binding identity and generator/harness/executable/log hashes. Four Python +groups pass: source/offset/bindings, all27 native dispatch cases, provenance, and +output/original/symlink isolation. Originals remain untouched. No runtime source +or existing tests/docs were modified by this investigator; no commit was made. + +## Proposed continuation gates + +1. Keep source-backed controller/air/jump fixes and current playable route solver + independent; preserve fccc0b9 and subsequent tested movement checkpoints. +2. Expose contact metadata/root-ownership diagnostics; recover4255C0 impact latch + and impulse completion, then implement material120..129's bounded hazard flow. +3. Recover/verify successful climb rays, full animation-end/fallback ownership and + independent world-response mode before adopting fence/ladder callbacks. +4. Complete dynamic pair eligibility/shared context and Vec4 publication, then + run input-only lab/tutorial/RETURN/outside cases with known special contacts. + General floor/step/wall fidelity is not established by these27 leaf probes. diff --git a/docs/compatibility.md b/docs/compatibility.md index 498af32..b7879cf 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -1,5 +1,17 @@ # Compatibility and validation +Jimmy movement (2026-11-05):108 copied-original ground/air/facing/jump observations +match managed components.26 integrated movement/20 body groups pass; lab and +two-way underground routes retain the user's baseline. Native Linux walking and +VR04 powered input replays pass all five jump aliases and resize, with identical +readbacks across aliases and zero Vulkan validation errors. Carl control lock, +control-independent body/fire and Grappler native replays pass. Source pressure +is restricted to real source support; the lab/outside capsule keeps compatibility +behavior. Ordinary air pitch/full root rendering and special/dynamic contacts +remain open, as do complete original and native Windows comparison. Details and +provenance: [Jimmy stabilization](gameplay/jimmy-movement-stabilization.md). + + Scooter feedback follow-up (2026-11-04): missing Goddard follow pitch/roll leveling and source positional engine-frequency correction are implemented.13 Scooter/2 ScooterAudio/10 Patrol groups,24 targeted Python checks, route/audio regressions diff --git a/docs/decisions.md b/docs/decisions.md index e02dc06..34551cc 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -308,3 +308,14 @@ then apply recovered47D9D0 positional frequency/history and DX bounds. Use shared listener state for mounted/parked/script cameras; global audio cadence and attenuation remain separate. See the focused gameplay reports. + +48. **Stabilize Jimmy from authoritative components while preserving the playable baseline.** + Use JN's original decompiler index as leads only. Integrate source ground/air + input, velocity, full-axis base facing and precise jump hold/gravity after + copied-original comparison. Preserve retained targets and keyboard-turn latch; + facing runs without raw input ownership. Require real support polygon338 for + downward ground pressure; do not translate capsule Grounded into that state. + The failed stair route and successful compatibility rerun are retained evidence. + Keep ordinary air pitch/actor-root visual bridge together as the next chunk, + and special/root-changing/dynamic body behavior behind independent gates. + See gameplay/jimmy-movement-stabilization.md. diff --git a/docs/gameplay/jimmy-air-motion.md b/docs/gameplay/jimmy-air-motion.md new file mode 100644 index 0000000..37f81cc --- /dev/null +++ b/docs/gameplay/jimmy-air-motion.md @@ -0,0 +1,131 @@ +# Jimmy ordinary airborne movement audit + +2026-11-04. User prioritizes stable Jimmy movement and explicitly preserves the +current GamePort feel over JN-Engine's replacement movement. JN-Engine's saved +original decompiler output was used only to locate/interpret original routines; +its C/Godot movement was not used as a behavioral reference. Authoritative source +is the immutable project EXE SHA256 +`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`. + +## Recovered contracts and concrete mismatches + +Addresses below are original EXE VAs; independently mapped file offsets equal +VA−400000. `tools/binary/jimmy_air_motion.py` guards source identity, five complete +bounded ranges and decoded absolute relocation operands. Source instruction +extracts are retained in artifacts/jimmy-air-audit/{input,apply}.asm. + +| Original VA / offset | Original behavior | Prior port mismatch / bounded correction | +|---|---|---| +|439900..439A69 /39900..39A69|Mode1 keyboard Left precedes Right, changes stored turn by100dt; no-key return toward0 occurs only when complete6E6 keyboard-turn latch is set. Key turning sets latch; mouse turning clears it.|AirSteering always applied return, without storing the latch. JimmyAirMotion.Input owns explicit latch state; caller must retain it and share it with other input modes.| +|439AE6..439B69 /39AE6..39B69|Up adds30 only when scalardouble1.5, set latch828, speed=cap, stored target710=currentYaw+180, keyboard yaw delta0. Already latched backward keeps cap. Releasing acceptance clears830 and latch. The830 clock's increment owner remains unresolved.| +|439416..439490 /39416..39490|Without Up or accepted backward, release positive/negative scalar toward0 by35. Left-only still receives this decay after its acceleration. Keyboard side bias can move while scalar remains0.| +|43951E..4395CF /3951E..395CF|Accepted active input publishes destination yaw even with zero turn: ordinary currentYaw+delta; latched with delta uses currentYaw−delta*.5, otherwise stored710. No active input retains the previous destination.| +|437C40..437DF6 /37C40..37DF6|Read current live velocity; special global4F83E0 returns unchanged. Only nonzero incoming velocity OR nonzero keyboard lateral admits yaw addition and side computation. That gate does not suppress the later base forward rewrite. Side=(turn*(1−friction)*speed*float(1/45)+bias)*dt. Read full Euler via328, add yaw via334 and use full-Euler38C(0,0,speed). Publish its X/Z plus side, preserving incoming Y.| +|437E10..437F4B /37E10..37F4B|Only supported218 and nonnull support polygon338 reaches the support suffix. It subtracts float250 at4A3E58 from current live Vy. The rest of the normal/angle calculation does not project X/Z onto a slope or publish a new actor Euler here.| +|437C22..437C2D /37C22..37C2D|Controlled wrapper publishes complete6C8 controller scalar into body160 afterward. This is separate from live velocity and body friction state.| + +Complete/game interface displacement isC0. Complete6BC acceleration30,6C0 decay35, +6C4 current cap600,6C8 controller scalar,6D4 turn rate,6D8 applied turn,6E4 accepted +forward/back,6E6 keyboard-turn latch,710 stored backward heading,828 auto-turn latch, +830 clock,850 accepted-backward and870 lateral bias. Live Euler is game224/228/22C; +destination is game274/278/27C. Ground only sets6E6 on turns; neutral/up/back do +not clear it. The source's air handler owns later keyboard-turn return behavior. + +## Confirmed differences from the pre-audit port + +1. RecoveredMotion.AddSpeed's unconditional Min(speed+30,cap) reduces existing + overspeed; the original only adds while below cap. This affects ground/air use + of that helper; changing the shared helper requires checking its other callers. +2. Active forward/backward input without turn must publish current yaw as the new + destination. LabSimulation only changed targetYaw for a nonzero turn delta, + allowing residual destination-yaw drift after releasing turn while keeping Up. +3. Ground direction uses full Euler X/Z, not yaw alone. A pitch30/yaw45/roll20 + native case projects speed300 to X/Z≈−183.725/+183.725, not±212.132. This matters + during tilt restoration after gadgets/script placement; no new slope tilt is + invented by the helper. +4. Live support with a real polygon supplies downward Vy−250 pressure. The port + preserved Y unchanged. Supported/no-polygon and unsupported cases retain Y. +5. Side computation shares the incoming-motion/bias gate. The existing simplified + apply computes side outside it. Most ordinary landings reset turn0, but the + mathematical distinction is explicit and tested. +6. Primary/backward acceptance and the latent auto-turn state are not modeled by + the old simplified input. Do not enable a fabricated1.5-second timer: its live + clock owner must be recovered first. The pure helper permits explicit source + state inputs so the seeded branches can be compared without claiming live use. + +## Implementation, tests and integration + +`JimmyGroundMotion.Input` returns state, keyboard lateral and heading-update flag. +Callers resolve backward acceptance (ordinary raw−1/3 primary blocks it), retain +shared6E6 on neutral ground input and set it on Left/Right. BackSeconds defaults0; +leave auto-turn live admission gated until its clock owner is established. +`Apply` accepts full live Euler, source turn/bias, actual support and actual support +polygon presence. It returns velocity and Euler. Body integration, input/apply +order, ordinary/gadget mode dispatch, collision and published-speed copy stay +with the caller. In particular, do not derive a support polygon merely from a +provisional capsule's Grounded flag or apply this ground suffix during air mode. + +Twenty-five copied-original observations execute successfully in isolated Wine32: +17 keyboard suffix cases (combinations, release/crossing, cap/overspeed, backward +cap and seeded exact/over1.5/latch branches), eight complete437C40 cases (rest, +stationary turn, lateral-only, turn, full tilt, supported polygon, missing polygon, +unsupported). Synthetic actor/root/support/animation methods surround the copied +routines; original OMT vector/trig methods execute from a copied DLL. No original +game entrypoint, camera prefix, general dynamic body or complete Jimmy executes. +The initial missing OMT export qualifier was corrected before the final run; +only the final exit0/JIMMY_GROUND_COMPLETE output establishes observations. + +The committed original-ground-reference.json records both source identities, +bounded spans, generator/shared harness/executable/log hashes and all25 cases. +Two managed groups compare every case and check active-versus-idle heading and +caller-owned primary/backward suppression. Two Python groups validate identity, +provenance, ranges/offsets and complete observed counts. Logs and final capture +metadata are under artifacts/jimmy-ground-audit/. Parent owns live integration, +route/render/platform checks and root status documents; this agent made no shared +runtime edits or commits. Whole-original/native Windows movement parity remains +unverified. Mouse/analog, camera side timers, generic clock registration, full +standing/pose/climb branches and engine cadence remain separate evidence gates. diff --git a/docs/gameplay/jimmy-jump-motion.md b/docs/gameplay/jimmy-jump-motion.md new file mode 100644 index 0000000..b1cbef4 --- /dev/null +++ b/docs/gameplay/jimmy-jump-motion.md @@ -0,0 +1,58 @@ +# Jimmy jump and powered hold conformance + +2026-11-05. Authoritative EXE SHA256 +`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`. +This extends the existing [jetpack recovery](../analysis/jetpack.md); the playable +550 impulse, −800 gravity and existing state0..5 behavior remain the baseline. +JN-Engine's tuned movement is not used. + +## Evidence and corrections + +REA inspect-with-objdump Evidence +`ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904` +retains the complete original disassembly in +artifacts/jimmy-movement-audit/rea-original-disassembly.json. This is static +instruction evidence. The complete437F90..4387D8 range, including both jump +tables, maps to file37F90..387D8. Euler helpers4723F0/472480/472B10 map to +723F0/72480/72B10. The generator guards identity, offsets and each range's hash. + +`tools/binary/jimmy_jump_motion.py` extends the air harness without its early +suffix return. It executes full copied437F90 with synthetic actor/body, support, +energy/inventory, level, animation and effect callbacks, plus original OMT trig +and original Euler leaves. The game entrypoint, collision/body integration, +effect countdown421FB0 and real animation/audio are not executed. Absolute +strings and jump-table entries are separately relocated; operands outside the +mapped image are rejected so disassembled table bytes cannot corrupt relocation. +Initial harness attempts required correcting those relocations and the synthetic +509948 owner pointer. Only the final successful32-case run is used as evidence. + +The isolated Wine32 run exits0 and prints JIMMY_JUMP_MOTION_COMPLETE. Fixture +`tests/GamePort.JimmyJumpTests/original-jump-reference.json` records32 observations, +source ranges, relocations, generator/shared setup/probe executable/output hashes. +Generated source, capture.json and wine.log remain in artifacts/jimmy-jump-audit. +The managed suite compares jump state, hold/effect timers, pending impulse, +vertical/extra acceleration, pose requests, effect calls and radius writes. + +Two directly evidenced precision mismatches are corrected in `JetpackBurst`: + +- Before powered state3, gravity correction retains the wide intermediate: + `(float)((double)gravityY * 1.33f - gravityY)`. With−800 this is−264.000031, + rather than the old staged float−264. +- 438407 stores hold as float but43840D compares the unrounded x87 sum against + float.4. Stored `.3f + .1f` and `23f/60 + 1f/60` both become.400000006, + but only the first starts the burst. The port now compares the wide sum before + returning. Testing the stored float cannot distinguish those observations. + +Coverage includes states0..5, held/released branches, takeoff/landing, null effect, +expiry, exact/adjacent hold thresholds, inventory/energy/gadget/level gates, +VR04 immunity and both sides of the500-height acceleration threshold. The outer +437940 grounded/released bypass remains a caller phase and is not certified by +invoking437F90 alone. Physics consumes pending impulse on the following pass; +source effect421FB0, input registration and raw control retain their own owners. + +## Remaining limits + +This proves bounded original component outputs and managed conformance, not a +whole-original trajectory. Fixed60Hz, the capsule in lab/outside, render root, +complete animation completion, sound and native Windows feel remain separate. +Live route and SDL tests are recorded in [movement stabilization](jimmy-movement-stabilization.md). diff --git a/docs/gameplay/jimmy-movement-stabilization.md b/docs/gameplay/jimmy-movement-stabilization.md new file mode 100644 index 0000000..afc47a4 --- /dev/null +++ b/docs/gameplay/jimmy-movement-stabilization.md @@ -0,0 +1,99 @@ +# Jimmy movement stabilization + +2026-11-04. User pauses gadget expansion and prioritizes solid Jimmy movement. +Current C# movement is the playable baseline; runtime packages fccc0b9 and source +42ea2b8 remain preserved. JN-Engine's native/Godot movement is explicitly not the +behavior oracle. Its saved original decompiler/class index is a navigation aid; +REA, authoritative bytes and copied-original observations verify corrections. + +## Working checkpoints + +1. Compare ordinary ground/air input, velocity and facing with copied-original + cases; preserve current acceleration/jump/gravity values unless contradicted. +2. Verify jump/hold/release/landing, jetpack acceleration/expiry, queued impulse + and physics-before-input ownership, including fresh/retained scene order. +3. Recover lab/outside contact metadata, root publication and animation-owned + response sufficiently to replace the provisional capsule safely. Preserve + scene/actor state ownership; do not enable unsupported special contacts. +4. Verify the combined input/physics/control/animation behavior on lab → VR04 → + lab → outside, including all jump aliases, stairs/slopes/walls/ceilings, + cutscenes, reset, RETURN and stable presentation-rate behavior. + +## Evidence boundary on entry + +Current ordinary body is source-backed in bounded tutorials; lab/outside still +use the modern capsule. Controller input and apply are simplified in LabSimulation, +with source-based Jump550/gravity800 plus jump acceleration correction, fixed60Hz +as a modern policy, and a sole/root render bridge. Previous numeric/route/native +verification remains valuable; it does not certify complete movement fidelity. +Ground/air/math corrections are separate from admitting special/dynamic physics. + +New independent reports: jimmy-ground-motion.md, jimmy-air-motion.md, +jimmy-orientation.md and ../checkpoint/jimmy-special-contact.md. Parent owns +integration/jump/route verification; investigators own their named new files only. +Findings/tests and implementation status are updated here as chunks finish. + +## Controller checkpoint, 2026-11-05 + +Integrated `JimmyGroundMotion`, `JimmyAirMotion` and `JimmyOrientation` into +LabSimulation. Ground Up/accepted Down publishes current heading even without +turn input, clearing the old turn destination; neutral retains it. Acceleration +preserves existing overspeed. Ground backward acceptance honors raw−1/3 primary +fire. Air input retains the shared keyboard-turn latch, performs its independent +supported subtraction/brake and compares coast with the wide product. Full-Euler +apply preserves incoming Vy and correctly gates lateral/yaw on incoming velocity. +Facing uses original shortest arcs/full-axis angle normalization and runs in the +base phase even without raw control. Published speed, pending impulse, effect +clock and fresh/retained ordering remain separate. [Jump conformance](jimmy-jump-motion.md) +adds the exact wide hold comparison and gravity intermediate. + +108 saved native observations compare against managed components:25 ground, +35 air,16 facing and32 jump.27 additional native special-contact dispatch cases +establish callback eligibility only.12 air destination writes establish missing +pitch/roll target behavior, which remains a deliberate implementation gate; see +[jimmy-air-motion.md](jimmy-air-motion.md). These are copied-original component +observations, not observed original whole-game play. + +### Collision compatibility boundary + +The original supported ground apply subtracts250 from live Vy only when actual +support polygon338 is non-null. This is live with the source body and its real +SupportHit. A capsule Grounded flag or floor-height query does not stand in for338. +An attempted mapping from capsule support introduced a repeatable lab stair block +(artifacts/jimmy-movement-audit/lab-route.log, leg1 root4307.62/15.13/351.25). +Removing that mapping restores the entire input-only route +(lab-route-compatible.log), and the two-way underground route also passes. The +capsule retains baseline landing Vy0. This is an explicit compatibility gate, +not an original-body result or a replacement friction/step tuning fix. + +### Next coherent implementation chunks + +1. Implement source destination-Euler pitch/roll with retained7EC/7F0, the full + actor-root visual bridge and mode/registration order together. Verify ordinary + jump, powered turning, Bubble cleanup, landing and RETURN. Baseline ordinary + air currently stays visually upright; the recovered−40/+10 targets are not live. +2. Finish Vec4 previous/live-root publication after callbacks; separate body + integration210 from world-response1D0. Verify successful fence/ladder entry, + animation-end/fallback completion and4255C0 hazard/impulse ownership before + broader Jimmy body admission. The incomplete success-probe experiment is + preserved under ignored artifacts/jimmy-special-contact/success; it is not + conformance evidence or part of the committed dispatcher tool. +3. Recover dynamic pair eligibility/shared context and original support metadata; + replace the lab/outside capsule in an independently verified route chunk. +4. Complete animation/camera/retained helper/cadence comparison on a working + original installation and native Windows. The user's preserved movement + baseline remains authoritative among unverified port alternatives. + +### Cross-system regression interpretation + +Original AddEuler stores small negative pitch near360; Bubble's test/smoke checks +now compare signed angular direction rather than requiring a negative stored +number. Its fire/throttle and source target sign stay unchanged. Source-supported +Grappler attachment also exposes phase composition: fresh input writes Vy100, +then the ordinary ground controller subtracts250, producing−150; retained late +input writes100 after that publication. The existing ground native positive-Vy +case proves this subtraction. Managed attachment checks now distinguish those +orders. Control loss still runs the body, but a supported root need not move; +its regression checks the physics count/support/ownership instead of inventing +an airborne displacement. Grappler completion/other callbacks are not inferred +from these tests. diff --git a/docs/gameplay/jimmy-orientation.md b/docs/gameplay/jimmy-orientation.md new file mode 100644 index 0000000..4d99253 --- /dev/null +++ b/docs/gameplay/jimmy-orientation.md @@ -0,0 +1,72 @@ +# Jimmy facing interpolation and full Euler seams + +2026-11-04. This source-backed helper closes an integration dependency of the +ordinary movement audit. The current playable port remains the baseline. No +JN-Engine native movement/controller constants were adopted. + +## Recovered original contract + +Authoritative EXE SHA256 +`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`. +Code VAs below have independently mapped file offset VA−400000. New extractor +jimmy_orientation.py records three bounded ranges, hashes and two double factors. + +| VA / file offset | Contract | +|---|---| +|43A420..43A5CF /3A420..3A5CF|Jimmy game-interface3D8 facing.475CA0 gameplay gate, +5 enabled, +A dirty control execution. Clear dirty, read current224/228/22C and retained target274/278/27C. Unequal axes reassert dirty; current/target remain distinct state.| +|43A4A4..43A58C /3A4A4..3A58C|For each target−current difference, wrap strictly>180 by−360 and strictly<−180 by+360 once. ±180 retain sign. Pitch/yaw deltas have explicit float stack stores; roll's difference remains on x87 until final argument publication.| +|43A58C..43A5C2 /3A58C..3A5C2|Multiply differences by supplied float dt, then double4.5 for pitch/roll (4AFD38), double3.7 for yaw (4AFCF0), store each resulting delta as float parameter and invoke334. There is no small-step snap or gain clamp.| +|458F90..458FB6 /58F90..58FB6|Jimmy334 wrapper repeats gameplay gate, then forwards XYZ float parameters to472480.| +|472480..472570 /72480..72570|Add angles and preserve original asymmetric negative truncation and strict>360 single wrap. Existing RocketOrientation.Add models this leaf; zero steps can normalize negative angles.| +|473240→47328D /73240→7328D|Shared base updater invokes game3D8→43A420.43796A calls40E050 before437A1B raw-owner identity check. Facing is thus a base phase independent of movement input acceptance. Body/registry/callback ordering still belongs to caller.| + +Jimmy vtable4A373C+334 binds458F90 and+3D8 binds43A420. The probe uses these +original wrapper/leaf bodies with a synthetic game-interface object and active +475CA0. No global game entrypoint or actor/controller/body path executes. + +## Why this matters for live integration + +LabSimulation previously interpolated raw targetPitch−Pitch and targetRoll−Roll +with float4.5, while yaw used IEEERemainder and float3.7. Source AddEuler used by +movement canonicalizes all axes, so a recovered pitch/roll338 must approach0 +through360. A raw difference would instead rotate338 toward0 the long way. +This can create an artificial spin after a slope/vehicle/Bubble tilt. Source +native338→0 at60Hz produces339.65 on both pitch/roll, preserving the short arc. + +New JimmyOrientation.Step(current,target,dt,enabled=true,dirty=true) returns the +new full Euler and leaves destination state untouched. It supports ordinary +movement and existing Bubble facing; no targets are invented/reset by the helper. +X/Y delta rounding, factor widths and AddEuler parameter publication are preserved +with double intermediates and explicit float argument casts. Disabled/clean gates +return current unchanged. Caller owns actual enabled/dirty fields and scheduling; +this pure API does not infer either from input ownership. + +Parent owns LabSimulation integration: apply this once in the recovered base +phase, after fresh input and before ordinary controlled apply, while retained +input remains after player/fire. Remove duplicate naive interpolation. Exact +base-wrapper/dirty flag state and unsupported class modes remain separate gates. + +## Evidence and verification + +Parent's retained REA inspect_with_objdump Evidence +`ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904` +contains the complete original disassembly. Bundle: +artifacts/jimmy-movement-audit/rea-original-disassembly.json. The focused source +instructions/caller are retained under artifacts/jimmy-orientation-audit. The +same routine may not be recognized as a Ghidra procedure under the default profile; +no unchanged failed pseudocode selector was repeated. This evidence establishes +bytes/instructions, not original gameplay runtime. + +The isolated copied-original probe executes43A420/458F90/472480 and records16 +cases: ordinary axes,338→0 leveling, both359/1 seams, negative angles, exact±180, +>180, canonical360, fractional input/double arithmetic, small-angle/no-snap, +120-tick settling, upright and enabled/dirty/zero-dt gates. Wine32 exits0 with +JIMMY_ORIENTATION_COMPLETE. Source/generator/shared-map-helper/generated EXE/log +hashes are committed in original-orientation-reference.json. Native outputs and +capture metadata are under artifacts/jimmy-orientation-audit/probe. + +Two managed groups compare all16 observations and verify retained target state. +Two Python groups guard identity, ranges/offsets, double factors, complete fixture +and provenance/gates. This is component execution plus managed conformance, not +whole-original/native Windows gameplay, full animation/visual-root parity or a +complete scene registry/cadence implementation. Parent records live verification. diff --git a/docs/progress.md b/docs/progress.md index 590bed9..884de05 100644 --- a/docs/progress.md +++ b/docs/progress.md @@ -1,4 +1,32 @@ -# Progress — 2026-11-04 +# Progress — 2026-11-05 + +## Jimmy controller conformance checkpoint + +User pauses gadget expansion and prioritizes Jimmy movement, preserving our +playable baseline over JN-Engine's tuned movement. Integrated recovered ground/ +air input and velocity, shared keyboard-turn latch, full-axis base facing before +control gating, exact jetpack hold comparison and gravity intermediate.108 saved +original component outputs match managed checks:25 ground,35 air,16 facing, +32 jump. REA retained complete original instructions; native component runs are +separate from whole-original gameplay.27 special-contact dispatch and12 missing +air-target observations are documented, with explicit implementation gates. + +26 integrated movement groups,20 body groups and13 Jimmy evidence guards pass. +Input-only lab and two-way underground routes pass. A pressure/capsule stair +regression was caught and its evidence retained: source−250 Vy requires an actual +support polygon and remains disabled in the lab/outside capsule. Native Linux +1920×1080 SDL walking and powered flight pass all five jump aliases, with resize, +received-key checks, identical final readbacks per replay and zero validation +errors. Native Carl/control-phase and9-stage Grappler replays also pass. Source +angle normalization required signed-direction Bubble assertions; supported +Grappler tests now distinguish fresh−150 versus late100 velocity publication. + +Continuation/coverage: [Jimmy movement](gameplay/jimmy-movement-stabilization.md). +Next: ordinary-air destination Euler plus actor-root render bridge, followed by +root-changing/special/dynamic contacts before broader source-body admission. +The incomplete successful-climb probe is preserved in ignored artifacts, not +claimed as verified. All investigator file ownership has returned to primary. +No new gadget work, broad body replacement or complete movement parity is claimed. ## Scooter pitch and dismount follow-up diff --git a/docs/reverse-engineering.md b/docs/reverse-engineering.md index e52eaa2..801c664 100644 --- a/docs/reverse-engineering.md +++ b/docs/reverse-engineering.md @@ -5,6 +5,14 @@ offsets, virtual addresses, API symbols or observed behavior. Decompiled output evidence, not original source. Original gameplay has not yet been observed successfully; isolated original DLL probes and modern runtime checks are recorded separately. +- [Jimmy movement stabilization](gameplay/jimmy-movement-stabilization.md): + current priority, preserving our playable controller over JN's tuned replacement. + Ground/air/facing/jump reports record108 native component observations matched + by managed implementations,27 special-contact eligibility observations and12 + recovered air destination writes. The last two are investigation evidence; + special-body and ordinary air-pitch/render integration remain open. REA's + complete original instruction Evidence and offsets are linked in those reports. + - `gameplay/grappler-live.md`: boundedVR08 integration/coverage and runtime evidence. `grappler-body.md` records shared sphere context and41 native cases; `grappler-camera.md`, `grappler-resources.md`, `grappler-lifecycle.md` record diff --git a/docs/tasks.md b/docs/tasks.md index 366a285..83d099e 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -46,6 +46,23 @@ compile, runtime and original-fidelity verification are separate. ## Immediate continuation +- [ ] Current priority: stabilize Jimmy's ground/air input, facing, jump/landing, + body/contact response and route/control transitions before more gadgets. Keep + our movement baseline; JN-Engine is an original-code index, not a movement model. + See gameplay/jimmy-movement-stabilization.md for bounded evidence/verification gates. + +- [x] Jimmy controller arithmetic/facing checkpoint: source ground/air components, + shared keyboard latch, control-independent full-axis facing, exact jump hold and + gravity intermediates.108 saved original component observations match managed + checks. Capsule compatibility remains explicit; broad collision is not complete. +- [ ] Next Jimmy chunk: source ordinary-air destination pitch/roll and retained + mode fields together with the actor-root visual bridge.12 original target writes + are recorded; do not silently enable physics tilt without matching presentation. +- [ ] Then verify root-changing contact publication, world-response/integration + flags, successful fence/ladder completion, hazard/impulse and dynamic eligibility + before replacing the lab/outside capsule.27 dispatch cases establish eligibility + only; the unfinished successful-climb harness remains ignored investigation work. + - [x] Scooter feedback: Goddard gradually levels pitch/roll after tilted dismount; engine uses missing source positional frequency/history correction.13 Scooter, 2 audio,10 Patrol and24 Python groups plus native input replays pass. See diff --git a/scripts/test.sh b/scripts/test.sh index e664572..d296b49 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -6,6 +6,10 @@ python3 tools/extractors/prepare.py --all-scenes --audio sounds musicsecretlab dotnet run --project tests/GamePort.DataTests -- ../Original dotnet run --project tests/GamePort.CollisionTests -- ../Original dotnet run --project tests/GamePort.MovementTests -- ../Original +dotnet run --project tests/GamePort.JimmyGroundTests +dotnet run --project tests/GamePort.JimmyAirTests +dotnet run --project tests/GamePort.JimmyOrientationTests +dotnet run --project tests/GamePort.JimmyJumpTests dotnet run --project tests/GamePort.DirectorTests -- ../Original dotnet run --project tests/GamePort.PatrolTests -- ../Original dotnet run --project tests/GamePort.SupportTests -- ../Original diff --git a/src/GamePort/Application/BubbleSmoke.cs b/src/GamePort/Application/BubbleSmoke.cs index e330aff..07cacce 100644 --- a/src/GamePort/Application/BubbleSmoke.cs +++ b/src/GamePort/Application/BubbleSmoke.cs @@ -106,7 +106,7 @@ public sealed class BubbleSmoke if (count == 1) checks[1] = effect.Active && !effect.Expanding && effect.Visible && effect.Width == 240 && effect.Height >= 210 && effect.Height <= 270; if (count == 2) checks[2] = player.GadgetMode == 0 && player.MovementMode == 2 - && player.Speed > 0 && player.TurnRate > 0 && player.Pitch < 0 && !player.Shooting; + && player.Speed > 0 && player.TurnRate > 0 && MathF.IEEERemainder(player.Pitch,360) < 0 && !player.Shooting; if (count == 3) checks[3] = player.BubbleBounces > bouncesBeforeHeld && MathF.Abs(player.Velocity.Y - 900) < .001f && boingSounds > soundsBeforeHeld; if (count == 4) checks[4] = player.GadgetMode == 0 && effect.Active && !player.Shooting; diff --git a/src/GamePort/Game/AirSteering.cs b/src/GamePort/Game/AirSteering.cs index b54cc1a..720b89b 100644 --- a/src/GamePort/Game/AirSteering.cs +++ b/src/GamePort/Game/AirSteering.cs @@ -2,8 +2,9 @@ namespace GamePort.Game; public readonly record struct AirSteeringResult(float Speed, float TurnRate); -/// Keyboard subset of normal airborne input439900 (mode1). -/// Modes1/2 share the handler; special flight mode2 and mouse/analog are separate. +/// Legacy stateless compatibility helper and shared steering constants. +/// Live ordinary input uses JimmyAirMotion, which retains the keyboard latch, +/// supported mode1 braking and original coast comparison precision. /// public static class AirSteering { diff --git a/src/GamePort/Game/JetpackBurst.cs b/src/GamePort/Game/JetpackBurst.cs index 7286c99..0fd9175 100644 --- a/src/GamePort/Game/JetpackBurst.cs +++ b/src/GamePort/Game/JetpackBurst.cs @@ -66,7 +66,7 @@ public static class JetpackBurst } if (state.JumpState < 3) - extra = input.GravityY * 1.33f - input.GravityY; + extra = (float)((double)input.GravityY * 1.33f - input.GravityY); else { if (input.EffectAvailable && state.EffectRemaining <= 0 && state.JumpState is 3 or 4) @@ -109,8 +109,11 @@ public static class JetpackBurst EffectRemaining = input.EffectAvailable ? 0 : state.EffectRemaining }; return Result(impulse: JumpImpulse, pose: JetpackPose.Jump); case 1: - state = state with { HoldSeconds = state.HoldSeconds + input.DeltaSeconds }; - if (state.HoldSeconds <= HoldThreshold) return Result(); + //438407 storesfloat but keeps the unrounded sum on x87 for + //43840D's comparison. Different sums can store the samefloat. + double hold=(double)state.HoldSeconds+input.DeltaSeconds; + state = state with { HoldSeconds = (float)hold }; + if (hold <= HoldThreshold) return Result(); break; case 2: break; diff --git a/src/GamePort/Game/JimmyAirMotion.cs b/src/GamePort/Game/JimmyAirMotion.cs new file mode 100644 index 0000000..69bd2a5 --- /dev/null +++ b/src/GamePort/Game/JimmyAirMotion.cs @@ -0,0 +1,58 @@ +using System.Numerics; +namespace GamePort.Game; + +public readonly record struct JimmyAirInputState(float Speed,float TurnRate,bool KeyboardTurn); +public readonly record struct JimmyAirApply(Vector3 Velocity,Vector3 Rotation,float AppliedTurnRate); + +/// Ordinary mode1 keyboard input439900 and437F90 velocity prefix. +/// Body integration, facing interpolation, jump suffix and input ownership are +/// caller phases. Source constraints and observations: jimmy-air-motion.md. +public static class JimmyAirMotion +{ + public static JimmyAirInputState Input(JimmyAirInputState state,PlayerInput input,bool supported, + float seconds,float maximumSpeed=600) + { + if(!float.IsFinite(state.Speed)||!float.IsFinite(state.TurnRate)||!float.IsFinite(seconds) + ||seconds<=0||seconds>=1||!float.IsFinite(maximumSpeed)||maximumSpeed<=0) + throw new ArgumentOutOfRangeException(nameof(seconds)); + float turn=state.TurnRate;bool keyboard=state.KeyboardTurn;float turnStep=100*seconds; + if(input.Left){turn+=turnStep;keyboard=true;} + else if(input.Right){turn-=turnStep;keyboard=true;} + else if(keyboard)turn=turn<0?MathF.Min(0,turn+turnStep):MathF.Max(0,turn-turnStep); + float speed=state.Speed; + if(input.Forward) + { + if(speed(double)maximumSpeed*.9090909361839294f)speed-=17.5f; + //A stored air mode may still receive input while body218 is supported. + //This independent subtraction intentionally has no crossing clamp. + if(supported)speed=speed>0?speed-17.5f:0; + if(input.Backward) + { + if(speed>0)speed=MathF.Max(0,speed-(supported?35:17.5f)); + else if(speed<0)speed=MathF.Min(0,speed+35); + } + return new(speed,Math.Clamp(turn,-30,30),keyboard); + } + + public static JimmyAirApply Apply(float speed,float turn,Vector3 rotation,Vector3 velocity, + float seconds,float friction=.8f) + { + if(!float.IsFinite(speed)||!float.IsFinite(turn)||!float.IsFinite(seconds)||seconds<0||seconds>=1 + ||!float.IsFinite(friction)||!float.IsFinite(velocity.X)||!float.IsFinite(velocity.Y)||!float.IsFinite(velocity.Z)) + throw new ArgumentOutOfRangeException(nameof(seconds)); + float side=0,applied=0; + if(velocity!=Vector3.Zero) + { + applied=turn; + rotation=RocketOrientation.Add(rotation,new(0,turn*seconds,0)); + side=(float)((double)turn*.0181818176060915f*(1.0-friction)*speed); + } + var forward=RocketOrientation.Rotate(new(0,0,speed),rotation); + var(sin,cos)=RocketOrientation.Trig(rotation.Y); + return new(new((float)(forward.X+(double)cos*side),velocity.Y, + (float)(forward.Z+(double)sin*side)),rotation,applied); + } +} diff --git a/src/GamePort/Game/JimmyGroundMotion.cs b/src/GamePort/Game/JimmyGroundMotion.cs new file mode 100644 index 0000000..f07caa9 --- /dev/null +++ b/src/GamePort/Game/JimmyGroundMotion.cs @@ -0,0 +1,64 @@ +using System.Numerics; +namespace GamePort.Game; + +public readonly record struct JimmyGroundState(float Speed,float TargetYaw, + float BackSeconds=0,bool AutoTurning=false,float BackYaw=0); +public readonly record struct JimmyGroundInput(JimmyGroundState State,float Lateral,bool HeadingUpdated); +public readonly record struct JimmyGroundApply(Vector3 Velocity,Vector3 Rotation); + +/// 43915D..4395CF keyboard ground suffix and437C40 ground apply. +/// Body, phase gates, backward acceptance and the830 clock owner remain caller-owned. +/// See docs/gameplay/jimmy-ground-motion.md for copied-original references/limits. +public static class JimmyGroundMotion +{ + public static JimmyGroundInput Input(JimmyGroundState state,float yaw,PlayerInput input, + float maximumSpeed=600,bool blockBackward=false) + { + Finite(state.Speed);Finite(state.TargetYaw);Finite(state.BackSeconds);Finite(state.BackYaw);Finite(yaw);Finite(maximumSpeed); + if(maximumSpeed<=0)throw new ArgumentOutOfRangeException(nameof(maximumSpeed)); + float speed=state.Speed,angle=0,lateral=0,backTime=state.BackSeconds,backYaw=state.BackYaw; + bool active=false,back=input.Backward&&!blockBackward,auto=state.AutoTurning; + float Accelerate(float value)=>value1.5){speed=maximumSpeed;auto=true;backYaw=yaw+180;angle=0;} + } + else speed=maximumSpeed; + } + else {backTime=0;auto=false;} + if(!input.Forward&&!back) + {if(speed>0)speed=MathF.Max(0,speed-35);if(speed<0)speed=MathF.Min(0,speed+35);} + float target=state.TargetYaw; + if(active)target=auto?(angle!=0?yaw-angle*.5f:backYaw):yaw+angle; + return new(new(speed,target,backTime,auto,backYaw),lateral,active); + } + + public static JimmyGroundApply Apply(float speed,Vector3 velocity,Vector3 rotation,float turnRate, + float lateral,bool supported,bool hasSupportPolygon,float seconds,float friction=.8f,bool specialLocked=false) + { + Finite(speed);Finite(turnRate);Finite(lateral);Finite(seconds);Finite(friction); + Finite(velocity.X);Finite(velocity.Y);Finite(velocity.Z); + Finite(rotation.X);Finite(rotation.Y);Finite(rotation.Z); + if(seconds<=0||seconds>=1)throw new ArgumentOutOfRangeException(nameof(seconds)); + if(specialLocked)return new(velocity,rotation); + float side=0; + if(velocity!=Vector3.Zero||lateral!=0) + { + rotation=RocketOrientation.Add(rotation,new(0,turnRate*seconds,0)); + side=(float)(((double)turnRate*.02222222276031971f*(1.0-friction)*speed+lateral)*seconds); + } + var forward=RocketOrientation.Rotate(new(0,0,speed),rotation); + var(sine,cosine)=RocketOrientation.Trig(rotation.Y); + var result=new Vector3(forward.X+cosine*side,velocity.Y,forward.Z+sine*side); + if(supported&&hasSupportPolygon)result.Y-=250; + return new(result,rotation); + } + private static void Finite(float value){if(!float.IsFinite(value))throw new ArgumentOutOfRangeException(nameof(value));} +} diff --git a/src/GamePort/Game/JimmyOrientation.cs b/src/GamePort/Game/JimmyOrientation.cs new file mode 100644 index 0000000..43c82df --- /dev/null +++ b/src/GamePort/Game/JimmyOrientation.cs @@ -0,0 +1,25 @@ +using System.Numerics; +namespace GamePort.Game; + +/// 43A420 active Jimmy facing, followed by334→458F90→472480. +/// Targets are retained caller state; all three axes take the shortest arc. +/// Source4.5/3.7 constants are doubles and delta parameters publish as floats. +public static class JimmyOrientation +{ + public static Vector3 Step(Vector3 current,Vector3 target,float seconds,bool enabled=true,bool dirty=true) + { + if(!float.IsFinite(current.X)||!float.IsFinite(current.Y)||!float.IsFinite(current.Z) + ||!float.IsFinite(target.X)||!float.IsFinite(target.Y)||!float.IsFinite(target.Z) + ||!float.IsFinite(seconds)||seconds<0||seconds>=1) + throw new ArgumentOutOfRangeException(nameof(seconds)); + if(!enabled||!dirty)return current; + static float Arc(float value)=>value>180?value-360:value< -180?value+360:value; + static double WideArc(double value)=>value>180?value-360:value< -180?value+360:value; + var x=Arc(target.X-current.X);var y=Arc(target.Y-current.Y); + //X/Y differences have explicit float stack stores. The Z difference + //remains on x87 until its final float argument publication. + var z=WideArc((double)target.Z-current.Z); + var delta=new Vector3((float)((double)x*seconds*4.5),(float)((double)y*seconds*3.7),(float)(z*seconds*4.5)); + return RocketOrientation.Add(current,delta); + } +} diff --git a/src/GamePort/Game/LabSimulation.cs b/src/GamePort/Game/LabSimulation.cs index 7681348..116bc4b 100644 --- a/src/GamePort/Game/LabSimulation.cs +++ b/src/GamePort/Game/LabSimulation.cs @@ -10,7 +10,7 @@ public enum PlayerPose { Idle, Run, Backpedal, Jump, Fall, Fly, Shoot, Swing } /// /// Walking, airborne steering and jetpack checkpoint. Recovered arithmetic is described in -/// movement-checkpoint.md. Legacy capsule, floor-derived pivot and60Hz are port policies; +/// jimmy-movement-stabilization.md. Legacy capsule, floor-derived pivot and60Hz are port policies; /// original collision, intro, object interactions and animation timing remain open. /// public sealed class LabSimulation @@ -32,6 +32,7 @@ public sealed class LabSimulation private int movementMode; private JetpackBurstState jumpState; private bool forceFall; + private bool keyboardTurn, hasSupportPolygon; private Vector3 noclipEntry; private float noclipEntryYaw; private int gadgetMode = -1; @@ -189,6 +190,7 @@ public sealed class LabSimulation Yaw = targetYaw = startYaw; Speed = PublishedSpeed = TurnRate = extraAirAcceleration = shadowDistance = 0; lateralContribution = 0; pendingImpulse = Vector3.Zero; movementMode = 0; + keyboardTurn=false;hasSupportPolygon=false; jumpState = default; forceFall = JetpackEffectVisible = false; Shooting = false; @@ -262,6 +264,7 @@ public sealed class LabSimulation //424BE0..424C34 runs this wrapper before437940's ownership gate. StepCeiling(); StepFloorPolicy(); //437940's base40E050, before the input-identity gate. + StepFacing(); //40E050→473240→43A420 also runs without input ownership. if (controlled) StepPlayer(input); Invisible.Step(FixedStepClock.Step, anyControlled ?? controlled, input.Fire, input.Jump, Energy, IgnoresGadgetEnergy, AdjustEnergy); @@ -444,26 +447,26 @@ public sealed class LabSimulation //438A60 dispatches by stored movement mode, not current support. if (movementMode == 0) { - if (TracksBubbleOrientation && (input.Forward || input.Left || input.Right - || input.Backward && !(GadgetMode is -1 or 3 && input.Fire))) targetPitch=targetRoll=0; - float yawDelta = 0; - if (input.Left) { yawDelta += 20; lateralContribution = -1000; Speed = RecoveredMotion.AddSpeed(Speed,MaximumSpeed); } - else if (input.Right) { yawDelta -= 20; lateralContribution = 1000; Speed = RecoveredMotion.AddSpeed(Speed,MaximumSpeed); } - if (input.Forward) { yawDelta *= 0.5f; Speed = RecoveredMotion.AddSpeed(Speed,MaximumSpeed); } - if (yawDelta != 0) targetYaw = Yaw + yawDelta; - if (input.Backward) Speed = MathF.Max(Speed - 52.5f, -300); - else if (!input.Forward) Speed = RecoveredMotion.ReleaseSpeed(Speed); + //The830 backward clock owner remains unresolved; ordinary state0 + //does not invent a hold timer or admit its seeded auto-turn branch. + var ground=JimmyGroundMotion.Input(new(Speed,targetYaw),Yaw,input,MaximumSpeed, + blockBackward:(GadgetMode is -1 or 3)&&input.Fire); + Speed=ground.State.Speed;targetYaw=ground.State.TargetYaw;lateralContribution=ground.Lateral; + if(input.Left||input.Right)keyboardTurn=true; + if(ground.HeadingUpdated)targetPitch=targetRoll=0; } else if (movementMode==2) { var steering=BubbleMotion.StepInput(Speed,TurnRate,input,Grounded,dt,MaximumSpeed); Speed=steering.Speed; TurnRate=steering.TurnRate; + if(input.Left||input.Right)keyboardTurn=true; targetPitch=steering.TargetPitch; targetRoll=steering.TargetRoll; targetYaw=Yaw; } else { - var steering = AirSteering.Step(Speed, TurnRate, input, dt,MaximumSpeed); + var steering = JimmyAirMotion.Input(new(Speed,TurnRate,keyboardTurn),input,Grounded,dt,MaximumSpeed); Speed = steering.Speed; TurnRate = steering.TurnRate; + keyboardTurn=steering.KeyboardTurn; if (TracksBubbleOrientation) { targetPitch=0; targetRoll=-TurnRate; } //439E2B preserves current yaw as the destination; air apply then //438011..43802B adds the independent turn rate directly to yaw. @@ -492,15 +495,16 @@ public sealed class LabSimulation StopForPrimaryFire,SetShooting,AdjustEnergy); } + private void StepFacing() + { + var rotation=JimmyOrientation.Step(new(Pitch,Yaw,Roll),new(targetPitch,targetYaw,targetRoll),FixedStepClock.Step); + Pitch=rotation.X;Yaw=rotation.Y;Roll=rotation.Z; + } + private void StepPlayer(PlayerInput input) { ControllerSteps++; const float dt = FixedStepClock.Step; - if (TracksBubbleOrientation) - { - Pitch+=(targetPitch-Pitch)*dt*4.5f; - Roll+=(targetRoll-Roll)*dt*4.5f; - } if (movementMode==2) { var bubble=BubbleMotion.StepApply(Speed,TurnRate,Yaw,Pitch,Velocity,Grounded,input.Jump,dt); @@ -508,8 +512,6 @@ public sealed class LabSimulation if (Grounded) { BubbleBounces++; if (bubble.Boing) GadgetSound?.Invoke(106,false); } return; } - var yawError = MathF.IEEERemainder(targetYaw - Yaw, 360); - Yaw = (Yaw + yawError * dt * 3.7f) % 360; //437A96 selects air mode on held jump;437B9E..BAC resets jump/mode/turn //only in the player's grounded/released update, after input when fresh. if (input.Jump) movementMode = 1; @@ -517,15 +519,18 @@ public sealed class LabSimulation { movementMode = 0; TurnRate = 0; } - if (Velocity.LengthSquared() != 0 || movementMode == 0 && lateralContribution != 0) - Yaw = (Yaw + TurnRate * dt) % 360; - var (sin, cos) = Trig(Yaw); - var velocity = new Vector3(-sin * Speed, Velocity.Y, cos * Speed); - //437CDx ground uses /45 then dt;43803B air uses /55 without dt. - const float friction = .8f; - var sideSpeed = movementMode == 0 ? (TurnRate * (1 - friction) * Speed / 45 + lateralContribution) * dt - : TurnRate * (1 - friction) * Speed * .0181818176060915f; - velocity += new Vector3(cos, 0, sin) * sideSpeed; + Vector3 velocity; + if(movementMode==0) + { + var ground=JimmyGroundMotion.Apply(Speed,Velocity,new(Pitch,Yaw,Roll),TurnRate, + lateralContribution,Grounded,hasSupportPolygon,dt); + velocity=ground.Velocity;Pitch=ground.Rotation.X;Yaw=ground.Rotation.Y;Roll=ground.Rotation.Z; + } + else + { + var airMotion=JimmyAirMotion.Apply(Speed,TurnRate,new(Pitch,Yaw,Roll),Velocity,dt); + velocity=airMotion.Velocity;Pitch=airMotion.Rotation.X;Yaw=airMotion.Rotation.Y;Roll=airMotion.Rotation.Z; + } if (collision.GroundHeight(ActorRoot, 2500) is { } shadowFloor) shadowDistance = MathF.Abs(ActorRoot.Y - shadowFloor - 13); var air = JetpackBurst.Step(jumpState, new(Grounded, input.Jump, velocity.Y, shadowDistance, @@ -576,6 +581,10 @@ public sealed class LabSimulation } } Grounded = result.Grounded && velocity.Y <= 0; + //The capsule has no original338 support polygon. Combining source + //downward pressure with its slide solver blocks the lab stair route. + //Keep that solver's baseline until the source body/contact bridge lands. + hasSupportPolygon=false; if (Grounded && velocity.Y < 0 || result.HitCeiling && velocity.Y > 0 && ceilingRay == null) velocity.Y = 0; if (Grounded) { extraAirAcceleration = 0; forceFall = false; } Velocity = velocity; @@ -598,6 +607,7 @@ public sealed class LabSimulation pendingImpulse = result.Body.Impulse; extraAirAcceleration = result.Body.Acceleration.Y; Grounded = result.Body.Supported; + hasSupportPolygon=result.SupportHit!=null; if (Grounded) forceFall = false; if (result.Landing != null) Landings++; if (result.Contact is { StoredNormal.Y: > -.7f }) {WallHits++;Grappler?.Contact();} diff --git a/src/GamePort/Game/RecoveredMotion.cs b/src/GamePort/Game/RecoveredMotion.cs index 380d172..b2ac32f 100644 --- a/src/GamePort/Game/RecoveredMotion.cs +++ b/src/GamePort/Game/RecoveredMotion.cs @@ -18,7 +18,8 @@ public static class RecoveredMotion // Deliberately per invocation: original increments omit dt. Call cadence is // not yet verified. Rendering must not directly choose simulation cadence. - public static float AddSpeed(float speed, float maximumSpeed = MaximumSpeed) => MathF.Min(speed + SpeedIncrement, maximumSpeed); + public static float AddSpeed(float speed, float maximumSpeed = MaximumSpeed) => + speed speed > 0 ? MathF.Max(0, speed - SpeedDecay) : MathF.Min(0, speed + SpeedDecay); diff --git a/tests/GamePort.BodyPhysicsTests/Program.cs b/tests/GamePort.BodyPhysicsTests/Program.cs index 0196160..ccf200c 100644 --- a/tests/GamePort.BodyPhysicsTests/Program.cs +++ b/tests/GamePort.BodyPhysicsTests/Program.cs @@ -84,6 +84,7 @@ var player=Simulation(); Check(player.UsesOriginalBody && player.PublishedSpeed==0,"tutorial explicitly selects source body"); for(var i=0;i<120;i++)player.Step(default); Check(player.Grounded && player.Landings==0,"steady source support must not chatter"); +Check(player.Velocity.Y==-250,"source support polygon admits the ground controller's downward pressure"); var sole=standing.Vertices.Min(v=>Vector3.Transform(v.Position,player.Model).Y); Check(MathF.Abs(sole-player.Position.Y)<.001f,"modern sole/root render bridge remains explicit and stable"); var rootBefore=player.ActorRoot; diff --git a/tests/GamePort.BubbleTests/Program.cs b/tests/GamePort.BubbleTests/Program.cs index 61d1a8e..de78246 100644 --- a/tests/GamePort.BubbleTests/Program.cs +++ b/tests/GamePort.BubbleTests/Program.cs @@ -80,7 +80,7 @@ Test("Bubble fire throttles without starting the ordinary ray",()=>{ var world=Floor();var p=Player("LV1B",world);var director=new SceneDirector(new("LV1B",[Entity("3JIM","JIM1")]),new TaskStates([]),(_,_)=>1); var bag=new SceneInventory(new int[19]);bag.SetState(0,3,1);using var ray=new SceneGadgets(director,bag,p,world); p.GadgetMode=0;for(var i=0;i<20;i++)p.Step(new(false,false,true,false,false,Fire:true)); - Check(p.Speed>0&&p.TurnRate>0&&p.Pitch<0&&!ray.Ray.Visible&&!p.Shooting,"shared fire predicate is Bubble throttle, not shoot"); + Check(p.Speed>0&&p.TurnRate>0&&MathF.IEEERemainder(p.Pitch,360)<0&&!ray.Ray.Visible&&!p.Shooting,"shared fire predicate is Bubble throttle, not shoot"); }); Test("lava bypass, retained entry and strict4-second debounce",()=>{ var state=new Vr01FloorState();var e=state.Visit(111,0); diff --git a/tests/GamePort.GrapplerLiveTests/Program.cs b/tests/GamePort.GrapplerLiveTests/Program.cs index 041ad29..5be92f6 100644 --- a/tests/GamePort.GrapplerLiveTests/Program.cs +++ b/tests/GamePort.GrapplerLiveTests/Program.cs @@ -25,7 +25,8 @@ static void Attach() using var f=new Fixture();f.Attach(); Check(f.G.Attached&&f.G.Attachments==1&&f.P.GadgetMode==7,"owned raw7"); Check(f.P.PhysicsSteps==1&&f.P.ControllerSteps==1,"both phases run once"); - Check(f.P.Velocity.Y==100&&f.P.JumpState==0&&!f.G.SwingPose,"attachment impulse and next-input SWING"); + Check(f.P.Velocity.Y==-150&&f.P.JumpState==0&&!f.G.SwingPose, + "fresh input writes attachment100 before supported ground apply subtracts250; SWING starts next input"); int body=f.P.PhysicsSteps;f.Binding.Step(default); Check(f.P.PhysicsSteps==body+1&&f.G.SwingPose&&f.P.Pose==PlayerPose.Swing,"ordinary body and swing pose continue"); Check(float.IsFinite(f.P.ActorRoot.Length()),"finite attached root"); @@ -109,8 +110,10 @@ static void CameraStates() } static void Ownership() { - using var f=new Fixture();f.Attach();var root=f.P.ActorRoot; - f.P.Step(default,false,false);Check(f.G.Attached&&f.G.Equipped&&f.P.ActorRoot!=root,"controlfalse still body, no generic release"); + using var f=new Fixture();f.Attach();var physics=f.P.PhysicsSteps; + f.P.Step(default,false,false); + Check(f.G.Attached&&f.G.Equipped&&f.P.PhysicsSteps==physics+1&&f.P.Grounded, + "controlfalse still integrates the supported body without a generic gadget release or invented takeoff"); f.D.ReleasePlayerGadget();Check(!f.G.Attached&&!f.G.Equipped&&f.P.GadgetMode==-1,"namedJimmy selected cleanup"); f.I.Inventory.SelectGadget(7);f.D.Trigger("gr");Check(!f.G.Equipped,"actualVR08 intro MCA/CAM cleanup"); } diff --git a/tests/GamePort.InteractionTests/GamePort.InteractionTests.csproj b/tests/GamePort.InteractionTests/GamePort.InteractionTests.csproj index f39ea41..6d6645d 100644 --- a/tests/GamePort.InteractionTests/GamePort.InteractionTests.csproj +++ b/tests/GamePort.InteractionTests/GamePort.InteractionTests.csproj @@ -34,5 +34,8 @@ + + + diff --git a/tests/GamePort.JimmyAirTests/GamePort.JimmyAirTests.csproj b/tests/GamePort.JimmyAirTests/GamePort.JimmyAirTests.csproj new file mode 100644 index 0000000..ab70e8a --- /dev/null +++ b/tests/GamePort.JimmyAirTests/GamePort.JimmyAirTests.csproj @@ -0,0 +1,6 @@ + + Exenet10.0enableenablefalse + + + + diff --git a/tests/GamePort.JimmyAirTests/Program.cs b/tests/GamePort.JimmyAirTests/Program.cs new file mode 100644 index 0000000..dcf4ab6 --- /dev/null +++ b/tests/GamePort.JimmyAirTests/Program.cs @@ -0,0 +1,26 @@ +using System.Numerics; +using System.Text.Json; +using GamePort.Game; +using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-air-reference.json"))); +int inputs=0,applies=0; +foreach(var c in doc.RootElement.GetProperty("cases").EnumerateArray()) +{ + var p=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray(); + var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray();string name=c.GetProperty("name").GetString()!; + if(c.GetProperty("kind").GetString()=="INPUT") + { + var result=JimmyAirMotion.Input(new(p[0],p[1],p[2]!=0),new(p[3]!=0,p[4]!=0,p[5]!=0,p[6]!=0,false),p[7]!=0,p[9],p[8]); + Near(result.Speed,o[0],name+" speed");Near(result.TurnRate,o[1],name+" turn");Check(result.KeyboardTurn==(o[2]!=0),name+" keyboard latch");inputs++; + } + else + { + var result=JimmyAirMotion.Apply(p[0],p[7],new(p[4],p[5],p[6]),new(p[1],p[2],p[3]),p[9],p[8]); + NearV(result.Velocity,new(o[0],o[1],o[2]),name+" velocity");NearV(result.Rotation,new(o[3],o[4],o[5]),name+" Euler");Near(result.AppliedTurnRate,o[6],name+" rate");applies++; + } +} +Check(inputs==22&&applies==13,"complete original observations"); +Console.WriteLine("PASS22 copied-original airborne keyboard-input observations, including supported mode1, coast boundary and latch"); +Console.WriteLine("PASS13 copied-original air velocity/Euler observations, including zero velocity, pitch, seam and original vertical preservation"); +static void Check(bool ok,string name){if(!ok)throw new Exception(name);} +static void Near(float a,float b,string name)=>Check(float.IsFinite(a)&&Math.Abs(a-b)<.005f,$"{name}: {a} != {b}"); +static void NearV(Vector3 a,Vector3 b,string name)=>Check(float.IsFinite(a.X+a.Y+a.Z)&&Vector3.Distance(a,b)<.04f,$"{name}: {a} != {b}"); diff --git a/tests/GamePort.JimmyAirTests/original-air-reference.json b/tests/GamePort.JimmyAirTests/original-air-reference.json new file mode 100644 index 0000000..dd4d0e3 --- /dev/null +++ b/tests/GamePort.JimmyAirTests/original-air-reference.json @@ -0,0 +1,1074 @@ +{ + "source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8", + "ranges": [ + { + "va": "0x439900", + "file_offset": "0x39900", + "length": 1207, + "sha256": "e6fd687cd797d004d9584bb7b6c004def933b9c496ef17a19a607be5c05e1236" + }, + { + "va": "0x437f90", + "file_offset": "0x37f90", + "length": 410, + "sha256": "0d65625eea1015707e9d5001196c15a945cb93b14b03cd022d98687778c9846c" + }, + { + "va": "0x4723f0", + "file_offset": "0x723f0", + "length": 48, + "sha256": "ae10074b5ae2ff3d2d2ce8c16358476acdba2f2a166be8ad5c9f05e3f55ffc23" + }, + { + "va": "0x472480", + "file_offset": "0x72480", + "length": 240, + "sha256": "406c3904538abe07d88ca440e39ca56c00765d0871943991ba7b792da4803c16" + }, + { + "va": "0x472b10", + "file_offset": "0x72b10", + "length": 256, + "sha256": "ee9516aef07738fcf7da370af74185f7522686759218ad1bf4d93be46f0c28b2" + } + ], + "relocations": [ + { + "va": 4431078, + "target": 4772864 + }, + { + "va": 4431266, + "target": 4772868 + }, + { + "va": 4430132, + "target": 4774164 + }, + { + "va": 4430237, + "target": 4774164 + }, + { + "va": 4430275, + "target": 4774164 + }, + { + "va": 4430306, + "target": 4774164 + }, + { + "va": 4430344, + "target": 4774164 + }, + { + "va": 4430786, + "target": 4774164 + }, + { + "va": 4430885, + "target": 4774164 + }, + { + "va": 4430957, + "target": 4774164 + }, + { + "va": 4430978, + "target": 4774164 + }, + { + "va": 4431009, + "target": 4774164 + }, + { + "va": 4430443, + "target": 4774180 + }, + { + "va": 4430202, + "target": 4774216 + }, + { + "va": 4430495, + "target": 4774216 + }, + { + "va": 4430608, + "target": 4774216 + }, + { + "va": 4430738, + "target": 4774216 + }, + { + "va": 4430805, + "target": 4774216 + }, + { + "va": 4430939, + "target": 4774216 + }, + { + "va": 4430167, + "target": 4774220 + }, + { + "va": 4430845, + "target": 4774220 + }, + { + "va": 4430257, + "target": 4774252 + }, + { + "va": 4430326, + "target": 4774252 + }, + { + "va": 4430372, + "target": 4774252 + }, + { + "va": 4430396, + "target": 4774252 + }, + { + "va": 4430713, + "target": 4838876 + }, + { + "va": 4430512, + "target": 4848340 + }, + { + "va": 4431047, + "target": 4865656 + }, + { + "va": 4431235, + "target": 4914472 + }, + { + "va": 4431115, + "target": 4914476 + }, + { + "va": 4431162, + "target": 4914476 + }, + { + "va": 4430862, + "target": 4914480 + }, + { + "va": 4430149, + "target": 5281885 + }, + { + "va": 4430471, + "target": 5281886 + }, + { + "va": 4430594, + "target": 5281886 + }, + { + "va": 4430184, + "target": 5281887 + }, + { + "va": 4430831, + "target": 5281888 + }, + { + "va": 4430161, + "target": 5282464 + }, + { + "va": 4430196, + "target": 5282464 + }, + { + "va": 4430489, + "target": 5282468 + }, + { + "va": 4430602, + "target": 5282468 + }, + { + "va": 4430839, + "target": 5282468 + }, + { + "va": 4423800, + "target": 4772108 + }, + { + "va": 4423682, + "target": 4774164 + }, + { + "va": 4423741, + "target": 4774180 + }, + { + "va": 4423789, + "target": 4777448 + }, + { + "va": 4423753, + "target": 4838840 + }, + { + "va": 4662415, + "target": 4774164 + }, + { + "va": 4662490, + "target": 4774164 + }, + { + "va": 4662565, + "target": 4774164 + }, + { + "va": 4662455, + "target": 4777412 + }, + { + "va": 4662468, + "target": 4777412 + }, + { + "va": 4662530, + "target": 4777412 + }, + { + "va": 4662543, + "target": 4777412 + }, + { + "va": 4662613, + "target": 4777412 + }, + { + "va": 4662626, + "target": 4777412 + }, + { + "va": 4664145, + "target": 4772108 + }, + { + "va": 4664108, + "target": 4777448 + }, + { + "va": 4664119, + "target": 4777448 + }, + { + "va": 4664132, + "target": 4777448 + } + ], + "scope": "Copied439900 ordinary mode1 keyboard prefix and437F90 velocity prefix, synthetic actor/body/mouse, original Euler helpers and OMT trig; no original game entrypoint, body integration, jump suffix or camera.", + "files": { + "tools/binary/jimmy_air_motion.py": "86063fe0ee8822a8cc37009d4a2b65027b1037bffcc08ddf949e00e892bc9de8", + "tools/binary/jimmy_air_motion_probe.c": "4f825d33dcf161d2a119d06f288db384ecb2468d36c4ae8f668fbeacbfc8eb6e", + "tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810", + "artifacts/jimmy-air-audit/jimmy_air_motion_probe.exe": "a8ee0c2ef0c1a586530c3308e499e3163f9ae4cc7a412803809a2074109fd0d6", + "artifacts/jimmy-air-audit/probe/wine.log": "645d1dbf7a97a7fc9e776529eb490f2f00f4a559dd4a522c3780d5ed7152f102" + }, + "cases": [ + { + "kind": "INPUT", + "name": "up", + "input": [ + 300.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 330.0, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "overspeed", + "input": [ + 700.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 700.0, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "coast_high", + "input": [ + 600.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 582.5, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "coast_low", + "input": [ + 500.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 500.0, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "coast_edge", + "input": [ + 545.45459, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 527.95459, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "down", + "input": [ + 300.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 282.5, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "back_to_zero", + "input": [ + -10.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 0.0, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "up_down", + "input": [ + 300.0, + 0.0, + 0.0, + 1.0, + 1.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 312.5, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "up_down_zero", + "input": [ + 0.0, + 0.0, + 0.0, + 1.0, + 1.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 12.5, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "left", + "input": [ + 300.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 300.0, + 10.0, + 1.0 + ] + }, + { + "kind": "INPUT", + "name": "right", + "input": [ + 300.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 300.0, + -10.0, + 1.0 + ] + }, + { + "kind": "INPUT", + "name": "both_turn", + "input": [ + 300.0, + 29.0, + 0.0, + 0.0, + 0.0, + 1.0, + 1.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 300.0, + 30.0, + 1.0 + ] + }, + { + "kind": "INPUT", + "name": "turn_cap", + "input": [ + 300.0, + -29.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 300.0, + -30.0, + 1.0 + ] + }, + { + "kind": "INPUT", + "name": "return", + "input": [ + 300.0, + 20.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 300.0, + 10.0, + 1.0 + ] + }, + { + "kind": "INPUT", + "name": "no_latch", + "input": [ + 300.0, + 20.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 300.0, + 20.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "return_cross", + "input": [ + 300.0, + -5.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 600.0, + 0.100000001 + ], + "observed": [ + 300.0, + 0.0, + 1.0 + ] + }, + { + "kind": "INPUT", + "name": "ground_up", + "input": [ + 300.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 1.0, + 600.0, + 0.100000001 + ], + "observed": [ + 312.5, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "ground_small", + "input": [ + 5.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 600.0, + 0.100000001 + ], + "observed": [ + -12.5, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "ground_negative", + "input": [ + -300.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 600.0, + 0.100000001 + ], + "observed": [ + 0.0, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "ground_down", + "input": [ + 300.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 1.0, + 600.0, + 0.100000001 + ], + "observed": [ + 247.5, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "ground_up_down", + "input": [ + 0.0, + 0.0, + 0.0, + 1.0, + 1.0, + 0.0, + 0.0, + 1.0, + 600.0, + 0.100000001 + ], + "observed": [ + 0.0, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "tick", + "input": [ + 580.0, + 29.0, + 1.0, + 1.0, + 0.0, + 1.0, + 0.0, + 0.0, + 600.0, + 0.0166666675 + ], + "observed": [ + 600.0, + 30.0, + 1.0 + ] + }, + { + "kind": "APPLY", + "name": "rest", + "input": [ + 300.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 30.0, + 0.800000012, + 0.100000001 + ], + "observed": [ + 0.0, + 0.0, + 300.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + }, + { + "kind": "APPLY", + "name": "rising", + "input": [ + 300.0, + 0.0, + 10.0, + 0.0, + 0.0, + 0.0, + 0.0, + 30.0, + 0.800000012, + 0.100000001 + ], + "observed": [ + 17.0432549, + 10.0, + 301.298187, + 0.0, + 3.0, + 0.0, + 30.0 + ] + }, + { + "kind": "APPLY", + "name": "falling", + "input": [ + 300.0, + 0.0, + -10.0, + 0.0, + 0.0, + 90.0, + 0.0, + -30.0, + 0.800000012, + 0.100000001 + ], + "observed": [ + -301.304718, + -10.0, + -16.9277077, + 0.0, + 87.0, + 0.0, + -30.0 + ] + }, + { + "kind": "APPLY", + "name": "forward", + "input": [ + 300.0, + 0.0, + 0.0, + 300.0, + 0.0, + 0.0, + 0.0, + 30.0, + 0.800000012, + 0.100000001 + ], + "observed": [ + 17.0432549, + 0.0, + 301.298187, + 0.0, + 3.0, + 0.0, + 30.0 + ] + }, + { + "kind": "APPLY", + "name": "uphill", + "input": [ + 300.0, + 0.0, + -10.0, + 300.0, + 30.0, + 45.0, + 0.0, + 30.0, + 0.800000012, + 0.100000001 + ], + "observed": [ + -171.149582, + -10.0, + 198.214172, + 30.0, + 48.0, + 0.0, + 30.0 + ] + }, + { + "kind": "APPLY", + "name": "downhill", + "input": [ + 300.0, + 0.0, + -10.0, + 300.0, + 330.0, + 45.0, + 0.0, + 30.0, + 0.800000012, + 0.100000001 + ], + "observed": [ + -171.106842, + -10.0, + 198.175674, + 330.0, + 48.0, + 0.0, + 30.0 + ] + }, + { + "kind": "APPLY", + "name": "roll", + "input": [ + 300.0, + 0.0, + -10.0, + 300.0, + 0.0, + 45.0, + 30.0, + 30.0, + 0.800000012, + 0.100000001 + ], + "observed": [ + -200.998596, + -10.0, + 225.10141, + 0.0, + 48.0, + 30.0, + 30.0 + ] + }, + { + "kind": "APPLY", + "name": "near_seam", + "input": [ + 300.0, + 0.0, + 1.0, + 0.0, + 0.0, + 359.5, + 0.0, + 30.0, + 0.800000012, + 0.100000001 + ], + "observed": [ + 19.7001266, + 1.0, + 301.136139, + 0.0, + 2.5, + 0.0, + 30.0 + ] + }, + { + "kind": "APPLY", + "name": "negative_euler", + "input": [ + 300.0, + 0.0, + 1.0, + 0.0, + -3.0, + -1.0, + -2.0, + 30.0, + 0.800000012, + 0.100000001 + ], + "observed": [ + 22.2544899, + 1.0, + 300.545502, + 357.0, + 2.0, + 358.0, + 30.0 + ] + }, + { + "kind": "APPLY", + "name": "no_friction", + "input": [ + 300.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 30.0, + 0.0, + 0.100000001 + ], + "observed": [ + 147.774338, + 1.0, + 308.122711, + 0.0, + 3.0, + 0.0, + 30.0 + ] + }, + { + "kind": "APPLY", + "name": "reverse", + "input": [ + -300.0, + 0.0, + -10.0, + -300.0, + 0.0, + 180.0, + 0.0, + -20.0, + 0.800000012, + 0.100000001 + ], + "observed": [ + -11.2223301, + -10.0, + 300.582916, + 0.0, + 178.0, + 0.0, + -20.0 + ] + }, + { + "kind": "APPLY", + "name": "zero_scalar", + "input": [ + 0.0, + 0.0, + -10.0, + 300.0, + 0.0, + 0.0, + 0.0, + 30.0, + 0.800000012, + 0.100000001 + ], + "observed": [ + 0.0, + -10.0, + 0.0, + 0.0, + 3.0, + 0.0, + 30.0 + ] + }, + { + "kind": "APPLY", + "name": "tick", + "input": [ + 600.0, + 10.0, + -13.0, + 500.0, + 5.0, + 179.0, + 3.0, + 29.0, + 0.800000012, + 0.0166666675 + ], + "observed": [ + -68.7713776, + -13.0, + -597.1203, + 5.0, + 179.483337, + 3.0, + 29.0 + ] + } + ] +} diff --git a/tests/GamePort.JimmyAirTests/original-air-targets-reference.json b/tests/GamePort.JimmyAirTests/original-air-targets-reference.json new file mode 100644 index 0000000..9222e29 --- /dev/null +++ b/tests/GamePort.JimmyAirTests/original-air-targets-reference.json @@ -0,0 +1,510 @@ +{ + "source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8", + "ranges": [ + { + "va": "0x439900", + "file_offset": "0x39900", + "length": 1207, + "sha256": "e6fd687cd797d004d9584bb7b6c004def933b9c496ef17a19a607be5c05e1236" + }, + { + "va": "0x437f90", + "file_offset": "0x37f90", + "length": 410, + "sha256": "0d65625eea1015707e9d5001196c15a945cb93b14b03cd022d98687778c9846c" + }, + { + "va": "0x4723f0", + "file_offset": "0x723f0", + "length": 48, + "sha256": "ae10074b5ae2ff3d2d2ce8c16358476acdba2f2a166be8ad5c9f05e3f55ffc23" + }, + { + "va": "0x472480", + "file_offset": "0x72480", + "length": 240, + "sha256": "406c3904538abe07d88ca440e39ca56c00765d0871943991ba7b792da4803c16" + }, + { + "va": "0x472b10", + "file_offset": "0x72b10", + "length": 256, + "sha256": "ee9516aef07738fcf7da370af74185f7522686759218ad1bf4d93be46f0c28b2" + } + ], + "relocations": [ + { + "va": 4431078, + "target": 4772864 + }, + { + "va": 4431266, + "target": 4772868 + }, + { + "va": 4430132, + "target": 4774164 + }, + { + "va": 4430237, + "target": 4774164 + }, + { + "va": 4430275, + "target": 4774164 + }, + { + "va": 4430306, + "target": 4774164 + }, + { + "va": 4430344, + "target": 4774164 + }, + { + "va": 4430786, + "target": 4774164 + }, + { + "va": 4430885, + "target": 4774164 + }, + { + "va": 4430957, + "target": 4774164 + }, + { + "va": 4430978, + "target": 4774164 + }, + { + "va": 4431009, + "target": 4774164 + }, + { + "va": 4430443, + "target": 4774180 + }, + { + "va": 4430202, + "target": 4774216 + }, + { + "va": 4430495, + "target": 4774216 + }, + { + "va": 4430608, + "target": 4774216 + }, + { + "va": 4430738, + "target": 4774216 + }, + { + "va": 4430805, + "target": 4774216 + }, + { + "va": 4430939, + "target": 4774216 + }, + { + "va": 4430167, + "target": 4774220 + }, + { + "va": 4430845, + "target": 4774220 + }, + { + "va": 4430257, + "target": 4774252 + }, + { + "va": 4430326, + "target": 4774252 + }, + { + "va": 4430372, + "target": 4774252 + }, + { + "va": 4430396, + "target": 4774252 + }, + { + "va": 4430713, + "target": 4838876 + }, + { + "va": 4430512, + "target": 4848340 + }, + { + "va": 4431047, + "target": 4865656 + }, + { + "va": 4431235, + "target": 4914472 + }, + { + "va": 4431115, + "target": 4914476 + }, + { + "va": 4431162, + "target": 4914476 + }, + { + "va": 4430862, + "target": 4914480 + }, + { + "va": 4430149, + "target": 5281885 + }, + { + "va": 4430471, + "target": 5281886 + }, + { + "va": 4430594, + "target": 5281886 + }, + { + "va": 4430184, + "target": 5281887 + }, + { + "va": 4430831, + "target": 5281888 + }, + { + "va": 4430161, + "target": 5282464 + }, + { + "va": 4430196, + "target": 5282464 + }, + { + "va": 4430489, + "target": 5282468 + }, + { + "va": 4430602, + "target": 5282468 + }, + { + "va": 4430839, + "target": 5282468 + }, + { + "va": 4423800, + "target": 4772108 + }, + { + "va": 4423682, + "target": 4774164 + }, + { + "va": 4423741, + "target": 4774180 + }, + { + "va": 4423789, + "target": 4777448 + }, + { + "va": 4423753, + "target": 4838840 + }, + { + "va": 4662415, + "target": 4774164 + }, + { + "va": 4662490, + "target": 4774164 + }, + { + "va": 4662565, + "target": 4774164 + }, + { + "va": 4662455, + "target": 4777412 + }, + { + "va": 4662468, + "target": 4777412 + }, + { + "va": 4662530, + "target": 4777412 + }, + { + "va": 4662543, + "target": 4777412 + }, + { + "va": 4662613, + "target": 4777412 + }, + { + "va": 4662626, + "target": 4777412 + }, + { + "va": 4664145, + "target": 4772108 + }, + { + "va": 4664108, + "target": 4777448 + }, + { + "va": 4664119, + "target": 4777448 + }, + { + "va": 4664132, + "target": 4777448 + } + ], + "target_range": { + "va": "0x439db7", + "file_offset": "0x39db7", + "length": 124, + "sha256": "202e8ef05e362b5745f6a501d69aa840f06bd348df4c3377d72fc64d0b0e7310" + }, + "scope": "Copied439900 through439E33; synthetic destination writer, actor/body/input and zero mouse; no camera, facing update, physics, game entrypoint or full trajectory.", + "cases": [ + { + "input": [ + 0.0, + 0.0, + 0.0, + 0.0, + 300.0, + 0.0, + -40.0, + 10.0 + ], + "observed": [ + 0.0, + 45.0, + -0.0, + 1.0 + ] + }, + { + "input": [ + 1.0, + 0.0, + 0.0, + 0.0, + 300.0, + 0.0, + -40.0, + 10.0 + ], + "observed": [ + -40.0, + 45.0, + -0.0, + 1.0 + ] + }, + { + "input": [ + 0.0, + 1.0, + 0.0, + 0.0, + 300.0, + 0.0, + -40.0, + 10.0 + ], + "observed": [ + 10.0, + 45.0, + -0.0, + 1.0 + ] + }, + { + "input": [ + 1.0, + 1.0, + 0.0, + 0.0, + 300.0, + 0.0, + -40.0, + 10.0 + ], + "observed": [ + -40.0, + 45.0, + -0.0, + 1.0 + ] + }, + { + "input": [ + 0.0, + 0.0, + 1.0, + 0.0, + 300.0, + 0.0, + -40.0, + 10.0 + ], + "observed": [ + 0.0, + 45.0, + -1.66666675, + 1.0 + ] + }, + { + "input": [ + 0.0, + 0.0, + 0.0, + 1.0, + 300.0, + 0.0, + -40.0, + 10.0 + ], + "observed": [ + 0.0, + 45.0, + 1.66666675, + 1.0 + ] + }, + { + "input": [ + 1.0, + 0.0, + 1.0, + 0.0, + 300.0, + 0.0, + -40.0, + 10.0 + ], + "observed": [ + -40.0, + 45.0, + -1.66666675, + 1.0 + ] + }, + { + "input": [ + 0.0, + 1.0, + 0.0, + 1.0, + 300.0, + 0.0, + -40.0, + 10.0 + ], + "observed": [ + 10.0, + 45.0, + 1.66666675, + 1.0 + ] + }, + { + "input": [ + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 1.0, + -40.0, + 10.0 + ], + "observed": [ + 10.0, + 45.0, + -0.0, + 1.0 + ] + }, + { + "input": [ + 1.0, + 0.0, + 0.0, + 0.0, + 700.0, + 1.0, + -40.0, + 10.0 + ], + "observed": [ + -40.0, + 45.0, + -0.0, + 1.0 + ] + }, + { + "input": [ + 1.0, + 0.0, + 0.0, + 0.0, + 300.0, + 0.0, + 0.0, + 0.0 + ], + "observed": [ + 0.0, + 45.0, + -0.0, + 1.0 + ] + }, + { + "input": [ + 0.0, + 1.0, + 0.0, + 0.0, + 300.0, + 0.0, + -13.0, + 7.0 + ], + "observed": [ + 7.0, + 45.0, + -0.0, + 1.0 + ] + } + ], + "files": { + "tools/binary/jimmy_air_targets.py": "393a30df077845f55f3ba6e9f93ecbf206a73cae5a77eee9ff7ba9d0c2db8bf7", + "tools/binary/jimmy_air_targets_probe.c": "c63d98fb4a28c0e77da15a6c49dd8cc87ae5516358f35784ebc32957a7c02471", + "tools/binary/jimmy_air_motion_probe.c": "4f825d33dcf161d2a119d06f288db384ecb2468d36c4ae8f668fbeacbfc8eb6e", + "tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810", + "artifacts/jimmy-air-targets/jimmy_air_targets_probe.exe": "c491683ae810d9d44fb31ed0fdab319016d9a3bea6654412737ecf1db10103ae", + "artifacts/jimmy-air-targets/probe/wine.log": "1de345403a421435211e389d2b16c5f1b8bd9914a6de7eb2e6f75f4cb7cb08a2" + } +} diff --git a/tests/GamePort.JimmyGroundTests/GamePort.JimmyGroundTests.csproj b/tests/GamePort.JimmyGroundTests/GamePort.JimmyGroundTests.csproj new file mode 100644 index 0000000..fe6a5d2 --- /dev/null +++ b/tests/GamePort.JimmyGroundTests/GamePort.JimmyGroundTests.csproj @@ -0,0 +1,7 @@ + + Exenet10.0enableenablefalse + + + + + diff --git a/tests/GamePort.JimmyGroundTests/Program.cs b/tests/GamePort.JimmyGroundTests/Program.cs new file mode 100644 index 0000000..45fea02 --- /dev/null +++ b/tests/GamePort.JimmyGroundTests/Program.cs @@ -0,0 +1,29 @@ +using System.Numerics; +using System.Text.Json; +using GamePort.Game; +using var document=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-ground-reference.json"))); +int inputs=0,applies=0; +foreach(var c in document.RootElement.GetProperty("cases").EnumerateArray()) +{ + var p=c.GetProperty("input").EnumerateArray().Select(v=>v.GetSingle()).ToArray(); + var o=c.GetProperty("observed").EnumerateArray().Select(v=>v.GetSingle()).ToArray();string name=c.GetProperty("name").GetString()!; + if(c.GetProperty("kind").GetString()=="INPUT") + { + var r=JimmyGroundMotion.Input(new(p[0],0,p[6],p[7]!=0),p[5],new(p[1]!=0,p[2]!=0,p[3]!=0,p[4]!=0,false)); + Near(r.State.Speed,o[0],name+" scalar");Near(r.Lateral,o[1],name+" side");Near(r.State.TargetYaw,o[2],name+" heading"); + Check(r.State.AutoTurning==(o[3]!=0),name+" latch");inputs++; + } + else + { + var r=JimmyGroundMotion.Apply(p[0],new(p[1],p[2],p[3]),new(p[4],p[5],p[6]),p[7],p[8],p[9]!=0,p[10]!=0,p[11]); + Near(r.Velocity.X,o[0],name+" X");Near(r.Velocity.Y,o[1],name+" Y");Near(r.Velocity.Z,o[2],name+" Z");Near(r.Rotation.Y,o[3],name+" yaw");applies++; + } +} +Check(inputs==17&&applies==8,"complete25 native observations");Console.WriteLine("PASS17 original ground-input observations and8 ground-apply observations"); +var active=JimmyGroundMotion.Input(new(100,130),90,new(true,false,false,false,false));Check(active.State.TargetYaw==90,"active forward stops previous destination-yaw drift"); +var idle=JimmyGroundMotion.Input(new(100,130),90,default);Check(idle.State.TargetYaw==130,"idle retains prior destination yaw"); +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"); +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/GamePort.JimmyGroundTests/original-ground-reference.json b/tests/GamePort.JimmyGroundTests/original-ground-reference.json new file mode 100644 index 0000000..e1fa16f --- /dev/null +++ b/tests/GamePort.JimmyGroundTests/original-ground-reference.json @@ -0,0 +1,584 @@ +{ + "source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8", + "ranges": [ + { + "va": "0x43915d", + "file_offset": "0x3915d", + "length": 1138, + "sha256": "5d59e3d539ed3cd160bbbe5f49c03b2bd7085167fecfc9319aa1a73d98422bad" + }, + { + "va": "0x437c40", + "file_offset": "0x37c40", + "length": 831, + "sha256": "d61d6696fe5ca9ae955fb8c4a5ed551582e709ce914b7e25e26c7fe5721630b6" + }, + { + "va": "0x4723f0", + "file_offset": "0x723f0", + "length": 48, + "sha256": "ae10074b5ae2ff3d2d2ce8c16358476acdba2f2a166be8ad5c9f05e3f55ffc23" + }, + { + "va": "0x472480", + "file_offset": "0x72480", + "length": 240, + "sha256": "406c3904538abe07d88ca440e39ca56c00765d0871943991ba7b792da4803c16" + }, + { + "va": "0x472b10", + "file_offset": "0x72b10", + "length": 256, + "sha256": "ee9516aef07738fcf7da370af74185f7522686759218ad1bf4d93be46f0c28b2" + }, + { + "va": "0x476ff0", + "file_offset": "0x76ff0", + "length": 1184, + "sha256": "fb184f561d9aace113da3a8bff9dd2d2effceb9233507aeb1018b5cbde82cb94" + } + ], + "scope": "Copied43915D keyboard suffix and complete437C40, synthetic actor/body/support/animations and original OMT vector/trig. No input prefix/camera/game entrypoint; back-timer values are explicit test inputs.", + "files": { + "tools/binary/jimmy_ground_motion.py": "24ac3673c567f3c2d1cb2010a7cffa2ec4feb600144ffc739a52e8eba9124ed1", + "tools/binary/jimmy_ground_motion_probe.c": "9d331a791e5a52ccf03cd566abb44b211a978d47903f3a428ccd1ad44e3e55ee", + "tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810", + "artifacts/jimmy-ground-audit/jimmy_ground_motion_probe.exe": "04eb9135202420d6c6639f060fa3d1272c6e4bf4ee336de7c4a2f6d916d54f94", + "artifacts/jimmy-ground-audit/probe/wine.log": "2f4aa1d3050629214257012e213682de585a6d7a2db82becffb276cf188ee3ad" + }, + "cases": [ + { + "kind": "INPUT", + "name": "up", + "input": [ + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 30.0, + 0.0, + 90.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "left", + "input": [ + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 0.0, + -1000.0, + 110.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "right", + "input": [ + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 0.0, + 1000.0, + 70.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "upleft", + "input": [ + 100.0, + 1.0, + 0.0, + 1.0, + 0.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 160.0, + -1000.0, + 100.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "upright", + "input": [ + 100.0, + 1.0, + 0.0, + 0.0, + 1.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 160.0, + 1000.0, + 80.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "bothturn", + "input": [ + 100.0, + 1.0, + 0.0, + 1.0, + 1.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 160.0, + -1000.0, + 100.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "back", + "input": [ + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + -52.5, + 0.0, + 90.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "all", + "input": [ + 100.0, + 1.0, + 1.0, + 1.0, + 1.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 107.5, + -1000.0, + 100.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "release", + "input": [ + 100.0, + 0.0, + 0.0, + 0.0, + 0.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 65.0, + 0.0, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "negative", + "input": [ + -20.0, + 0.0, + 0.0, + 0.0, + 0.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 0.0, + 0.0, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "cross", + "input": [ + 20.0, + 0.0, + 0.0, + 0.0, + 0.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 0.0, + 0.0, + 0.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "overcap", + "input": [ + 700.0, + 1.0, + 0.0, + 0.0, + 0.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 700.0, + 0.0, + 90.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "turnovercap", + "input": [ + 700.0, + 1.0, + 0.0, + 1.0, + 0.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + 700.0, + -1000.0, + 100.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "backcap", + "input": [ + -299.0, + 0.0, + 1.0, + 0.0, + 0.0, + 90.0, + 0.0, + 0.0 + ], + "observed": [ + -300.0, + 0.0, + 90.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "backequal", + "input": [ + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 90.0, + 1.5, + 0.0 + ], + "observed": [ + -52.5, + 0.0, + 90.0, + 0.0 + ] + }, + { + "kind": "INPUT", + "name": "backturn", + "input": [ + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 90.0, + 1.50999999, + 0.0 + ], + "observed": [ + 600.0, + 0.0, + 270.0, + 1.0 + ] + }, + { + "kind": "INPUT", + "name": "latched", + "input": [ + 0.0, + 0.0, + 1.0, + 1.0, + 0.0, + 90.0, + 2.0, + 1.0 + ], + "observed": [ + 600.0, + -1000.0, + 80.0, + 1.0 + ] + }, + { + "kind": "APPLY", + "name": "rest", + "input": [ + 300.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.100000001 + ], + "observed": [ + 0.0, + 0.0, + 300.0, + 0.0 + ] + }, + { + "kind": "APPLY", + "name": "stationaryturn", + "input": [ + 300.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 20.0, + 0.0, + 0.0, + 0.0, + 0.100000001 + ], + "observed": [ + 0.0, + 0.0, + 300.0, + 0.0 + ] + }, + { + "kind": "APPLY", + "name": "side", + "input": [ + 300.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + -1000.0, + 0.0, + 0.0, + 0.100000001 + ], + "observed": [ + -100.0, + 0.0, + 300.0, + 0.0 + ] + }, + { + "kind": "APPLY", + "name": "turn", + "input": [ + 300.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 20.0, + 0.0, + 0.0, + 0.0, + 0.100000001 + ], + "observed": [ + -7.80225086, + 0.0, + 299.9104, + 2.0 + ] + }, + { + "kind": "APPLY", + "name": "tilt", + "input": [ + 300.0, + 0.0, + 13.0, + 1.0, + 30.0, + 45.0, + 20.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.100000001 + ], + "observed": [ + -183.725281, + 13.0, + 183.725281, + 45.0 + ] + }, + { + "kind": "APPLY", + "name": "ground", + "input": [ + 300.0, + 0.0, + 13.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 1.0, + 0.100000001 + ], + "observed": [ + 0.0, + -237.0, + 300.0, + 0.0 + ] + }, + { + "kind": "APPLY", + "name": "ground_nopoly", + "input": [ + 300.0, + 0.0, + 13.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.100000001 + ], + "observed": [ + 0.0, + 13.0, + 300.0, + 0.0 + ] + }, + { + "kind": "APPLY", + "name": "fall", + "input": [ + 300.0, + 0.0, + -13.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.100000001 + ], + "observed": [ + 0.0, + -13.0, + 300.0, + 0.0 + ] + } + ], + "dll_sha256": "3ec41ead011adf56387a6dbd4580e5b5a9721b5f8020c8a56420f42824354943" +} diff --git a/tests/GamePort.JimmyJumpTests/GamePort.JimmyJumpTests.csproj b/tests/GamePort.JimmyJumpTests/GamePort.JimmyJumpTests.csproj new file mode 100644 index 0000000..53d576c --- /dev/null +++ b/tests/GamePort.JimmyJumpTests/GamePort.JimmyJumpTests.csproj @@ -0,0 +1,6 @@ + + Exenet10.0enableenablefalse + + + + diff --git a/tests/GamePort.JimmyJumpTests/Program.cs b/tests/GamePort.JimmyJumpTests/Program.cs new file mode 100644 index 0000000..b6ff701 --- /dev/null +++ b/tests/GamePort.JimmyJumpTests/Program.cs @@ -0,0 +1,18 @@ +using System.Text.Json; +using GamePort.Game; +using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-jump-reference.json"))); +int compared=0; +foreach(var c in doc.RootElement.GetProperty("cases").EnumerateArray()) +{ + var p=c.GetProperty("input").EnumerateArray().ToArray();var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray(); + float F(int i)=>p[i].GetSingle();bool B(int i)=>F(i)!=0; + var input=new JetpackBurstInput(B(3),B(4),F(5),F(6),(int)F(7),F(8),p[9].GetString()!,(int)F(10),F(11),F(12),B(13)); + var r=JetpackBurst.Step(new((int)F(0),F(1),F(2)),input);string name=c.GetProperty("name").GetString()!; + Near(r.State.JumpState,o[0],name+" state");Near(r.State.HoldSeconds,o[1],name+" hold");Near(r.State.EffectRemaining,o[2],name+" timer"); + Near(r.ImpulseY,o[3],name+" impulse");Near(r.VelocityYOverride??input.VelocityY,o[4],name+" vertical");Near(r.ExtraAccelerationY,o[5],name+" acceleration"); + Near((int)r.Pose,o[6],name+" animation");Check(r.StartGadget==(o[7]!=0)&&r.StopGadget==(o[8]!=0),name+" effect calls"); + Near(r.RadiusOverride??60,o[9],name+" radius");Check(r.RadiusOverride.HasValue==(o[10]!=0),name+" radius write");compared++; +} +Check(compared==32,"complete native fixture");Console.WriteLine("PASS32 copied-original jump/hold/release/landing/jetpack suffix observations"); +static void Check(bool condition,string message){if(!condition)throw new Exception(message);} +static void Near(float a,float b,string message)=>Check(MathF.Abs(a-b)<.0002f,$"{message}: {a} != {b}"); diff --git a/tests/GamePort.JimmyJumpTests/original-jump-reference.json b/tests/GamePort.JimmyJumpTests/original-jump-reference.json new file mode 100644 index 0000000..0c2a635 --- /dev/null +++ b/tests/GamePort.JimmyJumpTests/original-jump-reference.json @@ -0,0 +1,1290 @@ +{ + "source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8", + "ranges": [ + { + "va": "0x437f90", + "file_offset": "0x37f90", + "length": 2120, + "sha256": "6df336d3c6dab62c15fa77f2d8bdce4bae30763bc2dd95492b4c39b73d889d9c" + }, + { + "va": "0x4723f0", + "file_offset": "0x723f0", + "length": 48, + "sha256": "ae10074b5ae2ff3d2d2ce8c16358476acdba2f2a166be8ad5c9f05e3f55ffc23" + }, + { + "va": "0x472480", + "file_offset": "0x72480", + "length": 240, + "sha256": "406c3904538abe07d88ca440e39ca56c00765d0871943991ba7b792da4803c16" + }, + { + "va": "0x472b10", + "file_offset": "0x72b10", + "length": 256, + "sha256": "ee9516aef07738fcf7da370af74185f7522686759218ad1bf4d93be46f0c28b2" + } + ], + "relocations": [ + { + "va": 4424565, + "target": 4425644 + }, + { + "va": 4425518, + "target": 4425668 + }, + { + "va": 4423800, + "target": 4772108 + }, + { + "va": 4423682, + "target": 4774164 + }, + { + "va": 4424100, + "target": 4774164 + }, + { + "va": 4424823, + "target": 4774164 + }, + { + "va": 4425138, + "target": 4774164 + }, + { + "va": 4424423, + "target": 4774176 + }, + { + "va": 4423741, + "target": 4774180 + }, + { + "va": 4424512, + "target": 4774252 + }, + { + "va": 4424216, + "target": 4777404 + }, + { + "va": 4423789, + "target": 4777448 + }, + { + "va": 4424322, + "target": 4829688 + }, + { + "va": 4424267, + "target": 4837304 + }, + { + "va": 4423753, + "target": 4838840 + }, + { + "va": 4424373, + "target": 4862224 + }, + { + "va": 4424719, + "target": 4914400 + }, + { + "va": 4424041, + "target": 4914404 + }, + { + "va": 4424956, + "target": 5163616 + }, + { + "va": 4425270, + "target": 5163616 + }, + { + "va": 4424148, + "target": 5174248 + }, + { + "va": 4424669, + "target": 5174248 + }, + { + "va": 4425386, + "target": 5174248 + }, + { + "va": 4425546, + "target": 5174248 + }, + { + "va": 4424805, + "target": 5178760 + }, + { + "va": 4425120, + "target": 5178760 + }, + { + "va": 4424602, + "target": 5178860 + }, + { + "va": 4424524, + "target": 5178868 + }, + { + "va": 4424112, + "target": 5178888 + }, + { + "va": 4424817, + "target": 5211092 + }, + { + "va": 4425132, + "target": 5211092 + }, + { + "va": 4424736, + "target": 5282120 + }, + { + "va": 4424881, + "target": 5282120 + }, + { + "va": 4425051, + "target": 5282120 + }, + { + "va": 4425195, + "target": 5282120 + }, + { + "va": 4424035, + "target": 6093828 + }, + { + "va": 4424054, + "target": 6093828 + }, + { + "va": 4424248, + "target": 6093828 + }, + { + "va": 4424261, + "target": 6093828 + }, + { + "va": 4424354, + "target": 6093828 + }, + { + "va": 4424367, + "target": 6093828 + }, + { + "va": 4424417, + "target": 6093828 + }, + { + "va": 4424436, + "target": 6093828 + }, + { + "va": 4662415, + "target": 4774164 + }, + { + "va": 4662490, + "target": 4774164 + }, + { + "va": 4662565, + "target": 4774164 + }, + { + "va": 4662455, + "target": 4777412 + }, + { + "va": 4662468, + "target": 4777412 + }, + { + "va": 4662530, + "target": 4777412 + }, + { + "va": 4662543, + "target": 4777412 + }, + { + "va": 4662613, + "target": 4777412 + }, + { + "va": 4662626, + "target": 4777412 + }, + { + "va": 4664145, + "target": 4772108 + }, + { + "va": 4664108, + "target": 4777448 + }, + { + "va": 4664119, + "target": 4777448 + }, + { + "va": 4664132, + "target": 4777448 + } + ], + "scope": "Copied full437F90, synthetic base actor, effect, inventory, level, animation; original OMT trig. No game entrypoint or body. Grounded-release outer437940 bypass is not in cases.", + "files": { + "tools/binary/jimmy_jump_motion.py": "80dd1883e21d5c64fc45e3384abe64247158ddafe745c1dd2c452ae41829009c", + "tools/binary/jimmy_jump_motion_probe.c": "f94bc83330d73abd3e0b09515e95ab230482e0851b4105318719e109d1294a04", + "tools/binary/jimmy_air_motion_probe.c": "4f825d33dcf161d2a119d06f288db384ecb2468d36c4ae8f668fbeacbfc8eb6e", + "tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810", + "artifacts/jimmy-jump-audit/jimmy_jump_motion_probe.exe": "3b570f908e01ce3548f5afca0e81d1682937ddd4a474fe8f889b8ab33332100e", + "artifacts/jimmy-jump-audit/probe/wine.log": "068b2d673a93d68bc168628cb63c4d04bf80b7913a671da28513c6a31a4339ed" + }, + "cases": [ + { + "name": "state0_released", + "input": [ + 0.0, + 0.200000003, + 4.0, + 0.0, + 0.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 0.0, + 0.200000003, + 4.0, + 0.0, + 20.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "state0_held", + "input": [ + 0.0, + 0.200000003, + 4.0, + 0.0, + 1.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 0.0, + 0.200000003, + 4.0, + 0.0, + 20.0, + -264.000031, + 2.0, + 0.0, + 1.0, + 60.0, + 0.0 + ] + }, + { + "name": "state1_released", + "input": [ + 1.0, + 0.200000003, + 4.0, + 0.0, + 0.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 2.0, + 0.200000003, + 4.0, + 0.0, + 20.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "state1_held", + "input": [ + 1.0, + 0.200000003, + 4.0, + 0.0, + 1.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 1.0, + 0.300000012, + 4.0, + 0.0, + 20.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "state2_released", + "input": [ + 2.0, + 0.200000003, + 4.0, + 0.0, + 0.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 2.0, + 0.200000003, + 4.0, + 0.0, + 20.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "state2_held", + "input": [ + 2.0, + 0.200000003, + 4.0, + 0.0, + 1.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.200000003, + 8.0, + 0.0, + 10.0, + -264.000031, + 3.0, + 1.0, + 0.0, + 100.0, + 1.0 + ] + }, + { + "name": "state3_released", + "input": [ + 3.0, + 0.200000003, + 4.0, + 0.0, + 0.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 4.0, + 0.200000003, + 0.0, + 0.0, + 20.0, + 880.0, + 2.0, + 0.0, + 1.0, + 60.0, + 0.0 + ] + }, + { + "name": "state3_held", + "input": [ + 3.0, + 0.200000003, + 4.0, + 0.0, + 1.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.200000003, + 4.0, + 0.0, + 20.0, + 880.0, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "state4_released", + "input": [ + 4.0, + 0.200000003, + 4.0, + 0.0, + 0.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 0.0, + 0.200000003, + 4.0, + 0.0, + 20.0, + 880.0, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "state4_held", + "input": [ + 4.0, + 0.200000003, + 4.0, + 0.0, + 1.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 4.0, + 0.200000003, + 4.0, + 0.0, + 20.0, + 880.0, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "state5_released", + "input": [ + 5.0, + 0.200000003, + 4.0, + 0.0, + 0.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 5.0, + 0.200000003, + 4.0, + 0.0, + 20.0, + 880.0, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "state5_held", + "input": [ + 5.0, + 0.200000003, + 4.0, + 0.0, + 1.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 5.0, + 0.200000003, + 4.0, + 0.0, + 20.0, + 880.0, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "takeoff", + "input": [ + 0.0, + 0.0, + 0.0, + 1.0, + 1.0, + 0.0, + 75.9000015, + 0.0, + 100.0, + "LV1B", + -1.0, + 0.0166666675, + 0.0, + 1.0 + ], + "observed": [ + 1.0, + 0.0, + 0.0, + 550.0, + 0.0, + -264.000031, + 1.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "land_held", + "input": [ + 3.0, + 0.699999988, + 4.0, + 1.0, + 1.0, + -40.0, + 75.9000015, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + 880.0, + 1.0 + ], + "observed": [ + 4.0, + 0.699999988, + 0.0, + 0.0, + -40.0, + 1040.0, + 2.0, + 0.0, + 1.0, + 60.0, + 1.0 + ] + }, + { + "name": "land_state5", + "input": [ + 5.0, + 0.699999988, + 4.0, + 1.0, + 1.0, + -40.0, + 75.9000015, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + 880.0, + 1.0 + ], + "observed": [ + 0.0, + 0.699999988, + 4.0, + 0.0, + -40.0, + 1040.0, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "hold_equal", + "input": [ + 1.0, + 0.300000012, + 0.0, + 0.0, + 1.0, + 200.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.400000006, + 8.0, + 0.0, + 10.0, + -264.000031, + 3.0, + 1.0, + 0.0, + 100.0, + 1.0 + ] + }, + { + "name": "hold_exact_input", + "input": [ + 1.0, + 0.400000006, + 0.0, + 0.0, + 1.0, + 200.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.0, + -264.0, + 1.0 + ], + "observed": [ + 1.0, + 0.400000006, + 0.0, + 0.0, + 200.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "hold_tick", + "input": [ + 1.0, + 0.383333325, + 0.0, + 0.0, + 1.0, + 200.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.0166666675, + -264.0, + 1.0 + ], + "observed": [ + 1.0, + 0.400000006, + 0.0, + 0.0, + 200.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "hold_over", + "input": [ + 1.0, + 0.400000006, + 0.0, + 0.0, + 1.0, + 200.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.00100000005, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.400999993, + 8.0, + 0.0, + 10.0, + -264.000031, + 3.0, + 1.0, + 0.0, + 100.0, + 1.0 + ] + }, + { + "name": "no_inventory", + "input": [ + 2.0, + 0.200000003, + 0.0, + 0.0, + 1.0, + -20.0, + 200.0, + 0.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.200000003, + 0.0, + 0.0, + -20.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "disabled_inventory", + "input": [ + 2.0, + 0.200000003, + 0.0, + 0.0, + 1.0, + -20.0, + 200.0, + 4.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.200000003, + 0.0, + 0.0, + -20.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "no_energy", + "input": [ + 2.0, + 0.200000003, + 0.0, + 0.0, + 1.0, + -20.0, + 200.0, + 1.0, + 0.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.200000003, + 0.0, + 0.0, + -20.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "tutorial_bypass", + "input": [ + 2.0, + 0.200000003, + 0.0, + 0.0, + 1.0, + -20.0, + 200.0, + 0.0, + 0.0, + "VR04", + 6.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.200000003, + 8.0, + 0.0, + 10.0, + -264.000031, + 3.0, + 1.0, + 0.0, + 100.0, + 1.0 + ] + }, + { + "name": "blocked_level", + "input": [ + 2.0, + 0.200000003, + 0.0, + 0.0, + 1.0, + -20.0, + 200.0, + 1.0, + 100.0, + "LEV3", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.200000003, + 0.0, + 0.0, + -20.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "blocked_gadget", + "input": [ + 2.0, + 0.200000003, + 0.0, + 0.0, + 1.0, + -20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + 7.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.200000003, + 0.0, + 0.0, + -20.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "expired_3", + "input": [ + 3.0, + 0.200000003, + 0.0, + 0.0, + 1.0, + -20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 0.0, + 0.200000003, + 0.0, + 0.0, + -20.0, + -264.0, + 2.0, + 0.0, + 1.0, + 60.0, + 0.0 + ] + }, + { + "name": "expired_4", + "input": [ + 4.0, + 0.200000003, + -0.100000001, + 0.0, + 0.0, + -20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 0.0, + 0.200000003, + 0.0, + 0.0, + -20.0, + -264.0, + 2.0, + 0.0, + 1.0, + 60.0, + 0.0 + ] + }, + { + "name": "null_effect", + "input": [ + 2.0, + 0.200000003, + 0.0, + 0.0, + 1.0, + -20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 0.0 + ], + "observed": [ + 3.0, + 0.200000003, + 0.0, + 0.0, + 10.0, + -264.000031, + 3.0, + 1.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "far_burn", + "input": [ + 3.0, + 0.200000003, + 4.0, + 0.0, + 1.0, + -20.0, + 500.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.200000003, + 4.0, + 0.0, + -20.0, + 720.0, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "near_fall", + "input": [ + 3.0, + 0.200000003, + 4.0, + 0.0, + 1.0, + -2.0, + 499.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.200000003, + 4.0, + 0.0, + -2.0, + 1040.0, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "near_edge", + "input": [ + 3.0, + 0.200000003, + 4.0, + 0.0, + 1.0, + -1.0, + 499.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + -264.0, + 1.0 + ], + "observed": [ + 3.0, + 0.200000003, + 4.0, + 0.0, + -1.0, + 880.0, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + }, + { + "name": "fraction_extra", + "input": [ + 1.0, + 0.200000003, + 4.0, + 0.0, + 0.0, + 20.0, + 200.0, + 1.0, + 100.0, + "LV1B", + -1.0, + 0.100000001, + 17.75, + 1.0 + ], + "observed": [ + 2.0, + 0.200000003, + 4.0, + 0.0, + 20.0, + -264.000031, + 0.0, + 0.0, + 0.0, + 60.0, + 0.0 + ] + } + ] +} diff --git a/tests/GamePort.JimmyOrientationTests/GamePort.JimmyOrientationTests.csproj b/tests/GamePort.JimmyOrientationTests/GamePort.JimmyOrientationTests.csproj new file mode 100644 index 0000000..1d180d0 --- /dev/null +++ b/tests/GamePort.JimmyOrientationTests/GamePort.JimmyOrientationTests.csproj @@ -0,0 +1,6 @@ + + Exenet10.0enableenablefalse + + + + diff --git a/tests/GamePort.JimmyOrientationTests/Program.cs b/tests/GamePort.JimmyOrientationTests/Program.cs new file mode 100644 index 0000000..760a3a5 --- /dev/null +++ b/tests/GamePort.JimmyOrientationTests/Program.cs @@ -0,0 +1,24 @@ +using System.Numerics; +using System.Text.Json; +using GamePort.Game; +using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-orientation-reference.json"))); +int count=0; +foreach(var c in doc.RootElement.GetProperty("cases").EnumerateArray()) +{ + var p=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray(); + var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray(); + var current=new Vector3(p[0],p[1],p[2]);var target=new Vector3(p[3],p[4],p[5]); + bool dirty=p[9]!=0; + for(int i=0;i<(int)p[7];i++) + { + var before=current;current=JimmyOrientation.Step(current,target,p[6],p[8]!=0,dirty); + if(p[8]!=0&&dirty)dirty=before!=target; + } + Check(Vector3.Distance(current,new(o[0],o[1],o[2]))<.001f,$"{c.GetProperty("name").GetString()}: {current} != {o[0]},{o[1]},{o[2]}");count++; +} +Check(count==16,"all original orientation cases"); +Console.WriteLine("PASS16 copied-original Jimmy facing observations: shortest arcs,180 boundaries, negative normalization, gate retention and repeated settling"); +var retained=new Vector3(0,10,0);JimmyOrientation.Step(new(350),retained,1f/60); +Check(retained==new Vector3(0,10,0),"step does not mutate destination state"); +Console.WriteLine("PASS retained target state remains independent of current Euler"); +static void Check(bool ok,string name){if(!ok)throw new Exception(name);} diff --git a/tests/GamePort.JimmyOrientationTests/original-orientation-reference.json b/tests/GamePort.JimmyOrientationTests/original-orientation-reference.json new file mode 100644 index 0000000..2964b22 --- /dev/null +++ b/tests/GamePort.JimmyOrientationTests/original-orientation-reference.json @@ -0,0 +1,374 @@ +{ + "source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8", + "ranges": [ + { + "va": "0x43a420", + "file_offset": "0x3a420", + "length": 431, + "sha256": "e052ee855e625d03a3317dcc7d507081c7519576381afa5741572157e5ffb988" + }, + { + "va": "0x458f90", + "file_offset": "0x58f90", + "length": 38, + "sha256": "7f014c2a630c2e257513df09ab56595ad0fdcf892ea623d483148c002c6931c2" + }, + { + "va": "0x472480", + "file_offset": "0x72480", + "length": 240, + "sha256": "406c3904538abe07d88ca440e39ca56c00765d0871943991ba7b792da4803c16" + } + ], + "constants": { + "0x4afcf0": 3.7, + "0x4afd38": 4.5 + }, + "scope": "Copied43A420/458F90/472480, synthetic enabled/dirty actor; no original AI/body/game entrypoint.", + "rea_evidence": "ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904", + "files": { + "tools/binary/jimmy_orientation.py": "3dab00935c844af6b8792d87923294ae3eb660e4a0a1744836b02e9e81152964", + "tools/binary/jimmy_orientation_probe.c": "b3c194090e58665fbd071e0515a93221057a8a385b0f34e76e57ee5a9274e241", + "tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810", + "artifacts/jimmy-orientation-audit/jimmy_orientation_probe.exe": "b58b0f9bf54c9201abd911a6da75375f9d14422378f3bbf48ff25676b398fc78", + "artifacts/jimmy-orientation-audit/probe/wine.log": "9bc970a46ac7bed33507d4f1388680d478f306667fda3256041fbcdc4f2354b4" + }, + "cases": [ + { + "name": "ordinary", + "input": [ + 10.0, + 20.0, + 30.0, + 0.0, + 30.0, + 0.0, + 0.100000001, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 5.5, + 23.7000008, + 16.5, + 1.0 + ] + }, + { + "name": "level", + "input": [ + 338.0, + 90.0, + 338.0, + 0.0, + 90.0, + 0.0, + 0.0166666675, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 339.649994, + 90.0, + 339.649994, + 1.0 + ] + }, + { + "name": "seam", + "input": [ + 359.0, + 359.0, + 359.0, + 1.0, + 1.0, + 1.0, + 0.100000001, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 359.899994, + 359.73999, + 359.899994, + 1.0 + ] + }, + { + "name": "opposite_seam", + "input": [ + 1.0, + 1.0, + 1.0, + 359.0, + 359.0, + 359.0, + 0.100000001, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 0.0999999642, + 0.25999999, + 0.0999999642, + 1.0 + ] + }, + { + "name": "negative", + "input": [ + -20.0, + -10.0, + -30.0, + 0.0, + 20.0, + 0.0, + 0.100000001, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 349.0, + 1.10000038, + 344.0, + 1.0 + ] + }, + { + "name": "equal180", + "input": [ + 180.0, + 180.0, + 180.0, + 0.0, + 0.0, + 0.0, + 0.100000001, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 99.0, + 113.400002, + 99.0, + 1.0 + ] + }, + { + "name": "positive180", + "input": [ + 0.0, + 0.0, + 0.0, + 180.0, + 180.0, + 180.0, + 0.100000001, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 81.0, + 66.5999985, + 81.0, + 1.0 + ] + }, + { + "name": "over180", + "input": [ + 181.0, + 181.0, + 181.0, + 0.0, + 0.0, + 0.0, + 0.100000001, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 261.549988, + 247.230011, + 261.549988, + 1.0 + ] + }, + { + "name": "canonical360", + "input": [ + 360.0, + 360.0, + 360.0, + 0.0, + 0.0, + 0.0, + 0.100000001, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 360.0, + 360.0, + 360.0, + 1.0 + ] + }, + { + "name": "fractional", + "input": [ + 0.00100000005, + 359.998993, + 0.00100000005, + 359.998993, + 0.00100000005, + 359.998993, + 0.370000005, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 360.0, + 0.00175030529, + 360.0, + 1.0 + ] + }, + { + "name": "tiny", + "input": [ + 0.00999999978, + 0.00999999978, + 0.00999999978, + 0.0, + 0.0, + 0.0, + 0.0166666675, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 0.00925000012, + 0.00938333292, + 0.00925000012, + 1.0 + ] + }, + { + "name": "settle", + "input": [ + 338.0, + 359.0, + 338.0, + 0.0, + 1.0, + 0.0, + 0.0166666675, + 120.0, + 1.0, + 1.0 + ], + "observed": [ + 359.998077, + 0.999036431, + 359.998077, + 1.0 + ] + }, + { + "name": "upright", + "input": [ + 0.0, + 90.0, + 0.0, + 0.0, + 90.0, + 0.0, + 0.100000001, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 0.0, + 90.0, + 0.0, + 0.0 + ] + }, + { + "name": "disabled", + "input": [ + 20.0, + 90.0, + 30.0, + 0.0, + 0.0, + 0.0, + 0.100000001, + 1.0, + 0.0, + 1.0 + ], + "observed": [ + 20.0, + 90.0, + 30.0, + 1.0 + ] + }, + { + "name": "clean", + "input": [ + 20.0, + 90.0, + 30.0, + 0.0, + 0.0, + 0.0, + 0.100000001, + 1.0, + 1.0, + 0.0 + ], + "observed": [ + 20.0, + 90.0, + 30.0, + 0.0 + ] + }, + { + "name": "zero_dt", + "input": [ + 20.0, + 90.0, + 30.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 20.0, + 90.0, + 30.0, + 1.0 + ] + } + ] +} diff --git a/tests/GamePort.MovementTests/Program.cs b/tests/GamePort.MovementTests/Program.cs index 94741c1..485732b 100644 --- a/tests/GamePort.MovementTests/Program.cs +++ b/tests/GamePort.MovementTests/Program.cs @@ -18,6 +18,7 @@ var tests = new (string Name, Action Check)[] ("turn-only speed, forward acceleration/cap and release", SpeedLimits), ("backpedal cap and release", Backpedal), ("yaw sign, forward half-turn and left precedence", Turning), + ("active heading clears stale turn while control lock retains facing", FacingOwnership), ("fixed-step input replay independent of presentation rate", ReplayRates), ("jump rises, falls and returns to support", JumpLanding), ("held zero-burn jump repeats and release stops repetition", HeldJump), @@ -358,8 +359,9 @@ static void Turning() left.Step(new(false, false, true, false, false)); right.Step(new(false, false, false, true, false)); forwardLeft.Step(new(true, false, true, false, false)); - Check(left.Yaw > 0 && right.Yaw < 0, "left/right yaw signs"); - Near(left.Yaw, -right.Yaw, .00001f, "opposed keyboard yaw symmetry"); + Check(left.Yaw > 0 && MathF.IEEERemainder(right.Yaw,360)<0, "left/right yaw directions across source wrap"); + Near(left.Yaw, 1.2333333f, .00001f, "left facing increment"); + Near(right.Yaw, 359, .00001f, "source negative-add truncation at zero seam"); Near(forwardLeft.Yaw, left.Yaw / 2, .00001f, "Up halves target turn offset"); Near(forwardLeft.Speed, 60, 0, "Up plus turn performs both speed increments"); Check(left.Velocity.X < 0 && right.Velocity.X > 0, "keyboard side-velocity signs for next physics pass"); @@ -375,6 +377,37 @@ static void Turning() SameState(both, leftOnly, "Left has precedence when Left and Right are held together"); } +static void FacingOwnership() +{ + var active = FlatSimulation(); + var neutral = FlatSimulation(); + foreach (var simulation in new[] { active, neutral }) + for (var tick = 0; tick < 12; tick++) simulation.Step(new(false, false, true, false, false)); + var heading = active.Yaw; + active.Step(new(true, false, false, false, false)); + neutral.Step(default); + Near(active.Yaw, heading, .0001f, "Up writes current heading instead of retaining the old turn destination"); + Check(neutral.Yaw > heading, "neutral input retains the prior facing destination"); + + var locked = FlatSimulation(); + locked.Step(new(false, false, true, false, false)); + locked.PrepareForScript(); + var before = locked.Yaw; + locked.Step(new(true, false, false, true, true), controlled: false); + Check(locked.Yaw > before && locked.Speed == 0 && locked.ControllerSteps == 1 && locked.Jumps == 0, + "base facing advances its retained target during control lock while input and jump remain gated"); + + var tilted = FlatSimulation(); + tilted.SeedBubbleTilt(new(350, 0, 10)); + tilted.Step(new(true, false, false, false, false)); + Check(tilted.Pitch > 350 && tilted.Pitch < 351 && tilted.Roll < 10 && tilted.Roll > 9, + "ground heading levels all axes by the shortest arc through the zero seam"); + var pitch = tilted.Pitch; + tilted.Step(default, controlled: false); + Check(tilted.Pitch > pitch && tilted.Roll < 9.25f, + "pitch and roll settling belong to the same control-independent facing phase"); +} + static void ReplayRates() { LabSimulation? reference = null; @@ -412,7 +445,7 @@ static void JumpLanding() Check(sawFall && largestHeight - floor > 100, "jump rises and enters descending phase"); Check(simulation.Grounded && simulation.Jumps == 1 && simulation.Landings == 1, "released jump lands once"); Near(simulation.Position.Y, floor, .01f, "landing returns feet to supporting floor"); - Near(simulation.Velocity.Y, 0, 0, "landing clears downward velocity"); + Near(simulation.Velocity.Y, 0, 0, "capsule compatibility landing retains its baseline vertical velocity"); } static void HeldJump() @@ -489,7 +522,7 @@ static void JetpackControl() right.Step(new(true, false, false, true, true)); Check(!left.Grounded && left.JetpackEffectVisible, "steering occurs during powered flight"); } - Check(straight.Position.Z > 400 && left.Yaw > 20 && right.Yaw < -20, + Check(straight.Position.Z > 400 && left.Yaw > 20 && MathF.IEEERemainder(right.Yaw,360)<-20, "powered Up moves from rest and Left/Right turn while airborne"); Check(left.Position.X < -50 && right.Position.X > 50 && left.Position.Y > initialHeight, "powered paths change direction and retain vertical lift"); diff --git a/tests/GamePort.PatrolTests/GamePort.PatrolTests.csproj b/tests/GamePort.PatrolTests/GamePort.PatrolTests.csproj index 9ac66ba..7094cc6 100644 --- a/tests/GamePort.PatrolTests/GamePort.PatrolTests.csproj +++ b/tests/GamePort.PatrolTests/GamePort.PatrolTests.csproj @@ -42,5 +42,8 @@ + + + diff --git a/tests/test_jimmy_air_motion.py b/tests/test_jimmy_air_motion.py new file mode 100644 index 0000000..20194a1 --- /dev/null +++ b/tests/test_jimmy_air_motion.py @@ -0,0 +1,42 @@ +"""Authoritative source guards and copied-original airborne probe provenance.""" +from pathlib import Path +import collections,hashlib,json,sys,unittest +ROOT=Path(__file__).resolve().parents[1] +sys.path.insert(0,str(ROOT/'tools/binary')) +from jimmy_air_motion import collect +from jimmy_air_targets import collect as collect_targets +class JimmyAirMotionEvidence(unittest.TestCase): + def test_destination_writer_original_observations(self): + fixture=json.loads((ROOT/'tests/GamePort.JimmyAirTests/original-air-targets-reference.json').read_text()) + actual=collect_targets(ROOT.parent/'Original') + for key in ('source_sha256','ranges','relocations','target_range'): + self.assertEqual(actual[key],fixture[key]) + self.assertEqual(len(fixture['cases']),12) + for file,digest in fixture['files'].items(): + if file.startswith('tools/'): + self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),digest) + # These are recovered target writes, not a live-port conformance claim. + cases=fixture['cases'] + self.assertEqual(cases[1]['observed'],[-40,45,0,1]) + self.assertEqual(cases[2]['observed'],[10,45,0,1]) + self.assertEqual(cases[3]['observed'],[-40,45,0,1]) + self.assertEqual(cases[10]['observed'],[0,45,0,1]) + self.assertEqual(cases[11]['observed'],[7,45,0,1]) + def test_source_identity_ranges_and_offsets(self): + actual=collect(ROOT.parent/'Original');fixture=json.loads((ROOT/'tests/GamePort.JimmyAirTests/original-air-reference.json').read_text()) + self.assertEqual(actual['source_sha256'],fixture['source_sha256']);self.assertEqual(actual['ranges'],fixture['ranges']) + self.assertEqual(actual['relocations'],fixture['relocations']) + self.assertEqual(len(actual['ranges']),5) + for row in actual['ranges']:self.assertEqual(int(row['file_offset'],16),int(row['va'],16)-0x400000) + def test_complete_observations_and_generator_provenance(self): + fixture=json.loads((ROOT/'tests/GamePort.JimmyAirTests/original-air-reference.json').read_text()) + self.assertEqual(collections.Counter(c['kind'] for c in fixture['cases']),dict(INPUT=22,APPLY=13)) + for file,digest in fixture['files'].items(): + self.assertEqual(len(digest),64) + if file.startswith('tools/'):self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),digest) + cases={(c['kind'],c['name']):c for c in fixture['cases']} + self.assertEqual(cases['INPUT','overspeed']['observed'][0],700) + self.assertEqual(cases['INPUT','ground_small']['observed'][0],-12.5) + self.assertEqual(cases['INPUT','no_latch']['observed'][1],20) + self.assertEqual(cases['APPLY','rest']['observed'],[0,0,300,0,0,0,0]) +if __name__=='__main__':unittest.main() diff --git a/tests/test_jimmy_ground_motion.py b/tests/test_jimmy_ground_motion.py new file mode 100644 index 0000000..82b9888 --- /dev/null +++ b/tests/test_jimmy_ground_motion.py @@ -0,0 +1,24 @@ +"""Source/provenance guards for original Jimmy keyboard-ground components.""" +from pathlib import Path +import collections,hashlib,json,sys,unittest +ROOT=Path(__file__).resolve().parents[1] +sys.path.insert(0,str(ROOT/'tools/binary')) +from jimmy_ground_motion import collect +class JimmyGroundEvidence(unittest.TestCase): + def test_original_identity_ranges_and_offsets(self): + source=collect(ROOT.parent/'Original');fixture=json.loads((ROOT/'tests/GamePort.JimmyGroundTests/original-ground-reference.json').read_text()) + for field in ('source_sha256','dll_sha256','ranges'):self.assertEqual(source[field],fixture[field]) + self.assertEqual(len(source['ranges']),6) + for row in source['ranges']:self.assertEqual(int(row['file_offset'],16),int(row['va'],16)-0x400000) + def test_probe_provenance_and_complete_native_observations(self): + fixture=json.loads((ROOT/'tests/GamePort.JimmyGroundTests/original-ground-reference.json').read_text()) + for path,digest in fixture['files'].items(): + if path.startswith('tools/'):self.assertEqual(hashlib.sha256((ROOT/path).read_bytes()).hexdigest(),digest) + self.assertEqual(collections.Counter(c['kind'] for c in fixture['cases']),dict(INPUT=17,APPLY=8)) + rows={c['name']:c for c in fixture['cases']} + self.assertEqual(rows['overcap']['observed'][0],700) + self.assertEqual(rows['ground']['observed'][1],-237) + self.assertEqual(rows['ground_nopoly']['observed'][1],13) + self.assertEqual(rows['backequal']['observed'][0],-52.5) + self.assertEqual(rows['backturn']['observed'][0],600) +if __name__=='__main__':unittest.main() diff --git a/tests/test_jimmy_jump_motion.py b/tests/test_jimmy_jump_motion.py new file mode 100644 index 0000000..de3e96e --- /dev/null +++ b/tests/test_jimmy_jump_motion.py @@ -0,0 +1,20 @@ +"""Source/range/probe provenance for original Jimmy jump observations.""" +from pathlib import Path +import hashlib,json,sys,unittest +ROOT=Path(__file__).resolve().parents[1] +sys.path.insert(0,str(ROOT/'tools/binary')) +from jimmy_jump_motion import collect +class JimmyJumpEvidence(unittest.TestCase): + def test_original_identity_ranges_and_offsets(self): + f=json.loads((ROOT/'tests/GamePort.JimmyJumpTests/original-jump-reference.json').read_text());s=collect(ROOT.parent/'Original') + self.assertEqual(f['source_sha256'],s['source_sha256']);self.assertEqual(f['ranges'],s['ranges']);self.assertEqual(f['relocations'],s['relocations']) + for r in s['ranges']:self.assertEqual(int(r['file_offset'],16),int(r['va'],16)-0x400000) + self.assertTrue(all(0x400000<=r['target']<0x699000 for r in s['relocations'])) + def test_provenance_and_native_threshold_cases(self): + f=json.loads((ROOT/'tests/GamePort.JimmyJumpTests/original-jump-reference.json').read_text());self.assertEqual(len(f['cases']),32) + for file,digest in f['files'].items(): + if file.startswith('tools/'):self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),digest) + cases={c['name']:c for c in f['cases']} + self.assertEqual(cases['hold_equal']['observed'][1],cases['hold_tick']['observed'][1]) + self.assertEqual(cases['hold_equal']['observed'][0],3);self.assertEqual(cases['hold_tick']['observed'][0],1) +if __name__=='__main__':unittest.main() diff --git a/tests/test_jimmy_orientation.py b/tests/test_jimmy_orientation.py new file mode 100644 index 0000000..1b2cf66 --- /dev/null +++ b/tests/test_jimmy_orientation.py @@ -0,0 +1,23 @@ +"""Jimmy facing source/constant identity and copied-original observation provenance.""" +from pathlib import Path +import hashlib,json,sys,unittest +ROOT=Path(__file__).resolve().parents[1] +sys.path.insert(0,str(ROOT/'tools/binary')) +from jimmy_orientation import collect +class JimmyOrientationEvidence(unittest.TestCase): + def test_identity_ranges_offsets_and_double_factors(self): + source=collect(ROOT.parent/'Original');fixture=json.loads((ROOT/'tests/GamePort.JimmyOrientationTests/original-orientation-reference.json').read_text()) + for field in ('source_sha256','ranges','constants'):self.assertEqual(source[field],fixture[field]) + self.assertEqual(source['constants'],{'0x4afcf0':3.7,'0x4afd38':4.5}) + for row in source['ranges']:self.assertEqual(int(row['file_offset'],16),int(row['va'],16)-0x400000) + def test_native_provenance_case_completeness_and_gates(self): + fixture=json.loads((ROOT/'tests/GamePort.JimmyOrientationTests/original-orientation-reference.json').read_text()) + self.assertEqual(len(fixture['cases']),16) + for file,digest in fixture['files'].items(): + self.assertEqual(len(digest),64) + if file.startswith('tools/'):self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),digest) + cases={c['name']:c for c in fixture['cases']} + for name in ('clean','disabled','zero_dt'):self.assertEqual(cases[name]['observed'][:3],cases[name]['input'][:3]) + self.assertGreater(cases['level']['observed'][0],338) + self.assertGreater(cases['positive180']['observed'][1],0) +if __name__=='__main__':unittest.main() diff --git a/tests/test_jimmy_special_contact.py b/tests/test_jimmy_special_contact.py new file mode 100644 index 0000000..4c236cf --- /dev/null +++ b/tests/test_jimmy_special_contact.py @@ -0,0 +1,511 @@ +"""Jimmy special material dispatch: source guards and copied-original observations.""" +from pathlib import Path +import hashlib,json,sys,unittest,tempfile +ROOT=Path(__file__).resolve().parents[1] +sys.path.insert(0,str(ROOT/'tools/binary')) +from jimmy_special_contact import collect,classify,generate +# Original-code observations are committed here; generated logs remain ignored. +FIXTURE=json.loads(r'''{ + "source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8", + "ranges": [ + { + "va": "0x43aa40", + "file_offset": "0x3aa40", + "length": 1443, + "sha256": "2acd114eb62fe67490d9301bc8e68f196830be74eb9076f52f79111467344a78" + }, + { + "va": "0x42a7e0", + "file_offset": "0x2a7e0", + "length": 140, + "sha256": "b999b3f9eb20ea2be18843048f8695e34e014e54b989e45f71d4113d9a81cf18" + }, + { + "va": "0x42a8d0", + "file_offset": "0x2a8d0", + "length": 72, + "sha256": "88a303b3ae7cca7fc4c3935848077bbaf5393f83ed184b8e042e67803c3c4863" + }, + { + "va": "0x43a900", + "file_offset": "0x3a900", + "length": 320, + "sha256": "73185486b7c1f3b972757db81837c495491144623f2944a82d564bb0d72626f4" + }, + { + "va": "0x43aff0", + "file_offset": "0x3aff0", + "length": 1456, + "sha256": "5c641e54e5e854c965e652aa2a63d3249de8d0ebe6a3317caeaa5f5ebdac47c6" + } + ], + "bindings": [ + { + "table": "0x4a3bdc", + "slot": "0x160", + "target": "0x42a7e0" + }, + { + "table": "0x4a3bdc", + "slot": "0x164", + "target": "0x42a8d0" + }, + { + "table": "0x4a373c", + "slot": "0x374", + "target": "0x42a660" + }, + { + "table": "0x4af6c4", + "slot": "0x374", + "target": "0x43aa40" + } + ], + "scope": "Copied43AA40 only, synthetic actor/material records, no-op160/164 damage callbacks and miss-only rays. No successful climb, damage, body or game entrypoint.", + "cases": [ + { + "input": [ + -1.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 59.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 60.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 2 + ] + }, + { + "input": [ + 69.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 2 + ] + }, + { + "input": [ + 70.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 109.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 110.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 1, + 0 + ] + }, + { + "input": [ + 119.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 1, + 0 + ] + }, + { + "input": [ + 120.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 1, + 0, + 0 + ] + }, + { + "input": [ + 129.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 1, + 0, + 0 + ] + }, + { + "input": [ + 130.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 179.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 180.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 1 + ] + }, + { + "input": [ + 181.0, + 4.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 120.0, + 3.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 120.0, + 3.0000999, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 1, + 0, + 0 + ] + }, + { + "input": [ + 120.0, + 2.0, + 0.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 120.0, + 4.0, + 1.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 1, + 0, + 0 + ] + }, + { + "input": [ + 110.0, + 4.0, + 2.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 1, + 0 + ] + }, + { + "input": [ + 60.0, + 4.0, + 1.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 180.0, + 4.0, + 1.0, + 0.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 120.0, + 4.0, + 0.0, + 1.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 120.0, + 4.0, + 0.0, + 2.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 120.0, + 4.0, + 0.0, + 3.0, + 1.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 180.0, + 4.0, + 0.0, + 0.0, + 0.0, + 1.0 + ], + "observed": [ + 0, + 0, + 0 + ] + }, + { + "input": [ + 120.0, + 4.0, + 0.0, + 0.0, + 1.0, + 0.0 + ], + "observed": [ + 1, + 0, + 0 + ] + }, + { + "input": [ + 60.0, + 4.0, + 0.0, + 0.0, + 1.0, + 0.0 + ], + "observed": [ + 0, + 0, + 2 + ] + } + ], + "files": { + "tools/binary/jimmy_special_contact.py": "bf0d690aa5dd79265718e46ff5bbeca86c7ca0e71a2b894e4ef0515f7cbd8cf1", + "tools/binary/jimmy_special_contact_probe.c": "553e77b6a175cd42a4fbdd98222dcbffed0cf26d4f516a09f982d264c213be95", + "tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810", + "artifacts/jimmy-special-contact/jimmy_special_contact_probe.exe": "4a759864c4ea3e9e478af28a6ef4f70f7e48da4102fb6dad3418fb9b02d1c019", + "artifacts/jimmy-special-contact/probe/wine.log": "e680314e9dd8098aa2f4ce3650f0be21072d6ae0e120f5b92b7d3d029a166aa0" + } +} +''') + +class JimmySpecialContacts(unittest.TestCase): + def test_source_ranges_bindings_and_offsets(self): + source=collect(ROOT.parent/'Original') + for key in ('source_sha256','ranges','bindings'):self.assertEqual(source[key],FIXTURE[key]) + for row in source['ranges']:self.assertEqual(int(row['file_offset'],16),int(row['va'],16)-0x400000) + + def test_twenty_seven_original_dispatch_observations(self): + self.assertEqual(len(FIXTURE['cases']),27) + for case in FIXTURE['cases']: + material,elapsed,mode,missing,support,controlled=case['input'] + policy=classify(None if missing else int(material),elapsed,int(mode)) + actual=[int(policy=='damage160'),int(policy=='damage164'), + 2 if policy=='fence_candidate' else 1 if policy=='ladder_candidate' and support else 0] + self.assertEqual(actual,case['observed'],case) + + def test_generated_probe_cannot_target_originals_or_symlinks(self): + original=ROOT.parent/'Original' + for target in (original,original/'generated',ROOT.parent): + with self.assertRaises(ValueError):generate(original,target) + with tempfile.TemporaryDirectory() as directory: + root=Path(directory);(root/'jimmy_special_contact_probe.c').symlink_to(original/'Neutron.exe') + with self.assertRaises(ValueError):generate(original,root) + + def test_source_provenance(self): + for file,digest in FIXTURE['files'].items(): + self.assertEqual(len(digest),64) + if file.startswith('tools/'): + self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),digest) + +if __name__=='__main__':unittest.main() diff --git a/tools/binary/jimmy_air_motion.py b/tools/binary/jimmy_air_motion.py new file mode 100644 index 0000000..9c413b8 --- /dev/null +++ b/tools/binary/jimmy_air_motion.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +"""Guard original airborne input/apply and prepare isolated copied-code probes.""" +import argparse,hashlib,json,re,struct,subprocess +from pathlib import Path +from checkpoint_script_state import EXE_SHA256,find_case,read_va +from pe_inspect import PE +RANGES=((0x439900,0x439db7),(0x437f90,0x43812a),(0x4723f0,0x472420),(0x472480,0x472570),(0x472b10,0x472c10)) +def collect(original): + pe=PE(find_case(Path(original),'Neutron.exe')) + if hashlib.sha256(pe.data).hexdigest()!=EXE_SHA256:raise ValueError('Unexpected original EXE') + report=dict(source_sha256=EXE_SHA256,ranges=[dict(va=hex(a),file_offset=hex(pe.offset(a-pe.base)),length=b-a, + sha256=hashlib.sha256(read_va(pe,a,b-a)).hexdigest()) for a,b in RANGES]) + targets={0x48d10c} + for a,b in RANGES: + asm=subprocess.run(['objdump','-d','-Mintel',f'--start-address={a}',f'--stop-address={b}',str(pe.path)],capture_output=True,text=True,check=True).stdout + targets.update(int(v,16) for v in re.findall(r'ds:0x([0-9a-f]+)',asm)) + report['relocations']=[] + for a,b in RANGES: + data=read_va(pe,a,b-a) + for t in sorted(targets): + report['relocations'].extend(dict(va=a+m.start(),target=t) for m in re.finditer(re.escape(struct.pack('x+=root_position.x;r->y+=root_position.y;r->z+=root_position.z;return r; +} +static float TC friction(void*self){(void)self;return .8f;} +static int TC support(void*self){(void)self;return supported;} +static void*TC support_polygon(void*self){(void)self;return has_polygon?polygon:NULL;} +static void TC destination(void*self,float x,float y,float z){unsigned char*g=self;*(float*)(g+0x274)=x;*(float*)(g+0x278)=y;*(float*)(g+0x27c)=z;} +static void TC animate(void*self,void*name){(void)self;(void)name;} +static void*input_entry(void){ + unsigned char*c=VirtualAlloc(NULL,256,MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE),*p=c; + emit_byte(&p,0x53);emit_byte(&p,0x55);emit_byte(&p,0x56);emit_byte(&p,0x57); + emit_byte(&p,0x81);emit_byte(&p,0xec);word(&p,0x90); + emit_byte(&p,0xbd);word(&p,(uintptr_t)object); /*ebp complete*/ + emit_byte(&p,0x31);emit_byte(&p,0xff); /*edi=0*/ + emit_byte(&p,0xba);word(&p,1);emit_byte(&p,0x31);emit_byte(&p,0xf6); /*edx=1,esi=0*/ + emit_byte(&p,0xbb);word(&p,(uintptr_t)(object+0x9bc)); + const int slots[]={0x14,0x18,0x1c}; + for(int i=0;i<3;i++){emit_byte(&p,0xc7);emit_byte(&p,0x44);emit_byte(&p,0x24);emit_byte(&p,slots[i]);word(&p,0);} + jump(p,AT(0x43915d));p+=5;unsigned char*end=p; + emit_byte(&p,0x81);emit_byte(&p,0xc4);word(&p,0x90);emit_byte(&p,0x5f);emit_byte(&p,0x5e);emit_byte(&p,0x5d);emit_byte(&p,0x5b);emit_byte(&p,0xc3); + jump(AT(0x4395cf),end);return c; +} +static void setup(void){ + map_source();const struct{uint32_t at,target;}reloc[]={/* RELOCATIONS */}; + for(unsigned i=0;i