diff --git a/AGENTS.md b/AGENTS.md
index 24f2dc1..a1eaa57 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -46,11 +46,15 @@ changes. Current gadget controls/resources/primary-fire findings belong in
docs/gameplay/. Distinguish static recovery, implementation, port tests and original
runtime evidence. Main owns integration/runtime; gadget investigators have
exclusive named files, not shared directories.
-Latest gadget continuation: docs/gameplay/grappler-component.md. GrapplerMotion
-is isolated:30 copied-original scalar observations,5 managed/14 Python groups,
-existing25 movement/15 gadget groups and main build pass. Ray/body/camera/helper
-gates remain before liveVR08. Source and REA artifacts are retained under
-artifacts/grappler-{ray,motion,resources,scalars}/; all ownership returned after
+Latest gadget continuation: docs/gameplay/grappler-query.md. GrapplerMotion,
+GrapplerGeometry and boundedVR08 GrapplerRay remain outside live simulation:
+72 copied-original observations,10 managed/18 Python groups,11 camera groups,
+13 Rocketship groups and main build pass. ActualVR08 ray/material tests pass;
+lab GPU readback unchanged and VR08 preview validates. Aim rejection ends active
+input before the attachment leaf; do not implement a hidden-cursor bypass.
+Shared body context/base contact, camera and helper presentation/lifetime
+remain gates before liveVR08. Source and REA artifacts are retained under
+artifacts/grappler-{ray,motion,resources,scalars,query}/; all ownership returned after
investigator usage limits. No approximate hook/pull mechanic is enabled.
The user clarified orbit's remaining issue was inverted Left/Right; Left/A and
Right/D azimuth mappings are corrected, Up/Down unchanged. Playable packages
diff --git a/docs/architecture.md b/docs/architecture.md
index dac2345..feb633c 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -290,3 +290,11 @@ GrapplerMotion implements the isolated attachment/reel/damping arithmetic and
independent fire/jump detach predicate, compared with30 copied-original cases.
It owns no body/ray/camera/helper lifetime and is not called by live simulation;
integration gates and retained source/REA findings are in gameplay/grappler-component.md.
+
+GrapplerGeometry adds source aim early-return/rope-constraint/post-base contact
+rules. GrapplerRay binds the verifiedVR08 static profile and captures selected
+polygon/material with the hit via OriginalCameraRay.TraceSelectedGeometry, which
+is independent of camera debug disabling. No live simulation calls these yet.
+The active-input return must gate later primary dispatch while normal Jimmy frame
+publication continues. Shared collision context/base contact and helper/camera
+ownership remain integration work; see gameplay/grappler-query.md.
diff --git a/docs/compatibility.md b/docs/compatibility.md
index b0da2b2..bad11f8 100644
--- a/docs/compatibility.md
+++ b/docs/compatibility.md
@@ -3,6 +3,14 @@
Compilation, native runtime, original behavior and full feature completion are
separate evidence categories. **The game is not fully reconstructed/playable yet.**
+Grappler query/constraint checkpoint:42 new copied-original observations (72
+total),10 managed/18 Python groups,11 camera/13 Rocketship groups and main build
+pass. ActualVR08 ray/filter/material integration works in tests. Lab gameplay
+readback is byte-identical; lab and VR08 geometry preview render with enabled
+Vulkan validation, zero errors.539 original hashes verify. Attached world-body/
+base-contact composition, camera and helper presentation/lifetime remain open;
+Grappler is not live and playable packages remain70cba65. See gameplay/grappler-query.md.
+
Grappler scalar checkpoint:30 copied-original Wine32 observations match5 managed
groups,14 Python source/projection checks,25 movement/15 gadget groups and main
build pass. No live Grappler, new Vulkan path or original/native Windows gameplay
diff --git a/docs/decisions.md b/docs/decisions.md
index cde04a5..a9daa62 100644
--- a/docs/decisions.md
+++ b/docs/decisions.md
@@ -270,9 +270,16 @@
left-handed view/projection; apply the shared Vulkan Y correction only once.
Regress screen right/up and depth across camera poses, not frame presence
alone. The modern inspector is separate from recovered original camera logic.
-46. **Keep Grappler cursor/attachment and input/normal gates distinct.** Cursor
- distance/material rejection does not prevent attachment on a ray hit.
+46. **Keep Grappler cursor/attachment and input/normal gates distinct.** The leaf
+ attachment helper lacks cursor filters, but aim's earlier true return ends
+ active input before that helper. Do not interpret it as a rejection bypass.
Attached input may return early while ordinary Jimmy frame publication still
runs. Compare isolated sqrt/first-scale/reel/damping with original snippets
before composing body/camera/helper ownership; do not invent250 clamps or a
detach impulse. GrapplerMotion remains isolated until those gates close.
+47. **Keep Grappler query metadata and component boundaries explicit.** Capture
+ the actual first selected polygon/material with its hit. Preserve root versus
+ swing-pivot origins, quick-magnitude constraint order and strict>60 contact
+ detach. Native aim/constraint/post-base suffix probes do not establish the
+ full body context, base contact, camera or helper lifecycle; close those
+ contracts before liveVR08. See gameplay/grappler-query.md.
diff --git a/docs/gameplay/grappler-component.md b/docs/gameplay/grappler-component.md
index dc938f0..8b3b070 100644
--- a/docs/gameplay/grappler-component.md
+++ b/docs/gameplay/grappler-component.md
@@ -1,5 +1,9 @@
# Grappler scalar checkpoint
+Continuation: [aim/constraint/contact checkpoint](grappler-query.md) adds42
+original component observations and corrects the enclosing aim→primary gate.
+The attachment leaf's broad acceptance does not bypass aim's earlier return.
+
2026-11-03. Continues user-requested gadgets after the Rocketship/orbit fixes.
The latest playable packages include the orbit Left/Right correction70cba65.
GrapplerMotion is an isolated component; no live equip/ray/swing/camera path is
diff --git a/docs/gameplay/grappler-query.md b/docs/gameplay/grappler-query.md
new file mode 100644
index 0000000..db4f67c
--- /dev/null
+++ b/docs/gameplay/grappler-query.md
@@ -0,0 +1,120 @@
+# Grappler aim, constraint and contact checkpoint
+
+2026-11-03. Continues [scalar checkpoint](grappler-component.md). Adds a bounded
+VR08 ray/material adapter and isolated aim/rope-constraint/post-base contact
+implementation. **Grappler is not enabled in live gameplay yet.** The next gates
+are shared body collision state, camera and helper presentation/lifetime.
+
+## Corrected active-input ownership
+
+The attachment leaf426A70 accepts a ray hit without repeating the cursor filter.
+That does not mean ordinary input can attach to every hidden-cursor surface:
+
+- 426084 calls438A60 input, then426098 calls complete188→429D00.
+- 42609E tests AL;4260A0 branches to4269C3 on true.4269C3..4269CD is a direct
+ epilogue/return, before later primary1C0→426A70 at4266C8.
+- Aim distance<450 hides the cursor and returns true; rejected material does
+ the same. Both therefore end the remaining active-input pass. Ordinary Jimmy
+ normal/frame publication still runs separately, as previously recovered.
+- The rejected-material branch42A4F8..42A535 may subtract250*dt when held fire
+ or consuming Enter46A3E0(13) accepts and old rope length>250. The close-distance
+ branch does not execute that reeling. Neither adds a final length clamp.
+- 42A7A0 already polls Enter among primary inputs; the extra consuming Enter path
+ is separate and short-circuited when the primary predicate is true. The managed
+ component receives those predicates; keyboard state consumption belongs to its
+ future caller, not this pure geometry API.
+
+This corrects the earlier interpretation that cursor rejection could simply be
+bypassed by held primary. No live behavior had been connected to that assumption.
+GrapplerAim.EndsActiveInput records the enclosing return, rather than only whether
+a fire button happened to be held.
+
+## Source evidence and implemented scope
+
+Authoritative EXE f5281076…1aea8 and OMT2.dll3ec41ead…54943 are required by
+`tools/binary/grappler_query.py`. Full hashes, each span hash/file offset and the
+native generator/executable/log identities are in the committed numeric fixture.
+Text file offsets below are VA−400000. Runtime globals are not file offsets.
+
+| Source span, exclusive end | File offset | Contract |
+| --- | --- | --- |
+|42A406..42A652|2A406|Aim hit/miss, strict450 threshold, selected polygon/material/definition distinction, blocked ranges, cursor point and early return.|
+|429EA0..429FA4|29EA0|Anchor minus root+116, X/Z perturbation by swing*dt*30, original DLL quick-magnitude normalization, rope-length constraint and desired root before body clipping.|
+|42A69B..42A6F1|2A69B|After base contact, zero swing X/Z; only sqrt(X²+Z²)>60 dispatches detach and sets Jimmy action latch1E25.|
+|426030..4260A6,4269C3..4269CD|26030,269C3|Input→aim→true-return gate, separate from later primary helper.|
+|42A7A0..42A7D6,46A3E0..46A3FB|2A7A0,6A3E0|Primary held predicate and consuming key-array read.|
+
+Selected polygon global695D54 points to material+4, definition+0C, ID+8; global
+5CFC60 holds the hit point. Missing polygon or definition passes the material
+gate; present polygon without a material blocks. IDs60..69,80..89,210..219,−1,170
+block. Visible cursor position uses hit−100*normalized(full ray), not normalized
+hit offset. Normalization uses the original quantized quick_magnitude.
+
+VR08 constructor's game table4D00D0 has slot134 at4D0204→475CD0, whose exact
+bytes32C0C21800 return false while popping its24-byte arguments. Therefore the
+existing NC/checkpoint admission and wall-first/grid/FIFO query are valid there.
+Actual VR08 has240 polygons and only collision material IDs0/2/3/4, all ordinary.
+GrapplerRay rejects other levels/profiles instead of inventing material context.
+It queries the actual root and full-Euler local(0,2400,2400), not root+116.
+
+OriginalCameraRay.TraceSelectedGeometry captures hit plus original polygon
+metadata together. It uses the existing traversal and is independent of the
+modern camera query toggle. Camera-only disabling must not disable gadget rays.
+Tests retain a farther first-hit blocked material instead of silently selecting a
+nearer allowed material. No global source state is manufactured from cursor art.
+
+The source constraint stores normalized X/Y before scaling, while Z retains its
+unrounded intermediate. Managed code preserves that order with double arithmetic;
+general x87 identity remains unclaimed. Zero-vector normalization is explicitly
+outside the finite modern component boundary (the source produces nonfinite
+geometry); it is not silently repaired with a new position.
+
+## Original-code and port verification
+
+`grappler_query_probe.c` copies three bounded EXE slices into private memory,
+relocates whitelisted operands, calls our copied original DLL quick_magnitude,
+and supplies synthetic ray/material/cursor/primary/detach accessors. It never
+runs the game entrypoint, actual world ray traversal, body dispatcher, base
+contact43AA40, camera, rope renderer or full detach lifecycle. The constraint
+exits before47B4B0; impact starts after43AA40. These bounds matter.
+
+42 observations complete in the isolated copied Wine32 environment with no
+network or Original mount:23 aim,10 constraint and9 post-base impact cases.
+Combined with the previous30 scalar observations,72 copied-original observations are
+checked by10 managed groups. New vector tolerance is.004 units (including large
+coordinates); scalar checkpoint retains.0002. Flags and owner/gate states compare
+exactly. The actual VR08 authored start yields two cardinal aiming hits with
+retained material identities. No original gameplay/render comparison is claimed.
+
+18 Python Grappler source/projection/evidence groups,11 existing camera groups,
+13 Rocketship groups and main .NET10 build pass. Final two-frame lab gameplay
+readback is byte-identical to the prior corrected-camera baseline. Actual VR08
+geometry preview also renders two frames; both runs enable Vulkan validation and
+report zero errors.539 original files verify unchanged. No new gameplay package
+was needed; playable packages remain70cba65.
+
+Logs: artifacts/grappler-query/{probe/wine.log,probe/capture.json,managed-final.log,
+python.log,camera.log,rocketship.log,build-final.log,gameplay.log,vr08.log,
+originals.log}. One synthetic first-hit test initially used the opposite of the
+source winding; its failed log is retained and the fixture winding was corrected.
+The first leaf guard expected a plain return, then was corrected to the actual
+stdcall24-byte return before importing references.
+
+REA's existing47C210 evidence
+ev_ff5aab3bdc275e6626753743a3567a556f698209ad9f65689cf49a4b5f56107d
+and43AA40/47B4B0 evidence in grappler-component.md remain supporting static
+records. A new local REA/Ghidra426030 pseudocode query was not recognized; the
+complete error/export/closed snapshot are retained in
+artifacts/grappler-live/rea-input/. No repeated selector/config repair or
+successful pseudocode is claimed. Exact guarded caller bytes plus the copied
+aim execution establish the early-return correction.
+
+## Next integration
+
+Carry the original shared sphere/selected-contact context across ordinary
+physics and the attached47B4B0 call, including42A660→43AA40. Do not treat the
+post-base contact suffix alone as full collision integration. Then finish helper
+rope/cursor material/transforms, follow-camera fields and equip/detach/control
+loss/RETURN persistence. The cursor's retainedsprites Canv8 is already exported
+for Baseball; rope HIROPE→rope01.ASE still needs a verified runtime binding.
+Only then enable boundedVR08 with input-driven attach/reel/swing/detach checks.
diff --git a/docs/gameplay/grappler.md b/docs/gameplay/grappler.md
index c5c1240..0536745 100644
--- a/docs/gameplay/grappler.md
+++ b/docs/gameplay/grappler.md
@@ -2,6 +2,9 @@
Continuation: [scalar implementation and30 copied-original cases](grappler-component.md).
The component remains isolated; live ray/body/camera/helper gates below still apply.
+Later [aim/constraint checkpoint](grappler-query.md) proves the enclosing input
+gate:429D00 returning true prevents later primary attachment dispatch. The leaf
+helper's lack of duplicate material checks must not be read as a bypass.
2026-11-03. Item7/raw7, using the supplied target6 decompiler bodies as leads,
then independently reading the hashed EXE instructions. No friend gameplay code
@@ -79,6 +82,8 @@ precedes that shared zero-energy reject. Do not add an energy cost from menu ind
Polygon without material blocks; material without definition passes this test;
absent selected polygon passes it. A valid cursor is placed100 back from the
hit along ray direction. This is not a query for the nearest3GRA entity.
+ Its true return at close/rejected surfaces ends426030 before primary dispatch;
+ rejected-material held fire/consuming Enter may still reel the existing length.
- **Attach / held primary:**426A70 returns false outside raw7; otherwise consumes
primary even on a miss. While unattached it stops+A3C, repeats the root/local
point ray, stores hit anchor, sets current length=distance(root,hit)−100.
diff --git a/docs/progress.md b/docs/progress.md
index 154b3b0..71e2930 100644
--- a/docs/progress.md
+++ b/docs/progress.md
@@ -1,5 +1,27 @@
# Progress — 2026-11-03
+## Grappler ray, constraint and contact checkpoint
+
+Added boundedVR08 GrapplerRay and first-hit polygon/material capture, plus aim
+gating, quick-magnitude rope constraint and post-base contact response.42 new
+copied-original cases (23 aim/10 constraint/9 impact) match; with earlier30,
+10 managed groups cover72 observations.18 Python,11 camera/13 Rocketship groups
+and .NET10 build pass. ActualVR08 authored-start rays hit with correct metadata;
+lab gameplay readback remains byte-identical and actualVR08 preview renders with
+enabled Vulkan validation, zero errors.539 originals unchanged.
+
+Important correction: the attach leaf's lack of duplicate material filters does
+not bypass aim rejection.426098..4260A0 ends active input on429D00's true return;
+close/rejected surfaces therefore prevent later primary dispatch. Rejected
+material may reel before returning; close distance does not. Strict>60 post-base
+contact detach and normalized source rope offsets are independently probed.
+Source/evidence/limits: [grappler-query.md](gameplay/grappler-query.md).
+
+No live Grappler or package update is claimed. Next: shared47B4B0 collision state
+and43AA40 composition, follow camera, rope/cursor render+reset/lifetime, then
+boundedVR08 live attach/reel/swing/detach/control-loss/RETURN. Pure constraint and
+post-base suffixes do not establish those integrations. Playable70cba65 retained.
+
## Grappler scalar checkpoint
Implemented isolated GrapplerMotion attachment length/first-scale, held/fast reel,
@@ -26,8 +48,8 @@ Build/package validation follows in orbit-camera.md.
Grappler is the next gadget. Independent investigations retained REA/source
artifacts before reaching usage limits; primary owns all files again. Preserve
-artifacts/grappler-{ray,motion,resources}/. Important recovered leads: attach uses
-any ray hit and does not repeat cursor distance/material rejection; VR08 slot134
+artifacts/grappler-{ray,motion,resources}/. Important recovered leads: the attach
+leaf uses any ray hit, but earlier aim rejection can prevent its dispatch; VR08 slot134
returns false through475CD0; root-local ray discards the swing pivot+116. Attach
uses x87 sqrt, swing normalization uses OMTquick magnitude; ordinary437940 frame
still runs after the swing input short-circuit. Rope is HIROPE→rope01.ASE with
diff --git a/docs/reverse-engineering.md b/docs/reverse-engineering.md
index 76e480b..f2e8f06 100644
--- a/docs/reverse-engineering.md
+++ b/docs/reverse-engineering.md
@@ -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
probes and modern runtime checks are recorded separately.
+- `gameplay/grappler-query.md`: enclosing426030 early-return correction,
+ VR08 static filter/selected-material metadata,42 copied-original aim/constraint/
+ post-base contact cases and corresponding managed components. The attachment
+ leaf's broad acceptance does not bypass earlier aim rejection. Full attached
+ body/base-contact, camera and helper presentation/lifetime remain separate.
+
- `gameplay/grappler-component.md`:30 copied-original attachment/reel/damping
observations, isolated managed component and retained ray/body/resource REA
evidence. Cursor rejection differs from attach acceptance, and input swing
diff --git a/docs/tasks.md b/docs/tasks.md
index 6ce688e..caa01e1 100644
--- a/docs/tasks.md
+++ b/docs/tasks.md
@@ -46,6 +46,13 @@ compile, runtime and original-fidelity verification are separate.
## Immediate continuation
+- [x] Grappler aim/root-Euler ray/first-hit material, normalized constraint and
+ post-base contact:42 additional original cases,72 total/10 managed/18 Python;
+ actualVR08 query and existing camera/Rocketship/GPU regressions pass.
+- [ ] Grappler live gates: carry shared sphere/contact context through attached
+ 47B4B0 and43AA40; complete follow camera and rope/cursor presentation/lifetime,
+ then actualVR08 attach/reel/swing/detach/control-loss/RETURN. See grappler-query.md.
+
- [x] User-clarified orbit Left/Right inversion: reverse horizontal azimuth
mapping while preserving correct Up/Down and gameplay controls.
- [x] Grappler isolated attachment/reel/damping component:30 copied-original
diff --git a/src/GamePort/Game/GrapplerGeometry.cs b/src/GamePort/Game/GrapplerGeometry.cs
new file mode 100644
index 0000000..e383108
--- /dev/null
+++ b/src/GamePort/Game/GrapplerGeometry.cs
@@ -0,0 +1,69 @@
+using System.Numerics;
+
+namespace GamePort.Game;
+
+public readonly record struct GrapplerSurface(bool PolygonPresent,bool MaterialPresent,bool DefinitionPresent,int MaterialId)
+{
+ public bool BlocksCursor=>PolygonPresent&&(!MaterialPresent||DefinitionPresent&&
+ (MaterialId is >=60 and <=69 or >=80 and <=89 or >=210 and <=219 or -1 or 170));
+}
+public readonly record struct GrapplerAim(bool CursorVisible,bool EndsActiveInput,Vector3 CursorPosition,float Length);
+public readonly record struct GrapplerConstraint(Vector3 Offset,Vector3 DesiredRoot);
+public readonly record struct GrapplerContact(GrapplerSwing Swing,bool Detach);
+
+/// 429D00 aim/constraint and42A69B post-base contact contracts.
+/// Caller still owns registry phases, actual body callbacks, camera and helpers.
+public static class GrapplerGeometry
+{
+ public static GrapplerAim Aim(Vector3 root,Vector3 endpoint,Vector3? hit,GrapplerSurface surface,
+ bool fire,bool enter,float length,float seconds)
+ {
+ Finite(root);Finite(endpoint);
+ GrapplerMotion.Finite(length);GrapplerMotion.Time(seconds);
+ if(hit is not{} point)return new(false,false,default,length);
+ Finite(point);
+ double x=(double)point.X-root.X,y=(double)point.Y-root.Y,z=(double)point.Z-root.Z;
+ if(Math.Sqrt(x*x+y*y+z*z)<450)return new(false,true,default,length);
+ if(surface.BlocksCursor)
+ return new(false,true,default,fire||enter?GrapplerMotion.HeldReel(length,seconds):length);
+ var delta=endpoint-root;
+ double inverse=InverseMagnitude(delta);
+ var offset=new Vector3((float)((double)(float)(delta.X*inverse)*100),
+ (float)((double)(float)(delta.Y*inverse)*100),(float)(delta.Z*inverse*100));
+ return new(true,false,point-offset,length);
+ }
+
+ public static GrapplerConstraint Constrain(Vector3 root,Vector3 anchor,GrapplerSwing swing,float length,float seconds)
+ {
+ Finite(root);Finite(anchor);
+ Validate(swing);GrapplerMotion.Finite(length);GrapplerMotion.Time(seconds);
+ var pivot=root+Vector3.UnitY*116;
+ var delta=new Vector3((float)((float)(anchor.X-pivot.X)+(double)swing.X*seconds*30),
+ anchor.Y-pivot.Y,(float)(((double)anchor.Z-pivot.Z)+(double)swing.Z*seconds*30));
+ double inverse=InverseMagnitude(delta);
+ var offset=new Vector3((float)((double)(float)(delta.X*inverse)*length),
+ (float)((double)(float)(delta.Y*inverse)*length),(float)(delta.Z*inverse*length));
+ return new(offset,new(anchor.X-offset.X,(float)(anchor.Y-((double)offset.Y+116)),anchor.Z-offset.Z));
+ }
+
+ public static GrapplerContact Contact(GrapplerSwing swing)
+ {
+ Validate(swing);
+ double x=swing.X,z=swing.Z;
+ return new(new(0,0,swing.Elapsed),Math.Sqrt(x*x+z*z)>60);
+ }
+
+ private static double InverseMagnitude(Vector3 vector)
+ {
+ var magnitude=OriginalBodySupport.QuickMagnitude(vector);
+ if(magnitude<=0)throw new NotSupportedException("Source zero-vector normalization produces nonfinite geometry");
+ return 1d/magnitude;
+ }
+ private static void Finite(Vector3 vector)
+ {
+ if(!float.IsFinite(vector.X)||!float.IsFinite(vector.Y)||!float.IsFinite(vector.Z))
+ throw new ArgumentOutOfRangeException(nameof(vector));
+ }
+ private static void Validate(GrapplerSwing swing)
+ {GrapplerMotion.Finite(swing.X);GrapplerMotion.Finite(swing.Z);GrapplerMotion.Finite(swing.Elapsed);}
+}
diff --git a/src/GamePort/Game/GrapplerMotion.cs b/src/GamePort/Game/GrapplerMotion.cs
index 79419ef..1e819b8 100644
--- a/src/GamePort/Game/GrapplerMotion.cs
+++ b/src/GamePort/Game/GrapplerMotion.cs
@@ -52,13 +52,13 @@ public static class GrapplerMotion
public static bool JumpDetaches(bool jumpHeld,bool fireHeld,bool attached)=>jumpHeld&&!fireHeld&&attached;
- private static void Time(float value)
+ internal static void Time(float value)
{
if(!float.IsFinite(value)||value<0||value>=1)throw new ArgumentOutOfRangeException(nameof(value));
}
- private static void Finite(float value)
+ internal static void Finite(float value)
{
if(!float.IsFinite(value))throw new ArgumentOutOfRangeException(nameof(value));
}
- private static void Finite(Vector3 value){Finite(value.X);Finite(value.Y);Finite(value.Z);}
+ internal static void Finite(Vector3 value){Finite(value.X);Finite(value.Y);Finite(value.Z);}
}
diff --git a/src/GamePort/Game/GrapplerRay.cs b/src/GamePort/Game/GrapplerRay.cs
new file mode 100644
index 0000000..e0f988b
--- /dev/null
+++ b/src/GamePort/Game/GrapplerRay.cs
@@ -0,0 +1,30 @@
+using System.Numerics;
+using GamePort.Assets;
+
+namespace GamePort.Game;
+
+/// Bounded VR08 root/full-Euler ray and first-hit material snapshot.
+/// Aiming's early return must gate later primary-fire attachment dispatch.
+public sealed class GrapplerRay
+{
+ private readonly OriginalCameraRay geometry;
+ public GrapplerRay(Mesh world,string level)
+ {
+ ArgumentNullException.ThrowIfNull(world);
+ if(level!="VR08")throw new NotSupportedException("Grappler ray admission currently covers VR08");
+ if(!world.HasCollisionMaterialIds||world.CollisionPolygons.Any(p=>p.MaterialId is not(0 or 2 or 3 or 4)))
+ throw new NotSupportedException("VR08 requires its verified material/definition profile");
+ geometry=OriginalCameraRay.FromRouteScene(world,level);
+ }
+
+ public Vector3 Endpoint(Vector3 root,Vector3 rotation)=>root+RocketOrientation.Rotate(new(0,2400,2400),rotation);
+ public CameraRaySelection? Trace(Vector3 root,Vector3 rotation)=>geometry.TraceSelectedGeometry(root,Endpoint(root,rotation));
+
+ public GrapplerAim Aim(Vector3 root,Vector3 rotation,bool fire,bool enter,float length,float seconds)
+ {
+ var endpoint=Endpoint(root,rotation);
+ var selection=geometry.TraceSelectedGeometry(root,endpoint);
+ var surface=selection is{} s?new GrapplerSurface(true,true,true,s.Polygon.MaterialId!.Value):default;
+ return GrapplerGeometry.Aim(root,endpoint,selection?.Hit.Position,surface,fire,enter,length,seconds);
+ }
+}
diff --git a/src/GamePort/Game/OriginalCameraRay.cs b/src/GamePort/Game/OriginalCameraRay.cs
index 139f6d8..94d8091 100644
--- a/src/GamePort/Game/OriginalCameraRay.cs
+++ b/src/GamePort/Game/OriginalCameraRay.cs
@@ -6,6 +6,7 @@ namespace GamePort.Game;
public readonly record struct CameraRayPolygon(SupportTriangle Triangle, Vector3 StoredNormal,
string? ShapeName = null, string? MaterialName = null, int? MaterialId = null);
public readonly record struct CameraRayResult(Vector3 Eye, float Gain, SupportHit? Hit);
+public readonly record struct CameraRaySelection(SupportHit Hit, CameraRayPolygon Polygon);
///
/// Source47C210 static camera predicate: first accepted wall-grid polygon, then
@@ -20,6 +21,7 @@ public sealed class OriginalCameraRay
public const float CellOrigin = 130; //49B1FC.
private readonly Dictionary> walls = [];
private readonly Dictionary> all = [];
+ private readonly Dictionary<(int Shape,int Polygon),CameraRayPolygon> sources = [];
public bool Enabled { get; set; } = true; // Modern camera-only debug override.
public int PolygonCount { get; }
public int WallPolygonCount { get; }
@@ -44,6 +46,7 @@ public sealed class OriginalCameraRay
RequireFinite(polygon.StoredNormal);
if (!identities.Add((triangle.ShapeId, triangle.PolygonId)))
throw new InvalidDataException("Camera query needs one source triangle per polygon; fan-triangulated polygons are unsupported");
+ sources.Add((triangle.ShapeId,triangle.PolygonId),polygon);
var wall = polygon.StoredNormal.Y < .7f; //4798B3; equality excluded.
var min = Vector3.Min(triangle.A, Vector3.Min(triangle.B, triangle.C));
var max = Vector3.Max(triangle.A, Vector3.Max(triangle.B, triangle.C));
@@ -59,15 +62,15 @@ public sealed class OriginalCameraRay
///
/// Route/tutorial complete game slot134 is475CD0 (false), including VR02's
- ///4CDD30 table (rocketship.md), so only the proven
+ ///4CDD30 and VR08's4D00D0 tables, so only the proven
/// NC/checkpoint gates apply. Reject other levels rather than inventing masks.
/// Prepared source metadata is required; raw render visibility is irrelevant.
///
public static OriginalCameraRay FromRouteScene(Mesh mesh, string levelCode)
{
ArgumentNullException.ThrowIfNull(mesh);
- if (levelCode is not ("LV1B" or "VR01" or "VR02" or "VR04" or "VR07" or "LEV1"))
- throw new NotSupportedException("Static camera game-filter recovery covers the route and VR01");
+ if (levelCode is not ("LV1B" or "VR01" or "VR02" or "VR04" or "VR07" or "VR08" or "LEV1"))
+ throw new NotSupportedException("Static camera game-filter recovery covers only selected route/tutorial scenes");
if (mesh.Indices.Length % 3 != 0 || mesh.CollisionPolygons.Length != mesh.Indices.Length / 3)
throw new InvalidDataException("Original camera query requires source polygon metadata");
var polygons = new CameraRayPolygon[mesh.CollisionPolygons.Length];
@@ -100,6 +103,14 @@ public sealed class OriginalCameraRay
return TraceCore(start, end, twoSided, diagnostic: false);
}
+ /// Capture47C210's hit and selected polygon/material together.
+ /// This geometry query is independent of the modern camera debug toggle.
+ public CameraRaySelection? TraceSelectedGeometry(Vector3 start,Vector3 end,bool twoSided=false)
+ {
+ var hit=TraceGeometry(start,end,twoSided);
+ return hit is{} h?new(h,sources[(h.ShapeId,h.PolygonId)]):null;
+ }
+
private SupportHit? TraceCore(Vector3 start, Vector3 end, bool twoSided, bool diagnostic)
{
foreach (var grid in new[] { walls, all })
diff --git a/tests/GamePort.GrapplerTests/GamePort.GrapplerTests.csproj b/tests/GamePort.GrapplerTests/GamePort.GrapplerTests.csproj
index 1b502cf..317c5a6 100644
--- a/tests/GamePort.GrapplerTests/GamePort.GrapplerTests.csproj
+++ b/tests/GamePort.GrapplerTests/GamePort.GrapplerTests.csproj
@@ -3,7 +3,15 @@
enableenablefalse
+
+
+
+
+
+
+
+
diff --git a/tests/GamePort.GrapplerTests/Program.cs b/tests/GamePort.GrapplerTests/Program.cs
index 74ae50d..fe1cea1 100644
--- a/tests/GamePort.GrapplerTests/Program.cs
+++ b/tests/GamePort.GrapplerTests/Program.cs
@@ -52,7 +52,8 @@ Reject(()=>GrapplerMotion.HeldReel(300,-.1f));Reject(()=>GrapplerMotion.FastReel
Reject(()=>GrapplerMotion.Attach(new(float.PositiveInfinity,0,0),Vector3.Zero,Vector3.Zero));
Reject(()=>GrapplerMotion.Swing(new(0,0,float.NaN),.1f,0,0,400));
Console.WriteLine("PASS nonfinite and unsupported timestep boundaries");
-Console.WriteLine("Grappler:5 scalar groups; ray/body/camera/lifetime and live VR08 integration remain separate gates.");
+QueryReferences.Run();
+Console.WriteLine("Grappler:10 groups,72 original component observations; body composition/camera/lifetime and live VR08 integration remain separate gates.");
static void Check(bool ok,string message){if(!ok)throw new Exception(message);}
static void Near(float actual,float expected,string message)=>Check(float.IsFinite(actual)&&MathF.Abs(actual-expected)<.0002f,$"{message}: {actual} != {expected}");
diff --git a/tests/GamePort.GrapplerTests/QueryReferences.cs b/tests/GamePort.GrapplerTests/QueryReferences.cs
new file mode 100644
index 0000000..1650046
--- /dev/null
+++ b/tests/GamePort.GrapplerTests/QueryReferences.cs
@@ -0,0 +1,76 @@
+using System.Numerics;
+using System.Text.Json;
+using GamePort.Assets;
+using GamePort.Game;
+
+static class QueryReferences
+{
+ public static void Run()
+ {
+ using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-query-reference.json")));
+ var cases=doc.RootElement.GetProperty("cases").EnumerateArray().ToArray();Check(cases.Length==42,"42 query/constraint/contact cases");
+ foreach(var c in cases)
+ {
+ var p=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
+ var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
+ var name=c.GetProperty("kind").GetString()+"/"+c.GetProperty("name").GetString();
+ switch(c.GetProperty("kind").GetString())
+ {
+ case "aim":
+ var a=GrapplerGeometry.Aim(Vector3.Zero,new(0,2400,2400),p[0]!=0?new Vector3(0,p[1],0):null,
+ new(p[2]!=1,p[2]!=2,p[2]!=3,(int)p[3]),p[4]!=0,p[5]!=0,p[6],p[7]);
+ Check(a.EndsActiveInput==(o[0]!=0)&&a.CursorVisible==(o[1]==0),name+" caller/visibility");
+ if(a.CursorVisible)Near(a.CursorPosition,new(o[3],o[4],o[5]),name+" cursor");
+ Near(a.Length,o[6],name+" length");break;
+ case "constraint":
+ var constraint=GrapplerGeometry.Constrain(new(p[0],p[1],p[2]),new(p[3],p[4],p[5]),new(p[6],p[7],0),p[8],p[9]);
+ Near(constraint.Offset,new(o[0],o[1],o[2]),name+" offset");
+ Near(constraint.DesiredRoot,new(o[3],o[4],o[5]),name+" root");break;
+ case "impact":
+ var impact=GrapplerGeometry.Contact(new(p[0],p[1],.75f));
+ Check(impact.Swing==new GrapplerSwing(o[0],o[1],.75f)&&impact.Detach==(o[2]!=0)
+ &&o[2]==o[3],name+" post-base clear/detach/latch");break;
+ default:throw new Exception("Unknown original query reference");
+ }
+ }
+ Console.WriteLine("PASS42 copied-original aim/constraint/post-base contact observations");
+
+ var blocked=GrapplerGeometry.Aim(Vector3.Zero,new(0,2400,2400),new(0,700,0),new(true,true,true,60),true,false,300,.1f);
+ Check(blocked.EndsActiveInput&&!blocked.CursorVisible&&blocked.Length==275,"blocked aim reels then skips later primary attachment");
+ var near=GrapplerGeometry.Aim(Vector3.Zero,new(0,2400,2400),new(0,449,0),new(true,true,true,0),true,false,300,.1f);
+ Check(near.EndsActiveInput&&near.Length==300,"close aim skips primary without blocked-material reel");
+ Console.WriteLine("PASS enclosing input gate distinguishes close/blocked aim from attachment helper acceptance");
+
+ CameraRayPolygon Wall(int shape,float z,int material)=>new(new(new(-100,-100,z),new(200,0,z),new(-100,100,z),shape,0),-Vector3.UnitZ,"wall","wall",material);
+ var query=new OriginalCameraRay([Wall(1,300,170),Wall(2,200,0)]);
+ var selected=query.TraceSelectedGeometry(Vector3.Zero,new(0,0,450));
+ Check(selected is{Polygon.MaterialId:170,Hit.ShapeId:1},"selected metadata follows first source hit, not nearer/allowed polygon");
+ query.Enabled=false;
+ Check(query.Trace(Vector3.Zero,new(0,0,450))==null&&query.TraceSelectedGeometry(Vector3.Zero,new(0,0,450))==selected,
+ "gameplay ray remains active when camera debug query is disabled");
+ Console.WriteLine("PASS first-hit material snapshot and camera-debug separation");
+
+ var world=Mesh.LoadSceneJson("artifacts/extracted/VR08/scene.json");
+ var level=GamLevel.Load("../Original/gam/VR08.gam");var root=level.FindStart()!.Position;var ray=new GrapplerRay(world,level.Code);
+ Check(ray.Endpoint(root,Vector3.Zero)==root+new Vector3(0,2400,2400),"aim uses actual root, not swing pivot+116");
+ int hits=0;
+ foreach(float yaw in new[]{0,90,180,270})
+ {
+ var rotation=new Vector3(0,yaw,0);var hit=ray.Trace(root,rotation);if(hit is not{} h)continue;
+ hits++;Check(h.Polygon.MaterialId is 0 or 2 or 3 or 4,"actual VR08 material context");
+ var aim=ray.Aim(root,rotation,true,false,0,1f/60);
+ Check(aim.CursorVisible||aim.EndsActiveInput,"actual ray reaches valid or close-surface gate");
+ }
+ Check(hits>0,"actual VR08 geometry produces authored-start aiming hits");
+ Console.WriteLine($"PASS actual VR08 root/Euler ray/filter/material integration ({hits} cardinal hits)");
+
+ Reject(()=>GrapplerGeometry.Constrain(Vector3.Zero,new(0,116,0),default,100,.1f));
+ Reject(()=>new GrapplerRay(world,"LV1B"));
+ Reject(()=>new GrapplerRay(world with{HasCollisionMaterialIds=false},"VR08"));
+ Console.WriteLine("PASS explicit zero-normalization and unsupported scene/profile boundaries");
+ }
+ static void Check(bool ok,string message){if(!ok)throw new Exception(message);}
+ static void Near(float a,float b,string name)=>Check(float.IsFinite(a)&&MathF.Abs(a-b)<.004f,$"{name}: {a} != {b}");
+ static void Near(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 Reject(Action action){try{action();throw new Exception("Unsupported boundary accepted");}catch(NotSupportedException){}}
+}
diff --git a/tests/GamePort.GrapplerTests/original-query-reference.json b/tests/GamePort.GrapplerTests/original-query-reference.json
new file mode 100644
index 0000000..c605b9f
--- /dev/null
+++ b/tests/GamePort.GrapplerTests/original-query-reference.json
@@ -0,0 +1,971 @@
+{
+ "source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
+ "dll_sha256": "3ec41ead011adf56387a6dbd4580e5b5a9721b5f8020c8a56420f42824354943",
+ "vr08_filter": {
+ "table": "0x4d00d0",
+ "slot": "0x134",
+ "target": "0x475cd0"
+ },
+ "ranges": [
+ {
+ "kind": "aim",
+ "va": "0x42a406",
+ "end_va": "0x42a652",
+ "file_offset": "0x2a406",
+ "sha256": "d0b7a01bce82ef7c94141f852a1886afe491953cbbf3d332382516fed58b6d79"
+ },
+ {
+ "kind": "constraint",
+ "va": "0x429ea0",
+ "end_va": "0x429fa4",
+ "file_offset": "0x29ea0",
+ "sha256": "ba61e38497f86c45071284b983e3709ea0ba9112b49d04295566ef8d58996097"
+ },
+ {
+ "kind": "impact_post_base",
+ "va": "0x42a69b",
+ "end_va": "0x42a6f1",
+ "file_offset": "0x2a69b",
+ "sha256": "14a425d42ab7cfe4c9fb754dc1c149dd0d91101a8d29ca568fbf3e5b89e1c1aa"
+ },
+ {
+ "kind": "input_gate",
+ "va": "0x426030",
+ "end_va": "0x4260a6",
+ "file_offset": "0x26030",
+ "sha256": "bf3bcca296c7fc5d3c7dd5e79bdd9311b5fcee7606842978346706dbdab9d1b7"
+ },
+ {
+ "kind": "input_return",
+ "va": "0x4269c3",
+ "end_va": "0x4269cd",
+ "file_offset": "0x269c3",
+ "sha256": "4602fb15bfda7c8828f0eb9f79612ce3fa9171720ad9b6751b2e982ead958c8a"
+ },
+ {
+ "kind": "primary_poll",
+ "va": "0x42a7a0",
+ "end_va": "0x42a7d6",
+ "file_offset": "0x2a7a0",
+ "sha256": "c8fa10f42eefe68a195d9980f1a57558a240cd7877bfeab567e7868c0ddf419f"
+ },
+ {
+ "kind": "consuming_enter",
+ "va": "0x46a3e0",
+ "end_va": "0x46a3fb",
+ "file_offset": "0x6a3e0",
+ "sha256": "3ed68398af88462b66579038c4687d79d2b00a0486babd28f8a5bdc33533a060"
+ },
+ {
+ "kind": "aim_return",
+ "va": "0x42a652",
+ "end_va": "0x42a660",
+ "file_offset": "0x2a652",
+ "sha256": "4c01c1dfa18487526b9b74e484c24ac294b19d80a8bcb403c12978c5965a99ba"
+ }
+ ],
+ "scope": "Synthetic ray/material/cursor accessors; original DLL magnitude; constraint before body and contact after stubbed base; no game entrypoint",
+ "cases": [
+ {
+ "kind": "aim",
+ "name": "miss",
+ "input": [
+ 0.0,
+ 700.0,
+ 0.0,
+ 0.0,
+ 1.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 0.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "near",
+ "input": [
+ 1.0,
+ 449.0,
+ 0.0,
+ 0.0,
+ 1.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "equal",
+ "input": [
+ 1.0,
+ 450.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 1.0,
+ 0.0,
+ 379.289307,
+ -70.7106781,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "far",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 1.0,
+ 0.0,
+ 629.289307,
+ -70.7106781,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "material_60",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 60.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "material_69",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 69.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "material_70",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 70.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 1.0,
+ 0.0,
+ 629.289307,
+ -70.7106781,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "material_80",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 80.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "material_89",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 89.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "material_90",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 90.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 1.0,
+ 0.0,
+ 629.289307,
+ -70.7106781,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "material_210",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 210.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "material_219",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 219.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "material_220",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 220.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 1.0,
+ 0.0,
+ 629.289307,
+ -70.7106781,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "material_-1",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ -1.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "material_170",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 170.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "no_polygon",
+ "input": [
+ 1.0,
+ 700.0,
+ 1.0,
+ 60.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 1.0,
+ 0.0,
+ 629.289307,
+ -70.7106781,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "no_material",
+ "input": [
+ 1.0,
+ 700.0,
+ 2.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "no_definition",
+ "input": [
+ 1.0,
+ 700.0,
+ 3.0,
+ 60.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 1.0,
+ 0.0,
+ 629.289307,
+ -70.7106781,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "blocked_fire",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 60.0,
+ 1.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 275.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "blocked_enter",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 60.0,
+ 0.0,
+ 1.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 275.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "blocked_idle",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 60.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "blocked_equal",
+ "input": [
+ 1.0,
+ 700.0,
+ 0.0,
+ 60.0,
+ 1.0,
+ 0.0,
+ 250.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 250.0
+ ]
+ },
+ {
+ "kind": "aim",
+ "name": "near_fire",
+ "input": [
+ 1.0,
+ 449.0,
+ 0.0,
+ 60.0,
+ 1.0,
+ 0.0,
+ 300.0,
+ 0.100000001
+ ],
+ "observed": [
+ 1.0,
+ 1.0,
+ 1.0,
+ 12345.0,
+ 12345.0,
+ 12345.0,
+ 300.0
+ ]
+ },
+ {
+ "kind": "constraint",
+ "name": "vertical",
+ "input": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1000.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 600.0,
+ 0.0166666675
+ ],
+ "observed": [
+ 0.0,
+ 600.0,
+ 0.0,
+ 0.0,
+ 284.0,
+ 0.0
+ ]
+ },
+ {
+ "kind": "constraint",
+ "name": "diagonal",
+ "input": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 800.0,
+ 400.0,
+ 0.0,
+ 0.0,
+ 600.0,
+ 0.0166666675
+ ],
+ "observed": [
+ 212.447495,
+ 484.38028,
+ 283.263306,
+ 87.5525055,
+ 199.61972,
+ 116.736694
+ ]
+ },
+ {
+ "kind": "constraint",
+ "name": "perturbed",
+ "input": [
+ 125.0,
+ 320.0,
+ -210.0,
+ -150.0,
+ 1200.0,
+ 450.0,
+ 12.0,
+ -23.0,
+ 700.0,
+ 0.0166666675
+ ],
+ "observed": [
+ -181.472336,
+ 515.408447,
+ 437.490021,
+ 31.4723358,
+ 568.591553,
+ 12.5099792
+ ]
+ },
+ {
+ "kind": "constraint",
+ "name": "long_tick",
+ "input": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 800.0,
+ 400.0,
+ 50.0,
+ -50.0,
+ 350.0,
+ 0.600000024
+ ],
+ "observed": [
+ 285.845215,
+ 162.931763,
+ -119.102173,
+ 14.1547852,
+ 521.068237,
+ 519.102173
+ ]
+ },
+ {
+ "kind": "constraint",
+ "name": "short",
+ "input": [
+ -40.0,
+ 300.0,
+ 15.0,
+ 280.0,
+ 500.0,
+ -120.0,
+ -20.0,
+ 35.0,
+ 125.0,
+ 0.100000001
+ ],
+ "observed": [
+ 118.232071,
+ 38.1980553,
+ -13.6421614,
+ 161.767929,
+ 345.801941,
+ -106.357841
+ ]
+ },
+ {
+ "kind": "constraint",
+ "name": "negative",
+ "input": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 800.0,
+ 400.0,
+ 10.0,
+ 20.0,
+ -50.0,
+ 0.100000001
+ ],
+ "observed": [
+ -18.5824604,
+ -38.5163727,
+ -25.9028244,
+ 318.582458,
+ 722.516357,
+ 425.902832
+ ]
+ },
+ {
+ "kind": "constraint",
+ "name": "fraction",
+ "input": [
+ 12.125,
+ -37.25,
+ 89.625,
+ 317.875,
+ 982.125,
+ -211.375,
+ 3.25,
+ -1.75,
+ 463.125,
+ 0.0170000009
+ ],
+ "observed": [
+ 142.231491,
+ 417.974121,
+ -139.67981,
+ 175.643509,
+ 448.150879,
+ -71.6951904
+ ]
+ },
+ {
+ "kind": "constraint",
+ "name": "horizontal",
+ "input": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 600.0,
+ 116.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ 400.0,
+ 0.100000001
+ ],
+ "observed": [
+ 400.0,
+ 0.0,
+ 0.0,
+ 200.0,
+ 0.0,
+ 0.0
+ ]
+ },
+ {
+ "kind": "constraint",
+ "name": "zero_length",
+ "input": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 800.0,
+ 400.0,
+ 1.0,
+ 2.0,
+ 0.0,
+ 0.100000001
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 300.0,
+ 684.0,
+ 400.0
+ ]
+ },
+ {
+ "kind": "constraint",
+ "name": "large",
+ "input": [
+ -13000.0,
+ 900.0,
+ -12000.0,
+ 14000.0,
+ 19000.0,
+ 18000.0,
+ -40.0,
+ 20.0,
+ 23000.0,
+ 0.0166666675
+ ],
+ "observed": [
+ 14044.2402,
+ 9361.43848,
+ 15621.4834,
+ -44.2402344,
+ 9522.56152,
+ 2378.5166
+ ]
+ },
+ {
+ "kind": "impact",
+ "name": "zero",
+ "input": [
+ 0.0,
+ 0.0
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0
+ ]
+ },
+ {
+ "kind": "impact",
+ "name": "below",
+ "input": [
+ 59.9000015,
+ 0.0
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0
+ ]
+ },
+ {
+ "kind": "impact",
+ "name": "equal_x",
+ "input": [
+ 60.0,
+ 0.0
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0
+ ]
+ },
+ {
+ "kind": "impact",
+ "name": "equal_z",
+ "input": [
+ 0.0,
+ 60.0
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0
+ ]
+ },
+ {
+ "kind": "impact",
+ "name": "pythagoras",
+ "input": [
+ 36.0,
+ 48.0
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0
+ ]
+ },
+ {
+ "kind": "impact",
+ "name": "above",
+ "input": [
+ 36.0,
+ 48.0000992
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 1.0,
+ 1.0
+ ]
+ },
+ {
+ "kind": "impact",
+ "name": "diagonal",
+ "input": [
+ 45.0,
+ 45.0
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 1.0,
+ 1.0
+ ]
+ },
+ {
+ "kind": "impact",
+ "name": "negative",
+ "input": [
+ -60.0,
+ 0.0
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 0.0,
+ 0.0
+ ]
+ },
+ {
+ "kind": "impact",
+ "name": "negative_above",
+ "input": [
+ 0.0,
+ -60.0999985
+ ],
+ "observed": [
+ 0.0,
+ 0.0,
+ 1.0,
+ 1.0
+ ]
+ }
+ ],
+ "generators": {
+ "grappler_query_probe.c": "c712653e89d506e622e77240b4fd0e3368d34c6c1ceb3f24093645fed8bf6741",
+ "grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810"
+ },
+ "executable_sha256": "5387d7523c6ff717e1c2f3587ec9e7adc53be63c184c664f8ac7e3ca4ba3b7ec",
+ "log_sha256": "9219572b31ff2b784d85aa964b876cc564d9238c3e9a67de70ba37505868b031"
+}
diff --git a/tests/test_grappler_query.py b/tests/test_grappler_query.py
new file mode 100644
index 0000000..d6b0720
--- /dev/null
+++ b/tests/test_grappler_query.py
@@ -0,0 +1,47 @@
+"""Original source gates and retained native component observations."""
+from collections import Counter
+import json
+from pathlib import Path
+import sys
+import unittest
+
+ROOT=Path(__file__).resolve().parents[1]
+sys.path.insert(0,str(ROOT/'tools/binary'))
+from grappler_query import collect
+
+
+class GrapplerQueryEvidence(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.source=collect(ROOT.parent/'Original')
+ cls.fixture=json.loads((ROOT/'tests/GamePort.GrapplerTests/original-query-reference.json').read_text())
+ cls.cases={(c['kind'],c['name']):c for c in cls.fixture['cases']}
+
+ def test_hashes_ranges_caller_return_and_vr08_filter(self):
+ for key in ('source_sha256','dll_sha256','ranges','vr08_filter'):
+ self.assertEqual(self.source[key],self.fixture[key])
+ self.assertEqual(self.source['vr08_filter']['target'],'0x475cd0')
+ self.assertEqual(len(self.source['ranges']),8)
+ self.assertEqual(Counter(c['kind'] for c in self.fixture['cases']),dict(aim=23,constraint=10,impact=9))
+
+ def test_native_close_and_blocked_paths_consume_input_with_distinct_reel_behavior(self):
+ close=self.cases['aim','near']['observed'];blocked=self.cases['aim','blocked_fire']['observed']
+ self.assertEqual(close[:3],[1,1,1]);self.assertEqual(close[-1],300)
+ self.assertEqual(blocked[:3],[1,1,1]);self.assertEqual(blocked[-1],275)
+ self.assertEqual(self.cases['aim','blocked_enter']['observed'][-1],275)
+ self.assertEqual(self.cases['aim','blocked_equal']['observed'][-1],250)
+
+ def test_native_selected_polygon_material_and_definition_are_distinct(self):
+ for name in ('no_polygon','no_definition'):
+ self.assertEqual(self.cases['aim',name]['observed'][:3],[0,0,1])
+ self.assertEqual(self.cases['aim','no_material']['observed'][:3],[1,1,1])
+ self.assertEqual(self.cases['aim','equal']['observed'][:3],[0,0,1])
+
+ def test_native_contact_equality_stays_attached_and_above60_detaches(self):
+ for name in ('zero','below','equal_x','equal_z','pythagoras','negative'):
+ self.assertEqual(self.cases['impact',name]['observed'],[0,0,0,0])
+ for name in ('above','diagonal','negative_above'):
+ self.assertEqual(self.cases['impact',name]['observed'],[0,0,1,1])
+
+
+if __name__=='__main__':unittest.main()
diff --git a/tools/binary/grappler_query.py b/tools/binary/grappler_query.py
new file mode 100644
index 0000000..e6deba7
--- /dev/null
+++ b/tools/binary/grappler_query.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python3
+"""Guarded VR08 ray/caller context and imported original-code probe results."""
+import argparse
+from collections import Counter
+import hashlib
+import json
+from pathlib import Path
+import re
+import struct
+from grappler import collect as source_contract
+from checkpoint_script_state import find_case,read_va
+from pe_inspect import PE
+from shrink_heading import DLL_SHA256
+
+RANGES=(('aim',0x42a406,0x42a652),('constraint',0x429ea0,0x429fa4),
+ ('impact_post_base',0x42a69b,0x42a6f1),('input_gate',0x426030,0x4260a6),
+ ('input_return',0x4269c3,0x4269cd),('primary_poll',0x42a7a0,0x42a7d6),
+ ('consuming_enter',0x46a3e0,0x46a3fb),('aim_return',0x42a652,0x42a660))
+
+
+def collect(original):
+ contract=source_contract(original);original=Path(original)
+ pe=PE(find_case(original,'Neutron.exe'))
+ if struct.unpack('