Recover actor normal callbacks and late collision reads
This commit is contained in:
1 parent
bf876e9c3c
commit
bdca29d3aa
19 files changed
+963
-1
No files matched your search
@@ -76,6 +76,15 @@ timing and retained helper cleanup/order; consult current verification receipts.
|
||||
The populated correction passes348 Python+2 HUD, all managed projects and36 GPU
|
||||
checks, plus native Linux Carl/VR04 SDL replays and Windows x64 cross-publish.
|
||||
All539 originals and924ad2f packages are unchanged; no new Windows execution.
|
||||
Normal continuation: docs/checkpoint/actor-normal-contacts.md adds30 complete
|
||||
original/C# snapshots,13 interfaces/182 bindings and5 scalar getter fields.
|
||||
OriginalNormalContacts is standalone; Jimmy ordinary374 bypasses reflection.
|
||||
Soldier174 and Jimmy204 endpoints are recorded, not fully executed policies.
|
||||
Next derived response and retained helper cleanup/activation/order; do not wire
|
||||
new actors or cache pre-callback radius/flags. Use reviewed relocation operands.
|
||||
352 Python and targeted body/pair/reclip checks pass, with Linux/Windows builds;
|
||||
539 originals and924ad2f packages stay unchanged. Latest integrated SDL/GPU
|
||||
evidence is bf876e9; no new live profile or native Windows verification is claimed.
|
||||
|
||||
2026-11-06 continuation: the earlier292 original component cases plus50 derived-
|
||||
caller cases and body/visual-sync audit supply no extra reset. Startup diagnostics
|
||||
|
||||
@@ -12,6 +12,12 @@ separate. Dynamic pair/reclip composition remains a test fixture until real
|
||||
actor callbacks and retained physical order are recovered. See
|
||||
checkpoint/dynamic-reclip.md; no generic live box solver is implied.
|
||||
|
||||
`OriginalNormalContacts` exposes inherited370/374/378 through an actor-owned
|
||||
accessor interface, keeping full-vector/XYZ setters, fresh Y, damping and heading
|
||||
impulse distinct. It is not a universal Jimmy callback: Jimmy's ordinary374
|
||||
override bypasses reflection. Real class bindings and late scalar ownership are
|
||||
documented in checkpoint/actor-normal-contacts.md; live profile wiring is retained.
|
||||
|
||||
`Scooter` is a separate registered C3DJEEP in VR05/LEV1, owning body, wheels,
|
||||
steering/impact/jump clocks and camera state. Selection summons at the companion;
|
||||
strict contact transfers raw control. PlayerSceneBinding runs body, player/input,
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
# Original normal callbacks and late scalar reads
|
||||
|
||||
2026-11-07. Continues [populated reclip](dynamic-reclip.md). Thirty complete
|
||||
emitted original/C# fixture snapshots now match exact float32 values and event
|
||||
order. `OriginalNormalContacts` implements the bounded inherited ceiling/wall/
|
||||
reflection callbacks as a standalone component. Live actor admission and the
|
||||
current body/profile wiring are unchanged.
|
||||
|
||||
## Evidence, layout and class coverage
|
||||
|
||||
Canonical Neutron.exe SHA-256:
|
||||
`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
|
||||
Retained complete REA instruction Evidence:
|
||||
`ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904`.
|
||||
`tools/binary/actor_contact.py` guards17 complete bodies,139 relocation operands,
|
||||
13 actual VR04 interfaces/182 method bindings and5 scalar getters. Source hashes,
|
||||
table/file offsets and pointer displacements are local in
|
||||
`artifacts/actor-contact/native/source.json`. Text offsets below equal VA−400000;
|
||||
the helper uses actual PE mapping.
|
||||
|
||||
| Callback VA / file offset | Owner / complete span |
|
||||
|---|---|
|
||||
|42A660 /2A660|Jimmy374, through42A714.|
|
||||
|43AA40 /3AA40|Player material policy, through43AFE3.|
|
||||
|472690 /72690|Inherited370 positive-Y response, through47274A.|
|
||||
|458890 /58890|Inherited374 reflection gate, through4588CD.|
|
||||
|472750 /72750|Inherited378 reflection/heading impulse, guarded through472970.|
|
||||
|409590 /9590|Soldier374 override, through4095EE.|
|
||||
|
||||
Prior REA pseudocode is reused for472690
|
||||
(`ev_122849f87121b02fefe6a3a443f75c7f02fee30c59c816b617d30e1f98fc2cff`),
|
||||
458890 (`ev_2e4ec83ea68f06777162a80ab45793cff068e973dc248556d4a408932d24c85a`)
|
||||
and43AA40 (`ev_4f2a6aa666451db831efd46f5c587573e22d8072315626b8bc2f844f9c6f0cae`).
|
||||
The new REA/Ghidra requests for409590 and4098C0 both report unrecognized
|
||||
procedures. Their complete failures, export and closed-session snapshot are
|
||||
retained under `artifacts/actor-contact/rea/`; no successful pseudocode is
|
||||
attributed to them. Existing REA instructions, canonical bytes and new copied-code
|
||||
execution support the bounded caller findings instead. Earlier unrecognized
|
||||
42A660/472750 requests were not repeated.
|
||||
|
||||
Jimmy game table4A373C selects374→42A660; soldier4C19C4 selects409590;
|
||||
Rocketship4B25AC selects43E8D0 and its separate370→43EB70. The other10 serialized
|
||||
VR04 interfaces use374→458890. All13 bind378→472750. Tables and complete-object
|
||||
displacements are recorded separately: some interfaces are+C8 rather than+C0.
|
||||
Class bindings do not establish active physical membership or constructor defaults.
|
||||
|
||||
The sampled offsets are class-specific beyond the shared base. Soldier608 is an
|
||||
integer state; Jimmy608 is its controller speed float. Player704 movement mode
|
||||
is separate from physical collision mode178. The composition fixes178 to0;
|
||||
the direct `jimmy_mode2` fixture changes704, not box-vs-box collision mode.
|
||||
Snapshot labels do not define a universal actor structure or shared mode enum.
|
||||
|
||||
All13 share these pure live-field getters:
|
||||
|
||||
| Slot → function VA / file offset | Interface-relative field / use |
|
||||
|---|---|
|
||||
|1D0→4718F0 /718F0|byte13C, per-body geometry permission.|
|
||||
|1D8→471910 /71910|byte13D, inherited wall-reflection gate.|
|
||||
|1E0→471930 /71930|byte137, box response inhibition.|
|
||||
|248→471AD0 /71AD0|float150, wall damping.|
|
||||
|260→471B30 /71B30|float15C, live radius.|
|
||||
|
||||
These are source field/read facts. The native fixtures supply explicit accessor
|
||||
stubs so they can log reads and inject changes; they do not execute these getters
|
||||
on constructor-created actors. Scene global4F69E5 is a different owner from1D0.
|
||||
The constructor/property/Init lifetimes of these fields are not established by a
|
||||
vtable binding alone.
|
||||
|
||||
## Recovered policies and state transitions
|
||||
|
||||
**Jimmy:**42A660 forwards to43AA40 on ordinary selections, including−1 and
|
||||
jetpack3.43AA65 explicitly accepts a null polygon, using material sentinel−1.
|
||||
Neither ordinary/null contact nor rejected elapsed<=3 material contact reaches
|
||||
generic reflection378. Test modes0/1/2 and raw-control NULL preserve velocity,
|
||||
acceleration, angular state and root; no control query occurs in this handler.
|
||||
VR04 has no special material IDs, as previously established in
|
||||
[material contacts](collision-contact-callbacks.md). Actual lab/outside hazard,
|
||||
FENCE and LADDER success remain separate gates.
|
||||
|
||||
The additional gadget7/active branch zeros globals4F82BC/C0, tests their prior
|
||||
two-component magnitude **strictly greater than60**, then invokes complete204
|
||||
and sets interface1D65.36/48 is equality and issues no204;36/49 does. Our204 is a
|
||||
record-only endpoint, not the actual429C10 cleanup. This does not change live
|
||||
grappler behavior or recover every cleanup effect.
|
||||
|
||||
**Inherited ceiling370:**472690 reads velocity, clears strictly positive Y
|
||||
through2C0, then independently reads acceleration and clears its positive Y
|
||||
through274. Negative channels survive independently. There is no generic
|
||||
position, movement-mode, jump or control reset. The adapter distinguishes full
|
||||
Vec4 writes from the wall callback's XYZ setter.
|
||||
|
||||
**Inherited wall374/378:**458890 first reads1D8; false returns before velocity
|
||||
normalization.472750 snapshots horizontal velocity, stores its quick magnitude,
|
||||
normalizes with the retained quotient and reflects using the supplied normal.
|
||||
It reads velocity again for live Y, then248 damping, then publishes XYZ through
|
||||
2C4. Damping is not clamped:1.25 reverses the damped horizontal result.
|
||||
|
||||
After publication, the source calls copied OMT `angles` twice: old normalized
|
||||
horizontal direction, then normalized reflected horizontal direction **before
|
||||
damping**. It wraps oldHeading−newHeading once at strict±180 and adds angular Y:
|
||||
|
||||
```
|
||||
heading delta degrees × old horizontal quick magnitude × float32(0.001)
|
||||
```
|
||||
|
||||
The factor is4D5FD8; angles import48D108 is
|
||||
`?angles@OMedia3DVector@@QAEXAAF0@Z`. The source's raw yaw uses the14-bit circle,
|
||||
e.g.9870 and14706 for the oblique fixture. `OriginalHeading.Angles` is a signed
|
||||
consumer view; masking yaw with16383 recovers that raw circle. Its behavior is
|
||||
unchanged; its comment now makes the distinction explicit.
|
||||
|
||||
Axis velocity(0,7,−40), normal+Z, damping.25 gives velocity(0,7,30) and angular
|
||||
Y9.20000076 from initial2. Oblique(30,7,−40) gives velocityX22.5000019 and
|
||||
angularY−3.31300402. Angular response remains independent of damping. A synthetic
|
||||
second velocity getter returningY99 proves that the second read owns the
|
||||
published Y; it is an accessor-order test, not observed spontaneous actor mutation.
|
||||
|
||||
**Soldier:**409590 calls generic458890 first. It then checks interface608==10
|
||||
and, independently of reflection being enabled, calls complete174 with force500
|
||||
and the supplied normal. Complete table4C1E64+174 targets4098C0. That callee
|
||||
begins by advancing RNG through509A40 twice, then reaches target/action-dependent
|
||||
branches. Its complete policy is not executed here. The fixture records174 and
|
||||
optionally changes scalar fields to test the enclosing caller, not to claim
|
||||
that the real soldier naturally performs those changes.
|
||||
|
||||
## Dynamic composition and late ownership
|
||||
|
||||
Three cases invoke complete original47A5E0 with real Jimmy/generic/soldier normal
|
||||
callbacks. Four more use the soldier's record-only174 endpoint to change one
|
||||
dependency after its dynamic callback:
|
||||
|
||||
| Injected change | Original/C# result |
|
||||
|---|---|
|
||||
|Box inhibition=true|Contact remains true; root staysZ15, radius reads[10], no static pass or314.|
|
||||
|Radius10→20|Reclip reads[10,20,20], rootZ55 against wallZ35; cached10 would give45.|
|
||||
|Scene geometry=false|Static primitive is skipped but retained polygon still gives a second normal callback; rootZ20.|
|
||||
|Sphere42C=true|Static force flag is visible to reclip; rootZ45, radius reads[10,10,10].|
|
||||
|
||||
Static callbacks can therefore run the full generic/soldier chain again. In
|
||||
these fixtures, the second reflection gives velocityZ−22.5 and angularY3.80000067.
|
||||
The final local root still publishes after callbacks. There is no added implicit
|
||||
context reset or root-changed guard.
|
||||
|
||||
The C# dynamic composition remains test-only. Its static getters are fixed
|
||||
between primitive passes; the fixture records repeated identical radius reads
|
||||
before the sole terminal callback. This is not a reusable live getter/reentrant
|
||||
dispatcher, linked-list mutation policy or proof of real actor registry ordering.
|
||||
|
||||
## Probe correction and implementation boundary
|
||||
|
||||
The initial numeric relocation scan selected bytes4095BE..C1 (`8B C4 68 00`)
|
||||
spanning `mov eax,esp` and `push500`, misreading them as pointer68C48B. It also
|
||||
selected other cross-instruction sequences. This corrupted the **private probe
|
||||
image**, causing a derived-dispatch fault. Those partial runs are invalid source
|
||||
behavior evidence and are retained as diagnostic failures only. Originals were
|
||||
never patched. The corrected generator uses37 individually reviewed callback
|
||||
operands within complete REA instructions:139 total rather than152. A regression
|
||||
explicitly rejects4095BE and guards the original seven bytes. The final30-case
|
||||
capture exits0 with all source/probe hashes verified.
|
||||
|
||||
`OriginalNormalContacts` and `IOriginalNormalBody` preserve the recovered getter/
|
||||
setter order, XYZ/full-vector distinction, reflection and angular tail. The
|
||||
standalone component is not substituted into the live Baseball, Jimmy or NPC
|
||||
profiles. Zero horizontal normalization remains an explicit unsupported source
|
||||
arithmetic boundary; the component throws rather than silently admitting a new
|
||||
policy. A disabled reflection gate returns before that boundary. General x87,
|
||||
arbitrary normals and zero/degenerate cases are not certified by these fixtures.
|
||||
|
||||
`tests/GamePort.ActorContactTests` keeps30 fixed snapshots and can compare the
|
||||
generated native observations with `--native`; `--dump` plus the Python helper's
|
||||
`--managed` produces complete exact-float32 differences. Snapshots include roots,
|
||||
velocity/acceleration/angular XYZW, two modes, marker/tether, derived endpoint
|
||||
calls/arguments, flags, radius samples, raw angle arguments/results, context
|
||||
counters/limits and the full emitted accessor event order. Jimmy no-effect paths
|
||||
and the two derived endpoints are bounded fixture logic, not complete new Player,
|
||||
grappler or soldier implementations.
|
||||
|
||||
## Next chunk
|
||||
|
||||
Recover the soldier174 policy and helper cleanup/activation/physical order across
|
||||
LOAD/RETURN; retain special Jimmy material and gadget gates. The next response
|
||||
adapter must preserve post-callback1E0, live radius/42C and per-node scene-geometry
|
||||
ownership, and may admit only explicitly supported actor states. Keep lab/outside
|
||||
capsule and current VR04 static body while those dependencies remain. Final tests,
|
||||
build identities and runtime limits are recorded in progress.md/compatibility.md
|
||||
and `artifacts/actor-contact/validation.json`.
|
||||
|
||||
Reproduce after preparing and fully copying the disposable Wine prefix:
|
||||
|
||||
```sh
|
||||
python3 tools/binary/actor_contact.py ../Original --output artifacts/actor-contact/native
|
||||
i686-w64-mingw32-gcc -O0 -Wall -Wextra -Wno-unused-function -o artifacts/actor-contact/native/probe.exe artifacts/actor-contact/native/actor_contact_probe.c
|
||||
python3 tools/recon/reference_capture.py --asset-probe --probe-executable artifacts/actor-contact/native/probe.exe --probe-success ACTOR_CONTACT_COMPLETE --seconds 45 --output artifacts/actor-contact/probe
|
||||
python3 tools/binary/actor_contact.py ../Original --output artifacts/actor-contact/native --capture artifacts/actor-contact/probe
|
||||
source scripts/env.sh
|
||||
dotnet run --project tests/GamePort.ActorContactTests -- --native artifacts/actor-contact/native/observations.json
|
||||
```
|
||||
|
||||
Normal response is separate from pair enter/stay/leave notifications and their
|
||||
game/task effects; those real consumers remain an admission gate too. In
|
||||
particular, an inhibited position response does not cancel pair membership.
|
||||
|
||||
Verification:352 Python checks,30 native/fixed managed snapshots,5 sphere groups,
|
||||
11 static groups,20 ordinary-body groups,100 complete body-ownership comparisons
|
||||
plus6 bounded state cases,28 pair cases,17 prior context cases and14 populated
|
||||
reclip/12 kernel steps pass. Linux Debug builds with zero warnings/errors;
|
||||
Windows x64 self-contained cross-publish succeeds. All539 originals and both
|
||||
924ad2f packaged DLLs/BUILD-INFO remain unchanged. No new SDL/Vulkan or Windows
|
||||
execution is claimed; the latest integrated render/native SDL evidence belongs
|
||||
to bf876e9. This unused component does not change live profile wiring.
|
||||
@@ -1,5 +1,13 @@
|
||||
# Core architecture coverage map
|
||||
|
||||
2026-11-07 normal callbacks: [actor contacts](actor-normal-contacts.md) adds30
|
||||
full emitted original/C# snapshots (S/P/M),13 interface/182 method bindings and5
|
||||
pure scalar getter fields. Inherited ceiling/reflection/angular response is a
|
||||
standalone component; Jimmy's ordinary374 override stays separate. Late scalar
|
||||
reads are tested with explicit injected endpoint changes. Soldier174/Jimmy204
|
||||
full policies, retained helper order and live scene binding remain open. No new
|
||||
port-render/original-game/native Windows runtime coverage is claimed.
|
||||
|
||||
2026-11-07 populated follow-up: [dynamic reclip](dynamic-reclip.md) adds14 full
|
||||
original/C# comparisons and12 kernel-step matches (S/P/M). Real synthetic static
|
||||
walls/ceiling now exercise shared nearest, retries,370/374 order and primitive
|
||||
|
||||
@@ -49,6 +49,13 @@ rounding divergences without admitting new actors. Next prioritize real Jimmy/
|
||||
VR04 callback mutations and live getter timing, then constructor-only helper
|
||||
cleanup/order across LOAD/RETURN; integrate the bounded response only afterward.
|
||||
|
||||
Actor continuation: [normal contacts](actor-normal-contacts.md) now compares30
|
||||
complete snapshots and implements inherited ceiling/reflection/heading impulse
|
||||
outside live wiring. Jimmy ordinary374 is separate; soldier mode10's174 policy
|
||||
and helper lifetime remain unresolved. Post-callback radius/inhibition/geometry/
|
||||
42C reads are explicit contracts, not constructor snapshots. Next close derived
|
||||
response and retained helper activation/order before a supported response adapter.
|
||||
|
||||
## Objective
|
||||
|
||||
Establish the original ownership and timing of player state across gameplay,
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# Compatibility and validation
|
||||
|
||||
2026-11-07 normal-callback checkpoint:30 complete emitted original/C# fixture
|
||||
snapshots match exact float32 values, raw angle arguments/results and getter
|
||||
order. The inherited ceiling/reflection/angular component remains outside live
|
||||
profile wiring. Jimmy no-effect paths and Soldier174/Jimmy204 record-only
|
||||
endpoints are explicitly bounded; no full derived policy is implied.352 Python
|
||||
checks and targeted sphere/static/body/ownership/pair/context/reclip checks pass.
|
||||
Linux Debug build has zero warnings/errors; Windows x64 self-contained cross-
|
||||
publish succeeds.539 originals and both924ad2f packaged DLLs/BUILD-INFO are
|
||||
unchanged. No new graphics/native SDL, whole-original or Windows execution is
|
||||
claimed; integrated runtime evidence remains bf876e9. Invalid partial captures
|
||||
from the corrected relocation scan are excluded. See
|
||||
[normal callbacks](checkpoint/actor-normal-contacts.md) and local
|
||||
artifacts/actor-contact/validation.json for source/capture/build identities.
|
||||
|
||||
2026-11-07 populated-reclip correction:14 complete original/C# observations and12
|
||||
kernel steps match exact float32 values after source-store arithmetic corrections.
|
||||
Initial node-visit, edge-projection and ray-hit failures are retained. No epsilon
|
||||
|
||||
@@ -422,3 +422,13 @@ assets and generated packages stay excluded.
|
||||
Count static node visits before the geometry gate, separately from actual
|
||||
primitive tests. Real actor callbacks/lifetime still gate live integration.
|
||||
See checkpoint/dynamic-reclip.md.
|
||||
59. **Bind normal response by real class and preserve late scalar reads.**
|
||||
Jimmy ordinary/null/jetpack374 does not enter inherited reflection378.
|
||||
The inherited handler samples live Y again, preserves unclamped damping and
|
||||
has a separate angular-heading tail. Implement that as an isolated component,
|
||||
confirmed by30 complete original/C# snapshots. Soldier mode10 additionally
|
||||
invokes complete174 with500; its RNG/action policy remains outside this
|
||||
boundary. Sample inhibition/radius/42C/scene geometry at their source points,
|
||||
not once before callbacks. Explicitly reviewed relocation operands replace
|
||||
the probe's rejected cross-instruction numeric scan. No new live actor is
|
||||
admitted from these finite fixtures. See checkpoint/actor-normal-contacts.md.
|
||||
@@ -7,6 +7,33 @@ Next-work plan: [recover interactions, then implement verified changes](checkpoi
|
||||
It defines the Carl source/differential gate, the bounded implementation step,
|
||||
movement/contact/animation recovery and the end-to-end platform checkpoint.
|
||||
|
||||
## Real normal callback continuation
|
||||
|
||||
[Normal callbacks](checkpoint/actor-normal-contacts.md) adds30 complete original/
|
||||
C# fixture comparisons,13 class interfaces/182 bindings and5 pure scalar getter
|
||||
fields. Jimmy's ordinary/null/jetpack374 does not invoke generic reflection;
|
||||
the inherited callback has a live gate, fresh Y read, unclamped damping and an
|
||||
angular-heading tail. Soldier mode10 adds a separate complete174/force500 call.
|
||||
Its full RNG/action-dependent policy remains open;174 and Jimmy204 are recorded
|
||||
endpoints, not executed derived policies. The two new REA procedure requests were
|
||||
unrecognized; retained original REA instructions and byte guards support the work.
|
||||
|
||||
The standalone OriginalNormalContacts component and bounded fixture match30 emitted states,
|
||||
angle arguments/results and accessor order exactly as float32. Four bounded
|
||||
injections confirm post-callback inhibition, radius10→20 reclip toZ55, retained
|
||||
callback with geometry disabled and fresh42C. Live body/profile wiring remains
|
||||
unchanged. Partial captures from an erroneous cross-instruction relocation scan
|
||||
are excluded;37 reviewed operands fix it, with a regression guarding4095BE.
|
||||
|
||||
Next recover derived soldier response and helper cleanup/activation/physical
|
||||
order across LOAD/RETURN, then bind a response adapter only to supported actor
|
||||
states. Class-specific608/704 state must remain distinct from collision mode178.
|
||||
Normal callbacks do not replace real enter/stay/leave/game-task effects; those
|
||||
consumers remain a separate gate.352 Python checks and targeted sphere/static/
|
||||
body/ownership/pair/context/reclip regressions pass. Linux Debug build and Windows
|
||||
x64 cross-publish succeed;539 originals and924ad2f packages are unchanged. No new
|
||||
graphics/SDL or Windows runtime run; prior integrated evidence remains bf876e9.
|
||||
|
||||
## Populated reclip and source rounding
|
||||
|
||||
[Populated dynamic reclip](checkpoint/dynamic-reclip.md) extends the copied
|
||||
|
||||
@@ -5,6 +5,11 @@ offsets, virtual addresses, API symbols or observed behavior. Decompiled output
|
||||
evidence, not original source. Original gameplay has not yet been observed successfully; isolated original DLL
|
||||
probes and modern runtime checks are recorded separately.
|
||||
|
||||
- [Actor normal contacts](checkpoint/actor-normal-contacts.md):30 complete
|
||||
original/C# emitted snapshots,13 interfaces/182 bindings and5 scalar getters.
|
||||
Jimmy override versus inherited ceiling/reflection/angular behavior and late
|
||||
dynamic reclip reads are verified in bounded fixtures. Soldier174/Jimmy204 are
|
||||
record-only endpoints; full policies/helper lifetime still gate live wiring.
|
||||
- [Populated dynamic reclip](checkpoint/dynamic-reclip.md):14 full observations
|
||||
and12 captured kernel steps. Original instruction stores explain delayed edge
|
||||
projection, ray normalization and hit-coordinate rounding. Shared kernels now
|
||||
|
||||
@@ -94,6 +94,13 @@ Execution order and acceptance criteria: [next work plan](checkpoint/next-work-p
|
||||
float stores; separate pre-gate node visits from primitive tests. See
|
||||
checkpoint/dynamic-reclip.md. Sequential same-actor queries do not establish
|
||||
real physical ordering, callback mutation contracts or helper lifetime.
|
||||
- [x] Compare30 original normal-callback/composition snapshots and implement the
|
||||
bounded inherited ceiling/reflection/angular component. Guard13 actual class
|
||||
interfaces/182 bindings and5 scalar getter fields; preserve post-callback live
|
||||
reads. See checkpoint/actor-normal-contacts.md. No new live actor admission.
|
||||
- [ ] Close soldier complete174 RNG/target/action effects and helper cleanup/
|
||||
activation/order across LOAD/RETURN before binding the shared response adapter.
|
||||
Real enter/stay/leave game/task consumers remain separate from normal response.
|
||||
|
||||
- [x] Expand original lifecycle coverage:96 Carl contact,8 composed input/
|
||||
controller/skip-prefix,48 task/objective and140 base/STOP cases; recover complete
|
||||
|
||||
@@ -21,6 +21,7 @@ dotnet run --project tests/GamePort.BodyOwnershipTests
|
||||
dotnet run --project tests/GamePort.PairLifecycleTests
|
||||
dotnet run --project tests/GamePort.DynamicContextTests
|
||||
dotnet run --project tests/GamePort.DynamicReclipTests
|
||||
dotnet run --project tests/GamePort.ActorContactTests
|
||||
dotnet run --project tests/GamePort.GadgetTests
|
||||
dotnet run --project tests/GamePort.InvisibleTests
|
||||
dotnet run --project tests/GamePort.BubbleMotionTests
|
||||
|
||||
@@ -30,7 +30,10 @@ public static class OriginalHeading
|
||||
return (-angle) & 0x3fff;
|
||||
}
|
||||
|
||||
/// <summary>Copied OMT2 vector::angles pitch/yaw, in signed14-bit circle units.</summary>
|
||||
/// <summary>
|
||||
/// Signed circle representation used by movement consumers of OMT2 angles.
|
||||
/// Mask yaw with16383 when matching the DLL's raw14-bit circle output.
|
||||
/// </summary>
|
||||
public static (int Pitch,int Yaw) Angles(Vector3 vector)
|
||||
{
|
||||
var heading=HeadingUnits(vector);
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace GamePort.Game;
|
||||
|
||||
/// <summary>Actor-owned accessors used by the base370/374/378 callbacks.</summary>
|
||||
public interface IOriginalNormalBody
|
||||
{
|
||||
Vector4 ReadVelocity();
|
||||
void WriteVelocity(Vector4 value);
|
||||
void WriteVelocityXYZ(Vector3 value);
|
||||
Vector4 ReadAcceleration();
|
||||
void WriteAcceleration(Vector4 value);
|
||||
bool ReflectWalls { get; }
|
||||
float WallDamping { get; }
|
||||
void AddAngularVelocity(Vector3 delta);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bounded472690/458890/472750 callbacks, with live accessor order and original
|
||||
/// heading impulse. Not a Jimmy override or live scene-admission policy.
|
||||
/// </summary>
|
||||
public static class OriginalNormalContacts
|
||||
{
|
||||
public static void Ceiling(IOriginalNormalBody body)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(body);
|
||||
var velocity = body.ReadVelocity();
|
||||
if (velocity.Y > 0) body.WriteVelocity(velocity with {Y = 0});
|
||||
var acceleration = body.ReadAcceleration();
|
||||
if (acceleration.Y > 0) body.WriteAcceleration(acceleration with {Y = 0});
|
||||
}
|
||||
|
||||
public static void GenericWall(IOriginalNormalBody body, Vector3 normal,
|
||||
Func<Vector4,int>? headingUnits = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(body);
|
||||
if (!body.ReflectWalls) return;
|
||||
Reflect(body,normal,headingUnits);
|
||||
}
|
||||
|
||||
public static void Reflect(IOriginalNormalBody body, Vector3 normal,
|
||||
Func<Vector4,int>? headingUnits = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(body);
|
||||
Finite(normal);
|
||||
var velocity = body.ReadVelocity();
|
||||
var horizontal = new Vector3(velocity.X,0,velocity.Z);
|
||||
var magnitude = OriginalBodySupport.QuickMagnitude(horizontal);
|
||||
if (magnitude <= 0) throw new NotSupportedException("Original zero-horizontal normalization is outside the finite contact contract");
|
||||
var direction = Normalize(horizontal,velocity.W);
|
||||
var dot = -((double)direction.Z*normal.Z + (double)direction.X*normal.X + (double)direction.Y*normal.Y);
|
||||
var reflected = new Vector3((float)(direction.X + 2*dot*normal.X),
|
||||
(float)(direction.Y + 2*dot*normal.Y),(float)(direction.Z + 2*dot*normal.Z));
|
||||
var x = reflected.X*magnitude;
|
||||
//472834 samples live Y again, after computing the horizontal reflection.
|
||||
var y = body.ReadVelocity().Y;
|
||||
var z = reflected.Z*magnitude;
|
||||
var damping = body.WallDamping;
|
||||
if (!float.IsFinite(damping)) throw new ArgumentOutOfRangeException(nameof(body));
|
||||
body.WriteVelocityXYZ(new((float)(x-(double)damping*x),y,(float)(z-(double)damping*z)));
|
||||
|
||||
headingUnits ??= static vector => OriginalHeading.Angles(new(vector.X,vector.Y,vector.Z)).Yaw & 16383;
|
||||
var oldHeading = headingUnits(direction)*0.02197265625f;
|
||||
var outgoing = Normalize(new(x,0,z),0);
|
||||
var newHeading = headingUnits(outgoing)*0.02197265625f;
|
||||
double delta = oldHeading-newHeading;
|
||||
if (delta > 180) delta -= 360;
|
||||
else if (delta < -180) delta += 360;
|
||||
body.AddAngularVelocity(new(0,(float)(delta*magnitude*0.001f),0));
|
||||
}
|
||||
|
||||
private static Vector4 Normalize(Vector3 vector,float w)
|
||||
{
|
||||
var length = OriginalBodySupport.QuickMagnitudeIntermediate(vector);
|
||||
if (length <= 0) throw new NotSupportedException("Original zero reflected normalization is outside the finite contact contract");
|
||||
var reciprocal = 1/length;
|
||||
return new((float)(vector.X*reciprocal),(float)(vector.Y*reciprocal),(float)(vector.Z*reciprocal),w);
|
||||
}
|
||||
private static void Finite(Vector3 vector)
|
||||
{
|
||||
if (!float.IsFinite(vector.X) || !float.IsFinite(vector.Y) || !float.IsFinite(vector.Z))
|
||||
throw new ArgumentOutOfRangeException(nameof(vector));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<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="expected.json" CopyToOutputDirectory="PreserveNewest" Condition="Exists('expected.json')" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,219 @@
|
||||
using System.Numerics;
|
||||
using System.Text.Json;
|
||||
using GamePort.Game;
|
||||
|
||||
// Original normal callback component over synthetic state/accessors. Derived
|
||||
// Soldier174 and Jimmy204 are recorded endpoints, not full policy emulation.
|
||||
var fixture = new Fixture();
|
||||
var rows = new List<JsonElement>();
|
||||
void Direct(string name,bool ceiling = false) => rows.Add(fixture.Direct(name,ceiling));
|
||||
void Dynamic(string name) => rows.Add(fixture.Dynamic(name));
|
||||
fixture.Reset(0); Direct("jimmy_null");
|
||||
fixture.Reset(0); fixture.Selection = 3; Direct("jimmy_jetpack");
|
||||
fixture.Reset(0); Direct("jimmy_ordinary_polygon");
|
||||
fixture.Reset(0); fixture.Elapsed = 3; Direct("jimmy_elapsed_gate");
|
||||
fixture.Reset(0); fixture.MovementMode = 1; Direct("jimmy_mode1");
|
||||
fixture.Reset(0); fixture.MovementMode = 2; Direct("jimmy_mode2");
|
||||
fixture.Reset(0); Direct("jimmy_uncontrolled");
|
||||
fixture.Reset(0); fixture.Selection = 7; Direct("jimmy_gadget7_inactive");
|
||||
fixture.Reset(0); fixture.Selection = 7; fixture.Grappling = true; Direct("jimmy_gadget7_equal");
|
||||
fixture.Reset(0); fixture.Selection = 7; fixture.Grappling = true; fixture.Tether.Y = 49; Direct("jimmy_gadget7_large");
|
||||
fixture.Reset(0); Direct("ceiling_positive",true);
|
||||
fixture.Reset(0); fixture.Velocity.Y = -7; fixture.Acceleration.Y = -13; Direct("ceiling_negative",true);
|
||||
fixture.Reset(0); fixture.Acceleration.Y = -13; Direct("ceiling_velocity_only",true);
|
||||
fixture.Reset(0); fixture.Velocity.Y = -7; Direct("ceiling_acceleration_only",true);
|
||||
fixture.Reset(1); fixture.Reflection = false; Direct("generic_disabled");
|
||||
fixture.Reset(1); Direct("generic_axis");
|
||||
fixture.Reset(1); fixture.Damping = 0; Direct("generic_no_damping");
|
||||
fixture.Reset(1); fixture.Damping = 1.25f; Direct("generic_excess_damping");
|
||||
fixture.Reset(1); fixture.Velocity.X = 30; Direct("generic_oblique");
|
||||
fixture.Reset(1); fixture.FreshY = true; Direct("generic_fresh_y");
|
||||
fixture.Reset(2); Direct("soldier_mode0");
|
||||
fixture.Reset(2); fixture.ActorMode = 10; Direct("soldier_mode10");
|
||||
fixture.Reset(2); fixture.ActorMode = 10; fixture.Reflection = false; Direct("soldier_mode10_disabled");
|
||||
fixture.Reset(0); Dynamic("dynamic_jimmy");
|
||||
fixture.Reset(1); Dynamic("dynamic_generic");
|
||||
fixture.Reset(2); fixture.ActorMode = 10; Dynamic("dynamic_soldier");
|
||||
fixture.Reset(2); fixture.ActorMode = 10; fixture.Mutation = 1; Dynamic("late_inhibition");
|
||||
fixture.Reset(2); fixture.ActorMode = 10; fixture.Mutation = 2; fixture.Wall(); Dynamic("late_radius");
|
||||
fixture.Reset(2); fixture.ActorMode = 10; fixture.Mutation = 3; fixture.Wall(true); Dynamic("late_geometry");
|
||||
fixture.Reset(2); fixture.ActorMode = 10; fixture.Mutation = 4; fixture.Wall(); Dynamic("late_force");
|
||||
|
||||
if(args is ["--dump"])
|
||||
{
|
||||
Console.WriteLine(JsonSerializer.Serialize(new {cases = rows}));
|
||||
return;
|
||||
}
|
||||
var native = args is ["--native", _];
|
||||
if(args.Length != 0 && !native) throw new ArgumentException("Use --native <observations.json> or --dump");
|
||||
using var expected = JsonDocument.Parse(File.ReadAllText(native ? args[1] : Path.Combine(AppContext.BaseDirectory,"expected.json")));
|
||||
var cases = expected.RootElement.GetProperty("cases").EnumerateArray().ToArray();
|
||||
if(cases.Length != rows.Count) throw new Exception("Case count differs");
|
||||
for(var i = 0; i < rows.Count; i++) Compare(cases[i],rows[i],cases[i].GetProperty("name").GetString()!);
|
||||
fixture.Reset(1); fixture.Velocity = Vector4.Zero; fixture.Reflection = false;
|
||||
OriginalNormalContacts.GenericWall(fixture,Vector3.UnitZ);
|
||||
fixture.Reflection = true;
|
||||
try
|
||||
{
|
||||
OriginalNormalContacts.GenericWall(fixture,Vector3.UnitZ);
|
||||
throw new Exception("Undefined original zero-horizontal path was silently admitted");
|
||||
}
|
||||
catch(NotSupportedException) { }
|
||||
Console.WriteLine($"PASS {rows.Count} original actor-contact snapshots, live getter order and bounded derived endpoints; exact float32.");
|
||||
|
||||
static void Compare(JsonElement expected,JsonElement actual,string path)
|
||||
{
|
||||
if(expected.ValueKind != actual.ValueKind) throw new Exception($"{path}: kind differs");
|
||||
if(expected.ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
if(expected.EnumerateObject().Count() != actual.EnumerateObject().Count()) throw new Exception($"{path}: field count differs");
|
||||
foreach(var p in expected.EnumerateObject()) Compare(p.Value,actual.GetProperty(p.Name),path+"."+p.Name);
|
||||
}
|
||||
else if(expected.ValueKind == JsonValueKind.Array)
|
||||
{
|
||||
if(expected.GetArrayLength() != actual.GetArrayLength()) throw new Exception($"{path}: array length differs");
|
||||
for(var i = 0; i < expected.GetArrayLength(); i++) Compare(expected[i],actual[i],$"{path}[{i}]");
|
||||
}
|
||||
else if(expected.ValueKind == JsonValueKind.Number)
|
||||
{
|
||||
if(expected.GetSingle() != actual.GetSingle()) throw new Exception($"{path}: {actual} != original {expected}");
|
||||
}
|
||||
else if(!JsonElement.DeepEquals(expected,actual)) throw new Exception($"{path}: {actual} != original {expected}");
|
||||
}
|
||||
|
||||
sealed class Fixture : IOriginalNormalBody
|
||||
{
|
||||
public Vector4 Root,Velocity,Acceleration,Angular;
|
||||
public Vector2 Tether;
|
||||
public int Selection,MovementMode,ActorMode,Mutation;
|
||||
public bool Grappling,Reflection,FreshY,Inhibited,ForceStatic,Geometry;
|
||||
public float Elapsed,Damping,Radius;
|
||||
private int profile,knocks,cleanups,marker,velocityGets;
|
||||
private float knockForce;
|
||||
private Vector4 knockNormal;
|
||||
private StaticCollisionContext context = null!;
|
||||
private readonly List<string> events = [];
|
||||
private readonly List<float> radii = [];
|
||||
private readonly List<object> angles = [];
|
||||
private CameraRayPolygon? wall;
|
||||
|
||||
public void Reset(int kind)
|
||||
{
|
||||
profile = kind; Root = new(0,0,15,1); Velocity = new(0,7,-40,0);
|
||||
Acceleration = new(11,13,17,0); Angular = new(1,2,3,0);
|
||||
Tether = new(36,48); Selection = -1; MovementMode = ActorMode = Mutation = 0;
|
||||
Grappling = FreshY = Inhibited = ForceStatic = false; Reflection = Geometry = true;
|
||||
Elapsed = 4; Damping = .25f; Radius = 10;
|
||||
knocks = cleanups = marker = velocityGets = 0; knockForce = 0; knockNormal = default;
|
||||
events.Clear(); radii.Clear(); angles.Clear(); wall = null;
|
||||
context = new(88,77){Nearest = new(77,88,new(111,222,333))};
|
||||
}
|
||||
public void Wall(bool seedLast = false)
|
||||
{
|
||||
wall = new(new(new(-100,-100,35),new(-100,100,35),new(100,100,35)),Vector3.UnitZ);
|
||||
if(seedLast) context.LastPolygon = wall;
|
||||
}
|
||||
public Vector4 ReadVelocity()
|
||||
{
|
||||
events.Add("Gv"); velocityGets++;
|
||||
if(FreshY && velocityGets == 2) Velocity.Y = 99;
|
||||
return Velocity;
|
||||
}
|
||||
public void WriteVelocity(Vector4 value) { events.Add("Sv4"); Velocity = value; }
|
||||
public void WriteVelocityXYZ(Vector3 value) { events.Add("Sv3"); Velocity = new(value,Velocity.W); }
|
||||
public Vector4 ReadAcceleration() { events.Add("Ga"); return Acceleration; }
|
||||
public void WriteAcceleration(Vector4 value) { events.Add("Sa4"); Acceleration = value; }
|
||||
public bool ReflectWalls { get { events.Add("Gate"); return Reflection; } }
|
||||
public float WallDamping { get { events.Add("F"); return Damping; } }
|
||||
public void AddAngularVelocity(Vector3 value) { events.Add("Aw"); Angular += new Vector4(value,0); }
|
||||
private int Heading(Vector4 vector)
|
||||
{
|
||||
var result = OriginalHeading.Angles(new(vector.X,vector.Y,vector.Z));
|
||||
var pitch = result.Pitch & 16383; var yaw = result.Yaw & 16383;
|
||||
angles.Add(new {vector = Values(vector),pitch,yaw}); events.Add("Angles");
|
||||
return yaw;
|
||||
}
|
||||
private void Knock(Vector3 normal)
|
||||
{
|
||||
events.Add("K174"); knocks++; knockForce = 500; knockNormal = new(normal,0);
|
||||
if(Mutation == 1) Inhibited = true;
|
||||
if(Mutation == 2) Radius = 20;
|
||||
if(Mutation == 3) Geometry = false;
|
||||
if(Mutation == 4) ForceStatic = true;
|
||||
}
|
||||
private void WallContact(Vector3 normal)
|
||||
{
|
||||
if(profile == 0)
|
||||
{
|
||||
// Only tested null/ordinary/elapsed-rejected Player material paths.
|
||||
// Complete204 is recorded, not the actual grappler cleanup policy.
|
||||
if(Selection == 7 && Grappling)
|
||||
{
|
||||
var length = Math.Sqrt((double)Tether.X*Tether.X+(double)Tether.Y*Tether.Y);
|
||||
Tether = default;
|
||||
if(length > 60) { events.Add("C204"); cleanups++; marker = 1; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OriginalNormalContacts.GenericWall(this,normal,Heading);
|
||||
if(profile == 2 && ActorMode == 10) Knock(normal);
|
||||
}
|
||||
}
|
||||
public JsonElement Direct(string name,bool ceiling)
|
||||
{
|
||||
if(ceiling) OriginalNormalContacts.Ceiling(this); else WallContact(Vector3.UnitZ);
|
||||
return Snapshot(name,-1);
|
||||
}
|
||||
private float ReadRadius() { events.Add("Radius"); radii.Add(Radius); return Radius; }
|
||||
public JsonElement Dynamic(string name)
|
||||
{
|
||||
var previous = new Vector3(0,0,50);
|
||||
var candidate = new Vector3(Root.X,Root.Y,Root.Z);
|
||||
var radius = ReadRadius();
|
||||
context.Nearest = context.Nearest with {FaceDistance = -1,EdgeDistance = radius};
|
||||
var box = new DynamicBoxCollider(1,Vector3.Zero,new(-50,-50,-10),new(50,50,10),Matrix4x4.Identity,40);
|
||||
foreach(var triangle in DynamicSceneCollision.Triangles(box))
|
||||
{
|
||||
var cross = Vector3.Cross(triangle.B-triangle.A,triangle.C-triangle.A);
|
||||
var normal = cross/OriginalBodySupport.QuickMagnitude(cross);
|
||||
var response = OriginalSphereResponse.Resolve(new(triangle.A,triangle.C,triangle.B),normal,
|
||||
previous,candidate,radius,context.Nearest);
|
||||
if(response.Contact == SphereContact.None) continue;
|
||||
candidate = response.Position; context.Nearest = response.State;
|
||||
WallContact(normal);
|
||||
}
|
||||
var contact = context.Nearest.FaceDistance != -1 || context.Nearest.EdgeDistance < radius;
|
||||
if(contact)
|
||||
{
|
||||
events.Add("Inhibit");
|
||||
if(!Inhibited)
|
||||
{
|
||||
var world = new OriginalStaticCollision(wall is {} polygon ? [polygon] : []);
|
||||
var initialPasses = context.Passes;
|
||||
var clipped = world.Move(previous,candidate-previous,ReadRadius(),context,edges:false,
|
||||
lowerEdges:ForceStatic,geometryEnabled:Geometry);
|
||||
// Fixed primitive getters: recursive source calls read the same
|
||||
// radius before their sole terminal callback. No actor callback
|
||||
// occurs between these bounded passes in this composition.
|
||||
for(var pass = 1; pass < context.Passes-initialPasses; pass++) ReadRadius();
|
||||
if(clipped.CallbackPolygon is {} last)
|
||||
{
|
||||
if(last.StoredNormal.Y <= -.7f) OriginalNormalContacts.Ceiling(this);
|
||||
else WallContact(last.StoredNormal);
|
||||
}
|
||||
events.Add("Root"); Root = new(clipped.Position,1);
|
||||
}
|
||||
}
|
||||
return Snapshot(name,contact ? 1 : 0);
|
||||
}
|
||||
private JsonElement Snapshot(string name,int contact) => JsonSerializer.SerializeToElement(new {
|
||||
name,contact,root = Values(Root),velocity = Values(Velocity),acceleration = Values(Acceleration),
|
||||
angular = Values(Angular),movementMode = MovementMode,actorMode = ActorMode,marker,
|
||||
tether = new[]{Tether.X,Tether.Y},knocks,force = knockForce,knockNormal = Values(knockNormal),cleanups,
|
||||
radius = Radius,forceStatic = ForceStatic ? 1 : 0,geometry = Geometry ? 1 : 0,inhibited = Inhibited ? 1 : 0,
|
||||
radii,angles,passes = context.Passes,visits = context.NodeVisits,face = context.Nearest.FaceDistance,
|
||||
edge = context.Nearest.EdgeDistance,events = string.Join(',',events)
|
||||
});
|
||||
private static float[] Values(Vector4 v) => [v.X,v.Y,v.Z,v.W];
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"cases": [
|
||||
{"name":"jimmy_null","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":""},
|
||||
{"name":"jimmy_jetpack","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":""},
|
||||
{"name":"jimmy_ordinary_polygon","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":""},
|
||||
{"name":"jimmy_elapsed_gate","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":""},
|
||||
{"name":"jimmy_mode1","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":1,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":""},
|
||||
{"name":"jimmy_mode2","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":2,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":""},
|
||||
{"name":"jimmy_uncontrolled","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":""},
|
||||
{"name":"jimmy_gadget7_inactive","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":""},
|
||||
{"name":"jimmy_gadget7_equal","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[0,0],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":""},
|
||||
{"name":"jimmy_gadget7_large","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":1,"tether":[0,0],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":1,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":"C204"},
|
||||
{"name":"ceiling_positive","contact":-1,"root":[0,0,15,1],"velocity":[0,0,-40,0],"acceleration":[11,0,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gv,Sv4,Ga,Sa4"},
|
||||
{"name":"ceiling_negative","contact":-1,"root":[0,0,15,1],"velocity":[0,-7,-40,0],"acceleration":[11,-13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gv,Ga"},
|
||||
{"name":"ceiling_velocity_only","contact":-1,"root":[0,0,15,1],"velocity":[0,0,-40,0],"acceleration":[11,-13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gv,Sv4,Ga"},
|
||||
{"name":"ceiling_acceleration_only","contact":-1,"root":[0,0,15,1],"velocity":[0,-7,-40,0],"acceleration":[11,0,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gv,Ga,Sa4"},
|
||||
{"name":"generic_disabled","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gate"},
|
||||
{"name":"generic_axis","contact":-1,"root":[0,0,15,1],"velocity":[0,7,30,0],"acceleration":[11,13,17,0],"angular":[1,9.20000076,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0}],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw"},
|
||||
{"name":"generic_no_damping","contact":-1,"root":[0,0,15,1],"velocity":[0,7,40,0],"acceleration":[11,13,17,0],"angular":[1,9.20000076,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0}],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw"},
|
||||
{"name":"generic_excess_damping","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-10,0],"acceleration":[11,13,17,0],"angular":[1,9.20000076,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0}],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw"},
|
||||
{"name":"generic_oblique","contact":-1,"root":[0,0,15,1],"velocity":[22.5000019,7,30,0],"acceleration":[11,13,17,0],"angular":[1,-3.31300402,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[{"vector":[0.599998295,0,-0.799997687,0],"pitch":0,"yaw":9870},{"vector":[0.599998295,0,0.799997687,0],"pitch":0,"yaw":14706}],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw"},
|
||||
{"name":"generic_fresh_y","contact":-1,"root":[0,0,15,1],"velocity":[0,99,30,0],"acceleration":[11,13,17,0],"angular":[1,9.20000076,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0}],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw"},
|
||||
{"name":"soldier_mode0","contact":-1,"root":[0,0,15,1],"velocity":[0,7,30,0],"acceleration":[11,13,17,0],"angular":[1,9.20000076,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0}],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw"},
|
||||
{"name":"soldier_mode10","contact":-1,"root":[0,0,15,1],"velocity":[0,7,30,0],"acceleration":[11,13,17,0],"angular":[1,9.20000076,3,0],"movementMode":0,"actorMode":10,"marker":0,"tether":[36,48],"knocks":1,"force":500,"knockNormal":[0,0,1,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0}],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw,K174"},
|
||||
{"name":"soldier_mode10_disabled","contact":-1,"root":[0,0,15,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":10,"marker":0,"tether":[36,48],"knocks":1,"force":500,"knockNormal":[0,0,1,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[],"angles":[],"passes":0,"visits":0,"face":77,"edge":88,"events":"Gate,K174"},
|
||||
{"name":"dynamic_jimmy","contact":1,"root":[0,0,20,1],"velocity":[0,7,-40,0],"acceleration":[11,13,17,0],"angular":[1,2,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[10,10],"angles":[],"passes":1,"visits":0,"face":40,"edge":10,"events":"Radius,Inhibit,Radius,Root"},
|
||||
{"name":"dynamic_generic","contact":1,"root":[0,0,20,1],"velocity":[0,7,30,0],"acceleration":[11,13,17,0],"angular":[1,9.20000076,3,0],"movementMode":0,"actorMode":0,"marker":0,"tether":[36,48],"knocks":0,"force":0,"knockNormal":[0,0,0,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[10,10],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0}],"passes":1,"visits":0,"face":40,"edge":10,"events":"Radius,Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw,Inhibit,Radius,Root"},
|
||||
{"name":"dynamic_soldier","contact":1,"root":[0,0,20,1],"velocity":[0,7,30,0],"acceleration":[11,13,17,0],"angular":[1,9.20000076,3,0],"movementMode":0,"actorMode":10,"marker":0,"tether":[36,48],"knocks":1,"force":500,"knockNormal":[0,0,1,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[10,10],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0}],"passes":1,"visits":0,"face":40,"edge":10,"events":"Radius,Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw,K174,Inhibit,Radius,Root"},
|
||||
{"name":"late_inhibition","contact":1,"root":[0,0,15,1],"velocity":[0,7,30,0],"acceleration":[11,13,17,0],"angular":[1,9.20000076,3,0],"movementMode":0,"actorMode":10,"marker":0,"tether":[36,48],"knocks":1,"force":500,"knockNormal":[0,0,1,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":1,"inhibited":1,"radii":[10],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0}],"passes":0,"visits":0,"face":40,"edge":10,"events":"Radius,Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw,K174,Inhibit"},
|
||||
{"name":"late_radius","contact":1,"root":[0,0,55,1],"velocity":[0,7,-22.5,0],"acceleration":[11,13,17,0],"angular":[1,3.80000067,3,0],"movementMode":0,"actorMode":10,"marker":0,"tether":[36,48],"knocks":2,"force":500,"knockNormal":[0,0,1,0],"cleanups":0,"radius":20,"forceStatic":0,"geometry":1,"inhibited":0,"radii":[10,20,20],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0},{"vector":[0,0,1,0],"pitch":0,"yaw":0},{"vector":[0,0,-1,0],"pitch":0,"yaw":8192}],"passes":2,"visits":4,"face":15,"edge":10,"events":"Radius,Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw,K174,Inhibit,Radius,Radius,Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw,K174,Root"},
|
||||
{"name":"late_geometry","contact":1,"root":[0,0,20,1],"velocity":[0,7,-22.5,0],"acceleration":[11,13,17,0],"angular":[1,3.80000067,3,0],"movementMode":0,"actorMode":10,"marker":0,"tether":[36,48],"knocks":2,"force":500,"knockNormal":[0,0,1,0],"cleanups":0,"radius":10,"forceStatic":0,"geometry":0,"inhibited":0,"radii":[10,10],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0},{"vector":[0,0,1,0],"pitch":0,"yaw":0},{"vector":[0,0,-1,0],"pitch":0,"yaw":8192}],"passes":1,"visits":2,"face":40,"edge":10,"events":"Radius,Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw,K174,Inhibit,Radius,Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw,K174,Root"},
|
||||
{"name":"late_force","contact":1,"root":[0,0,45,1],"velocity":[0,7,-22.5,0],"acceleration":[11,13,17,0],"angular":[1,3.80000067,3,0],"movementMode":0,"actorMode":10,"marker":0,"tether":[36,48],"knocks":2,"force":500,"knockNormal":[0,0,1,0],"cleanups":0,"radius":10,"forceStatic":1,"geometry":1,"inhibited":0,"radii":[10,10,10],"angles":[{"vector":[0,0,-1,0],"pitch":0,"yaw":8192},{"vector":[0,0,1,0],"pitch":0,"yaw":0},{"vector":[0,0,1,0],"pitch":0,"yaw":0},{"vector":[0,0,-1,0],"pitch":0,"yaw":8192}],"passes":2,"visits":4,"face":15,"edge":10,"events":"Radius,Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw,K174,Inhibit,Radius,Radius,Gate,Gv,Gv,F,Sv3,Angles,Angles,Aw,K174,Root"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
from pathlib import Path
|
||||
import json
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0,str(ROOT/'tools/binary'))
|
||||
from actor_contact import CALLBACK_OPERANDS,CASES,collect,generate
|
||||
from checkpoint_script_state import find_case,read_va
|
||||
from pe_inspect import PE
|
||||
|
||||
|
||||
class ActorContactTests(unittest.TestCase):
|
||||
def test_complete_bodies_and_reviewed_relocations(self):
|
||||
source=collect(ROOT.parent/'Original')
|
||||
self.assertEqual(len(source['bodies']),17)
|
||||
self.assertEqual(len(source['probe_operands']),139)
|
||||
self.assertEqual(len(CALLBACK_OPERANDS),37)
|
||||
addresses=[p['va'] for p in source['probe_operands']]
|
||||
self.assertEqual(len(addresses),len(set(addresses)))
|
||||
self.assertNotIn(0x4095be,addresses)
|
||||
pe=PE(find_case(ROOT.parent/'Original','Neutron.exe'))
|
||||
self.assertEqual(read_va(pe,0x4095be,7).hex(),'8bc4680000fa43')
|
||||
|
||||
def test_real_class_overrides_and_pure_scalar_getters(self):
|
||||
source=collect(ROOT.parent/'Original')
|
||||
classes={c['kind']:c for c in source['normal_bindings']}
|
||||
self.assertEqual(len(classes),13)
|
||||
self.assertTrue(all(len(c['methods'])==14 for c in classes.values()))
|
||||
self.assertEqual(classes['3JIM']['methods']['0x374'],'0x42a660')
|
||||
self.assertEqual(classes['3SOL']['methods']['0x374'],'0x409590')
|
||||
self.assertEqual(classes['3ROC']['methods']['0x374'],'0x43e8d0')
|
||||
self.assertEqual(classes['3TRO']['methods']['0x374'],'0x458890')
|
||||
self.assertEqual([g['field'] for g in source['scalar_getters']],['0x13c','0x13d','0x137','0x150','0x15c'])
|
||||
|
||||
def test_generation_rejects_original_and_symlink_outputs(self):
|
||||
original=ROOT.parent/'Original'
|
||||
with self.assertRaisesRegex(ValueError,'Separate output'):
|
||||
generate(original,original/'forbidden-generated-probe')
|
||||
with tempfile.TemporaryDirectory() as temporary:
|
||||
output=Path(temporary)
|
||||
(output/'probe.exe').symlink_to(find_case(original,'Neutron.exe'))
|
||||
with self.assertRaisesRegex(ValueError,'symlinks'):generate(original,output)
|
||||
|
||||
def test_saved_reference_covers_all_bounded_profiles_and_late_reads(self):
|
||||
cases=json.loads((ROOT/'tests/GamePort.ActorContactTests/expected.json').read_text())['cases']
|
||||
self.assertEqual(tuple(c['name'] for c in cases),CASES)
|
||||
by_name={c['name']:c for c in cases}
|
||||
self.assertEqual(by_name['late_radius']['radii'],[10,20,20])
|
||||
self.assertEqual(by_name['late_radius']['root'],[0,0,55,1])
|
||||
self.assertEqual(by_name['late_inhibition']['radii'],[10])
|
||||
self.assertEqual(by_name['soldier_mode10_disabled']['force'],500)
|
||||
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
@@ -0,0 +1,124 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Guard and execute original normal callbacks on bounded synthetic actors."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import struct
|
||||
from dynamic_context import collect as dynamic_collect
|
||||
from collision_response import header
|
||||
from checkpoint_script_state import find_case,read_va
|
||||
from pe_inspect import PE
|
||||
from physical_registration import CLASSES
|
||||
from dynamic_reclip import differences
|
||||
|
||||
CALLBACKS=(('jimmy_wall',0x42a660,0x42a714),('player_wall',0x43aa40,0x43afe3),
|
||||
('base_ceiling',0x472690,0x47274a),('base_wall',0x458890,0x4588cd),
|
||||
('reflection',0x472750,0x472970),('soldier_wall',0x409590,0x4095ee))
|
||||
# Complete operands reviewed within individual instructions in retained REA
|
||||
# ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904.
|
||||
# A numeric scan across instruction boundaries incorrectly selected4095BE.
|
||||
CALLBACK_OPERANDS=(
|
||||
(0x42a663,0x4f0588),(0x42a678,0x4f8210),(0x42a69d,0x4f82bc),
|
||||
(0x42a6a3,0x4f82c0),(0x42a6b1,0x4f82bc),(0x42a6bb,0x4f82c0),
|
||||
(0x42a6cd,0x49d5b4),(0x43aa52,0x48e5a0),(0x43ab58,0x48d400),
|
||||
(0x43abd2,0x4f0668),(0x43ac25,0x48d108),(0x43ac3c,0x48e5b4),
|
||||
(0x43acb9,0x4f0668),(0x43ad05,0x4afd40),(0x43ad9d,0x48e5ec),
|
||||
(0x43adbd,0x48d400),(0x43ae4c,0x48e5ec),(0x43ae6c,0x48d400),
|
||||
(0x43af16,0x48d108),(0x43af30,0x48e5b4),(0x43afd1,0x4f0670),
|
||||
(0x4726ac,0x48d914),(0x472703,0x48d914),(0x47278f,0x48d104),
|
||||
(0x47279d,0x48d104),(0x4727a3,0x48d924),(0x472882,0x48d108),
|
||||
(0x4728b1,0x48e5b4),(0x4728bb,0x48d104),(0x4728c1,0x48d924),
|
||||
(0x472900,0x48e5b4),(0x47290a,0x48d914),(0x472917,0x48e5b0),
|
||||
(0x472924,0x48e5c4),(0x47292c,0x48e5c0),(0x472939,0x48e5c4),
|
||||
(0x47294a,0x4d5fd8))
|
||||
GETTERS=((0x1d0,0x4718f0,'8a813c010000c3',0x13c),
|
||||
(0x1d8,0x471910,'8a813d010000c3',0x13d),
|
||||
(0x1e0,0x471930,'8a8137010000c3',0x137),
|
||||
(0x248,0x471ad0,'d98150010000c3',0x150),
|
||||
(0x260,0x471b30,'d9815c010000c3',0x15c))
|
||||
SLOTS=(0x370,0x374,0x378,0x1d0,0x1d8,0x1e0,0x248,0x260,0x270,0x274,0x2b8,0x2bc,0x2c0,0x2c4)
|
||||
CASES=('jimmy_null','jimmy_jetpack','jimmy_ordinary_polygon','jimmy_elapsed_gate',
|
||||
'jimmy_mode1','jimmy_mode2','jimmy_uncontrolled','jimmy_gadget7_inactive',
|
||||
'jimmy_gadget7_equal','jimmy_gadget7_large','ceiling_positive','ceiling_negative',
|
||||
'ceiling_velocity_only','ceiling_acceleration_only','generic_disabled','generic_axis',
|
||||
'generic_no_damping','generic_excess_damping','generic_oblique','generic_fresh_y',
|
||||
'soldier_mode0','soldier_mode10','soldier_mode10_disabled','dynamic_jimmy',
|
||||
'dynamic_generic','dynamic_soldier','late_inhibition','late_radius','late_geometry','late_force')
|
||||
|
||||
|
||||
def collect(original):
|
||||
report=dynamic_collect(original);pe=PE(find_case(Path(original),'Neutron.exe'))
|
||||
for name,start,end in CALLBACKS:
|
||||
code=read_va(pe,start,end-start)
|
||||
report['bodies'].append(dict(name=name,va=hex(start),file_offset=hex(pe.offset(start-pe.base)),
|
||||
length=end-start,sha256=hashlib.sha256(code).hexdigest()))
|
||||
for va,target in CALLBACK_OPERANDS:
|
||||
if read_va(pe,va,4)!=struct.pack('<I',target):raise ValueError('Changed reviewed operand')
|
||||
report['probe_operands'].append(dict(va=va,target=target))
|
||||
report['probe_operands'].sort(key=lambda p:p['va'])
|
||||
bindings=[]
|
||||
for kind,name,ctor,table,displacement,*_ in CLASSES:
|
||||
bindings.append(dict(kind=kind,name=name,table=hex(table),displacement=hex(displacement),
|
||||
table_file_offset=hex(pe.offset(table-pe.base)),
|
||||
methods={hex(slot):hex(struct.unpack('<I',read_va(pe,table+slot,4))[0]) for slot in SLOTS}))
|
||||
report['normal_bindings']=bindings
|
||||
getters=[]
|
||||
for slot,va,code,field in GETTERS:
|
||||
if read_va(pe,va,len(bytes.fromhex(code))).hex()!=code:raise ValueError('Changed scalar getter')
|
||||
if any(c['methods'][hex(slot)]!=hex(va) for c in bindings):raise ValueError('Getter override requires separate recovery')
|
||||
getters.append(dict(slot=hex(slot),va=hex(va),file_offset=hex(pe.offset(va-pe.base)),field=hex(field),bytes=code))
|
||||
report['scalar_getters']=getters
|
||||
report['scope']='Complete normal callbacks and dynamic/static kernels, synthetic actor/getters/grid; Soldier complete174 and Jimmy204 are record-only stubs, not executed policies.'
|
||||
return report
|
||||
|
||||
|
||||
def generate(original,output):
|
||||
original,output=Path(original).resolve(),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('Generated output contains symlinks')
|
||||
report=collect(original);output.mkdir(parents=True,exist_ok=True)
|
||||
for name in ('actor_contact_probe.c','collision_dispatch_probe.c','collision_response_probe.c'):
|
||||
text=Path(__file__).with_name(name).read_text()
|
||||
if name=='collision_dispatch_probe.c':text=text.split('int main(void)')[0]
|
||||
(output/name).write_text(text)
|
||||
(output/'collision_response_relocations.h').write_text(header(report))
|
||||
(output/'source.json').write_text(json.dumps(report,indent=2)+'\n')
|
||||
return dict(bodies=len(report['bodies']),relocations=len(report['probe_operands']),classes=len(report['normal_bindings']))
|
||||
|
||||
|
||||
def capture(output,directory):
|
||||
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
source=json.loads((output/'source.json').read_text());metadata=json.loads((directory/'capture.json').read_text())
|
||||
log=(directory/'wine.log').read_text()
|
||||
if metadata['captures'][-1]['wineExit']!=0 or 'ACTOR_CONTACT_COMPLETE' not in log:raise ValueError('Incomplete execution')
|
||||
for name,key in [('Neutron.exe','sha256'),('OMT2.dll','omt_sha256')]:
|
||||
if sha(find_case(directory/'game',name))!=source[key]:raise ValueError('Copied source identity mismatch')
|
||||
if json.loads((directory/'probe-identity.json').read_text())['sha256']!=sha(output/'probe.exe'):raise ValueError('Probe identity mismatch')
|
||||
cases=[json.loads(line[6:]) for line in log.splitlines() if line.startswith('ACTOR ')]
|
||||
if tuple(c['name'] for c in cases)!=CASES:raise ValueError('Incomplete case sequence')
|
||||
files=[directory/'wine.log',directory/'capture.json',directory/'probe-identity.json',
|
||||
*(output/name for name in ('source.json','actor_contact_probe.c','collision_dispatch_probe.c',
|
||||
'collision_response_probe.c','collision_response_relocations.h','probe.exe'))]
|
||||
(output/'observations.json').write_text(json.dumps(dict(cases=cases,scope=source['scope'],
|
||||
provenance={str(p):sha(p) for p in files}),indent=2)+'\n')
|
||||
return dict(cases=len(cases),scope=source['scope'])
|
||||
|
||||
|
||||
def compare(output,managed):
|
||||
native=json.loads((output/'observations.json').read_text());actual=json.loads(managed.read_text())
|
||||
if any(tuple(c['name'] for c in data['cases'])!=CASES for data in (native,actual)):
|
||||
raise ValueError('Case sequence differs')
|
||||
cases=[dict(name=a['name'],differences=differences(a,b)) for a,b in zip(native['cases'],actual['cases'])]
|
||||
result=dict(exact_cases=sum(not c['differences'] for c in cases),total_cases=len(cases),cases=cases,
|
||||
scope='Exact float32 numeric values and full emitted state/trace; derived endpoints remain synthetic.')
|
||||
(output/'comparison.json').write_text(json.dumps(result,indent=2)+'\n')
|
||||
return result
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
cli=argparse.ArgumentParser(description=__doc__);cli.add_argument('original',type=Path)
|
||||
cli.add_argument('--output',type=Path,required=True);mode=cli.add_mutually_exclusive_group()
|
||||
mode.add_argument('--capture',type=Path);mode.add_argument('--managed',type=Path);args=cli.parse_args()
|
||||
print(json.dumps(compare(args.output,args.managed) if args.managed else
|
||||
capture(args.output,args.capture) if args.capture else generate(args.original,args.output),indent=2))
|
||||
@@ -0,0 +1,125 @@
|
||||
/* Complete original callbacks; actor accessors and derived policy endpoints are
|
||||
* fixtures. No original constructor, entrypoint or full soldier knockback runs. */
|
||||
#include "collision_dispatch_probe.c"
|
||||
static unsigned char complete_body[0x2400],box_body[0x500],test_material[32],test_chunk[32];
|
||||
#define BODY (complete_body+0xc0)
|
||||
static uintptr_t body_methods[0x440/4],outer_methods[0x210/4],box_methods[0x440/4];
|
||||
static Vec body_root,body_previous,body_velocity,body_acceleration,body_angular,knock_normal;
|
||||
static float body_radius,damping,knock_force;
|
||||
static int reflect,mutation,fresh_y,inhibited,knocks,cleanups,velocity_gets;
|
||||
static unsigned radius_count;static float radius_values[16];
|
||||
static char event_log[1024];static unsigned event_length;
|
||||
typedef void(TC *Angles)(void*,short*,short*);
|
||||
static Angles original_angles;
|
||||
static Vec angle_vectors[8];static short angle_pitch[8],angle_yaw[8];static unsigned angle_count;
|
||||
static void event(const char*s){int n=snprintf(event_log+event_length,sizeof(event_log)-event_length,"%s%s",event_length?",":"",s);require(n>0&&event_length+(unsigned)n<sizeof(event_log),"event bound");event_length+=(unsigned)n;}
|
||||
static void vector_json(Vec v){printf("[%.9g,%.9g,%.9g,%.9g]",v.x,v.y,v.z,v.w);}
|
||||
static Vec*TC t_velocity(void*self,Vec*out){require(self==BODY,"velocity owner");event("Gv");velocity_gets++;if(fresh_y&&velocity_gets==2)body_velocity.y=99;*out=body_velocity;return out;}
|
||||
static void TC t_velocity4(void*self,Vec v){require(self==BODY,"velocity4 owner");event("Sv4");body_velocity=v;}
|
||||
static void TC t_velocity3(void*self,float x,float y,float z){require(self==BODY,"velocity3 owner");event("Sv3");body_velocity.x=x;body_velocity.y=y;body_velocity.z=z;}
|
||||
static Vec*TC t_acceleration(void*self,Vec*out){require(self==BODY,"acceleration owner");event("Ga");*out=body_acceleration;return out;}
|
||||
static void TC t_acceleration4(void*self,Vec v){require(self==BODY,"acceleration4 owner");event("Sa4");body_acceleration=v;}
|
||||
static void TC t_angular(void*self,float x,float y,float z){require(self==BODY,"angular owner");event("Aw");body_angular.x+=x;body_angular.y+=y;body_angular.z+=z;}
|
||||
static int TC t_reflect(void*self){require(self==BODY,"reflect owner");event("Gate");return reflect;}
|
||||
static float TC t_damping(void*self){require(self==BODY,"damping owner");event("F");return damping;}
|
||||
static void TC t_angles(void*self,short*p,short*y){require(angle_count<8,"angle bound");unsigned i=angle_count++;angle_vectors[i]=*(Vec*)self;original_angles(self,p,y);angle_pitch[i]=*p;angle_yaw[i]=*y;event("Angles");}
|
||||
static void TC t_knock(void*self,float force,Vec n){require(self==complete_body&&force==500,"knock owner/force");event("K174");knocks++;knock_force=force;knock_normal=n;
|
||||
if(mutation==1)inhibited=1;
|
||||
if(mutation==2)body_radius=20;
|
||||
if(mutation==3)*(unsigned char*)AT(0x4f69e5)=0;
|
||||
if(mutation==4)BODY[0x42c]=1;
|
||||
}
|
||||
static void TC t_cleanup(void*self){require(self==complete_body,"cleanup owner");event("C204");cleanups++;}
|
||||
static void TC unexpected(void*self){(void)self;require(0,"unsupported callback policy");}
|
||||
static float TC t_radius(void*self){if(self==box_body)return 40;require(self==BODY&&radius_count<16,"radius owner/bound");radius_values[radius_count++]=body_radius;event("Radius");return body_radius;}
|
||||
static Vec*TC t_root(void*self,Vec*out){*out=self==box_body?(Vec){0,0,0,1}:body_root;return out;}
|
||||
static Vec*TC t_previous(void*self,Vec*out){require(self==BODY,"previous owner");*out=body_previous;return out;}
|
||||
static void TC t_publish(void*self,Vec value){require(self==BODY,"root owner");event("Root");body_root=value;}
|
||||
static int TC t_geometry(void*self){(void)self;return 1;}
|
||||
static int TC t_mode(void*self){(void)self;return 0;}
|
||||
static int TC t_inhibit(void*self){require(self==box_body,"box inhibit owner");event("Inhibit");return inhibited;}
|
||||
static Vec*TC t_low(void*self,Vec*out){(void)self;*out=(Vec){-50,-50,-10,1};return out;}
|
||||
static Vec*TC t_high(void*self,Vec*out){(void)self;*out=(Vec){50,50,10,1};return out;}
|
||||
static Vec*TC t_point(void*self,Vec*out,float x,float y,float z){(void)self;*out=(Vec){x,y,z,1};return out;}
|
||||
static void reset(int kind){
|
||||
memset(complete_body,0,sizeof(complete_body));memset(box_body,0,sizeof(box_body));
|
||||
memset(body_methods,0,sizeof(body_methods));memset(outer_methods,0,sizeof(outer_methods));memset(box_methods,0,sizeof(box_methods));
|
||||
*(void**)complete_body=outer_methods;*(void**)BODY=body_methods;*(void**)box_body=box_methods;
|
||||
outer_methods[0x160/4]=outer_methods[0x164/4]=(uintptr_t)unexpected;
|
||||
outer_methods[0x174/4]=(uintptr_t)t_knock;outer_methods[0x204/4]=(uintptr_t)t_cleanup;
|
||||
body_methods[0x2bc/4]=(uintptr_t)t_velocity;body_methods[0x2c0/4]=(uintptr_t)t_velocity4;body_methods[0x2c4/4]=(uintptr_t)t_velocity3;
|
||||
body_methods[0x270/4]=(uintptr_t)t_acceleration;body_methods[0x274/4]=(uintptr_t)t_acceleration4;
|
||||
body_methods[0x2b8/4]=(uintptr_t)t_angular;body_methods[0x1d8/4]=(uintptr_t)t_reflect;body_methods[0x248/4]=(uintptr_t)t_damping;
|
||||
body_methods[0x378/4]=(uintptr_t)AT(0x472750);body_methods[0x370/4]=(uintptr_t)AT(0x472690);
|
||||
body_methods[0x374/4]=(uintptr_t)AT(kind==0?0x42a660:kind==1?0x458890:0x409590);
|
||||
body_methods[0x260/4]=box_methods[0x260/4]=(uintptr_t)t_radius;
|
||||
body_methods[0x310/4]=box_methods[0x310/4]=(uintptr_t)t_root;
|
||||
body_methods[0x2f8/4]=(uintptr_t)t_previous;body_methods[0x314/4]=(uintptr_t)t_publish;
|
||||
body_methods[0x1d0/4]=(uintptr_t)t_geometry;body_methods[0x178/4]=(uintptr_t)t_mode;
|
||||
box_methods[0x1e0/4]=(uintptr_t)t_inhibit;box_methods[0x2e4/4]=(uintptr_t)t_low;
|
||||
box_methods[0x2dc/4]=(uintptr_t)t_high;box_methods[0x384/4]=(uintptr_t)t_point;
|
||||
body_root=(Vec){0,0,15,1};body_previous=(Vec){0,0,50,1};
|
||||
body_velocity=(Vec){0,7,-40,0};body_acceleration=(Vec){11,13,17,0};body_angular=(Vec){1,2,3,0};
|
||||
body_radius=10;damping=.25f;reflect=1;mutation=fresh_y=inhibited=knocks=cleanups=velocity_gets=0;
|
||||
event_length=angle_count=radius_count=0;event_log[0]=0;knock_force=0;knock_normal=(Vec){0};
|
||||
*(float*)(BODY+0x774)=4;*(short*)AT(0x4f0588)=-1;*AT(0x4f8210)=0;
|
||||
*(float*)AT(0x4f82bc)=36;*(float*)AT(0x4f82c0)=48;*(void**)AT(0x5099e4)=BODY;
|
||||
empty_grid();*(void**)AT(0x695d4c)=NULL;*(float*)AT(0x695d5c)=77;*(float*)AT(0x5cfbe0)=88;
|
||||
*(Vec*)AT(0x5cfbe8)=(Vec){111,222,333,1};*(unsigned*)AT(0x695d74)=0;
|
||||
*(unsigned*)AT(0x695d70)=*(unsigned*)AT(0x695d78)=0;
|
||||
*(unsigned char*)AT(0x4f69e5)=1;*AT(0x695d46)=*AT(0x695d45)=0;
|
||||
memset(test_material,0,sizeof(test_material));memset(test_chunk,0,sizeof(test_chunk));
|
||||
*(void**)(polygon[0]+4)=test_material;*(void**)(test_material+0xc)=test_chunk;*(int*)(test_chunk+8)=23;
|
||||
}
|
||||
static void emit(const char*name,int contact){
|
||||
printf("ACTOR {\"name\":\"%s\",\"contact\":%d,\"root\":",name,contact);vector_json(body_root);
|
||||
printf(",\"velocity\":");vector_json(body_velocity);printf(",\"acceleration\":");vector_json(body_acceleration);
|
||||
printf(",\"angular\":");vector_json(body_angular);
|
||||
printf(",\"movementMode\":%d,\"actorMode\":%d,\"marker\":%u,\"tether\":[%.9g,%.9g],\"knocks\":%d,\"force\":%.9g,\"knockNormal\":",
|
||||
*(short*)(BODY+0x704),*(int*)(BODY+0x608),BODY[0x1d65],*(float*)AT(0x4f82bc),*(float*)AT(0x4f82c0),knocks,knock_force);vector_json(knock_normal);
|
||||
printf(",\"cleanups\":%d,\"radius\":%.9g,\"forceStatic\":%u,\"geometry\":%u,\"inhibited\":%d,\"radii\":[",cleanups,body_radius,BODY[0x42c],*AT(0x4f69e5),inhibited);
|
||||
for(unsigned i=0;i<radius_count;i++)printf("%s%.9g",i?",":"",radius_values[i]);
|
||||
printf("],\"angles\":[");for(unsigned i=0;i<angle_count;i++){printf("%s{\"vector\":",i?",":"");vector_json(angle_vectors[i]);printf(",\"pitch\":%d,\"yaw\":%d}",angle_pitch[i],angle_yaw[i]);}
|
||||
printf("],\"passes\":%u,\"visits\":%u,\"face\":%.9g,\"edge\":%.9g,\"events\":\"%s\"}\n",*(unsigned*)AT(0x695d78),*(unsigned*)AT(0x695d70),*(float*)AT(0x695d5c),*(float*)AT(0x5cfbe0),event_log);
|
||||
}
|
||||
static void direct(const char*name,int ceiling,void*p){
|
||||
((void(TC*)(void*,Vec,void*))body_methods[(ceiling?0x370:0x374)/4])(BODY,(Vec){0,0,1,0},p);emit(name,-1);
|
||||
}
|
||||
static void dynamic(const char*name){int contact=((int(__cdecl*)(void*,void*))AT(0x47a5e0))(box_body,BODY)&255;emit(name,contact);}
|
||||
static void wall35(void){add_triangle(0,(Vec){-100,-100,35,1},(Vec){-100,100,35,1},(Vec){100,100,35,1},(Vec){0,0,1,0});}
|
||||
int main(void){
|
||||
setbuf(stdout,NULL);map_copy();HMODULE dll=GetModuleHandleA("OMT2.dll");require(dll!=NULL,"mapped OMT");
|
||||
FARPROC address=GetProcAddress(dll,"?angles@OMedia3DVector@@QAEXAAF0@Z");
|
||||
memcpy(&original_angles,&address,sizeof(original_angles));require(original_angles!=NULL,"original angles");
|
||||
*(void**)AT(0x48d108)=t_angles;
|
||||
reset(0);direct("jimmy_null",0,NULL);
|
||||
reset(0);*(short*)AT(0x4f0588)=3;direct("jimmy_jetpack",0,NULL);
|
||||
reset(0);direct("jimmy_ordinary_polygon",0,polygon[0]);
|
||||
reset(0);*(float*)(BODY+0x774)=3;*(int*)(test_chunk+8)=120;direct("jimmy_elapsed_gate",0,polygon[0]);
|
||||
reset(0);*(short*)(BODY+0x704)=1;direct("jimmy_mode1",0,NULL);
|
||||
reset(0);*(short*)(BODY+0x704)=2;direct("jimmy_mode2",0,NULL);
|
||||
reset(0);*(void**)AT(0x5099e4)=NULL;direct("jimmy_uncontrolled",0,NULL);
|
||||
reset(0);*(short*)AT(0x4f0588)=7;direct("jimmy_gadget7_inactive",0,NULL);
|
||||
reset(0);*(short*)AT(0x4f0588)=7;*AT(0x4f8210)=1;direct("jimmy_gadget7_equal",0,NULL);
|
||||
reset(0);*(short*)AT(0x4f0588)=7;*AT(0x4f8210)=1;*(float*)AT(0x4f82c0)=49;direct("jimmy_gadget7_large",0,NULL);
|
||||
reset(0);direct("ceiling_positive",1,NULL);
|
||||
reset(0);body_velocity.y=-7;body_acceleration.y=-13;direct("ceiling_negative",1,NULL);
|
||||
reset(0);body_acceleration.y=-13;direct("ceiling_velocity_only",1,NULL);
|
||||
reset(0);body_velocity.y=-7;direct("ceiling_acceleration_only",1,NULL);
|
||||
reset(1);reflect=0;direct("generic_disabled",0,NULL);
|
||||
reset(1);direct("generic_axis",0,NULL);
|
||||
reset(1);damping=0;direct("generic_no_damping",0,NULL);
|
||||
reset(1);damping=1.25f;direct("generic_excess_damping",0,NULL);
|
||||
reset(1);body_velocity.x=30;direct("generic_oblique",0,NULL);
|
||||
reset(1);fresh_y=1;direct("generic_fresh_y",0,NULL);
|
||||
reset(2);direct("soldier_mode0",0,NULL);
|
||||
reset(2);*(int*)(BODY+0x608)=10;direct("soldier_mode10",0,NULL);
|
||||
reset(2);reflect=0;*(int*)(BODY+0x608)=10;direct("soldier_mode10_disabled",0,NULL);
|
||||
reset(0);dynamic("dynamic_jimmy");reset(1);dynamic("dynamic_generic");
|
||||
reset(2);*(int*)(BODY+0x608)=10;dynamic("dynamic_soldier");
|
||||
reset(2);*(int*)(BODY+0x608)=10;mutation=1;dynamic("late_inhibition");
|
||||
reset(2);*(int*)(BODY+0x608)=10;mutation=2;wall35();dynamic("late_radius");
|
||||
reset(2);*(int*)(BODY+0x608)=10;mutation=3;wall35();*(void**)AT(0x695d4c)=polygon[0];dynamic("late_geometry");
|
||||
reset(2);*(int*)(BODY+0x608)=10;mutation=4;wall35();dynamic("late_force");
|
||||
puts("ACTOR_CONTACT_COMPLETE");return 0;
|
||||
}
|
||||
Reference in new issue
Block a user