Preserve contact-owned roots and independent body modes
This commit is contained in:
1 parent
3845ea7114
commit
c9d0c5be59
25 files changed
+16384
-70
No files matched your search
@@ -51,6 +51,12 @@ dirty/Init and retained apply-owned pitch seeds stay separate from current Euler
|
|||||||
Modern local sole correction and final OMT render-decomposition precision remain
|
Modern local sole correction and final OMT render-decomposition precision remain
|
||||||
explicit; broader special/root-changing/dynamic contacts are next.27 contact
|
explicit; broader special/root-changing/dynamic contacts are next.27 contact
|
||||||
dispatch observations still do not establish live special callbacks.
|
dispatch observations still do not establish live special callbacks.
|
||||||
|
Body publication/mode foundation now implements fresh previous/live XYZW,
|
||||||
|
independent source flags, retained context and post-landing payload ownership.
|
||||||
|
100 new complete original comparisons plus six bounded callback-state cases pass;
|
||||||
|
see docs/checkpoint/body-contact-implementation.md. Keep admission gated: actual
|
||||||
|
Jimmy hazards/climbs, multi-frame actor mode/facing/animation and dynamic/shared
|
||||||
|
scene context are still open. No automatic lab/outside solver replacement.
|
||||||
No Remote/new-gadget implementation until this movement priority is handled.
|
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
|
The initial architecture checkpoint is documented in docs/checkpoint/review.md; use the playable
|
||||||
69d0187 baseline as a comparison tool. Read
|
69d0187 baseline as a comparison tool. Read
|
||||||
|
|||||||
@@ -107,6 +107,14 @@ avoids a Python runtime dependency in native packages. Mesh draw ranges omit nul
|
|||||||
materials following the original renderer, while retaining their geometry. Default
|
materials following the original renderer, while retaining their geometry. Default
|
||||||
normal atlas and morph transforms are supported by binary/duplicate-asset evidence.
|
normal atlas and morph transforms are supported by binary/duplicate-asset evidence.
|
||||||
|
|
||||||
|
`OriginalBodyPhysics` now retains current/previous Vec4, anchor and independent
|
||||||
|
integration/support/collision/world-response/alternate modes. World callbacks see
|
||||||
|
live state; fresh full-point equality controls candidate publication. Landing
|
||||||
|
publishes floor root/anchor/acceleration before37C, then restores cached velocity
|
||||||
|
and supported=true. Inactive paths preserve the prior per-body collision context.
|
||||||
|
This is a bounded foundation for special callbacks, not automatic scene admission;
|
||||||
|
see [body contact implementation](checkpoint/body-contact-implementation.md).
|
||||||
|
|
||||||
`Game/LabSimulation` supplies the no-gadget walking/jump checkpoint, using recovered
|
`Game/LabSimulation` supplies the no-gadget walking/jump checkpoint, using recovered
|
||||||
speed/yaw/impulse/airborne/camera formulas. `FixedStepClock` supplies a deliberate
|
speed/yaw/impulse/airborne/camera formulas. `FixedStepClock` supplies a deliberate
|
||||||
60Hz port policy independent of rendering; original invocation cadence remains
|
60Hz port policy independent of rendering; original invocation cadence remains
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
# Body callback ownership implementation
|
||||||
|
|
||||||
|
2026-11-05. Continues Jimmy movement after the air/render checkpoint27be8ed.
|
||||||
|
Current lab/outside capsule and all special-contact admission gates are preserved.
|
||||||
|
This implements the body publication/mode prerequisites, not new climb/hazard
|
||||||
|
mechanics or a complete original body in every level.
|
||||||
|
|
||||||
|
## Evidence and implementation
|
||||||
|
|
||||||
|
[Root publication](body-root-publication.md) records19 new original component
|
||||||
|
cases using actual copied479D20/47B4B0/kernel. [Body modes](body-modes.md) records87
|
||||||
|
new observations using full479D20/support/friction and a synthetic dispatcher.
|
||||||
|
Both reuse retained REA Evidence and guard original spans/offsets/provenance.
|
||||||
|
|
||||||
|
`OriginalBodyState` now retains finite live-root W, source previous Vec4, support
|
||||||
|
anchor and independent `BodyModes`: integration210, support1C8, collision220,
|
||||||
|
world response1D0 and alternate228. Nullable modes mean the ordinary constructor
|
||||||
|
defaults; the explicit point constructor supplies W1. Scooter reset now uses that
|
||||||
|
point constructor instead of zero-initializing W through default(struct).
|
||||||
|
`OrdinaryBodyStep.PreviousPosition` deliberately stays the frame-entry XYZ
|
||||||
|
diagnostic consumed by the existing provisional dynamic adapter. It is not used
|
||||||
|
as a substitute for the newly retained previous Vec4.
|
||||||
|
|
||||||
|
- Support clear precedes the integration gate. Inactive integration preserves
|
||||||
|
roots, anchor, pending work and the existing collision context, then returns.
|
||||||
|
- The geometry argument/global getter remains independent of body modes. Global
|
||||||
|
geometry-off follows the recovered gravity/support policy. A scene getter
|
||||||
|
optionally models support's fresh global read after callbacks.
|
||||||
|
- World response-off copies current root to previous and translates, retaining
|
||||||
|
gravity/impulse, optional support/friction and the previous static context.
|
||||||
|
- Collision-off translates or holds according to228, preserves previous root,
|
||||||
|
skips support/friction and still reaches suppression. Neither unclipped branch
|
||||||
|
acquires the world branch's−25000 candidate clamp.
|
||||||
|
- World callbacks now receive the live entry root, not the tentative clipped
|
||||||
|
candidate. They may edit live/previous independently. Fresh XYZW equality
|
||||||
|
controls publication of the precomputed candidate and its original W. Callback
|
||||||
|
roots rejected by that barrier receive neither old fallingY nor candidate clamp.
|
||||||
|
Changing both roots to equal still permits the old candidate to overwrite them.
|
||||||
|
- Support uses fresh live/previous XYZ after publication/rejection. Landing37C
|
||||||
|
observes the floor root, anchor and zeroed vertical acceleration but old velocity.
|
||||||
|
Callback root/anchor/acceleration/impulse/modes survive; source cached VX/Z plus
|
||||||
|
Y0 and supported=true are published afterward. Friction/suppression read current
|
||||||
|
speed/motion and retain their own ownership.
|
||||||
|
- The existing wall hook remains wall-only. Ordinary/profile ceiling/reflection
|
||||||
|
behavior is kept separate. Static context resets only in the world branch;
|
||||||
|
other branches retain it, reporting zero new traversal work.
|
||||||
|
|
||||||
|
`tests/GamePort.BodyOwnershipTests` compares81 complete native mode/landing outputs
|
||||||
|
and19 root outputs. The17 native root-isolation cases no-op support; the managed
|
||||||
|
support gate mirrors those publication outputs, while two cases execute actual
|
||||||
|
support in both implementations. For six native synthetic-dispatch mutation cases,
|
||||||
|
a real wall delivers the managed callback: owned state/flags/branch continuation
|
||||||
|
compare, while intentionally different clipped XYZ is not claimed as numeric
|
||||||
|
conformance. All100 complete comparisons and six state comparisons pass.
|
||||||
|
|
||||||
|
Existing20 body,13 Scooter and13 Grappler groups pass in initial targeted runs.
|
||||||
|
Artifacts: artifacts/body-contact-integration/{ownership-initial,body-initial,
|
||||||
|
scooter-initial,grappler-initial,build-initial}.log. The full regression, native and
|
||||||
|
package results are recorded below as verification finishes.
|
||||||
|
|
||||||
|
## Remaining integration boundary
|
||||||
|
|
||||||
|
No real Jimmy material120..129/110..119/FENCE/LADDER callback is enabled here.
|
||||||
|
Animation acceptance/end/fallback, hazard/impulse updater4255C0, successful ray
|
||||||
|
filters, control/facing/action state, dynamic eligibility and scene-wide shared
|
||||||
|
collision globals still need separate recovery and runtime proof. No callback is
|
||||||
|
classified ordinary merely to bypass constructor rejection.
|
||||||
|
|
||||||
|
LabSimulation still reconstructs the admitted ordinary body each pass; actual
|
||||||
|
multi-frame special modes must persist actor state when their callbacks are
|
||||||
|
integrated. Vehicles/projectiles already retain their body records. The per-body
|
||||||
|
static context remains a bounded approximation of original scene-global ownership.
|
||||||
|
Radius/factor/friction/suppression arguments remain fixed during the admitted
|
||||||
|
pass; reentrant/nested body updates and other mutable getter side effects are not
|
||||||
|
established by these finite probes. Modern F3 noclip is a separate policy.
|
||||||
|
|
||||||
|
The root record adds no TSK/save fields or runtime original-code dependency.
|
||||||
|
Physics remains independent of raw player control. The existing rendering/air
|
||||||
|
state and upright local alignment from the previous checkpoint are preserved.
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
# Body modes and post-callback ownership
|
||||||
|
|
||||||
|
2026-11-05. This closes a bounded prerequisite for Jimmy's special contacts; it
|
||||||
|
does not enable new terrain/climb policies or replace the lab/outside capsule.
|
||||||
|
The authoritative EXE SHA256 is
|
||||||
|
`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
|
||||||
|
JN-Engine gameplay is not the oracle. Retained REA instruction Evidence
|
||||||
|
`ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904`
|
||||||
|
is artifacts/jimmy-movement-audit/rea-original-disassembly.json; the original
|
||||||
|
479D20 procedure Evidence is
|
||||||
|
`ev_5439072b32ae9f9208795ad2b07bc524e2407b46da487072fb3dfd8c10e7c4b0`.
|
||||||
|
No unchanged failed Ghidra selector was repeated. This investigation reuses those
|
||||||
|
instructions and independently guards the complete body/support/friction spans.
|
||||||
|
|
||||||
|
## Source branch and state map
|
||||||
|
|
||||||
|
Addresses are EXE VAs; raw offsets equal VA−400000 in these PE-mapped spans.
|
||||||
|
Slot numbers refer to the body/game interface, Jimmy complete object+C0.
|
||||||
|
The generic data fields and initialization are separately recorded in
|
||||||
|
[body composition](collision-body-composition-source.md).
|
||||||
|
|
||||||
|
| Source VA / raw offset | Recovered phase |
|
||||||
|
|---|---|
|
||||||
|
|479D2E/479D34 /79D2E/79D34|Read supported218; cache prior support695D49 even if integration will reject.|
|
||||||
|
|479D3D..479D4E /79D3D..79D4E|If support handling1C8, clear supported21C(false). Otherwise preserve the previous supported flag.|
|
||||||
|
|479D58..479D60 /79D58..79D60|Integration210=false returns after those effects: root/previous/anchor, impulse, velocity, acceleration, angular velocity and static context remain unchanged.|
|
||||||
|
|479DDA..479E54 /79DDA..79E54|Global geometry4F69E5=true publishes anchor(0,−25000,0). False publishes supported=true, anchor(0,currentY,0), acceleration(0,+800,0), velocity(oldX,0,oldZ). Pending impulse still applies later.|
|
||||||
|
|479E63..479FD2 /79E63..79FD2|Rotate by angular×dt; consume impulse once; add acceleration then gravity separately; compute displacement from final velocity.|
|
||||||
|
|479FD6 /79FD6|Collision220 gates the post-integration branch.|
|
||||||
|
|479FE8 /79FE8|When collision=true, world-response1D0 selects clipping versus direct translation. This is not the integration/global-geometry gate.|
|
||||||
|
|47A038..47A096 /7A038..7A096|World branch alone resets last polygon/nearest face130000/nearest edge radius/auxiliary; captures full live root into previous2FC, then dispatches world traversal.|
|
||||||
|
|47A123..47A1C4 /7A123..7A1C4|World path compares fresh previous/live Vec4; equality permits candidate clampY≥−25000/publication314. See the independent root-publication investigation.|
|
||||||
|
|47A1CC..47A220 /7A1CC..7A220|Collision=true/world-response=false copies live Vec4 to previous, then translates31C(displacement). No static-context reset, world dispatch or−25000 clamp.|
|
||||||
|
|47A22A /7A22A|Fresh support1C8 read after world callback/publication/direct translation; true calls47B890.|
|
||||||
|
|47B890 /7B890|Support independently rereads global geometry. False skips its query/result publication; it does not retroactively cancel the gravity already consumed earlier in479D20.|
|
||||||
|
|47A241..47A25A /7A241..7A25A|Fresh published-speed268==0 enters friction47A330. That helper reads current supported218 and only damps when supported and magnitude>0.|
|
||||||
|
|47A264..47A28E /7A264..7A28E|Collision=false reads alternate228: false translates31C; true holds root. Both skip previous-root copy, support and friction.|
|
||||||
|
|47A294..47A31D /7A294..7A31D|All integrated branches reach suppression. Angular and linear quick magnitude×scale≤.1 clear the respective velocity; linear additionally requires a fresh published268==0. Rotation already happened, even if angular velocity is then cleared.|
|
||||||
|
|
||||||
|
A support-disabled body may retain supported=true, including while moving upward.
|
||||||
|
If collision is enabled, that stale-but-owned supported state still allows
|
||||||
|
friction. Disabling support is not permission to clear it unconditionally.
|
||||||
|
Collision-disabled bodies skip friction even when global geometry-off forced
|
||||||
|
supported=true. World-response-off retains integration, gravity, impulse,
|
||||||
|
optional support and friction, plus the prior static context. F3 noclip remains a
|
||||||
|
separate modern policy.
|
||||||
|
|
||||||
|
## Flag mutation timing
|
||||||
|
|
||||||
|
The source does not reselect a branch already entered. Synthetic world callbacks
|
||||||
|
that change integration210, collision220 or world1D0 still finish the selected
|
||||||
|
world publication/support/friction path in the current call. The changed flags
|
||||||
|
persist for a later call. Support1C8 is read fresh after world dispatch, so changing
|
||||||
|
it there suppresses the current support query. Global geometry is also read fresh
|
||||||
|
inside support; changing it during world work suppresses support while retaining
|
||||||
|
the already integrated gravity/acceleration and earlier anchor.
|
||||||
|
|
||||||
|
For example, the final native fixture's world mutation5 changes global geometry
|
||||||
|
to false after integrating fallingVy−213.333328. The output still has that Vy,
|
||||||
|
acceleration0 and anchorY−25000, with no support query; it is not the early
|
||||||
|
geometry-off result with acceleration+800/support=true/vertical cancellation.
|
||||||
|
A mutable scene-global getter can represent that read boundary; embedding a new
|
||||||
|
per-body geometry flag would misstate its ownership. No live original writer or
|
||||||
|
new gameplay use of that global is inferred from the synthetic callback.
|
||||||
|
|
||||||
|
## Landing37C: writes before and after callback
|
||||||
|
|
||||||
|
47BB10..47BB4B publishes anchor, supported root through318 and acceleration
|
||||||
|
(oldAx,0,oldAz). It checks prior supported695D49 and invokes37C at47BB5E only on
|
||||||
|
an unsupported→supported transition. The callback observes the new root/anchor/
|
||||||
|
zeroed vertical acceleration but old live velocity and supported=false.
|
||||||
|
|
||||||
|
47BB64..47BB80 then overwrites velocity with **cached pre-callback VX/Z and Y0**,
|
||||||
|
and writes supported=true. Support pointers34C/33C follow at47BB91/47BBA1.
|
||||||
|
Consequently:
|
||||||
|
|
||||||
|
- Callback velocityXYZ and supported edits are overwritten, even though the
|
||||||
|
callback legitimately owned them during its invocation.
|
||||||
|
- Callback root (including W), acceleration, anchor and pending impulse survive.
|
||||||
|
Pending impulse is not consumed a second time; its next owner is a later body pass.
|
||||||
|
- Modes and published speed survive. Published speed is read fresh by friction;
|
||||||
|
changing it to100 skips damping in the same call.
|
||||||
|
- Callback angular velocity survives into friction/suppression; with(7,123,9),
|
||||||
|
friction.8/dt1/60 yields approximately(6.906667,121.360001,8.88).
|
||||||
|
- Changing support/collision/integration modes during37C does not rerun preceding
|
||||||
|
branches or stop the support function's final supported=true publication.
|
||||||
|
|
||||||
|
The native payload cases verify each item. They do not execute Jimmy's real37C
|
||||||
|
(which is an inherited no-op), an animation event or a special Player callback.
|
||||||
|
They establish generic phase ownership for safe composition.
|
||||||
|
|
||||||
|
## Copied-original fixture and verification
|
||||||
|
|
||||||
|
`tools/binary/body_modes.py` reuses the existing read-only body/support range and
|
||||||
|
relocation collector. Generated sources are separated from the Wine work/prefix
|
||||||
|
under artifacts/body-modes/generated. The probe executes full copied479D20,
|
||||||
|
47A330 friction and47B890/support queries against the existing synthetic floor.
|
||||||
|
Its47B4B0 world dispatcher is deliberately substituted: it adds the supplied
|
||||||
|
movement to the candidate and performs selected synthetic flag mutations.
|
||||||
|
Angular334 is a simple additive synthetic virtual, not proof of generic angle
|
||||||
|
normalization. The copied original OMT quick-magnitude export is retained.
|
||||||
|
No real world traversal, actor, loader/game entrypoint, animation or audio runs.
|
||||||
|
|
||||||
|
The final isolated Wine32 run exits0 with BODY_MODES_COMPLETE.87 observations:
|
||||||
|
64 combinations of integration/support/world/collision/alternate/global geometry;
|
||||||
|
6 world-mutation cases;11 genuine landing-mutation cases;6 no-clamp/suppression
|
||||||
|
extras. Source, generator/shared harness/generated EXE/log hashes and all numeric
|
||||||
|
vectors/counters/event traces are committed in tests/body-modes-reference.json.
|
||||||
|
The initial landing setup had prior support=true and therefore correctly emitted
|
||||||
|
no37C; it was corrected to unsupported before using those cases as callback
|
||||||
|
evidence. A regeneration attempt into the parent directory containing a Wine
|
||||||
|
prefix was rejected by the symlink guard; separate generated output resolved it.
|
||||||
|
Only the final87-case run is retained as the committed conformance fixture.
|
||||||
|
|
||||||
|
Four Python groups pass: identity/ranges/provenance, all64 branch/counter/context
|
||||||
|
combinations, callback/suppression observations and generated-output separation.
|
||||||
|
Run from GamePort:
|
||||||
|
|
||||||
|
```
|
||||||
|
python3 -m unittest discover -s tests -p test_body_modes.py -v
|
||||||
|
python3 tools/binary/body_modes.py ../Original --generate-probe artifacts/body-modes/new-generated
|
||||||
|
```
|
||||||
|
|
||||||
|
Parent owns managed integration and its conformance claim. Source-world mutation
|
||||||
|
outputs depend on the synthetic unclipped dispatcher candidate; a real-wall
|
||||||
|
adapter may compare branch/state invariants without claiming candidateXYZ parity.
|
||||||
|
All64 flag cases,11 landing payload cases and6 no-clamp/suppression cases permit
|
||||||
|
full numeric body comparison under the corresponding floor/empty-world fixture.
|
||||||
|
Contact metadata, root-changing Vec4 publication, special animation/control and
|
||||||
|
dynamic body eligibility remain independent gates. Whole-original gameplay and
|
||||||
|
native Windows movement are not established by these component calls.
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
# Contact-owned Vec4 root publication
|
||||||
|
|
||||||
|
2026-11-05. Follow-up to [body composition](collision-body-composition-source.md)
|
||||||
|
and [special contacts](jimmy-special-contact.md). This closes one body-state
|
||||||
|
boundary; it does not enable special contacts or replace the lab/outside capsule.
|
||||||
|
Original Neutron.exe SHA256:
|
||||||
|
`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
|
||||||
|
|
||||||
|
## Source structures and phases
|
||||||
|
|
||||||
|
All VAs below are independently PE-mapped; raw offsets equal VA−400000 for these
|
||||||
|
ranges. REA's retained complete EXE disassembly is
|
||||||
|
`ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904`,
|
||||||
|
artifacts/jimmy-movement-audit/rea-original-disassembly.json. Earlier body Evidence
|
||||||
|
`ev_5439072b32ae9f9208795ad2b07bc524e2407b46da487072fb3dfd8c10e7c4b0`
|
||||||
|
and its prototype limitations remain in the composition report. No unchanged
|
||||||
|
failed Ghidra selector was repeated. Instructions establish the following facts;
|
||||||
|
original component execution corroborates their numeric consequences below.
|
||||||
|
|
||||||
|
Jimmy uses the game interface at complete+C0. **Data** previous-root Vec4 is
|
||||||
|
interface1F4/1F8/1FC/200 (complete2B4..2C0); current-root Vec4 is
|
||||||
|
interface214/218/21C/220 (complete2D4..2E0). These are not same-numbered virtual
|
||||||
|
slots. Vtable4A373C binds previous getter2F8→4721E0, previous setter2FC→472240,
|
||||||
|
live getter310→472300 and Vec4 setter314→472360. Each getter copies all four
|
||||||
|
floats into the caller buffer.314 is a plain four-float store; unlike XYZ318's
|
||||||
|
472330 wrapper, it does not immediately call3DC. Full logical/render publication
|
||||||
|
ownership therefore remains distinct from the body-state store.
|
||||||
|
|
||||||
|
| VA / raw offset | Recovered operation |
|
||||||
|
|---|---|
|
||||||
|
|47A084 /7A084|After integration and before world dispatch, copy current full Vec4 into previous2FC. A stale initial previous root does not survive this boundary.|
|
||||||
|
|47A0D6 /7A0D6|Positive displacementY:47B4B0 receives fullXYZ.|
|
||||||
|
|47A10F..47A11F /7A10F..7A11F|NonpositiveY:47B4B0 receives XZ/zeroY, then add the original already-computed fallingY to the **candidate**, after dispatcher/contact returns.|
|
||||||
|
|47B80F /7B80F;47B82E /7B82E|Dispatcher terminal374/370 receives actor/normal/polygon, not the candidate pointer. The bounded dispatcher call closure has no actor310/314/2FC root publication before those callbacks. It modifies the separate candidate.|
|
||||||
|
|47A12C /7A12C;47A13D /7A13D|After dispatch/contact, read fresh previous2F8 and then fresh current310 into separate stack buffers.|
|
||||||
|
|47A143..47A181 /7A143..7A181|Compare X,Y,Z,W. Only equality through all four comparisons reaches candidate publication.|
|
||||||
|
|47A187..47A1C4 /7A187..7A1C4|Only the permitted candidate has Y clamped to−25000, then full Vec4 is stored through314. A rejected callback-owned live root is neither displaced nor clamped here.|
|
||||||
|
|47A22A..47A235 /7A22A..7A235|Support eligibility is read afterward. Support47B890 can run even when publication was rejected; it reads current/previous afresh.|
|
||||||
|
|
||||||
|
For admitted finite values, the useful projection is:
|
||||||
|
|
||||||
|
```
|
||||||
|
previous = live // world branch entry
|
||||||
|
candidate = dispatch(entry, full or XZ delta)
|
||||||
|
if falling: candidate.Y += precontactDelta.Y
|
||||||
|
previousNow = getPrevious(); liveNow = getLive()
|
||||||
|
if previousNow.XYZW == liveNow.XYZW:
|
||||||
|
candidate.Y = max(candidate.Y, -25000)
|
||||||
|
setLive(candidate) // candidate W, not callback W
|
||||||
|
supportIfEnabled() // uses current/previous now
|
||||||
|
frictionAndSuppression() // source state remains independently owned
|
||||||
|
```
|
||||||
|
|
||||||
|
This is not `callback changed Position => skip`: changing **both** previous and
|
||||||
|
live to equal values permits the old candidate to overwrite that change. Changing
|
||||||
|
only previous can reject publication even when live XYZ stayed at entry. Changing
|
||||||
|
only W can reject it even when all XYZ match. The initial entry root remains a
|
||||||
|
useful diagnostic, but must not substitute for the fresh source previous record
|
||||||
|
when the support phase runs.
|
||||||
|
|
||||||
|
## Original execution and observations
|
||||||
|
|
||||||
|
The generated probe executes full copied479D20, real47B4B0/grid/kernel and, in two
|
||||||
|
cases, real47B890/support. It reuses the independently guarded
|
||||||
|
body_step_probe.c mapper and synthetic virtual/body/grid contracts. A broad
|
||||||
|
synthetic vertical wall produces one actual terminal374 contact per case.
|
||||||
|
The custom contact mutates body records; it is not a recovered climb/hazard
|
||||||
|
mechanic. A wrapper at the support CALL either logs/no-ops to isolate candidate
|
||||||
|
publication or calls the unchanged original47B890. No game entrypoint, script,
|
||||||
|
animation, audio or GPU is executed. Original files are not modified/executed in
|
||||||
|
place; the existing reference_capture sandbox mounts only a separate copied
|
||||||
|
installation, disables networking and uses a generated Wine32 prefix.
|
||||||
|
|
||||||
|
19 final cases exit0 and print BODY_ROOT_PUBLICATION_COMPLETE. Native output,
|
||||||
|
capture.json, generated source/header and source hashes are under
|
||||||
|
artifacts/body-root-publication/. The committed fixture is
|
||||||
|
`tests/body-root-publication-reference.json`; its input/flag schemas and source,
|
||||||
|
shared harness, probe executable and output hashes are recorded. Build output is
|
||||||
|
kept in build/ separately from the Wine prefix: output-symlink protection
|
||||||
|
intentionally rejects generating over a directory containing prefix symlinks.
|
||||||
|
|
||||||
|
Representative observations (entry=(0,20,20,1), radius10, factor1.265,
|
||||||
|
velocity=(0,−120,−900), dt1/60):
|
||||||
|
|
||||||
|
| Contact action | Final live / previous effect | Publication |
|
||||||
|
|---|---|---|
|
||||||
|
|None|Live(0,17.7777786,10,1)|Allowed; original gravity and old falling delta applied.|
|
||||||
|
|Change liveX to100|Live(100,20,20,1), previous remains entry|Rejected; no old fallingY is added to live.|
|
||||||
|
|Change previousX to100|Live remains entry|Rejected even though live itself did not move.|
|
||||||
|
|Change liveW to2 or previousW to2|XYZ remains entry; changed W is retained|Rejected.|
|
||||||
|
|Set both XYZ to(101,250,303)|Old candidate overwrites live; previous remains(101,250,303,1)|Allowed because fresh roots are equal.|
|
||||||
|
|Set both W to2|Old candidateW1 overwrites liveW; previousW2 remains|Allowed; retaining callback liveW would be incorrect.|
|
||||||
|
|Set liveY to−30000|Callback-owned liveY remains−30000 in isolated-support case|Rejected, so candidate clamp does not clamp live.|
|
||||||
|
|EntryY−26000, no root mutation|LiveY−25000|Allowed candidate is clamped.|
|
||||||
|
|Entry previous=(999,999,999,3)|Contact sees entry previous=(0,20,20,1)|World branch resets previous before callback.|
|
||||||
|
|
||||||
|
The unchanged upward case endsY23.1111107; upward liveX/W mutations reject just
|
||||||
|
as downward ones do. `callback_motion` consumes an initial impulse30 before the
|
||||||
|
contact (seenVy≈−103.3333), then the contact writes velocity(9,8,7),
|
||||||
|
acceleration(4,5,6), pendingImpulseY77. Those new fields survive. The root still
|
||||||
|
uses the precontact falling delta and endsY18.2777786; the new positiveVy8 is not
|
||||||
|
integrated again during this pass.
|
||||||
|
|
||||||
|
Event strings corroborate ownership: C=terminal contact, R=fresh previous read,
|
||||||
|
L=fresh live read, P=candidate Vec4 publication, S=support CALL. Permitted cases
|
||||||
|
are `CRLPS`; rejected cases `CRLS`. The two original-support cases continue
|
||||||
|
`CRLSRL`, proving support reads both records after rejection. With contact-owned
|
||||||
|
live=(101,5,303,1), real support raises rootY12.6499996, zeros Vy, sets support
|
||||||
|
and emits one landing. Therefore rejection is not a blanket return from physics.
|
||||||
|
|
||||||
|
## Verification and implementation boundary
|
||||||
|
|
||||||
|
Four Python groups pass: original identity/ranges/12 publication anchors/four
|
||||||
|
bindings/four root leaves; all19 saved boundaries and call ordering; generator/
|
||||||
|
shared-harness provenance; original/output/symlink isolation. Commands:
|
||||||
|
|
||||||
|
```
|
||||||
|
python3 -m unittest discover -s tests -p test_body_root_publication.py -v
|
||||||
|
python3 tools/binary/body_root_publication.py ../Original --generate-probe artifacts/body-root-publication/build
|
||||||
|
i686-w64-mingw32-gcc -O0 -I tools/binary -I artifacts/body-root-publication/build artifacts/body-root-publication/build/body_root_publication_probe.c -o artifacts/body-root-publication/build/body_root_publication_probe.exe -lm
|
||||||
|
python3 tools/recon/reference_capture.py --asset-probe --probe-executable artifacts/body-root-publication/build/body_root_publication_probe.exe --probe-success BODY_ROOT_PUBLICATION_COMPLETE --seconds 15 --output artifacts/body-root-publication/probe
|
||||||
|
```
|
||||||
|
|
||||||
|
Parent owns runtime integration and managed conformance. Preserve live Vec4 W and
|
||||||
|
fresh previous Vec4; call a contact with live root state rather than candidate.
|
||||||
|
After it returns, compare those records before applying candidate/clamp. Keep
|
||||||
|
callback velocity/acceleration/queued impulse, and pass fresh previous into
|
||||||
|
support. A legacy entry-position diagnostic may remain a distinct output.
|
||||||
|
|
||||||
|
Confidence is high for these guarded finite component cases. Nonfinite/x87
|
||||||
|
unordered comparisons, arbitrary callback-driven flag/radius/material mutations,
|
||||||
|
actual special animation handlers and their root/previous policies, real dynamic
|
||||||
|
pairs/shared context, whole-original movement and native Windows gameplay remain
|
||||||
|
separate gates. This report makes no lab/outside source-body admission claim and
|
||||||
|
changes no runtime/shared documentation or existing fixtures/tests.
|
||||||
@@ -24,6 +24,12 @@ full current Euler publication and source hierarchical model rotation.146 native
|
|||||||
observations now compare with managed components. The model-local sole correction
|
observations now compare with managed components. The model-local sole correction
|
||||||
is modern; exact final OMT render decomposition and broad collision remain open.
|
is modern; exact final OMT render decomposition and broad collision remain open.
|
||||||
|
|
||||||
|
[Body contact ownership](body-contact-implementation.md) now closes the finite
|
||||||
|
current/previous XYZW barrier, independent body modes, context lifetime and landing
|
||||||
|
payload ordering.100 new complete original comparisons and six callback-state
|
||||||
|
comparisons pass. Special callback mechanics, actor mode persistence and scene-wide
|
||||||
|
dynamic/shared context remain separate gates; lab/outside capsule is preserved.
|
||||||
|
|
||||||
| ID / system | Recovered contract / anchors | Port implementation | Evidence / remaining gap | Next bounded action |
|
| 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. |
|
| 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. |
|
||||||
|
|||||||
@@ -128,3 +128,13 @@ or existing tests/docs were modified by this investigator; no commit was made.
|
|||||||
4. Complete dynamic pair eligibility/shared context and Vec4 publication, then
|
4. Complete dynamic pair eligibility/shared context and Vec4 publication, then
|
||||||
run input-only lab/tutorial/RETURN/outside cases with known special contacts.
|
run input-only lab/tutorial/RETURN/outside cases with known special contacts.
|
||||||
General floor/step/wall fidelity is not established by these27 leaf probes.
|
General floor/step/wall fidelity is not established by these27 leaf probes.
|
||||||
|
|
||||||
|
|
||||||
|
## Subsequent prerequisite implementation
|
||||||
|
|
||||||
|
[Body contact implementation](body-contact-implementation.md) now supplies the
|
||||||
|
fresh previous/live XYZW barrier, independent source modes and landing ownership,
|
||||||
|
with100 complete native comparisons plus six callback-state cases. The missing
|
||||||
|
barrier/flag paragraphs above describe the audit baseline, superseded by that
|
||||||
|
bounded foundation. Actual hazard/climb callbacks, animation acceptance/completion,
|
||||||
|
per-actor multi-frame state and dynamic context still gate broad admission.
|
||||||
@@ -1,5 +1,14 @@
|
|||||||
# Compatibility and validation
|
# Compatibility and validation
|
||||||
|
|
||||||
|
Body contact foundation (2026-11-05): finite XYZW publication, independent body
|
||||||
|
modes, static-context retention and landing callback ownership implemented.100
|
||||||
|
full native numeric outputs and six state/branch comparisons pass; existing
|
||||||
|
20 body/13 Scooter/13 Grappler groups pass. Native Linux both Scooter scenes,
|
||||||
|
Jimmy walking/flight and control phases pass with zero Vulkan errors; all five
|
||||||
|
Jimmy final/airborne readbacks match the preserved air bridge exactly. No special
|
||||||
|
Jimmy contact or broader scene admission is enabled. Evidence and remaining
|
||||||
|
limits: [body contact](checkpoint/body-contact-implementation.md).
|
||||||
|
|
||||||
Jimmy airborne bridge (2026-11-05): ordinary forward/back pitch and turn lean,
|
Jimmy airborne bridge (2026-11-05): ordinary forward/back pitch and turn lean,
|
||||||
source target/dirty/Init/retained-seed ownership, full authored Euler and logical
|
source target/dirty/Init/retained-seed ownership, full authored Euler and logical
|
||||||
root hierarchical rendering are integrated.146 native component outputs match;
|
root hierarchical rendering are integrated.146 native component outputs match;
|
||||||
|
|||||||
@@ -329,3 +329,14 @@
|
|||||||
an original pivot offset or mutate source geometry/body support. Defer OMT's
|
an original pivot offset or mutate source geometry/body support. Defer OMT's
|
||||||
final approximate-angle model decomposition with its measured seam mismatch.
|
final approximate-angle model decomposition with its measured seam mismatch.
|
||||||
Broader special/dynamic collision retains separate gates. See jimmy-air-bridge.md.
|
Broader special/dynamic collision retains separate gates. See jimmy-air-bridge.md.
|
||||||
|
|
||||||
|
50. **Preserve contact-owned root and body modes instead of treating world-off as noclip.**
|
||||||
|
Keep current/previous full Vec4, anchor and source integration/support/
|
||||||
|
collision/world/alternate gates independently. Only fresh XYZW equality permits
|
||||||
|
publication of the original candidate; callback roots do not inherit stale
|
||||||
|
falling displacement/clamp. Landing callback root/anchor/acceleration/impulse/
|
||||||
|
modes persist, while cached velocity/support publication follows afterward.
|
||||||
|
World-off still integrates and may support; collision-off has its own hold/
|
||||||
|
translation branch. Preserve inactive-path context. Retain the lab/outside
|
||||||
|
capsule until real Jimmy callbacks and multi-frame/dynamic ownership are proven.
|
||||||
|
See checkpoint/body-contact-implementation.md.
|
||||||
@@ -1,5 +1,23 @@
|
|||||||
# Progress — 2026-11-05
|
# Progress — 2026-11-05
|
||||||
|
|
||||||
|
## Body root/mode ownership checkpoint
|
||||||
|
|
||||||
|
Implemented the next Jimmy body prerequisites while keeping lab/outside capsule
|
||||||
|
and special-contact gates. OriginalBodyPhysics separates integration/support/
|
||||||
|
collision/world response/alternate/global geometry, retains previous/current
|
||||||
|
Vec4 and anchor, gives callbacks the live root and uses fresh XYZW equality for
|
||||||
|
candidate publication. Support/landing callback state ownership is explicit;
|
||||||
|
only world publication applies its candidate clamp/falling displacement.
|
||||||
|
|
||||||
|
New conformance compares100 complete native outputs (19 root+81 mode/landing)
|
||||||
|
and six callback-state cases with an explicit synthetic-vs-real wall boundary.
|
||||||
|
All pass, as do existing20 body/13 Scooter/13 Grappler targeted groups. Source/
|
||||||
|
provenance: [implementation](checkpoint/body-contact-implementation.md),
|
||||||
|
[root](checkpoint/body-root-publication.md), [modes](checkpoint/body-modes.md).
|
||||||
|
Full regression/native/package verification is in progress. Both investigators
|
||||||
|
returned ownership. Real Jimmy hazard/climb state and dynamic eligibility remain
|
||||||
|
next; no broad admission, new gadget or whole-original parity is claimed.
|
||||||
|
|
||||||
## Jimmy airborne target and render bridge
|
## Jimmy airborne target and render bridge
|
||||||
|
|
||||||
Ordinary jump/jetpack now reads source forward/backward pitch and turn lean, with
|
Ordinary jump/jetpack now reads source forward/backward pitch and turn lean, with
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ 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
|
evidence, not original source. Original gameplay has not yet been observed successfully; isolated original DLL
|
||||||
probes and modern runtime checks are recorded separately.
|
probes and modern runtime checks are recorded separately.
|
||||||
|
|
||||||
|
- [Body root publication](checkpoint/body-root-publication.md) and
|
||||||
|
[body modes](checkpoint/body-modes.md):19 actual dispatcher/kernel contact-root
|
||||||
|
observations plus87 body/support/friction flag/payload observations. Parent
|
||||||
|
[integration](checkpoint/body-contact-implementation.md) compares100 complete
|
||||||
|
outputs and six state-only mutation cases; independent flags, XYZW and landing
|
||||||
|
ownership are implemented without enabling special Jimmy terrain or dynamic pairs.
|
||||||
- [Jimmy air target state](gameplay/jimmy-air-target-state.md) and
|
- [Jimmy air target state](gameplay/jimmy-air-target-state.md) and
|
||||||
[render transform](gameplay/jimmy-render-transform.md): apply-owned pitch seeds,
|
[render transform](gameplay/jimmy-render-transform.md): apply-owned pitch seeds,
|
||||||
full STRT/current Euler, destination/dirty Init, degree-to-short caching and
|
full STRT/current Euler, destination/dirty Init, degree-to-short caching and
|
||||||
|
|||||||
+7
-2
@@ -60,8 +60,13 @@ compile, runtime and original-fidelity verification are separate.
|
|||||||
12 target writes plus12 degree/14 hierarchical transforms compare against
|
12 target writes plus12 degree/14 hierarchical transforms compare against
|
||||||
managed components. Sole alignment remains modern; final OMT decomposition
|
managed components. Sole alignment remains modern; final OMT decomposition
|
||||||
precision is separate. See gameplay/jimmy-air-bridge.md.
|
precision is separate. See gameplay/jimmy-air-bridge.md.
|
||||||
- [ ] Then verify root-changing contact publication, world-response/integration
|
- [x] Body callback publication/mode prerequisite: finite XYZW fresh equality,
|
||||||
flags, successful fence/ladder completion, hazard/impulse and dynamic eligibility
|
independent integration/support/collision/world/alternate modes, context lifetime
|
||||||
|
and landing payload ownership.100 full native comparisons plus six callback
|
||||||
|
state cases pass. Special callback/body admission remains gated; see
|
||||||
|
checkpoint/body-contact-implementation.md.
|
||||||
|
- [ ] Next verify successful fence/ladder completion, hazard/impulse, actor mode
|
||||||
|
persistence/control/facing and dynamic eligibility
|
||||||
before replacing the lab/outside capsule.27 dispatch cases establish eligibility
|
before replacing the lab/outside capsule.27 dispatch cases establish eligibility
|
||||||
only; the unfinished successful-climb harness remains ignored investigation work.
|
only; the unfinished successful-climb harness remains ignored investigation work.
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ dotnet run --project tests/GamePort.SupportTests -- ../Original
|
|||||||
dotnet run --project tests/GamePort.SphereResponseTests
|
dotnet run --project tests/GamePort.SphereResponseTests
|
||||||
dotnet run --project tests/GamePort.StaticCollisionTests
|
dotnet run --project tests/GamePort.StaticCollisionTests
|
||||||
dotnet run --project tests/GamePort.BodyPhysicsTests
|
dotnet run --project tests/GamePort.BodyPhysicsTests
|
||||||
|
dotnet run --project tests/GamePort.BodyOwnershipTests
|
||||||
dotnet run --project tests/GamePort.GadgetTests
|
dotnet run --project tests/GamePort.GadgetTests
|
||||||
dotnet run --project tests/GamePort.InvisibleTests
|
dotnet run --project tests/GamePort.InvisibleTests
|
||||||
dotnet run --project tests/GamePort.BubbleMotionTests
|
dotnet run --project tests/GamePort.BubbleMotionTests
|
||||||
|
|||||||
@@ -2,27 +2,42 @@ using System.Numerics;
|
|||||||
|
|
||||||
namespace GamePort.Game;
|
namespace GamePort.Game;
|
||||||
|
|
||||||
|
/// <summary>Independent479D20 virtual gates, not the global geometry switch.
|
||||||
|
/// Null Modes on legacy state means these ordinary defaults.</summary>
|
||||||
|
public sealed record BodyModes(bool Integration=true,bool Support=true,bool Collision=true,
|
||||||
|
bool WorldResponse=true,bool HoldPosition=false)
|
||||||
|
{
|
||||||
|
public static BodyModes Ordinary {get;} = new();
|
||||||
|
}
|
||||||
|
|
||||||
public readonly record struct OrdinaryBodyState(Vector3 Position, Vector3 Velocity,
|
public readonly record struct OrdinaryBodyState(Vector3 Position, Vector3 Velocity,
|
||||||
Vector3 Acceleration, Vector3 Impulse, bool Supported = false, float PublishedSpeed = 0,
|
Vector3 Acceleration, Vector3 Impulse, bool Supported = false, float PublishedSpeed = 0,
|
||||||
Vector3 AngularVelocity = default, Vector3 Rotation = default);
|
Vector3 AngularVelocity = default, Vector3 Rotation = default,float PositionW=1,
|
||||||
|
Vector4? PreviousRoot=null,Vector3 SupportAnchor=default,BodyModes? Modes=null)
|
||||||
|
{
|
||||||
|
public OrdinaryBodyState():this(Vector3.Zero,Vector3.Zero,Vector3.Zero,Vector3.Zero) { }
|
||||||
|
public Vector4 Root => new(Position,PositionW);
|
||||||
|
public BodyModes EffectiveModes => Modes??BodyModes.Ordinary;
|
||||||
|
}
|
||||||
|
|
||||||
public readonly record struct BodyLandingObservation(Vector3 Position, Vector3 Velocity,
|
public readonly record struct BodyLandingObservation(Vector3 Position, Vector3 Velocity,
|
||||||
Vector3 Acceleration, bool Supported);
|
Vector3 Acceleration, bool Supported);
|
||||||
|
|
||||||
public readonly record struct OrdinaryBodyStep(OrdinaryBodyState Body, Vector3 PreviousPosition,
|
public readonly record struct OrdinaryBodyStep(OrdinaryBodyState Body, Vector3 PreviousPosition,
|
||||||
Vector3 SupportAnchor, SupportHit? SupportHit, BodyLandingObservation? Landing,
|
Vector3 SupportAnchor, SupportHit? SupportHit, BodyLandingObservation? Landing,
|
||||||
CameraRayPolygon? Contact, int CollisionPasses, int TriangleTests);
|
CameraRayPolygon? Contact, int CollisionPasses, int TriangleTests,bool CandidatePublished=false);
|
||||||
|
|
||||||
public enum BodyResponseProfile { Jimmy, Baseball, Rocketship }
|
public enum BodyResponseProfile { Jimmy, Baseball, Rocketship }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bounded479D20 composition: enabled integration/support/pairs/static flags,
|
/// Bounded479D20 composition with independent body modes, finite Vec4 publication,
|
||||||
/// prevent-lowering true, ordinary Jimmy370/374/37C and no dynamic body pass.
|
/// ordinary/profile contacts and explicit callback ownership. Special Jimmy
|
||||||
/// Special Player374 policies are rejected at construction. This is independent
|
/// policies and dynamic pairs remain gated; no raw-control gate belongs here.
|
||||||
/// of controller ownership and published speed is distinct from input speed608.
|
/// Source roots/modes/anchor persist in Body; PreviousPosition in the step result
|
||||||
/// Euler addition follows the probe's334 fixture contract; actual generic angle
|
/// remains the entry-XYZ diagnostic used by the legacy dynamic adapter.
|
||||||
/// wrapping is not recovered. The live player bridge supplies zero angular speed.
|
/// Angular addition retains the body probe's fixture contract; live Jimmy supplies
|
||||||
/// See collision-body-probe.md and collision-body-composition-source.md.
|
/// zero angular speed. Radius/friction/factor arguments are fixed for this pass.
|
||||||
|
/// See body-root-publication.md, body-modes.md and collision-body-composition-source.md.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class OriginalBodyPhysics
|
public sealed class OriginalBodyPhysics
|
||||||
{
|
{
|
||||||
@@ -51,11 +66,12 @@ public sealed class OriginalBodyPhysics
|
|||||||
float radius = OriginalBodySupport.JimmyRadius, float factor = OriginalBodySupport.JimmyFactor,
|
float radius = OriginalBodySupport.JimmyRadius, float factor = OriginalBodySupport.JimmyFactor,
|
||||||
float friction = .8f, float suppressionScale = .5f, bool geometryEnabled = true,
|
float friction = .8f, float suppressionScale = .5f, bool geometryEnabled = true,
|
||||||
BodyResponseProfile profile = BodyResponseProfile.Jimmy,
|
BodyResponseProfile profile = BodyResponseProfile.Jimmy,
|
||||||
Func<OrdinaryBodyState,CameraRayPolygon,OrdinaryBodyState>? wallContact = null)
|
Func<OrdinaryBodyState,CameraRayPolygon,OrdinaryBodyState>? wallContact = null,
|
||||||
|
Func<OrdinaryBodyState,BodyLandingObservation,OrdinaryBodyState>? landingContact = null,
|
||||||
|
Func<bool>? geometryState = null)
|
||||||
{
|
{
|
||||||
Finite(body.Position); Finite(body.Velocity); Finite(body.Acceleration); Finite(body.Impulse);
|
Validate(body);
|
||||||
Finite(body.AngularVelocity); Finite(body.Rotation);
|
if (!float.IsFinite(friction) || !float.IsFinite(suppressionScale)
|
||||||
if (!float.IsFinite(body.PublishedSpeed) || !float.IsFinite(friction) || !float.IsFinite(suppressionScale)
|
|
||||||
|| !float.IsFinite(factor)) throw new ArgumentOutOfRangeException(nameof(body));
|
|| !float.IsFinite(factor)) throw new ArgumentOutOfRangeException(nameof(body));
|
||||||
if (!float.IsFinite(radius) || radius <= 0) throw new ArgumentOutOfRangeException(nameof(radius));
|
if (!float.IsFinite(radius) || radius <= 0) throw new ArgumentOutOfRangeException(nameof(radius));
|
||||||
if (!float.IsFinite(seconds) || seconds <= 0 || seconds >= 1)
|
if (!float.IsFinite(seconds) || seconds <= 0 || seconds >= 1)
|
||||||
@@ -63,9 +79,14 @@ public sealed class OriginalBodyPhysics
|
|||||||
|
|
||||||
var previous = body.Position;
|
var previous = body.Position;
|
||||||
var wasSupported = body.Supported;
|
var wasSupported = body.Supported;
|
||||||
body = body with { Supported = false };
|
if(body.EffectiveModes.Support)body = body with { Supported = false };
|
||||||
|
//479D3D's support clear precedes479D58's integration gate. Inactive
|
||||||
|
//integration preserves impulse, roots, anchor and the shared context.
|
||||||
|
if(!body.EffectiveModes.Integration)
|
||||||
|
return new(body,previous,body.SupportAnchor,null,null,null,0,0);
|
||||||
|
var geometryAtIntegration=geometryState?.Invoke()??geometryEnabled;
|
||||||
var anchor = new Vector3(0, -25000, 0);
|
var anchor = new Vector3(0, -25000, 0);
|
||||||
if (!geometryEnabled)
|
if (!geometryAtIntegration)
|
||||||
{
|
{
|
||||||
//479DF7..479E5A: global geometry-off policy, not prior support.
|
//479DF7..479E5A: global geometry-off policy, not prior support.
|
||||||
anchor.Y = previous.Y;
|
anchor.Y = previous.Y;
|
||||||
@@ -77,16 +98,94 @@ public sealed class OriginalBodyPhysics
|
|||||||
var impulse = body.Impulse;
|
var impulse = body.Impulse;
|
||||||
var delta = RecoveredMotion.Integrate(ref velocity, ref impulse, body.Acceleration,
|
var delta = RecoveredMotion.Integrate(ref velocity, ref impulse, body.Acceleration,
|
||||||
RecoveredMotion.Gravity, seconds);
|
RecoveredMotion.Gravity, seconds);
|
||||||
var context = new StaticCollisionContext(radius);
|
body=body with{Velocity=velocity,Impulse=impulse,SupportAnchor=anchor};
|
||||||
LastStaticContext=context;
|
var collisionBranch=body.EffectiveModes.Collision;
|
||||||
|
StaticCollisionContext? context=null;
|
||||||
|
CameraRayPolygon? terminal=null;
|
||||||
|
bool published=false;
|
||||||
|
if(collisionBranch&&body.EffectiveModes.WorldResponse)
|
||||||
|
{
|
||||||
|
context=new(radius);LastStaticContext=context;
|
||||||
|
body=body with{PreviousRoot=body.Root};
|
||||||
|
var candidateW=body.PositionW;
|
||||||
var horizontalFirst = delta.Y <= 0;
|
var horizontalFirst = delta.Y <= 0;
|
||||||
var move = collision.Move(previous, horizontalFirst ? delta with { Y = 0 } : delta,
|
var move=collision.Move(body.Position,horizontalFirst?delta with{Y=0}:delta,
|
||||||
radius, context, geometryEnabled: geometryEnabled);
|
radius,context,geometryEnabled:geometryAtIntegration);
|
||||||
var acceleration = body.Acceleration;
|
terminal=move.CallbackPolygon;
|
||||||
|
body=Contact(body,terminal,profile);
|
||||||
|
//The dispatcher changes its candidate, not the actor's live root.
|
||||||
|
//The hook sees the live root and may change previous/live independently.
|
||||||
|
if(wallContact!=null&&terminal is{StoredNormal.Y:>-.7f}wall)body=wallContact(body,wall);
|
||||||
|
Validate(body);
|
||||||
|
if(body.PreviousRoot==body.Root)
|
||||||
|
{
|
||||||
|
var candidate=move.Position;
|
||||||
|
if(horizontalFirst)candidate.Y+=delta.Y;
|
||||||
|
candidate.Y=MathF.Max(candidate.Y,-25000);
|
||||||
|
body=body with{Position=candidate,PositionW=candidateW};published=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(collisionBranch)
|
||||||
|
{
|
||||||
|
//47A1CC: disabling world response does not disable integration,
|
||||||
|
//support/friction or initialize the static collision context.
|
||||||
|
body=body with{PreviousRoot=body.Root,Position=body.Position+delta};
|
||||||
|
}
|
||||||
|
else if(!body.EffectiveModes.HoldPosition)
|
||||||
|
{
|
||||||
|
//47A264: collision disabled translates without updating previous;
|
||||||
|
//alternate228 holds position. Both skip support and friction below.
|
||||||
|
body=body with{Position=body.Position+delta};
|
||||||
|
}
|
||||||
|
|
||||||
|
SupportHit? supportHit = null;
|
||||||
|
BodyLandingObservation? landing = null;
|
||||||
|
if(collisionBranch&&body.EffectiveModes.Support)
|
||||||
|
{
|
||||||
|
var supportPrevious=body.PreviousRoot is{} root?new Vector3(root.X,root.Y,root.Z):previous;
|
||||||
|
var support = OriginalBodySupport.Resolve(new(body.Position,supportPrevious,body.Velocity,body.Acceleration,radius,factor,
|
||||||
|
PreventLowering: profile != BodyResponseProfile.Baseball),
|
||||||
|
wasSupported, (start, end, sides) => collision.TraceSupport(start, end, sides),
|
||||||
|
geometryEnabled:geometryState?.Invoke()??geometryEnabled);
|
||||||
|
if(support.Supported)
|
||||||
|
{
|
||||||
|
body=body with{Position=support.Body.Position,Acceleration=support.Body.Acceleration,
|
||||||
|
SupportAnchor=support.SupportAnchor};
|
||||||
|
if(support.Landed)
|
||||||
|
{
|
||||||
|
landing=new(body.Position,body.Velocity,body.Acceleration,body.Supported);
|
||||||
|
if(profile==BodyResponseProfile.Baseball)
|
||||||
|
body=body with{Impulse=new(body.Velocity.X,body.Velocity.Y*-.65f,body.Velocity.Z)};
|
||||||
|
if(landingContact!=null)body=landingContact(body,landing.Value);
|
||||||
|
Validate(body);
|
||||||
|
}
|
||||||
|
//47BB83 restores cached pre-callback X/Z and zeros Y. Root,
|
||||||
|
//anchor, acceleration, impulse and mode edits survive37C.
|
||||||
|
body=body with{Velocity=support.Body.Velocity,Supported=true};
|
||||||
|
supportHit=support.Hit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
anchor=body.SupportAnchor;
|
||||||
|
if(collisionBranch&&body.PublishedSpeed==0&&body.Supported&&OriginalBodySupport.QuickMagnitude(body.Velocity)>0)
|
||||||
|
{
|
||||||
|
var v=body.Velocity;var w=body.AngularVelocity;
|
||||||
|
body=body with{Velocity=v+new Vector3(-v.X*friction*seconds,0,-v.Z*friction*seconds),
|
||||||
|
AngularVelocity=w+new Vector3(-w.X*friction*seconds,-w.Y*friction*seconds,-w.Z*friction*seconds)};
|
||||||
|
}
|
||||||
|
if(OriginalBodySupport.QuickMagnitude(body.AngularVelocity)*suppressionScale<=.1f)
|
||||||
|
body=body with{AngularVelocity=Vector3.Zero};
|
||||||
|
if(body.PublishedSpeed==0&&OriginalBodySupport.QuickMagnitude(body.Velocity)*suppressionScale<=.1f)
|
||||||
|
body=body with{Velocity=Vector3.Zero};
|
||||||
|
return new(body,previous,anchor,supportHit,landing,terminal,context?.Passes??0,context?.TriangleTests??0,published);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static OrdinaryBodyState Contact(OrdinaryBodyState body,CameraRayPolygon? terminal,BodyResponseProfile profile)
|
||||||
|
{
|
||||||
|
var velocity=body.Velocity;var acceleration=body.Acceleration;
|
||||||
//47B80F/47B82E -> Jimmy ordinary374 or positive-Y-only370.
|
//47B80F/47B82E -> Jimmy ordinary374 or positive-Y-only370.
|
||||||
// Neither supported callback moves the actor root, so the source's
|
// Neither supported callback moves the actor root, so the source's
|
||||||
// post-callback previous/live-root equality test permits publication.
|
// post-callback previous/live-root equality test permits publication.
|
||||||
if (move.CallbackPolygon is { } contact && contact.StoredNormal.Y <= -.7f)
|
if (terminal is { } contact && contact.StoredNormal.Y <= -.7f)
|
||||||
{
|
{
|
||||||
if (profile == BodyResponseProfile.Rocketship)
|
if (profile == BodyResponseProfile.Rocketship)
|
||||||
velocity.Y = -120; //43EB70: unconditional; acceleration survives.
|
velocity.Y = -120; //43EB70: unconditional; acceleration survives.
|
||||||
@@ -96,7 +195,7 @@ public sealed class OriginalBodyPhysics
|
|||||||
if (acceleration.Y > 0) acceleration.Y = 0;
|
if (acceleration.Y > 0) acceleration.Y = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (profile == BodyResponseProfile.Baseball && move.CallbackPolygon is { } wall)
|
else if (profile == BodyResponseProfile.Baseball && terminal is { } wall)
|
||||||
{
|
{
|
||||||
//40FEE0 ->458890 ->472750: reflect horizontal direction, keep Y,
|
//40FEE0 ->458890 ->472750: reflect horizontal direction, keep Y,
|
||||||
//then damp horizontal components by1-.46. Its angular tail does not
|
//then damp horizontal components by1-.46. Its angular tail does not
|
||||||
@@ -111,55 +210,22 @@ public sealed class OriginalBodyPhysics
|
|||||||
reflected.Z * magnitude * (1-.46f));
|
reflected.Z * magnitude * (1-.46f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var position = move.Position;
|
return body with{Velocity=velocity,Acceleration=acceleration};
|
||||||
if(wallContact!=null&&move.CallbackPolygon is{StoredNormal.Y:>-.7f}terminal)
|
|
||||||
{
|
|
||||||
body=wallContact(body with{Position=position,Velocity=velocity,Acceleration=acceleration,Impulse=impulse},terminal);
|
|
||||||
position=body.Position;velocity=body.Velocity;acceleration=body.Acceleration;impulse=body.Impulse;
|
|
||||||
}
|
}
|
||||||
if (horizontalFirst) position.Y += delta.Y;
|
|
||||||
position.Y = MathF.Max(position.Y, -25000);
|
|
||||||
body = body with { Position = position, Velocity = velocity, Acceleration = acceleration, Impulse = impulse };
|
|
||||||
|
|
||||||
SupportHit? supportHit = null;
|
private static void Finite(Vector4 value)
|
||||||
BodyLandingObservation? landing = null;
|
|
||||||
if (geometryEnabled)
|
|
||||||
{
|
{
|
||||||
var support = OriginalBodySupport.Resolve(new(position, previous, velocity, acceleration, radius, factor,
|
if(!float.IsFinite(value.X)||!float.IsFinite(value.Y)||!float.IsFinite(value.Z)||!float.IsFinite(value.W))
|
||||||
PreventLowering: profile != BodyResponseProfile.Baseball),
|
throw new ArgumentOutOfRangeException(nameof(value));
|
||||||
wasSupported, (start, end, sides) => collision.TraceSupport(start, end, sides));
|
}
|
||||||
if (support.Supported)
|
|
||||||
|
private static void Validate(OrdinaryBodyState body)
|
||||||
{
|
{
|
||||||
//37C observes new root/zero acceleration but old velocity/support.
|
Finite(body.Position);Finite(body.Velocity);Finite(body.Acceleration);Finite(body.Impulse);
|
||||||
//Jimmy's inherited37C is a no-op; the observation is diagnostic.
|
Finite(body.AngularVelocity);Finite(body.Rotation);Finite(body.SupportAnchor);
|
||||||
if (support.Landed)
|
if(body.PreviousRoot is{} previous)Finite(previous);
|
||||||
{
|
if(!float.IsFinite(body.PositionW)||!float.IsFinite(body.PublishedSpeed))
|
||||||
landing = new(support.Body.Position, velocity, support.Body.Acceleration, false);
|
throw new ArgumentOutOfRangeException(nameof(body));
|
||||||
//40FF80 receives old live velocity after root/acceleration
|
|
||||||
//publication and writes impulse288, before support zeros Y.
|
|
||||||
if (profile == BodyResponseProfile.Baseball)
|
|
||||||
body = body with {Impulse = new(velocity.X, velocity.Y * -.65f, velocity.Z)};
|
|
||||||
}
|
|
||||||
body = body with { Position = support.Body.Position, Velocity = support.Body.Velocity,
|
|
||||||
Acceleration = support.Body.Acceleration, Supported = true };
|
|
||||||
anchor = support.SupportAnchor;
|
|
||||||
supportHit = support.Hit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (body.PublishedSpeed == 0 && body.Supported && OriginalBodySupport.QuickMagnitude(body.Velocity) > 0)
|
|
||||||
{
|
|
||||||
var v = body.Velocity;
|
|
||||||
var w = body.AngularVelocity;
|
|
||||||
body = body with {
|
|
||||||
Velocity = v + new Vector3(-v.X * friction * seconds, 0, -v.Z * friction * seconds),
|
|
||||||
AngularVelocity = w + new Vector3(-w.X * friction * seconds, -w.Y * friction * seconds, -w.Z * friction * seconds)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (OriginalBodySupport.QuickMagnitude(body.AngularVelocity) * suppressionScale <= .1f)
|
|
||||||
body = body with { AngularVelocity = Vector3.Zero };
|
|
||||||
if (body.PublishedSpeed == 0 && OriginalBodySupport.QuickMagnitude(body.Velocity) * suppressionScale <= .1f)
|
|
||||||
body = body with { Velocity = Vector3.Zero };
|
|
||||||
return new(body, previous, anchor, supportHit, landing, move.CallbackPolygon, context.Passes, context.TriangleTests);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Finite(Vector3 value)
|
private static void Finite(Vector3 value)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public sealed class Scooter : IDisposable
|
|||||||
}
|
}
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
Release();body=default;Steering=default;RiderRotation=Rotation=destination=Vector3.Zero;
|
Release();body=new();Steering=default;RiderRotation=Rotation=destination=Vector3.Zero;
|
||||||
faceRate=5;poseClock=impactTime=0;ImpactActive=jumpLatch=RiderStopped=false;wheels.Reset();
|
faceRate=5;poseClock=impactTime=0;ImpactActive=jumpLatch=RiderStopped=false;wheels.Reset();
|
||||||
BodySteps=InputSteps=FrameSteps=Contacts=Jumps=0;
|
BodySteps=InputSteps=FrameSteps=Contacts=Jumps=0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><EnableDefaultCompileItems>false</EnableDefaultCompileItems></PropertyGroup>
|
||||||
|
<ItemGroup><Compile Include="Program.cs"/><Compile Include="../../src/GamePort/Assets/*.cs"/><Compile Include="../../src/GamePort/Game/*.cs"/>
|
||||||
|
<None Include="../body-modes-reference.json" Link="body-modes-reference.json" CopyToOutputDirectory="PreserveNewest"/>
|
||||||
|
<None Include="../body-root-publication-reference.json" Link="body-root-publication-reference.json" CopyToOutputDirectory="PreserveNewest"/>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
using System.Numerics;
|
||||||
|
using System.Text.Json;
|
||||||
|
using GamePort.Game;
|
||||||
|
|
||||||
|
using var modes=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"body-modes-reference.json")));
|
||||||
|
int full=0,mutations=0;
|
||||||
|
foreach(var c in modes.RootElement.GetProperty("cases").EnumerateArray())
|
||||||
|
{
|
||||||
|
var p=c.GetProperty("input");var f=c.GetProperty("flags");var o=c.GetProperty("observed");
|
||||||
|
string name=c.GetProperty("name").GetString()!;int mutation=c.GetProperty("mutation").GetInt32();
|
||||||
|
bool geometry=f.GetProperty("geometry").GetBoolean();
|
||||||
|
var initial=new OrdinaryBodyState(V3(p,"position"),V3(p,"velocity"),V3(p,"acceleration"),V3(p,"impulse"),
|
||||||
|
p.GetProperty("supported").GetBoolean(),F(p,"published_speed"),V3(p,"angular"),V3(p,"rotation"),
|
||||||
|
V4(p,"position").W,V4(p,"previous"),V3(p,"anchor"),new(
|
||||||
|
f.GetProperty("integration").GetBoolean(),f.GetProperty("support").GetBoolean(),
|
||||||
|
f.GetProperty("collision").GetBoolean(),f.GetProperty("world_response").GetBoolean(),f.GetProperty("alternate").GetBoolean()));
|
||||||
|
bool worldMutation=mutation is >=1 and <=6;
|
||||||
|
//The native mode probe substitutes a linear dispatcher. For its six
|
||||||
|
//mutation cases, a real wall supplies our callback, so clipped XYZ is
|
||||||
|
//deliberately excluded while state and branch ownership are compared.
|
||||||
|
var polygons=new List<CameraRayPolygon>{Floor()};
|
||||||
|
if(worldMutation)polygons.Add(new(new(new(61,-1000,-1000),new(61,1000,-1000),new(61,0,1000),2),-Vector3.UnitX));
|
||||||
|
var physics=new OriginalBodyPhysics(new(polygons));int contacts=0,landings=0;
|
||||||
|
var result=physics.Step(initial,F(p,"seconds"),F(p,"radius"),F(p,"factor"),F(p,"friction"),F(p,"suppression_scale"),
|
||||||
|
geometryEnabled:geometry,wallContact:(body,_)=>
|
||||||
|
{
|
||||||
|
contacts++;
|
||||||
|
var flags=body.EffectiveModes;
|
||||||
|
if(mutation is 1 or 6)flags=flags with{Support=false};
|
||||||
|
if(mutation is 2 or 6)flags=flags with{WorldResponse=false};
|
||||||
|
if(mutation is 3 or 6)flags=flags with{Collision=false};
|
||||||
|
if(mutation is 4 or 6)flags=flags with{Integration=false};
|
||||||
|
if(mutation==5)geometry=false;
|
||||||
|
return body with{Modes=flags};
|
||||||
|
},landingContact:(body,_)=>
|
||||||
|
{
|
||||||
|
landings++;
|
||||||
|
return mutation switch
|
||||||
|
{
|
||||||
|
10=>body with{Modes=body.EffectiveModes with{Support=false}},
|
||||||
|
11=>body with{Modes=body.EffectiveModes with{Collision=false}},
|
||||||
|
12=>body with{PublishedSpeed=100},
|
||||||
|
13=>body with{Modes=body.EffectiveModes with{Integration=false}},
|
||||||
|
14=>body with{Velocity=new(7,123,9)},
|
||||||
|
15=>body with{Acceleration=new(7,123,9)},
|
||||||
|
16=>body with{Position=new(77,88,99),PositionW=2},
|
||||||
|
17=>body with{Impulse=new(7,123,9)},
|
||||||
|
18=>body with{SupportAnchor=new(7,123,9)},
|
||||||
|
19=>body with{AngularVelocity=new(7,123,9)},
|
||||||
|
20=>body with{Supported=false},
|
||||||
|
_=>body
|
||||||
|
};
|
||||||
|
},geometryState:()=>geometry);
|
||||||
|
var actual=result.Body;
|
||||||
|
if(!worldMutation){Near4(actual.Root,V4(o,"position"),name+" root");full++;}
|
||||||
|
else{Check(contacts==1&&result.CandidatePublished,name+" current world branch continues after mode mutation");mutations++;}
|
||||||
|
Near4(actual.PreviousRoot??initial.Root,V4(o,"previous"),name+" previous");
|
||||||
|
Near3(actual.Velocity,V3(o,"velocity"),name+" velocity");Near3(actual.Acceleration,V3(o,"acceleration"),name+" acceleration");
|
||||||
|
Near3(actual.Impulse,V3(o,"impulse"),name+" impulse");Near3(actual.AngularVelocity,V3(o,"angular"),name+" angular");
|
||||||
|
Near3(actual.Rotation,V3(o,"rotation"),name+" rotation");Near3(actual.SupportAnchor,V3(o,"anchor"),name+" anchor");
|
||||||
|
Near3(result.SupportAnchor,actual.SupportAnchor,name+" anchor diagnostic");
|
||||||
|
Near(actual.PublishedSpeed,F(o,"speed"),name+" speed");Check(actual.Supported==(F(o,"supported")!=0),name+" supported");
|
||||||
|
Check(landings==(int)F(o,"landings")&&result.Landing.HasValue==(landings!=0),name+" landing callbacks");
|
||||||
|
var final=o.GetProperty("final_flags").EnumerateArray().Select(x=>x.GetInt32()!=0).ToArray();var flagsAfter=actual.EffectiveModes;
|
||||||
|
Check(final.SequenceEqual(new[]{flagsAfter.Integration,flagsAfter.Support,flagsAfter.WorldResponse,flagsAfter.Collision,flagsAfter.HoldPosition,geometry}),name+" final flags");
|
||||||
|
}
|
||||||
|
Check(full==81&&mutations==6,"complete mode fixture coverage");
|
||||||
|
Console.WriteLine("PASS81 copied-original full numeric body mode/landing cases;6 callback-mode ownership cases compare state with explicit real-wall candidate difference");
|
||||||
|
|
||||||
|
using var roots=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"body-root-publication-reference.json")));
|
||||||
|
int rootCases=0;
|
||||||
|
foreach(var c in roots.RootElement.GetProperty("cases").EnumerateArray())
|
||||||
|
{
|
||||||
|
var p=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray();var o=c.GetProperty("observed");
|
||||||
|
string name=c.GetProperty("name").GetString()!;int kind=(int)p[0];bool support=p[3]!=0;
|
||||||
|
var wall=new CameraRayPolygon(new(new(-1000,-100000,0),new(-1000,100000,0),new(100000,0,0),2),Vector3.UnitZ);
|
||||||
|
var physics=new OriginalBodyPhysics(new([wall,Floor()]));
|
||||||
|
var entry=new Vector4(0,p[1],20,1);var previous=kind==11?new Vector4(999,999,999,3):entry;
|
||||||
|
//Native17 isolation cases no-op47B890; the managed support gate isolates
|
||||||
|
//the same publication outputs. The other2 cases execute real support.
|
||||||
|
var input=new OrdinaryBodyState(new(0,p[1],20),new(0,p[2],-900),Vector3.Zero,new(0,p[4]!=0?30:0,0),
|
||||||
|
PublishedSpeed:100,PreviousRoot:previous,Modes:BodyModes.Ordinary with{Support=support});
|
||||||
|
Vector4 seen=default,seenPrevious=default;Vector3 seenVelocity=default;int contacts=0;
|
||||||
|
var result=physics.Step(input,1f/60,radius:10,wallContact:(body,_)=>
|
||||||
|
{
|
||||||
|
contacts++;seen=body.Root;seenPrevious=body.PreviousRoot!.Value;seenVelocity=body.Velocity;
|
||||||
|
return kind switch
|
||||||
|
{
|
||||||
|
1=>body with{Position=body.Position+Vector3.UnitX*100},
|
||||||
|
2=>body with{PreviousRoot=body.PreviousRoot!.Value+new Vector4(100,0,0,0)},
|
||||||
|
3=>body with{PositionW=2},4=>body with{PreviousRoot=body.PreviousRoot!.Value with{W=2}},
|
||||||
|
5=>body with{Position=new(101,-30000,303)},
|
||||||
|
6=>body with{Position=new(101,250,303),PreviousRoot=new Vector4(101,250,303,1)},
|
||||||
|
7=>body with{PositionW=2,PreviousRoot=body.PreviousRoot!.Value with{W=2}},
|
||||||
|
8=>body with{Velocity=new(9,8,7),Acceleration=new(4,5,6),Impulse=new(0,77,0)},
|
||||||
|
9=>body with{Position=new(101,5,303)},
|
||||||
|
10=>body with{Position=body.Position+Vector3.UnitX*100,PreviousRoot=body.PreviousRoot!.Value+new Vector4(100,0,0,0),Velocity=new(9,8,7),Impulse=new(0,77,0)},
|
||||||
|
_=>body
|
||||||
|
};
|
||||||
|
});
|
||||||
|
Near4(result.Body.Root,V4(o,"live"),name+" live");Near4(result.Body.PreviousRoot!.Value,V4(o,"previous"),name+" previous");
|
||||||
|
Near3(result.Body.Velocity,V3(o,"velocity"),name+" velocity");Near3(result.Body.Acceleration,V3(o,"acceleration"),name+" acceleration");
|
||||||
|
Near3(result.Body.Impulse,V3(o,"impulse"),name+" impulse");Near4(seen,V4(o,"seen"),name+" callback sees live root");
|
||||||
|
Near4(seenPrevious,V4(o,"seenPrevious"),name+" callback sees entry previous");Near3(seenVelocity,V3(o,"seenVelocity"),name+" callback velocity");
|
||||||
|
var flags=o.GetProperty("flags").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
|
||||||
|
Check(contacts==flags[0]&&result.CandidatePublished==(flags[1]!=0)&&result.Body.Supported==(flags[5]!=0)
|
||||||
|
&&result.Landing.HasValue==(flags[6]!=0),name+" publication/landing");rootCases++;
|
||||||
|
}
|
||||||
|
Check(rootCases==19,"complete native root fixture");
|
||||||
|
Console.WriteLine("PASS19 copied-original live/previous Vec4 publication cases, callback visibility, clamping and real support after root changes");
|
||||||
|
|
||||||
|
//A disabled world/body pass preserves the context needed by a later attached query.
|
||||||
|
var empty=new OriginalBodyPhysics(new([]));var state=new OrdinaryBodyState(new(0,100,0),Vector3.One,Vector3.Zero,Vector3.Zero);
|
||||||
|
var active=empty.Step(state,1f/60);var saved=empty.LastStaticContext;
|
||||||
|
foreach(var flags in new[]{BodyModes.Ordinary with{WorldResponse=false},BodyModes.Ordinary with{Collision=false},BodyModes.Ordinary with{Integration=false}})
|
||||||
|
{
|
||||||
|
var inactive=empty.Step(active.Body with{Modes=flags},1f/60);
|
||||||
|
Check(ReferenceEquals(saved,empty.LastStaticContext)&&inactive.CollisionPasses==0&&inactive.TriangleTests==0,"inactive path retains context without traversing stale geometry");
|
||||||
|
}
|
||||||
|
Console.WriteLine("PASS independent disabled gates preserve the prior static context");
|
||||||
|
|
||||||
|
static CameraRayPolygon Floor()=>new(new(new(-1000,0,-1000),new(1000,0,-1000),new(0,0,1000),1),Vector3.UnitY);
|
||||||
|
static float F(JsonElement e,string key)=>e.GetProperty(key).GetSingle();
|
||||||
|
static Vector3 V3(JsonElement e,string key){var a=e.GetProperty(key).EnumerateArray().Select(x=>x.GetSingle()).ToArray();return new(a[0],a[1],a[2]);}
|
||||||
|
static Vector4 V4(JsonElement e,string key){var a=e.GetProperty(key).EnumerateArray().Select(x=>x.GetSingle()).ToArray();return new(a[0],a[1],a[2],a[3]);}
|
||||||
|
static void Near(float a,float b,string name){if(!float.IsFinite(a)||MathF.Abs(a-b)>.004f)throw new Exception($"{name}: {a} != {b}");}
|
||||||
|
static void Near3(Vector3 a,Vector3 b,string name){Near(a.X,b.X,name+" X");Near(a.Y,b.Y,name+" Y");Near(a.Z,b.Z,name+" Z");}
|
||||||
|
static void Near4(Vector4 a,Vector4 b,string name){Near3(new(a.X,a.Y,a.Z),new(b.X,b.Y,b.Z),name);Near(a.W,b.W,name+" W");}
|
||||||
|
static void Check(bool value,string name){if(!value)throw new Exception(name);}
|
||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,78 @@
|
|||||||
|
"""Original body mode/landing phase guards and retained native observations."""
|
||||||
|
from pathlib import Path
|
||||||
|
import hashlib,json,sys,tempfile,unittest
|
||||||
|
ROOT=Path(__file__).resolve().parents[1]
|
||||||
|
sys.path.insert(0,str(ROOT/'tools/binary'))
|
||||||
|
from body_modes import collect,generate
|
||||||
|
|
||||||
|
class BodyModeEvidence(unittest.TestCase):
|
||||||
|
def fixture(self):
|
||||||
|
return json.loads((ROOT/'tests/body-modes-reference.json').read_text())
|
||||||
|
|
||||||
|
def test_original_source_and_provenance(self):
|
||||||
|
fixture=self.fixture();source=collect(ROOT.parent/'Original')
|
||||||
|
for key in ('sha256','bodies','probe_operands','rea_evidence_id','flag_slots','scope'):
|
||||||
|
self.assertEqual(source[key],fixture['source'][key])
|
||||||
|
for row in source['bodies']:
|
||||||
|
self.assertEqual(int(row['file_offset'],16),int(row['va'],16)-0x400000)
|
||||||
|
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)
|
||||||
|
self.assertEqual(len(fixture['cases']),87)
|
||||||
|
|
||||||
|
def test_all_sixty_four_original_flag_combinations(self):
|
||||||
|
cases={c['name']:c for c in self.fixture()['cases']}
|
||||||
|
for bits in range(64):
|
||||||
|
c=cases[f'flags_{bits:02}'];f=c['flags'];o=c['observed'];calls=o['calls']
|
||||||
|
integrate=f['integration'];collision=f['collision'];world=f['world_response'];support=f['support'];geometry=f['geometry']
|
||||||
|
self.assertEqual(calls[0],int(integrate and collision and world))
|
||||||
|
self.assertEqual(calls[1],int(integrate and ((collision and not world) or (not collision and not f['alternate']))))
|
||||||
|
self.assertEqual(calls[2],int(integrate and collision))
|
||||||
|
self.assertEqual(calls[3],int(integrate and collision and world))
|
||||||
|
self.assertEqual(calls[4],1+int(integrate and collision))
|
||||||
|
self.assertEqual(calls[5],int(integrate and collision and (not support or not geometry)))
|
||||||
|
self.assertEqual(calls[6],int(integrate and collision and support and geometry))
|
||||||
|
self.assertEqual(calls[7],int(integrate));self.assertEqual(calls[8],int(integrate))
|
||||||
|
self.assertEqual(o['supported'],int(not support if not integrate else not geometry or not support))
|
||||||
|
reset=integrate and collision and world
|
||||||
|
self.assertEqual(o['context'],[0,130000,60,0] if reset else [0x11111111,1234,5678,0x22222222])
|
||||||
|
if not integrate:
|
||||||
|
self.assertEqual(o['impulse'],[0,20,0]);self.assertEqual(o['velocity'],[100,200,50])
|
||||||
|
self.assertEqual(o['events'],'GSFI' if support else 'GSI')
|
||||||
|
else:
|
||||||
|
self.assertLess(o['events'].index('R'),o['events'].index('Q'))
|
||||||
|
self.assertLess(o['events'].index('Q'),o['events'].index('C'))
|
||||||
|
|
||||||
|
def test_callback_mutation_and_suppression_observations(self):
|
||||||
|
cases={c['name']:c['observed'] for c in self.fixture()['cases']}
|
||||||
|
self.assertEqual(cases['world_mutation_1']['calls'][6],0)
|
||||||
|
self.assertEqual(cases['world_mutation_5']['acceleration'],[0,0,0])
|
||||||
|
self.assertLess(cases['world_mutation_5']['velocity'][1],-200)
|
||||||
|
for index in (2,3,4):
|
||||||
|
c=cases[f'world_mutation_{index}'];self.assertEqual(c['calls'][0],1);self.assertEqual(c['calls'][5],1)
|
||||||
|
for index in range(10,21):self.assertEqual(cases[f'landing_mutation_{index}']['landings'],1)
|
||||||
|
normal=cases['landing_mutation_10']
|
||||||
|
self.assertEqual(cases['landing_mutation_14']['velocity'],normal['velocity'])
|
||||||
|
self.assertEqual(cases['landing_mutation_15']['acceleration'],[7,123,9])
|
||||||
|
self.assertEqual(cases['landing_mutation_16']['position'],[77,88,99,2])
|
||||||
|
self.assertEqual(cases['landing_mutation_17']['impulse'],[7,123,9])
|
||||||
|
self.assertEqual(cases['landing_mutation_18']['anchor'],[7,123,9])
|
||||||
|
self.assertEqual(cases['landing_mutation_20']['supported'],1)
|
||||||
|
self.assertEqual(cases['landing_mutation_12']['calls'][5],0)
|
||||||
|
self.assertEqual(cases['landing_mutation_12']['speed'],100)
|
||||||
|
for name in ('world_off_below_floor','collision_off_below_floor'):
|
||||||
|
self.assertLess(cases[name]['position'][1],-25000)
|
||||||
|
for name in ('collision_off_linear_suppression','frozen_linear_suppression'):
|
||||||
|
self.assertEqual(cases[name]['velocity'],[0,0,0]);self.assertEqual(cases[name]['angular'],[0,0,0])
|
||||||
|
self.assertGreater(cases[name]['rotation'][1],0)
|
||||||
|
|
||||||
|
def test_generated_output_separation(self):
|
||||||
|
original=ROOT.parent/'Original'
|
||||||
|
for output in (original,original/'generated',ROOT.parent):
|
||||||
|
with self.assertRaises(ValueError):generate(original,output)
|
||||||
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
output=Path(directory);(output/'body_modes_probe.c').symlink_to(original/'Neutron.exe')
|
||||||
|
with self.assertRaises(ValueError):generate(original,output)
|
||||||
|
|
||||||
|
if __name__=='__main__':unittest.main()
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
"""Original body/contact Vec4 publication source and native observation guards."""
|
||||||
|
from pathlib import Path
|
||||||
|
import hashlib,json,sys,tempfile,unittest
|
||||||
|
ROOT=Path(__file__).resolve().parents[1]
|
||||||
|
sys.path.insert(0,str(ROOT/'tools/binary'))
|
||||||
|
from body_root_publication import collect,generate
|
||||||
|
|
||||||
|
class BodyRootPublicationEvidence(unittest.TestCase):
|
||||||
|
def fixture(self):
|
||||||
|
return json.loads((ROOT/'tests/body-root-publication-reference.json').read_text())
|
||||||
|
|
||||||
|
def test_original_identity_ranges_sites_and_offsets(self):
|
||||||
|
actual=collect(ROOT.parent/'Original');fixture=self.fixture()
|
||||||
|
for key in ('sha256','bodies','probe_operands','publication_sites','root_bindings','root_leaf_ranges','rea_evidence_id'):
|
||||||
|
self.assertEqual(actual[key],fixture[key])
|
||||||
|
self.assertEqual(len(actual['publication_sites']),12)
|
||||||
|
for row in actual['publication_sites']:
|
||||||
|
self.assertEqual(int(row['file_offset'],16),int(row['va'],16)-0x400000)
|
||||||
|
|
||||||
|
def test_nineteen_native_boundaries_and_callback_order(self):
|
||||||
|
fixture=self.fixture();self.assertEqual(len(fixture['cases']),19)
|
||||||
|
cases={c['name']:c for c in fixture['cases']}
|
||||||
|
for c in fixture['cases']:
|
||||||
|
o=c['observed'];self.assertEqual(o['seen'],[0,c['input'][1],20,1])
|
||||||
|
self.assertEqual(o['seenPrevious'],o['seen'])
|
||||||
|
self.assertEqual(o['flags'][0],1)
|
||||||
|
self.assertEqual(o['flags'][2],1)
|
||||||
|
self.assertTrue(o['events'].startswith('CRLP' if o['flags'][1] else 'CRLS'))
|
||||||
|
self.assertEqual(cases['live_w_down']['observed']['live'],[0,20,20,2])
|
||||||
|
self.assertEqual(cases['previous_w_down']['observed']['live'],[0,20,20,1])
|
||||||
|
self.assertEqual(cases['both_w_equal']['observed']['previous'][3],2)
|
||||||
|
self.assertEqual(cases['both_w_equal']['observed']['live'][3],1)
|
||||||
|
self.assertEqual(cases['both_xyz_equal']['observed']['live'],cases['unchanged_down']['observed']['live'])
|
||||||
|
self.assertEqual(cases['stale_previous_reset']['observed']['live'],cases['unchanged_down']['observed']['live'])
|
||||||
|
self.assertEqual(cases['below_clamp_unchanged']['observed']['live'][1],-25000)
|
||||||
|
self.assertEqual(cases['live_below_floor']['observed']['live'][1],-30000)
|
||||||
|
self.assertEqual(cases['below_clamp_live_x']['observed']['live'][1],-26000)
|
||||||
|
motion=cases['callback_motion']['observed']
|
||||||
|
self.assertEqual(motion['velocity'],[9,8,7,0]);self.assertEqual(motion['acceleration'],[4,5,6,0])
|
||||||
|
self.assertEqual(motion['impulse'],[0,77,0,0])
|
||||||
|
support=cases['support_after_live_change']['observed']
|
||||||
|
self.assertEqual(support['flags'][1],0);self.assertEqual(support['flags'][5:],[1,1])
|
||||||
|
self.assertAlmostEqual(support['live'][1],12.65,places=5)
|
||||||
|
self.assertEqual(support['velocity'][1],0)
|
||||||
|
|
||||||
|
def test_probe_provenance(self):
|
||||||
|
for name,digest in self.fixture()['files'].items():
|
||||||
|
self.assertEqual(len(digest),64)
|
||||||
|
if name.startswith('tools/'):
|
||||||
|
self.assertEqual(hashlib.sha256((ROOT/name).read_bytes()).hexdigest(),digest)
|
||||||
|
|
||||||
|
def test_output_isolation_and_symlink_rejection(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:
|
||||||
|
target=Path(directory);(target/'body_root_publication_probe.c').symlink_to(original/'Neutron.exe')
|
||||||
|
with self.assertRaises(ValueError):generate(original,target)
|
||||||
|
|
||||||
|
if __name__=='__main__':unittest.main()
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Read-only479D20 flag contracts and separate copied-body fixture generator."""
|
||||||
|
import argparse,hashlib,json
|
||||||
|
from pathlib import Path
|
||||||
|
from body_step_evidence import collect as body_collect
|
||||||
|
from collision_response import header
|
||||||
|
|
||||||
|
REA_ID='ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904'
|
||||||
|
|
||||||
|
def collect(original):
|
||||||
|
result=body_collect(original)
|
||||||
|
result['rea_evidence_id']=REA_ID
|
||||||
|
result['flag_slots']={'support':'0x1c8','world_response':'0x1d0','integration':'0x210','supported':'0x218','collision':'0x220','alternate':'0x228'}
|
||||||
|
result['scope']='Full copied479D20, original friction/support against synthetic body/triangle; synthetic world dispatcher and selected callback mutations; no game entrypoint or real actor.'
|
||||||
|
return result
|
||||||
|
|
||||||
|
def generate(original,output):
|
||||||
|
original=Path(original).resolve();output=Path(output).resolve()
|
||||||
|
if output.is_relative_to(original) or original.is_relative_to(output):raise ValueError('Output must be separate from originals')
|
||||||
|
if output.exists() and any(p.is_symlink() for p in output.rglob('*')):raise ValueError('Output contains symlinks')
|
||||||
|
result=collect(original);output.mkdir(parents=True,exist_ok=True)
|
||||||
|
base=Path(__file__).with_name('body_step_probe.c').read_text().split('static void run(')[0]
|
||||||
|
(output/'body_modes_probe.c').write_text(base+Path(__file__).with_name('body_modes_probe.c').read_text())
|
||||||
|
(output/'collision_response_relocations.h').write_text(header(result))
|
||||||
|
(output/'source.json').write_text(json.dumps(result,indent=2)+'\n');return result
|
||||||
|
|
||||||
|
if __name__=='__main__':
|
||||||
|
p=argparse.ArgumentParser();p.add_argument('original',type=Path);p.add_argument('--generate-probe',type=Path);a=p.parse_args()
|
||||||
|
print(json.dumps(generate(a.original,a.generate_probe) if a.generate_probe else collect(a.original),indent=2))
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/* Full copied479D20/friction/support, synthetic mode flags and world traversal.
|
||||||
|
* World stub only publishes candidate/discrete callback flag mutations; original
|
||||||
|
* support still queries the existing synthetic horizontal triangle. */
|
||||||
|
static int integration_flag,alternate_flag,mutation;
|
||||||
|
static unsigned world_calls,move_calls,previous_writes,position_writes,support_reads,friction_reads,factor_reads,rotates,clear_impulses,supported_writes;
|
||||||
|
static char events[512];static unsigned event_count;
|
||||||
|
static void event(char value){if(event_count<sizeof(events)-1){events[event_count++]=value;events[event_count]=0;}}
|
||||||
|
static int TC mode_integration(Body*b){(void)b;event('I');return integration_flag;}
|
||||||
|
static int TC mode_alternate(Body*b){(void)b;event('A');return alternate_flag;}
|
||||||
|
static int TC mode_support(Body*b){support_reads++;event('S');return b->support;}
|
||||||
|
static int TC mode_world(Body*b){event('W');return b->world;}
|
||||||
|
static int TC mode_collision(Body*b){event('C');return b->pairs;}
|
||||||
|
static int TC mode_supported(Body*b){event('G');return b->supported;}
|
||||||
|
static void TC mode_set_supported(Body*b,int value){supported_writes++;event(value?'T':'F');set_supported(b,value);}
|
||||||
|
static float TC mode_friction(Body*b){friction_reads++;event('D');return b->friction;}
|
||||||
|
static float TC mode_factor(Body*b){factor_reads++;event('H');return b->factor;}
|
||||||
|
static void TC mode_previous(Body*b,Vec value){previous_writes++;event('P');set_previous(b,value);}
|
||||||
|
static void TC mode_position(Body*b,Vec value){position_writes++;event('V');set_position(b,value);}
|
||||||
|
static void TC mode_move(Body*b,Vec value){move_calls++;event('M');move(b,value);}
|
||||||
|
static void TC mode_rotate(Body*b,float x,float y,float z){rotates++;event('R');rotate(b,x,y,z);}
|
||||||
|
static void TC mode_impulse_clear(Body*b,float x,float y,float z){clear_impulses++;event('Q');impulse_xyz(b,x,y,z);}
|
||||||
|
static void TC mode_landing(Body*b){
|
||||||
|
event('L');landing(b);
|
||||||
|
if(mutation==10)b->support=0;
|
||||||
|
if(mutation==11)b->pairs=0;
|
||||||
|
if(mutation==12)b->speed=100;
|
||||||
|
if(mutation==13)integration_flag=0;
|
||||||
|
if(mutation==14)b->velocity=(Vec){7,123,9,0};
|
||||||
|
if(mutation==15)b->acceleration=(Vec){7,123,9,0};
|
||||||
|
if(mutation==16)b->position=(Vec){77,88,99,2};
|
||||||
|
if(mutation==17)b->impulse=(Vec){7,123,9,0};
|
||||||
|
if(mutation==18)b->anchor=(Vec){7,123,9,0};
|
||||||
|
if(mutation==19)b->angular=(Vec){7,123,9,0};
|
||||||
|
if(mutation==20)b->supported=0;
|
||||||
|
}
|
||||||
|
static void __cdecl mode_world_move(Body*b,Vec*out,Vec delta,int edges){
|
||||||
|
(void)edges;world_calls++;event('X');*out=b->position;
|
||||||
|
out->x+=delta.x;out->y+=delta.y;out->z+=delta.z;
|
||||||
|
if(mutation==1)b->support=0;
|
||||||
|
if(mutation==2)b->world=0;
|
||||||
|
if(mutation==3)b->pairs=0;
|
||||||
|
if(mutation==4)integration_flag=0;
|
||||||
|
if(mutation==5)*AT(0x4f69e5)=0;
|
||||||
|
if(mutation==6){b->support=0;b->world=0;b->pairs=0;integration_flag=0;}
|
||||||
|
}
|
||||||
|
static void mode_setup(void){
|
||||||
|
setup();
|
||||||
|
table[0x218/4]=(uintptr_t)mode_supported;table[0x21c/4]=(uintptr_t)mode_set_supported;
|
||||||
|
table[0x210/4]=(uintptr_t)mode_integration;table[0x228/4]=(uintptr_t)mode_alternate;
|
||||||
|
table[0x1c8/4]=(uintptr_t)mode_support;table[0x1d0/4]=(uintptr_t)mode_world;
|
||||||
|
table[0x220/4]=(uintptr_t)mode_collision;table[0x248/4]=(uintptr_t)mode_friction;
|
||||||
|
table[0x250/4]=(uintptr_t)mode_factor;table[0x2fc/4]=(uintptr_t)mode_previous;
|
||||||
|
table[0x314/4]=(uintptr_t)mode_position;table[0x31c/4]=(uintptr_t)mode_move;
|
||||||
|
table[0x334/4]=(uintptr_t)mode_rotate;table[0x28c/4]=(uintptr_t)mode_impulse_clear;
|
||||||
|
table[0x37c/4]=(uintptr_t)mode_landing;
|
||||||
|
unsigned char*at=AT(0x47b4b0);at[0]=0xe9;*(uint32_t*)(at+1)=(uint32_t)((uintptr_t)mode_world_move-(uintptr_t)(at+5));
|
||||||
|
}
|
||||||
|
static void mode_run(const char*name,Body b,int flags,int changed){
|
||||||
|
integration_flag=(flags>>0)&1;b.support=(flags>>1)&1;b.world=(flags>>2)&1;
|
||||||
|
b.pairs=(flags>>3)&1;alternate_flag=(flags>>4)&1;*AT(0x4f69e5)=(flags>>5)&1;mutation=changed;
|
||||||
|
world_calls=move_calls=previous_writes=position_writes=support_reads=friction_reads=factor_reads=rotates=clear_impulses=supported_writes=event_count=0;events[0]=0;
|
||||||
|
*(uint32_t*)AT(0x695d4c)=0x11111111;*(float*)AT(0x695d5c)=1234;
|
||||||
|
*(float*)AT(0x5cfbe0)=5678;*(uint32_t*)AT(0x695d84)=0x22222222;
|
||||||
|
((BodyStep)AT(0x479d20))(&b,1.f/60);
|
||||||
|
printf("MODE {\"name\":\"%s\",\"flags\":%d,\"mutation\":%d,\"position\":[%.9g,%.9g,%.9g,%.9g],\"previous\":[%.9g,%.9g,%.9g,%.9g],\"velocity\":[%.9g,%.9g,%.9g],\"acceleration\":[%.9g,%.9g,%.9g],\"impulse\":[%.9g,%.9g,%.9g],\"angular\":[%.9g,%.9g,%.9g],\"rotation\":[%.9g,%.9g,%.9g],\"anchor\":[%.9g,%.9g,%.9g],\"supported\":%d,\"landings\":%u,\"final_flags\":[%d,%d,%d,%d,%d,%d],\"speed\":%.9g,\"calls\":[%u,%u,%u,%u,%u,%u,%u,%u,%u,%u],\"context\":[%lu,%.9g,%.9g,%lu],\"events\":\"%s\"}\n",
|
||||||
|
name,flags,changed,b.position.x,b.position.y,b.position.z,b.position.w,b.previous.x,b.previous.y,b.previous.z,b.previous.w,
|
||||||
|
b.velocity.x,b.velocity.y,b.velocity.z,b.acceleration.x,b.acceleration.y,b.acceleration.z,b.impulse.x,b.impulse.y,b.impulse.z,
|
||||||
|
b.angular.x,b.angular.y,b.angular.z,b.rotation.x,b.rotation.y,b.rotation.z,b.anchor.x,b.anchor.y,b.anchor.z,b.supported,b.landings,
|
||||||
|
integration_flag,b.support,b.world,b.pairs,alternate_flag,*AT(0x4f69e5),b.speed,
|
||||||
|
world_calls,move_calls,previous_writes,position_writes,support_reads,friction_reads,factor_reads,rotates,clear_impulses,supported_writes,
|
||||||
|
(unsigned long)*(uint32_t*)AT(0x695d4c),*(float*)AT(0x695d5c),*(float*)AT(0x5cfbe0),(unsigned long)*(uint32_t*)AT(0x695d84),events);
|
||||||
|
require(isfinite(b.position.y)&&isfinite(b.velocity.y),"finite mode output");
|
||||||
|
}
|
||||||
|
static Body mode_initial(void){
|
||||||
|
Body b=initial();b.supported=1;b.previous=(Vec){9,8,7,6};b.velocity=(Vec){100,200,50,0};
|
||||||
|
b.acceleration.y=-264;b.impulse.y=20;b.angular.y=12;return b;
|
||||||
|
}
|
||||||
|
int main(void){
|
||||||
|
setbuf(stdout,NULL);map_copy();mode_setup();
|
||||||
|
for(int flags=0;flags<64;flags++){char name[24];snprintf(name,sizeof(name),"flags_%02d",flags);mode_run(name,mode_initial(),flags,0);}
|
||||||
|
Body b;
|
||||||
|
for(int change=1;change<=6;change++){char name[40];snprintf(name,sizeof(name),"world_mutation_%d",change);b=mode_initial();b.position.y=76;b.velocity.y=-200;b.impulse.y=0;b.acceleration.y=0;mode_run(name,b,47,change);}
|
||||||
|
for(int change=10;change<=20;change++){char name[40];snprintf(name,sizeof(name),"landing_mutation_%d",change);b=mode_initial();b.supported=0;b.position.y=76;b.velocity.y=-200;b.impulse.y=0;b.acceleration.y=0;mode_run(name,b,47,change);}
|
||||||
|
b=mode_initial();b.position.y=-30000;b.supported=0;mode_run("world_off_below_floor",b,43,0);
|
||||||
|
b=mode_initial();b.position.y=-30000;b.supported=0;mode_run("collision_off_below_floor",b,33,0);
|
||||||
|
b=mode_initial();b.supported=0;b.velocity=(Vec){.125f,0,0,0};b.angular.y=.1f;b.impulse.y=b.acceleration.y=0;mode_run("collision_off_suppression",b,33,0);
|
||||||
|
b=mode_initial();b.supported=0;b.velocity=(Vec){.125f,0,0,0};b.angular.y=.1f;b.impulse.y=b.acceleration.y=0;mode_run("frozen_suppression",b,49,0);
|
||||||
|
b=mode_initial();b.supported=0;b.velocity=(Vec){.125f,0,0,0};b.angular.y=.1f;b.impulse.y=b.acceleration.y=0;mode_run("collision_off_linear_suppression",b,1,0);
|
||||||
|
b=mode_initial();b.supported=0;b.velocity=(Vec){.125f,0,0,0};b.angular.y=.1f;b.impulse.y=b.acceleration.y=0;mode_run("frozen_linear_suppression",b,17,0);
|
||||||
|
puts("BODY_MODES_COMPLETE");return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Read-only original body/contact Vec4 publication probe generator."""
|
||||||
|
import argparse,hashlib,json,struct
|
||||||
|
from pathlib import Path
|
||||||
|
from body_step_evidence import collect as body_collect
|
||||||
|
from collision_response import header
|
||||||
|
from checkpoint_script_state import find_case,read_va
|
||||||
|
from pe_inspect import PE
|
||||||
|
REA_ID='ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904'
|
||||||
|
ROOT_BINDINGS=((0x2f8,0x4721e0),(0x2fc,0x472240),(0x310,0x472300),(0x314,0x472360))
|
||||||
|
ROOT_LEAVES=((0x4721e0,0x47220a),(0x472240,0x472264),(0x472300,0x47232a),(0x472360,0x472384))
|
||||||
|
SITES=((0x47a084,'ff90fc020000'),(0x47a123,'8b168d44244c508bceff92f8020000'),
|
||||||
|
(0x47a13d,'ff9210030000'),(0x47a147,'d819dfe0f6c440'),(0x47a157,'d85904dfe0f6c440'),
|
||||||
|
(0x47a168,'d85908dfe0f6c440'),(0x47a179,'d8590cdfe0f6c440'),
|
||||||
|
(0x47a198,'c74424200050c3c6'),(0x47a1c4,'ff9014030000'),(0x47a235,'e856160000'),
|
||||||
|
(0x47b80f,'ff9774030000'),(0x47b82e,'ff9770030000'))
|
||||||
|
def collect(original):
|
||||||
|
r=body_collect(original);pe=PE(find_case(Path(original),'Neutron.exe'));sites=[]
|
||||||
|
for va,want in SITES:
|
||||||
|
actual=read_va(pe,va,len(bytes.fromhex(want))).hex()
|
||||||
|
if actual!=want:raise ValueError(f'Changed original publication site {va:#x}')
|
||||||
|
sites.append(dict(va=hex(va),file_offset=hex(pe.offset(va-pe.base)),bytes=actual))
|
||||||
|
bindings=[]
|
||||||
|
for slot,target in ROOT_BINDINGS:
|
||||||
|
if struct.unpack('<I',read_va(pe,0x4a373c+slot,4))[0]!=target:raise ValueError('Changed Jimmy root binding')
|
||||||
|
bindings.append(dict(table='0x4a373c',slot=hex(slot),target=hex(target)))
|
||||||
|
leaves=[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 ROOT_LEAVES]
|
||||||
|
r.update(publication_sites=sites,root_bindings=bindings,root_leaf_ranges=leaves,rea_evidence_id=REA_ID,scope='Copied full479D20/47B4B0 with synthetic wall/body/contact callbacks and logging support wrapper; no original game entrypoint.')
|
||||||
|
return r
|
||||||
|
def generate(original,output):
|
||||||
|
original=Path(original).resolve();output=Path(output).resolve()
|
||||||
|
if output.is_relative_to(original) or original.is_relative_to(output):raise ValueError('Separate output required')
|
||||||
|
if output.exists() and any(p.is_symlink() for p in output.rglob('*')):raise ValueError('Output symlinks rejected')
|
||||||
|
r=collect(original);output.mkdir(parents=True,exist_ok=True)
|
||||||
|
shared=Path(__file__).with_name('body_step_probe.c').read_text().split('int main(void)')[0]
|
||||||
|
(output/'body_root_publication_probe.c').write_text(shared+Path(__file__).with_name('body_root_publication_probe.c').read_text())
|
||||||
|
(output/'collision_response_relocations.h').write_text(header(r))
|
||||||
|
(output/'source.json').write_text(json.dumps(r,indent=2)+'\n');return r
|
||||||
|
if __name__=='__main__':
|
||||||
|
p=argparse.ArgumentParser();p.add_argument('original',type=Path);p.add_argument('--generate-probe',type=Path);a=p.parse_args()
|
||||||
|
print(json.dumps(generate(a.original,a.generate_probe) if a.generate_probe else collect(a.original),indent=2))
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
/* Full copied479D20 and47B4B0/kernel, synthetic wall/body/virtual contacts.
|
||||||
|
* The support wrapper logs call order and either calls real47B890 or no-ops to
|
||||||
|
* isolate publication. No game entrypoint, animation, scripts or audio. */
|
||||||
|
static int mutation,real_support,after_contact;
|
||||||
|
static unsigned callbacks,publications,support_calls,previous_reads,live_reads;
|
||||||
|
static Vec callback_live,callback_previous,callback_velocity,support_live,support_previous,published;
|
||||||
|
static char events[128];static unsigned event_count;
|
||||||
|
static void event(char c){if(event_count+1<sizeof(events)){events[event_count++]=c;events[event_count]=0;}}
|
||||||
|
static Vec *TC read_live(Body*b,Vec*out){if(after_contact){live_reads++;event('L');}*out=b->position;return out;}
|
||||||
|
static Vec *TC read_previous(Body*b,Vec*out){if(after_contact){previous_reads++;event('R');}*out=b->previous;return out;}
|
||||||
|
static void TC publish(Body*b,Vec value){publications++;published=value;event('P');b->position=value;}
|
||||||
|
static void TC special(Body*b,Vec normal,void*poly){
|
||||||
|
(void)normal;(void)poly;callbacks++;callback_live=b->position;callback_previous=b->previous;callback_velocity=b->velocity;
|
||||||
|
event('C');after_contact=1;
|
||||||
|
switch(mutation){
|
||||||
|
case 1:b->position.x+=100;break;
|
||||||
|
case 2:b->previous.x+=100;break;
|
||||||
|
case 3:b->position.w=2;break;
|
||||||
|
case 4:b->previous.w=2;break;
|
||||||
|
case 5:b->position=(Vec){101,-30000,303,1};break;
|
||||||
|
case 6:b->position=b->previous=(Vec){101,250,303,1};break;
|
||||||
|
case 7:b->position.w=b->previous.w=2;break;
|
||||||
|
case 8:b->velocity=(Vec){9,8,7,0};b->acceleration=(Vec){4,5,6,0};b->impulse=(Vec){0,77,0,0};break;
|
||||||
|
case 9:b->position=(Vec){101,5,303,1};break;
|
||||||
|
case 10:b->position.x+=100;b->previous.x+=100;b->velocity=(Vec){9,8,7,0};b->impulse.y=77;break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void __cdecl observe_support(Body*b){
|
||||||
|
support_calls++;support_live=b->position;support_previous=b->previous;event('S');
|
||||||
|
if(real_support)((void(__cdecl*)(Body*))AT(0x47b890))(b);
|
||||||
|
}
|
||||||
|
static unsigned char wall_polygon[0x30],wall_shape[0x90],wall_corners[60];
|
||||||
|
static Vec wall_points[3]={{-1000,-100000,0,1},{-1000,100000,0,1},{100000,0,0,1}};
|
||||||
|
static void add_wall(void){
|
||||||
|
*(void**)(wall_polygon+0x24)=wall_corners;*(Vec*)(wall_polygon+8)=(Vec){0,0,1,0};
|
||||||
|
*(void**)(wall_shape+0x68)=wall_points;
|
||||||
|
for(unsigned i=0;i<3;i++)*(unsigned*)(wall_corners+i*20)=i;
|
||||||
|
for(int x=127;x<=132;x++)for(int z=127;z<=132;z++){
|
||||||
|
Node*s=&sentinels[0][260*x+z],*n=calloc(1,sizeof(Node));void**r=calloc(1,0x1c);
|
||||||
|
require(n&&r,"wall allocation");r[0]=wall_polygon;r[1]=wall_shape;n->value=r;
|
||||||
|
n->next=s;n->previous=s->previous;s->previous->next=n;s->previous=n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void call_hook(unsigned va,void*function,unsigned expected){
|
||||||
|
require(*AT(va)==0xe8,"source relative CALL opcode");
|
||||||
|
require((unsigned)(va+5+*(int32_t*)AT(va+1))==expected,"source relative CALL target");
|
||||||
|
*(int32_t*)AT(va+1)=(int32_t)((unsigned char*)function-(AT(va)+5));
|
||||||
|
}
|
||||||
|
static void vec(Vec v){printf("%.9g,%.9g,%.9g,%.9g",v.x,v.y,v.z,v.w);}
|
||||||
|
static void one(const char*name,int kind,float y,float vy,int original_support,int change_impulse){
|
||||||
|
Body b=initial();b.radius=10;b.position=(Vec){0,y,20,1};b.previous=b.position;
|
||||||
|
if(kind==11)b.previous=(Vec){999,999,999,3}; //World entry must replace stale previous before contact.
|
||||||
|
b.velocity=(Vec){0,vy,-900,0};b.impulse.y=change_impulse?30:0;b.speed=100;
|
||||||
|
mutation=kind;real_support=original_support;after_contact=0;
|
||||||
|
callbacks=publications=support_calls=previous_reads=live_reads=event_count=0;events[0]=0;
|
||||||
|
memset(&callback_live,0,sizeof(Vec));memset(&callback_previous,0,sizeof(Vec));memset(&callback_velocity,0,sizeof(Vec));
|
||||||
|
memset(&support_live,0,sizeof(Vec));memset(&support_previous,0,sizeof(Vec));memset(&published,0,sizeof(Vec));
|
||||||
|
*(unsigned char*)AT(0x4f69e5)=1;*(unsigned char*)AT(0x695d46)=0;
|
||||||
|
((BodyStep)AT(0x479d20))(&b,1.f/60);
|
||||||
|
printf("ROOT %s in=%d,%.9g,%.9g,%d,%d live=",name,kind,y,vy,original_support,change_impulse);vec(b.position);
|
||||||
|
printf(" previous=");vec(b.previous);printf(" velocity=");vec(b.velocity);printf(" acceleration=");vec(b.acceleration);
|
||||||
|
printf(" impulse=");vec(b.impulse);printf(" seen=");vec(callback_live);printf(" seenPrevious=");vec(callback_previous);
|
||||||
|
printf(" seenVelocity=");vec(callback_velocity);printf(" supportLive=");vec(support_live);printf(" supportPrevious=");vec(support_previous);
|
||||||
|
printf(" published=");vec(published);
|
||||||
|
printf(" flags=%u,%u,%u,%u,%u,%d,%u events=%s\n",callbacks,publications,support_calls,previous_reads,live_reads,b.supported,b.landings,events);
|
||||||
|
require(callbacks==1,"one actual wall contact");
|
||||||
|
require(isfinite(b.position.x)&&isfinite(b.position.y)&&isfinite(b.position.w),"finite root");
|
||||||
|
}
|
||||||
|
int main(void){
|
||||||
|
setbuf(stdout,NULL);map_copy();setup();add_wall();
|
||||||
|
table[0x310/4]=(uintptr_t)read_live;table[0x2f8/4]=(uintptr_t)read_previous;table[0x314/4]=(uintptr_t)publish;
|
||||||
|
table[0x374/4]=(uintptr_t)special;call_hook(0x47a235,observe_support,0x47b890);
|
||||||
|
one("unchanged_down",0,20,-120,0,0);one("live_x_down",1,20,-120,0,0);
|
||||||
|
one("stale_previous_reset",11,20,-120,0,0);
|
||||||
|
one("previous_x_down",2,20,-120,0,0);one("live_w_down",3,20,-120,0,0);one("previous_w_down",4,20,-120,0,0);
|
||||||
|
one("live_below_floor",5,20,-120,0,0);one("both_xyz_equal",6,20,-120,0,0);one("both_w_equal",7,20,-120,0,0);
|
||||||
|
one("callback_motion",8,20,-120,0,1);one("both_equal_motion",10,20,-120,0,1);
|
||||||
|
one("unchanged_up",0,20,200,0,0);one("live_x_up",1,20,200,0,0);one("previous_w_up",4,20,200,0,0);
|
||||||
|
one("below_clamp_unchanged",0,-26000,-120,0,0);one("below_clamp_live_x",1,-26000,-120,0,0);
|
||||||
|
one("below_clamp_equal",6,-26000,-120,0,0);
|
||||||
|
one("support_after_live_change",9,20,-120,1,0);one("support_after_w_change",3,20,-120,1,0);
|
||||||
|
puts("BODY_ROOT_PUBLICATION_COMPLETE");return 0;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user