Recover Rocketship flight components against original-code probes

This commit is contained in:
UnixNight committed 2026-11-03 11:09:16 -05:00
1 parent c6eb1861cd
commit a274670fe8
23 files changed
+2462 -2

No files matched your search

+9 -1
View File
@@ -46,7 +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 continuation: docs/gameplay/baseball-implementation.md. Baseball's20-slot
Latest continuation: docs/gameplay/rocketship-component.md. Rocketship input and
vertical arithmetic are isolated/tested against28 copied-original observations;
the vehicle is not live. Close its aircraft collision, Euler/camera and owned
helper/attachment lifecycle gates before VR02 integration. Grappler source is in
docs/gameplay/grappler.md; no approximate hook/pull mechanic is enabled. Friend
research assessment is docs/reviews/jn-engine-survey.md; use its decompiler leads
with REA/source checks, not its tuned C gameplay. All ownership has returned.
Playable package baseline remains d6ca417; no package rebuild for this component.
Baseball continuation: docs/gameplay/baseball-implementation.md. Its20-slot
pool, hold/release aiming, original TIME art and boundedVR07 moving targets are
implemented; original dynamic pair discovery/other enemy consumers remain open.
Scooter recovery is saved in docs/gameplay/scooter.md; do not invent wheel supports.
+14
View File
@@ -270,3 +270,17 @@ and queued work are not cleared by a transform setter. The original full wrapper
registry, body response and morph clock are still not reconstructed by this bridge.
See checkpoint/control-phase-implementation.md. REA tooling is separate from
runtime architecture; setup/provenance are in rea.md.
## Isolated vehicle components
RocketFlight separates ordinary keyboard scalar/bank input from vertical
acceleration publication. The source applies retained state before the controlled
input/camera callback. It neither integrates a body nor owns a camera/passenger;
no live runtime path calls it yet. Twenty-eight isolated copied-original numeric
references support its bounded arithmetic. Aircraft callbacks, full Euler/camera,
owned-versus-placed property/reset and helper lifetime remain gates before an
explicit vehicle owner is added to PlayerSceneBinding/director scheduling.
The exact resource exporter is opt-in and assigns no attachment transforms.
See gameplay/rocketship-component.md. Grappler's distinct source ownership and
geometry/material/swing contract is in gameplay/grappler.md; it is not a simple
player movement mode or nearest-tag interaction.
+9
View File
@@ -3,6 +3,15 @@
Compilation, native runtime, original behavior and full feature completion are
separate evidence categories. **The game is not fully reconstructed/playable yet.**
Rocketship component/Grappler recovery (2026-11-03): isolated keyboard/vertical
math matches28 copied-original Wine32 observations across13 managed groups.
Rocket source3/resource5/Grappler12 and existing Gadget15/Movement25 groups pass;
main .NET10 build succeeds with the existing NU1900 metadata warning.539 originals
verify unchanged. Exact resource export remains opt-in; no live vehicle/Grappler,
new Vulkan/native Windows or whole-original gameplay verification is claimed.
No package rebuild: playable d6ca417 remains baseline. Next live gates and full
scope are recorded in gameplay/rocketship-component.md.
Supplied jn-engine assessment (2026-11-03): documentation/source/artifact review
only; no new build or runtime validation. Same declared EXE, different declared
OMT2.dll;254 ASE/126 PNG/35 GAM files match byte for byte. All539 original hashes
+9
View File
@@ -239,3 +239,12 @@
evidence. Capture tooling/derived scenes are present; raw OMTC, analysed
Ghidra database and proposed gameplay state traces are not. Record offered
permission before source import. Assessment: reviews/jn-engine-survey.md.
42. **Verify vehicle arithmetic before connecting live ownership.** RocketFlight
preserves per-callback input acceleration, support/brake ordering and retained
vertical-command publication, compared with28 isolated copied-original cases.
Radius50 is collision size, not render scale; rates650/−650 are acceleration,
not assigned velocity. Do not substitute Jimmy's body/camera for aircraft
callbacks or claim the scalar component is a live Rocketship. Resolve owned
versus placed properties, passenger/effect lifetime and control/camera phase
before VR02 integration. Grappler's geometry/material/swing contract likewise
forbids nearest-hook/direct-pull replacement. See gameplay/rocketship-component.md.
+123
View File
@@ -0,0 +1,123 @@
# Grappler source contract and integration gate
2026-11-03. Item7/raw7, using the supplied target6 decompiler bodies as leads,
then independently reading the hashed EXE instructions. No friend gameplay code
imported. Static recovery and twelve Python source/projection tests only: no live
Grappler, original gameplay execution or Windows validation is claimed.
## Identity, REA and guarded evidence
Neutron.exe SHA256 is `f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
All addresses below are preferred-base EXE virtual addresses; for these text spans
the file offset is VA−400000. `tools/binary/grappler.py` guards twelve spans,
three virtuals, two dispatch entries, sixteen constants and four strings;
`artifacts/grappler-contract/source.json` records each exact offset/hash.
REA6.8.0/Ghidra12.1.4 with project launcher/profile
`e1ad533d4cc0333c2136fe0894217de2d61feea098240326e78633f9e4ddcbf9`
decompiled jump predicate42A730, Evidence
`ev_4c43cfa8fa5d66c31111d49510aba391f069b446160a448c5544ea042dd452c4`.
Complete replies/export/snapshot are in
`artifacts/grappler-contract/rea-trajectory-20261103/`.
426A70's VA selector failed fallback file mapping; corrected offsets26A70,
29D00 and29C10 mapped correctly but have no recognized procedures in this
default Ghidra analysis. Those explicit errors are retained separately under
`rea-trajectory-offset-20261103/`; no identical retry followed. The older
`rea-controller/` attempt had an IPC denial. This run used the permitted local
Unix socket access and closed both owned sessions. No REA/config repair occurred.
Supporting decompilation is `../../../jn-engine-master/docs/decomp/evidence/
c3djimmy_target6.md`, helpers426A70/429D00/429C10. Its forced `__thiscall`,
`unaff_retaddr` and uninitialized aliases are not ABI proof. Byte-guarded objdump
and known game-interface helpers establish the contracts below; full-Euler/x87
and body execution still need separate references.
## Owners and fields
Jimmy complete pointer owns game interface+C0. Complete vtable4A3BDC has
188→429D00 (swing/aim),1C0→426A70 (held primary),204→429C10 (detach).
These offsets are distinct from movement mode complete+7C4.
| Owner | State and evidence |
|---|---|
| Jimmy complete+B0C | Owned C3DGraplingHook: ctor41EEB0 called422800, pointer stored422810, named at422821..82C; not a nearest serialized hook actor |
| Jimmy complete+B14 | Owned C3DTargetCursor: ctor4453B0 called42255B, stored42256B, named/hidden42257C..59D |
| Jimmy complete+A1C | Companion hidden and movement/collision disabled on equip/attach; cleanup restores only under its own9E8/visibility gates |
| Jimmy complete+1E04 | Loop34 audio handle;−1 sentinel; also touched by pre-mode-check swing helper |
| Globals4F8210/4F82CC | Attached byte / signed16 anchor index; constructor422761/767 initializes zero |
| Global4F8214+index*16 | Float4 anchor, copied from ray hit5CFC60 at426BA7..BD6; no tagged target search |
| Globals4F82B4/B8 | First rope length/current rope length; constructor zeroes both; first-length/scaling write only when B4==0 |
| Globals4F82BC/C0/C4/C8 | Horizontal swing scalars, elapsed damping time, fast-reel target |
| Jimmy complete+864 | Set on attach, cleared detach/cleanup; retain as an action flag until inherited consumers are fully recovered |
| Jimmy complete+7C8..7E0,854..85C | Follow eye/target and smoothing fields changed during equip/attach/detach |
Constructor zeroes the first anchor XYZ and scalars at42276E..7BE. Neither
guarded detach nor raw7 cleanup clears first lengthB4. Full helper persistence
through retained level loads remains a separate lifetime question. The indexed
region permits multiple slots by address arithmetic; do not invent a wrapping
rope/anchor stack: the bounded EXE references inspected show initialization and
reads of index, with no proven advancing writer.
## Input/update and state transitions
426030 receives Jimmy's game interface. After modal/game/control gates it runs
438A60 input then complete188→429D00 at426098; a true result ends Jimmy's active
controller pass. Held primary later reaches1C0→426A70 at4266C8 before the common
energy helper1C4 at4266DB. Thus Grappler attachment has no local energy charge and
precedes that shared zero-energy reject. Do not add an energy cost from menu index.
- **Equip:** jump-table4298E8 slot8 selects4297DD; hide/disable companion,
follow eye(0,50,−350), target(0,150,80), raw mode7. Optional inventory/menu
tutorial command9B remains its own branch.
- **Aim:** 429D00 samples root+Y116. After mode7's fast reel and optional jump
detach, its end portion performs a geometry ray from current root to full-Euler
local point(0,2400,2400), helper47C210. Distance<450 hides cursor and returns
true. Selected-polygon material IDs60..69,80..89,210..219,−1,170 also hide/block.
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.
- **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.
If B4==0, scale rope Z by length/600 and preserve first length. Set attached
byte and+864, reset jump word+7E8 and linked jump effect+6C0, emitSFX31, restart
loop34, clear horizontal swing/time, preserve velocityX/Z but setY100.
Fast-reel target=anchorY−rootY−200; eyeY400/Z−650, smoothing(.8,1,.8).
- **Reel:** when already attached and old length>250, subtract250*dt and ensure
loop34. Otherwise stop loop34. There is **no final250 clamp**. Swing helper
independently subtracts950*dt when target<current length, also without clamp.
- **Swing:** root+Y116 is constrained to length from anchor, perturbed by horizontal
scalars*dt*30. Proposed displacement passes through source body47B4B0 before
writing root314; velocityY is then cleared. SetSWING. Update scalars by
−constrained rope offsetX/Z*dt*.17 (stack0C/14, not body displacement64/6C).
At elapsed>=double.2, clamp each±50, multiply .95 when
length<350 else .98, then subtract float.2 **once**, not in a while loop.
Rope model orientation/placement and a separate shadow down-ray are also owned
here. This depends on full Euler/table math and body/camera shared context.
- **Detach:** independent jump predicate42A730 with attached and no held fire
calls204→429C10. Clear attachment/+864, restore eye(0,50,−350), target(0,130,100)
and smoothing(1.6,1,1.6). Multiply swing globals by.96 but **set body velocity
to(0,0,0)**, selectFALL, stop loop34 and hide rope. No invented launch impulse.
- **Collision:** game-interface override42A660 calls base43AA40, clears horizontal
swing and releases if their prior magnitude>60; pointer adjustment−C0 reaches
complete204. Shared collision dispatch/callback ownership remains a live gate.
- **Unequip:** raw7 cleanup4287AC restores eligible companion, detaches, restores
ordinary camera170, clears attached/+864, hides cursor; common tail sets raw−1.
## Implementation boundary and verification
The twelve Python tests verify byte identities, selected-material range edges and
missing-material branches, accepted-hit scalar initialization/reattach retention,
250/950 overshoot behavior, damping threshold/clamp/one-step timing and independent
jump/fire release. Host arithmetic projections explicitly omit x87 intermediate
precision, actual ray traversal, body/camera/actor execution. They do not establish
original runtime parity.
Safe now: use these isolated scalar rules and ownership map as implementation
contracts/tests. **Do not enable live Grappler as nearest-hook/direct pull.** Close
full-Euler ray/filter and selected-material context in VR08; body47B4B0 under
attached state including callback42A660; model/pose placement and shared camera
ownership; fresh/retained helper lifetime and control-loss cleanup. B4's first
length retention and simultaneous jump/fire are necessary regressions. REA's
missing function boundaries could be addressed on a copied analysis project using
the supplied explicit-boundary approach, without blindly trusting forced ABI.
+97
View File
@@ -0,0 +1,97 @@
# Rocketship resources and VR02 authored data
2026-11-03. Read-only original asset inspection plus exact resource export.
No original binary executed; no original/friend-tree changes. Binary ownership,
physics, transforms, animation timing and material flags belong to
[Rocketship recovery](rocketship.md), not to geometric compatibility.
`tools/extractors/rocketship_resources.py` exposes
`export_rocketship(original, output)`. It validates all12 source hashes, ASE
sample/topology and decoded RGBA identities before writing a separate directory.
It rejects original subtrees/ancestors and existing descendant symlinks. Four
source-named animation manifests reference exact original PNG pixels; no family
action names, transforms, invented UVs, interpolation or material flags are set.
Generated data: `artifacts/rocket-assets/resources/rocketship.json`.
```bash
python3 tools/extractors/rocketship_resources.py ../Original --output artifacts/rocket-assets/resources
python3 -m unittest discover -s tests -p test_rocketship_resources.py -v
```
## Meshes and textures
Coordinates use the existing independently matched ASE conversion `(x,z,y)`,
texture `(u,-v)`; exporter preserves sample positions. Original smoothing remains
unrecovered; existing ASE exporter reconstructs flat normals.
| Source | Indexed vertices / faces | Exact source sample times | fps / ticks per frame | Texture topology |
|---|---|---|---|---|
|strato.ASE / strato01|159 /262|0|30 /160|Own497 UVs,262 texture faces|
|firestrato.ASE / Cylinder01|7 /6|0,480,960|10 /480|Own10 UVs,6 texture faces|
|jimdrive.ASE / 01jimmy|426 /814|0,480|10 /480|No UVs; original jimstop426 base|
|godrocket.ASE / point|222 /411|0,960,1920|5 /960|No UVs; original godpoint222 base|
The two morphs retain the base's faces/UVs by vertex index, matching existing
original-morph exporter semantics. This establishes renderable resource
compatibility; runtime DRIVE/ROCK selection/attachment still needs binary proof.
The three godrocket samples share bounds but contain different indexed positions;
retain all samples rather than treating identical bounds as a static clip.
| Exact PNG | Size | Decoded RGBA SHA256 |
|---|---|---|
|strato.png|256×256|`b1b18454fe0413e3ce885a61e4407c808060da0fe29ef2aec26ccd4e39437f31`|
|fire.png|100×100|`07dbbc4c6b99b6fa5fe424f2f917e03352a9c635fdc1593fc12f354be83a9a7f`|
|jimycarl.png|256×256|`5e54ccb99e9e060843cd7f80fd93ff8bf47f8779666e41d4240398354a278a3f`|
|goddard02.png|256×256|`9eb24c8fa41ddf08d2f33dd7b7513b632d4262cfc26cab3383c54258b9647a62`|
Retained REA body-init43DD10 Evidence
`ev_d7bf671456c93939ac04ab612e10181e729e078de4bfc06b22f4b5302d71da00`
(`artifacts/rocket-contract/rea-core/00.json`) verifies HIDEFAULT→Strato.ase,
strato.png, DEFAULT and game110(50.0). EXE VAs in this range map to file offset
VA−400000. The source setter110→471240 establishes50 as body radius; it is not
a visual scale. Constructor4192E0 also binds DEFAULT→firestrato.ASE/fire.png;
see the accompanying Rocketship source report for guards/Evidence. Driver/dog
resource candidates are exported without
asserting their runtime state/visibility/material bindings. Do not substitute
rocket.ASE, rocketfire.ASE or objects.omt shape26 merely because their names
sound appropriate; their topology differs from this recovered Strato binding.
## VR02 and campaign corpus
All35 supplied GAMs were parsed.32 contain one3ROC; Level3B/3E and VR08 do not.
Two independent3FLA records occur in Level2 (offset7267) and Level2b (4C20),
not VR02; this does not count constructor-owned fire children. Complete observed
placement values are retained in `artifacts/rocket-assets/placements.json`.
VR02.gam SHA256
`3be92e270bd14e6fc41db702e68c894562128d23d46704b89f7abb1914bebc5c`.
All18 entity records/ordinals/property bytes/offsets are retained in the manifest.
Its sole3ROC is ordinal1, file offset1CD; position
`(445.8588257,74.9721756,598.4440918)`, yaw9.9755859375, TaskNameLIBBY.
Authored fields: MaxHeight3900, MaxSpeed1400, AccelRate400, DecelRate1, Up650,
Down−650, MaxVertVelocity650, NewGravity0, AccelLean20, DecelLean−20. These
values do not define the flying algorithm or active Jimmy-owned rocket spawn.
PHONEBOOTH/STRT points at intro3MCA `rs`; the source intro target list is
rs1/rs2/rs3/Jim1. There are **two rs1 patrol entities**, ordinals13/15,
offsets23DE/2C09. Preserve distinct records and original lookup behavior; do not
deduplicate tags or assume which position the original resolver chooses. Seven
3PIC records use indices3101..3107; LOAD offset21B9 targets RETURN with radius400.
VR02.omt SHA256
`ab041f663cd5e68d58e590feeb7661f308a70ccc682a32c49ccd82b74bec61c0`.
One shape0 `Box01`, offset74464,93802 bytes,424 indexed vertices/880 triangle
polygons; no NC-named shape. Material counts:0→160,2→96,3→192,5→400,null→32.
Retain the32 textureless polygons in collision data; absence of special Jimmy
materials alone does not prove game-class registration or flying-body admission.
The current route camera/static-body factory also excludes VR02 pending those
source gates. Resource export does not change that factory.
## Verification and remaining boundaries
Five resource checks pass: exact pixels/source sampling and mesh indices,
base-topology UV/sample-position binding, VR02 offsets/duplicate tags/null
polygons, protected output paths and changed-source/pixel rejection before output.
Standalone CLI export succeeds. No port gameplay, Vulkan, native Windows or
full original-runtime comparison is claimed by these checks. Main owns shared
prepare/package wiring; resources are currently opt-in via the new exporter.
+75
View File
@@ -0,0 +1,75 @@
# Rocketship arithmetic and resource checkpoint
2026-11-03. Continued gadgets after the supplied jn-engine assessment c6eb186.
Kept the playable d6ca417 source/packages and parked collision baseline intact.
Independent investigators owned Rocketship source, resources and Grappler source;
primary reviewed/integrated their files. All ownership has returned.
## Implemented and tested
`src/GamePort/Game/RocketFlight.cs` implements ordinary keyboard scalar/bank input
from41A6C0 and vertical publication from41A470..41A6A8. It is an isolated component,
not a connected live vehicle. Input updates retained state after application in
the ordinary source update; no input-before-integration reorder was introduced.
Caller owns body integration, X/Z vectors, facing and camera state.
Important source behavior preserved:
- Acceleration400 is per callback; support loss500*dt follows it. Down brakes
even with Up held, then Up wins the published vertical flags.
- Bank changes160*dt, clamps±45, and prior keyboard bank returns at130*dt.
- Up/Down650/−650 are acceleration commands, not direct velocities. Publication
subtracts global gravity; current velocity independently clamps±650.
- Below speed100, prior vertical command survives and the height clamp is skipped.
At the ceiling, root Y clamps but positive Vy survives; neutral snapping uses
a strict(−60,60) band.
Two isolated copied-original probes establish14 input-prefix and14 vertical-suffix
references. Generated Win32 harnesses used synthetic mouse/support/transform/audio
or body accessors, skipped camera/horizontal/integration paths and ran in separate
Wine32 namespaces. Original entrypoint/gameplay did not execute. Source bounds,
REA Evidence, file offsets and complete provenance are in
[rocketship.md](rocketship.md) and `artifacts/rocket-contract/`.
Numeric fixtures in `tests/GamePort.RocketFlightTests/` retain source, body,
generator, executable and log hashes. Thirteen managed groups compare all claimed
scalar/flag outputs with absolute tolerance.0002, reject nonfinite comparisons,
and cover phase/threshold/priority/invalid-input cases. Destination Euler and
source-preserved X/Z values are outside this scalar API's comparison. The test
is registered in `scripts/test.sh`; no live simulation path uses the component
yet. No bit-identical general x87 or original cadence claim is made.
`rocketship_resources.py` exports exact Strato/firestrato geometry, compatible
Jimmy/Goddard morph samples, PNG pixels and VR02 records after12 source hashes and
topology/pixel checks. Five tests cover output protection and resource identity.
It remains opt-in; shared preparation/package resources were not changed.
## Research integrated
[Rocketship source](rocketship.md) establishes Jimmy's owned ship, rider/control
handoff and cleanup, radius50/factor.6/friction.8, FireStrato binding and VR02's
false game polygon filter. The friend's label “visual scalar50” was corrected
through the original setter. Live body/factory admission remains unchanged.
[Grappler source](grappler.md) establishes owned rope/cursor, full-Euler ray and
material gates, attach/reel/swing/detach ordering and retained first rope length.
Twelve Python source/projection checks pass. No nearest-hook/direct-pull mechanic
or friend gameplay code was imported. Guarded tools also preserve provider gaps;
the existing local REA launcher was used without configuration changes.
Validation:13 Rocket managed groups,3 Rocket source groups,5 resource groups,
12 Grappler groups,15 existing Gadget and25 Movement groups pass. Main .NET10 build
passes with the existing NU1900 unavailable metadata warning;539 original hashes
verify unchanged. Independent read-only review agrees with the declared component
scope. No new Vulkan/live gameplay/native Windows checks or package rebuild was
needed or claimed; prior playable releases remain the user testing baseline.
## Next coherent chunk
Close the aircraft-specific370/374/378 collision callbacks, normal Euler/slip/
roll/facing and shared camera record update. Establish owned-versus-placed3ROC
property/reset behavior and retained helper lifetime. Then integrate explicit
vehicle ownership, passenger/Goddard/fire transforms and audio, mount/cleanup,
VR02 live body and F1 controls, with input/unequip/control-loss/RETURN regressions.
The source radius/support alone cannot justify using Jimmy's body/camera as a
vehicle replacement. Grappler's body/camera/material-context gates remain separate.
+167
View File
@@ -0,0 +1,167 @@
# Rocketship ownership and bounded flight components
2026-11-03. Original static recovery, guarded bytes and two isolated original
component probes. Friend research supplied useful class/function names; its
prototype vehicle mechanics were not imported. No live vehicle implementation
or original whole-game/native Windows verification is claimed by this report.
Primary owns any modern integration and its separate validation.
## Evidence and identity
EXE SHA256 `f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
`tools/binary/rocketship.py` guards ten source spans, six virtual targets and eight
constants, with PE-mapped file offsets in
`artifacts/rocket-contract/source-contract.json`. These .text VAs map to raw
offset VA−400000. Full disassembly windows are retained beside the report.
No friend OMT2.dll address is assumed applicable to our different DLL build.
| Source | REA Evidence | Retained path |
|---|---|---|
|43D840 constructor|`ev_0f31a079ff84847fd27d3e41de320d6bedddcbf3917b5f3e2b345773809a0b86`|rocket-contract/rea-core/01.json|
|43DD10 visual/body init|`ev_d7bf671456c93939ac04ab612e10181e729e078de4bfc06b22f4b5302d71da00`|rocket-contract/rea-core/00.json|
|41A140 apply|`ev_ba8607f59d6ebc468cd956e6b1c8d295eecb21889055130da4706e6cbc8e6ba2`|rocket-contract/rea-flight-ipc/00.json|
|41A6C0 input/camera|`ev_ef4490ca220408f61e74f4d122b472f9055475ec4b51e2446620a54ffd1c7b2c`|rocket-contract/rea-flight-ipc/01.json|
|43E7E0 controlled callback|`ev_20502f86a5c3c7bee2ea47608f89d578286785d1ba540b5fa7f7e56ed90505a0`|rocket-contract/rea-flight-ipc/04.json|
|4192E0 fire constructor|`ev_4f74f2325cf84e07d75696f1903bfff3800a02f9b6b706431a5b90b66a83c914`|rocket-contract/rea-flight-ipc/05.json|
Paths in that table are below `artifacts/`. Complete replies, bundles and closed
snapshots are retained. Initial `rea-flight/` failed at the known local Unix
socket sandbox boundary; one IPC-authorized retry succeeded.43DB10/43DF70 still
are not recognized as procedures in that profile; their saved errors are not
pseudocode evidence. Their bounded source instructions are guarded/reviewed.
419550 was queried as a possible effect initializer but is Flag construction;
it is not used to establish Rocketship behavior. No configuration was changed.
## State ownership, selection and cleanup
Jimmy's complete object owns a separate Rocketship allocation at+AB0, initialized
through constructor43D840; complete vtable4B2A4C, game-interface
vtable4B25AC at complete+C0. The ship's complete+740/interface+680 is a pointer to
the **complete Jimmy rider**, resolving the friend's unnamed linked-actor field.
Twenty other linked slots retain a separate unresolved effect/child role.
Item1 branch42944D..429686 uses this owned pointer; there is no nearest placed
3ROC search. It activates the ship, copies Jimmy root/Euler via game310/328 into
ship318/330, transfers game118 control to ship+C0 at4295A5, stores rider+740 at
4295B4, disables Jimmy physical participation through1E4, hides/disables relevant
companion flags, selects Jimmy DRIVE and writes raw gadget1 at42967F. Null owned
pointer skips this equip body. Availability/HUD commands remain separate.
Raw1 cleanup428512..42871D disables/hides ship flags, restores Jimmy game118
ownership at4285BA, restores companion policy, clears ship+740 at4286AE, clears
Jimmy acceleration/velocity, selects the normal animation/movement state, closes
HUD mode and writes raw−1. The original raw cleanup belongs to ownership change,
not just a rendered model toggle. Retained helper life and unmount-root timing
need the ordinary update/loader context before live integration.
43DD10 game110→471240 initializes authored34 and live15C **radius50**, not a visual
scale50.43D840 sets factor float32(.6); inherited419B70 sets friction float32(.8).
Thus ordinary radius×factor support clearance is30, distinct from Jimmy75.9.
Shape transforms/render scale are separate. This corrects the friend report's
"visual scalar" label. No wheel child construction was observed.
## Input/apply ordering and exact bounded arithmetic
Rocket registry update43DF70 calls inherited41A140 before its passenger/effect
tail. Controlled callback43E7E0 gates on407060 false and475CA0 true, then invokes
41A6C0, optionally updates a fire-held timer and calls rider complete1AC with dt.
**Apply consumes retained input state; input does not integrate the body.**
Offsets below are relative to the game interface (game pointer=complete+C0;
addC0 to these offsets for complete-object fields): speed608, bank614,
previous bank618, cap604, max height620,
up/down638/639, prior keyboard-bank flag63A, vertical command65C, mouse pitch66C.
The shared flying properties include acceleration5FC400, deceleration6001,
cap6041400, height620, rates624650/628−650 and velocity cap62C650. Inherited
constructor defaults are distinct from GAM reapplication and level-specific259
overrides;43DCE1 writes VR02 max height3900.
Keyboard/zero-mouse41A6C0 order:
1. Left bank +=160dt; else Right -=160dt. After keyboard release a retained
keyboard-origin bank approaches0 at130dt. Mouse-origin bank has no such return.
2. Up adds AccelRate **per callback** if below cap, then clamps cap. Without Up,
speed>cap×float32(.90909094) loses DecelRate×.5 per callback.
3. Supported state independently subtracts500dt, clamped0, even with Up held.
4. Down subtracts DecelRate×dt if supported or DecelRate×.1 in air from positive
speed; negative speed adds DecelRate toward0. Up+Down still performs this
braking, then Up clears the published Down flag. Bank clamps to±45.
Source Up/Down keys are50985E/509860, Left/Right50985D/50985F. Analog thresholds
are strictly>.5/<−.5. Right mouse509834 and accumulated mouse pitch>15 also give
Up;50993A or pitch<−15 give Down. Mouse Y accumulates×dt and moves toward the
±10 band by20dt outside it. Nonzero mouse X supplies bank delta×dt instead of
keyboard steering. Boost/barrel-roll globals and complete camera tail remain
outside the primary keyboard component; do not expose ordinary keyboard scope
as complete input support.
41A470..41A6A8 vertical publication is independently recoverable:
- speed<100 preserves prior65C and skips the height decision.
- At speed>=100, rootY>=MaxHeight clamps root only and sets command0, or DownRate
if prior Down. Below ceiling, prior Up/Down selects their respective command.
- Neutral uses−160 for Vy>0,+160 otherwise; strict−60<Vy<60 snaps Vy and command0.
- Body accelerationY becomes command−global gravity, preserving X/Z acceleration.
Existing Vy is then independently clamped±MaxVertVelocity, preserving X/Z.
UpRate/DownRate here are **acceleration commands**, despite the friend's velocity
target naming. Above-ceiling positive Vy is not immediately zeroed. No source
position integration occurs in this component beyond the direct ceiling clamp.
## Actual VR02 static scene gate
456270 constructor binds complete game table4CDD30 at4562DA and registers VR02
at456328.4563D0 is Init, not construction. Table4CDD30+134→475CD0 returnsfalse,
so shared4791C7/4791D9/NC registration has no additional VR02 game exclusion.
Resource-side material/shape inventory is in rocketship-assets.md; it does not
by itself establish flying body callbacks or dynamic actor eligibility.
## Isolated original numeric verification
Two generated32bit probes map copied EXE sections and rebase explicit guarded
global operands. The input probe executes original41A6C0 through41AC0E, replacing
mouse polling with fixed inputs, supplying synthetic support/Euler/audio virtuals,
and skipping the camera tail. The vertical probe uses a small frame thunk into
unchanged41A470..41A6A8 and synthetic body getters/setters; horizontal/animated
prefixes and integration do not execute. Neither calls the game entrypoint.
Both ran through `tools/recon/reference_capture.py` in separate generated Wine32
prefixes, with no network or original-directory mount, exiting0.
| Selected case | Original observation |
|---|---|
|Up airborne dt1/60 and dt.1|speed400 for both|
|Up supported dt1/60|391.666656|
|Up+Down airborne / supported|399.899994 /391.649994; Up true, Down false|
|Coast1400 /1200|1399.5 /1200|
|Down1000 airborne /supported|999.900024 /991.650024|
|Left+Right dt.1|bank16, Left wins|
|Prior keyboard10 /mouse10 neutral|bank0 /10|
|speed99,root5000,Vy900,command123|root5000,Vy650,command123,body acceleration923|
|Ceiling Up,root5000,Vy300|root3900,Vy300,command0,body acceleration800|
|Neutral Vy±60|retained velocity, command∓160|
|Neutral Vy±59.99|velocity0,command0,body acceleration800|
|Up /Down with gravity−800|body acceleration1450 /150|
All14 input and14 vertical cases, exact float32 inputs, tuning, observed outputs,
EXE/body/generator/probe/log hashes are in `original-input-results.json` and
`original-vertical-results.json` below `artifacts/rocket-contract/`. All vertical
cases preserve synthetic XZ velocity11/22 and acceleration33/44. Logs, compiled
probes and generated C remain there. Exporter flags `--probe-source`,
`--vertical-probe-source`, `--probe-log/--probe-executable` and vertical equivalents
reproduce the source and ingest complete logs; incomplete/duplicate cases reject.
These are isolated original arithmetic references, not original gameplay traces.
Three Python source/identity/incomplete-capture regression groups pass; both
generated probes compile with i686-w64-mingw32-gcc `-O0 -Wall -Wextra`.
## Safe implementation boundary and next gates
The primary implementation and its28 numeric comparisons are recorded in
[the component checkpoint](rocketship-component.md). Do not enable a live
Rocketship controller until:
normal horizontal Euler/slip/roll/facing and actual camera record updates are
closed; aircraft-specific body370/374/378 callbacks are composed; registry/control
handoff and retained-helper life are integrated; owned-versus-placed3ROC property
and reset timing are proven; passenger/Goddard/fire attachment and effect/audio
ownership are implemented. Collision/impact/mission sequences remain separate
gates. Do not turn this recovery into tuned nearest-rocket boarding or assume
ordinary Jimmy collision/camera matches the vehicle.
+28
View File
@@ -1,5 +1,33 @@
# Progress — 2026-11-03
## Rocketship component and Grappler recovery
Continued user-requested gadgets using supplied decompiler leads, independently
checked with local REA and guarded original bytes. Integrated source/resource
reports and exporters for Rocketship and Grappler; no friend gameplay code was
imported. All investigators returned ownership. Details:
[rocketship-component.md](gameplay/rocketship-component.md).
Implemented isolated RocketFlight ordinary keyboard scalar/bank and vertical
publication. Two copied-original Wine32 probes establish14 input and14 vertical
references;13 managed groups compare the committed numeric fixtures and threshold/
ordering/admission cases. This is not connected live flight. Original radius50
is a collider setter, correcting the friend's visual-scale interpretation;
Up/Down650 are acceleration commands, not direct velocity assignments.
Exact Strato/firestrato/Jimmy/Goddard resources and VR02 authored provenance export
separately with5 checks. Rocket source3/Grappler12 groups pass, along with existing
Gadget15/Movement25 groups and main .NET10 build (existing NU1900 metadata warning).
All539 originals verify unchanged. Native component probes are distinct from
whole-game, new Vulkan/live gameplay or native Windows validation. Packages remain
the prior playable d6ca417; preserved collision baselines remain untouched.
Next: close aircraft body callbacks, Euler/slip/roll/camera, owned-versus-placed
property/reset and passenger/effect/helper lifetime, then integrate explicit
vehicle ownership and boundedVR02/F1 with live input/control-loss/RETURN tests.
Grappler ray/material context, attached body/camera and helper lifetime remain
separate integration gates; no nearest-hook/direct-pull substitute was enabled.
## Supplied jn-engine research assessment
User requested review of the friend's SURVEY-for-Rockman.md and jn-engine-master.
+13
View File
@@ -93,6 +93,19 @@ and activation gating remain unresolved. The no-gadget controller checkpoint now
integrates the corrected formulas; see analysis/movement-checkpoint.md rather than
the older preliminary movement interpretations.
## Gadget component continuation — 2026-11-03
Supplied jn-engine class names/saved decompiler bodies guided independent local
REA and guarded-byte recovery. Rocketship owner/control, radius50/factor.6,
flight input/apply and VR02 game filter are documented in gameplay/rocketship.md.
Two synthetic Wine32 harnesses executed copied input/vertical instruction ranges,
yielding28 numeric references for13 managed RocketFlight groups. This does not
observe whole-game flight or recover the remaining body/camera/attachment phase.
Provenance and next gates: gameplay/rocketship-component.md. Grappler's source
ray/material, attach/reel/swing/detach and retained helper state are recorded in
gameplay/grappler.md with12 source/projection checks; live integration is gated.
Original/friend files remain untouched; no tuned friend C gameplay was imported.
## Unresolved
Follow-up evidence: `analysis/runtime-checkpoint.md` identifies TSK StoredVector,
+19 -1
View File
@@ -46,7 +46,25 @@ compile, runtime and original-fidelity verification are separate.
## Immediate continuation
**Latest user request: assess supplied friend's decomp. Completed2026-11-03.**
**Gadget component checkpoint2026-11-03:**
[Rocketship arithmetic/resources](gameplay/rocketship-component.md).
- [x] Use supplied decompiler leads with independent REA/source guards for
Rocketship owner/control/body dimensions, flight input/apply and VR02 filter.
- [x] Implement isolated keyboard/vertical components;13 managed groups compare
14 input+14 vertical copied-original observations and explicit boundaries.
- [x] Export exact Rocketship resources/VR02 records with5 checks; recover
Grappler attachment/material/swing/lifetime source with12 checks. Rocket source
3 checks, existing Gadget15/Movement25 and .NET10 build pass;539 hashes verify.
- [ ] Close Rocketship aircraft callbacks, normal Euler/slip/roll/camera and
owned-versus-GAM property/reset/helper/attachment gates; then integrate bounded
VR02 vehicle ownership, actual art/audio, F1 and live control/RETURN checks.
- [ ] Close Grappler ray/material context, attached dispatcher/camera/Euler and
helper lifetime before live mode7. No substitute hook/pull behavior.
No live Rocketship/Grappler or new package claim; d6ca417 remains playable baseline.
**Supplied friend's decomp assessment completed2026-11-03.**
See [assessment](reviews/jn-engine-survey.md), independent gameplay/capture
reviews and the prepared local evidence request. No source import or gameplay
change. Same EXE/shared corpus, different declared OMT2.dll;208 class specs and
+1
View File
@@ -19,6 +19,7 @@ dotnet run --project tests/GamePort.BubbleVisualTests
dotnet run --project tests/GamePort.BubbleTests
dotnet run --project tests/GamePort.BaseballTests
dotnet run --project tests/GamePort.BaseballVisualTests
dotnet run --project tests/GamePort.RocketFlightTests
dotnet run --project tests/GamePort.HeadingTests
dotnet run --project tests/GamePort.BlendTests
dotnet run --project tests/GamePort.CameraRayTests
+110
View File
@@ -0,0 +1,110 @@
namespace GamePort.Game;
public readonly record struct RocketFlightTuning(float Acceleration, float Deceleration,
float MaximumSpeed, float MaximumHeight, float UpRate, float DownRate, float MaximumVerticalSpeed);
public readonly record struct RocketSteering(float Speed, float Bank, bool KeyboardBank = false,
bool Up = false, bool Down = false);
public readonly record struct RocketVerticalState(float Height, float Velocity, float CommandedAcceleration);
public readonly record struct RocketVerticalStep(RocketVerticalState State, float BodyAcceleration);
/// <summary>
/// Bounded ordinary keyboard branch of C3DFlyingObject41A6C0. Input updates
/// retained scalars/flags after41A140's application in the ordinary update. Mouse,
/// analog, boost/roll, camera and body integration are separate contracts.
/// See gameplay/rocketship.md; this component does not enable a live vehicle.
/// </summary>
public static class RocketFlight
{
public static RocketSteering StepKeyboardInput(RocketSteering state, PlayerInput input,
bool supported, float seconds, RocketFlightTuning tuning)
{
Validate(tuning, seconds);
if (!float.IsFinite(state.Speed) || !float.IsFinite(state.Bank))
throw new ArgumentOutOfRangeException(nameof(state));
var bank = state.Bank;
var keyboardBank = state.KeyboardBank;
if (input.Left) { bank += 160 * seconds; keyboardBank = true; }
else if (input.Right) { bank -= 160 * seconds; keyboardBank = true; }
else if (keyboardBank)
bank = bank < 0 ? MathF.Min(0, bank + 130 * seconds) : MathF.Max(0, bank - 130 * seconds);
var speed = state.Speed;
//41A8C2: acceleration is per callback, unlike the later500*dt support
//loss. Do not convert it into a conventional acceleration-per-second.
if (input.Forward)
{
if (speed < tuning.MaximumSpeed) speed = MathF.Min(tuning.MaximumSpeed, speed + tuning.Acceleration);
}
else if (speed > tuning.MaximumSpeed * .9090909361839294f)
speed -= tuning.Deceleration * .5f;
if (supported) speed = MathF.Max(0, speed - 500 * seconds);
//41A9CA: Down still brakes when Up is also held; Up only wins the
//published vertical flag after this scalar update.
if (input.Backward)
{
if (speed > 0) speed = MathF.Max(0, speed - tuning.Deceleration * (supported ? seconds : .1f));
else if (speed < 0) speed = MathF.Min(0, speed + tuning.Deceleration);
}
return new(speed, Math.Clamp(bank, -45, 45), keyboardBank,
input.Forward, input.Backward && !input.Forward);
}
/// <summary>
///41A47F..41A6A8 vertical publication only. World/body integration precedes
/// this callback; UpRate/DownRate are requested acceleration, not velocity.
/// The below100 branch retains65C and does not clamp height. The height
/// clamp changes root Y, not the current velocity. Caller retains X/Z.
/// </summary>
public static RocketVerticalStep StepVertical(RocketVerticalState state,
RocketSteering steering, RocketFlightTuning tuning, float gravity)
{
ValidateTuning(tuning);
if (!float.IsFinite(state.Height) || !float.IsFinite(state.Velocity)
|| !float.IsFinite(state.CommandedAcceleration) || !float.IsFinite(steering.Speed)
|| !float.IsFinite(gravity)) throw new ArgumentOutOfRangeException(nameof(state));
var height = state.Height;
var velocity = state.Velocity;
var command = state.CommandedAcceleration;
if (steering.Speed >= 100)
{
if (height >= tuning.MaximumHeight)
{
height = tuning.MaximumHeight;
command = steering.Down ? tuning.DownRate : 0;
}
else if (steering.Up) command = tuning.UpRate;
else if (steering.Down) command = tuning.DownRate;
else
{
command = velocity > 0 ? -160 : 160;
if (velocity > -60 && velocity < 60) { velocity = 0; command = 0; }
}
}
velocity = Math.Clamp(velocity, -tuning.MaximumVerticalSpeed, tuning.MaximumVerticalSpeed);
return new(new(height, velocity, command), command - gravity);
}
private static void Validate(RocketFlightTuning tuning, float seconds)
{
if (!float.IsFinite(seconds) || seconds <= 0 || seconds >= 1)
throw new ArgumentOutOfRangeException(nameof(seconds));
ValidateTuning(tuning);
}
private static void ValidateTuning(RocketFlightTuning tuning)
{
if (!float.IsFinite(tuning.Acceleration) || tuning.Acceleration < 0
|| !float.IsFinite(tuning.Deceleration) || tuning.Deceleration < 0
|| !float.IsFinite(tuning.MaximumSpeed) || tuning.MaximumSpeed <= 0
|| !float.IsFinite(tuning.MaximumHeight) || !float.IsFinite(tuning.UpRate)
|| !float.IsFinite(tuning.DownRate) || !float.IsFinite(tuning.MaximumVerticalSpeed)
|| tuning.MaximumVerticalSpeed < 0)
throw new ArgumentOutOfRangeException(nameof(tuning));
}
}
@@ -0,0 +1,8 @@
<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"/></ItemGroup>
<ItemGroup><Content Include="original-input-reference.json" CopyToOutputDirectory="PreserveNewest"/>
<Content Include="original-vertical-reference.json" CopyToOutputDirectory="PreserveNewest"/></ItemGroup>
</Project>
+194
View File
@@ -0,0 +1,194 @@
using GamePort.Game;
using System.Text.Json;
var checks = new (string Name, Action Check)[]
{
("acceleration is per callback and does not pull an overspeed value down", Acceleration),
("support loss follows acceleration, including both vertical keys", SupportOrder),
("coast threshold is strict and loss is per callback", Coasting),
("braking depends on support and clamps both signs", Braking),
("Up wins published flags after simultaneous Down braking", BothDirections),
("left precedence, bank limits and prior keyboard release", Bank),
("vertical rates publish acceleration after compensating gravity", VerticalCommands),
("strict neutral velocity band and symmetric existing velocity cap", VerticalBand),
("height clamp retains velocity and allows Down acceleration", HeightClamp),
("low scalar retains acceleration and skips height clamp", LowSpeed),
("fourteen copied-original input-prefix numeric references", OriginalReferences),
("fourteen copied-original vertical-suffix numeric references", OriginalVerticalReferences),
("state, tuning and timestep admission", Invalid),
};
foreach (var (name, check) in checks) { check(); Console.WriteLine($"PASS {name}"); }
Console.WriteLine($"Rocket flight checks: {checks.Length} passed. Recovered arithmetic; not live/original gameplay verification.");
static RocketFlightTuning Tuning() => new(400, 1, 1400, 3900, 650, -650, 650);
static PlayerInput Input(bool up = false, bool down = false, bool left = false, bool right = false)
=> new(up, down, left, right, false);
static RocketSteering Step(float speed = 0, PlayerInput input = default, bool supported = false,
float dt = .1f, float bank = 0, bool keyboardBank = false)
=> RocketFlight.StepKeyboardInput(new(speed, bank, keyboardBank), input, supported, dt, Tuning());
static void Acceleration()
{
Near(Step(input: Input(up:true), dt:.01f).Speed,400,"short callback");
Near(Step(input: Input(up:true), dt:.5f).Speed,400,"long callback");
Near(Step(1300,Input(up:true)).Speed,1400,"cap crossing");
Near(Step(1500,Input(up:true)).Speed,1500,"retained overspeed");
}
static void SupportOrder()
{
Near(Step(input:Input(up:true),supported:true).Speed,350,"accelerate then support loss");
Near(Step(25,supported:true).Speed,0,"support loss clamps");
Near(Step(100,Input(up:true,down:true),supported:true).Speed,449.9f,"accel, support, then Down");
Near(Step(-20,supported:true).Speed,0,"negative supported scalar");
}
static void Coasting()
{
var threshold=1400*.9090909361839294f;
Near(Step(threshold).Speed,threshold,"equal threshold");
Near(Step(1400,dt:.01f).Speed,1399.5f,"short callback coast");
Near(Step(1400,dt:.5f).Speed,1399.5f,"long callback coast");
Near(Step(1000).Speed,1000,"low coast retains scalar");
}
static void Braking()
{
Near(Step(100,Input(down:true),dt:.25f).Speed,99.9f,"air brake");
Near(Step(500,Input(down:true),supported:true,dt:.25f).Speed,374.75f,"support brake");
Near(Step(.05f,Input(down:true)).Speed,0,"positive crossing");
Near(Step(-.5f,Input(down:true)).Speed,0,"negative crossing");
Near(Step(-3,Input(down:true)).Speed,-2,"negative per-call recovery");
Near(Step(1400,Input(down:true)).Speed,1399.4f,"coast precedes brake");
}
static void BothDirections()
{
var both=Step(0,Input(up:true,down:true));
Near(both.Speed,399.9f,"Down brakes newly accelerated speed");
Check(both.Up&&!both.Down,"Up wins flags");
Check(Step(input:Input(down:true)).Down,"Down alone");
Check(!Step().Up&&!Step().Down,"fresh flags clear old requests");
}
static void Bank()
{
Near(Step(input:Input(left:true,right:true)).Bank,16,"left precedence");
Near(Step(input:Input(right:true)).Bank,-16,"right sign");
Near(Step(input:Input(left:true),bank:44).Bank,45,"positive cap");
Near(Step(input:Input(right:true),bank:-44).Bank,-45,"negative cap");
Near(Step(bank:20,keyboardBank:true).Bank,7,"release positive");
Near(Step(bank:-20,keyboardBank:true).Bank,-7,"release negative");
Near(Step(bank:5,keyboardBank:true).Bank,0,"release crossing");
Near(Step(bank:20).Bank,20,"non-keyboard bank retained");
Check(Step(input:Input(left:true)).KeyboardBank,"keyboard origin set");
}
static RocketVerticalStep Vertical(float height=1000,float velocity=0,float command=0,
float speed=500,bool up=false,bool down=false)
=> RocketFlight.StepVertical(new(height,velocity,command),new(speed,0,Up:up,Down:down),Tuning(),-800);
static void VerticalCommands()
{
var up=Vertical(up:true);
Near(up.State.CommandedAcceleration,650,"up command");
Near(up.BodyAcceleration,1450,"up compensates gravity");
Near(up.State.Velocity,0,"up does not assign velocity");
Near(Vertical(down:true).BodyAcceleration,150,"down compensates gravity");
Near(Vertical().BodyAcceleration,800,"neutral cancels gravity");
Near(Vertical(up:true,down:true).State.CommandedAcceleration,650,"below ceiling Up precedence");
Near(Vertical(speed:100,up:true).BodyAcceleration,1450,"inclusive speed threshold");
}
static void VerticalBand()
{
Near(Vertical(velocity:59.9f).State.Velocity,0,"positive snap");
Near(Vertical(velocity:-59.9f).State.Velocity,0,"negative snap");
Near(Vertical(velocity:60).State.CommandedAcceleration,-160,"positive boundary");
Near(Vertical(velocity:-60).State.CommandedAcceleration,160,"negative boundary");
Near(Vertical(velocity:700,up:true).State.Velocity,650,"upper cap");
Near(Vertical(velocity:-700,down:true).State.Velocity,-650,"lower cap");
Near(Vertical(velocity:700).State.CommandedAcceleration,-160,"neutral decision precedes cap");
}
static void HeightClamp()
{
var ceiling=Vertical(height:4000,velocity:123,up:true);
Near(ceiling.State.Height,3900,"ceiling root clamp");
Near(ceiling.State.Velocity,123,"height clamp preserves velocity");
Near(ceiling.State.CommandedAcceleration,0,"ceiling rejects Up acceleration");
Near(Vertical(height:3900,down:true).State.CommandedAcceleration,-650,"Down at equal ceiling");
Near(Vertical(height:3900,up:true,down:true).State.CommandedAcceleration,-650,"ceiling Down priority");
}
static void LowSpeed()
{
var low=Vertical(height:5000,velocity:700,command:-321,speed:99,up:true);
Near(low.State.Height,5000,"below100 does not clamp height");
Near(low.State.CommandedAcceleration,-321,"retained65C");
Near(low.BodyAcceleration,479,"retained command still compensates gravity");
Near(low.State.Velocity,650,"low speed still caps velocity");
}
static void OriginalReferences()
{
using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-input-reference.json")));
var root=doc.RootElement;
Check(root.GetProperty("source_sha256").GetString()=="f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8","original identity");
var tuning=root.GetProperty("tuning");
var parameters=Tuning() with{Acceleration=tuning.GetProperty("acceleration").GetSingle(),
Deceleration=tuning.GetProperty("deceleration").GetSingle(),MaximumSpeed=tuning.GetProperty("maximum_speed").GetSingle()};
Check(root.GetProperty("cases").GetArrayLength()==14,"reference count");
foreach(var sample in root.GetProperty("cases").EnumerateArray())
{
var name=sample.GetProperty("name").GetString();
var input=sample.GetProperty("input");var expected=sample.GetProperty("observed");
var keys=Input(input.GetProperty("up").GetBoolean(),input.GetProperty("down").GetBoolean(),
input.GetProperty("left").GetBoolean(),input.GetProperty("right").GetBoolean());
var state=new RocketSteering(input.GetProperty("speed").GetSingle(),input.GetProperty("bank").GetSingle(),
input.GetProperty("keyboard").GetBoolean());
var actual=RocketFlight.StepKeyboardInput(state,keys,input.GetProperty("supported").GetBoolean(),input.GetProperty("dt").GetSingle(),parameters);
Near(actual.Speed,expected.GetProperty("speed").GetSingle(),$"{name} scalar");
Near(actual.Bank,expected.GetProperty("bank").GetSingle(),$"{name} bank");
Check(actual.Up==expected.GetProperty("up").GetBoolean()&&actual.Down==expected.GetProperty("down").GetBoolean(),$"{name} vertical flags");
Check(actual.KeyboardBank==expected.GetProperty("keyboard").GetBoolean(),$"{name} bank origin");
//The source also observed destination Euler. It belongs to the still
//separate facing/rotation contract and is deliberately not compared here.
}
}
static void OriginalVerticalReferences()
{
using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-vertical-reference.json")));
var root=doc.RootElement;
Check(root.GetProperty("source_sha256").GetString()=="f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8","original vertical identity");
var tuning=root.GetProperty("tuning");
var parameters=Tuning() with{MaximumHeight=tuning.GetProperty("maximum_height").GetSingle(),
UpRate=tuning.GetProperty("up_rate").GetSingle(),DownRate=tuning.GetProperty("down_rate").GetSingle(),
MaximumVerticalSpeed=tuning.GetProperty("maximum_vertical_speed").GetSingle()};
Check(root.GetProperty("cases").GetArrayLength()==14,"vertical reference count");
foreach(var sample in root.GetProperty("cases").EnumerateArray())
{
var name=sample.GetProperty("name").GetString();
var input=sample.GetProperty("input");var expected=sample.GetProperty("observed");
var state=new RocketVerticalState(input.GetProperty("height").GetSingle(),input.GetProperty("velocity").GetSingle(),input.GetProperty("command").GetSingle());
var steering=new RocketSteering(input.GetProperty("speed").GetSingle(),0,Up:input.GetProperty("up").GetBoolean(),Down:input.GetProperty("down").GetBoolean());
var actual=RocketFlight.StepVertical(state,steering,parameters,input.GetProperty("gravity").GetSingle());
Near(actual.State.Height,expected.GetProperty("height").GetSingle(),$"{name} height");
Near(actual.State.Velocity,expected.GetProperty("velocity").GetSingle(),$"{name} velocity");
Near(actual.State.CommandedAcceleration,expected.GetProperty("command").GetSingle(),$"{name} retained65C");
Near(actual.BodyAcceleration,expected.GetProperty("bodyacceleration").GetSingle(),$"{name} published acceleration");
//X/Z were preserved by the original suffix. This scalar component
//returns only Y and cannot overwrite the caller's X/Z vectors.
}
}
static void Invalid()
{
foreach(var dt in new[]{0f,-.1f,1,float.NaN,float.PositiveInfinity})
Reject(()=>Step(dt:dt));
Reject(()=>Step(float.NaN)); Reject(()=>Step(bank:float.PositiveInfinity));
Reject(()=>RocketFlight.StepKeyboardInput(default,default,false,.1f,Tuning() with{MaximumSpeed=0}));
Reject(()=>RocketFlight.StepKeyboardInput(default,default,false,.1f,Tuning() with{Deceleration=-1}));
Reject(()=>Vertical(height:float.NaN)); Reject(()=>Vertical(velocity:float.PositiveInfinity));
Reject(()=>Vertical(command:float.NaN)); Reject(()=>Vertical(speed:float.NaN));
Reject(()=>RocketFlight.StepVertical(default,default,Tuning(),float.NaN));
}
static void Near(float value,float expected,string message)
{
if(!float.IsFinite(value)||!float.IsFinite(expected)||MathF.Abs(value-expected)>.0002f)
throw new Exception($"{message}: {value} != {expected}");
}
static void Check(bool condition,string message) { if(!condition)throw new Exception(message); }
static void Reject(Action action)
{
try { action(); } catch(ArgumentOutOfRangeException) { return; }
throw new Exception("Expected invalid input rejection");
}
@@ -0,0 +1,381 @@
{
"scope": "Copied41A6C0 input prefix, synthetic mouse/support/Euler/audio, camera tail skipped",
"source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
"generator_sha256": "14cd616f8153fda668a52294ce78eba5d3f11d1c6a55ac5b377600c20700eae9",
"executable_sha256": "759350e214755fd5253034242be4453bb2ea3d205f997c56923f46cd9694d010",
"log_sha256": "1b4a35d24d0efc763d1fdc66dc22ba90dccfdb8688d5488fd84d5f3069d46bae",
"source_input_body_sha256": "4c68ae3cf48aecf266ef0a9e8ec81646bd4b774251aac4e38563765a51db2625",
"tuning": {
"acceleration": 400.0,
"deceleration": 1.0,
"maximum_speed": 1400.0,
"acceleration_lean": 20.0,
"deceleration_lean": -20.0
},
"cases": [
{
"name": "up_air",
"input": {
"speed": 0.0,
"bank": 0.0,
"keyboard": false,
"up": true,
"down": false,
"left": false,
"right": false,
"supported": false,
"dt": 0.01666666753590107
},
"observed": {
"speed": 400.0,
"bank": 0.0,
"keyboard": false,
"up": true,
"down": false,
"dest": [
20.0,
0.0,
-0.0
]
}
},
{
"name": "up_air_dt",
"input": {
"speed": 0.0,
"bank": 0.0,
"keyboard": false,
"up": true,
"down": false,
"left": false,
"right": false,
"supported": false,
"dt": 0.10000000149011612
},
"observed": {
"speed": 400.0,
"bank": 0.0,
"keyboard": false,
"up": true,
"down": false,
"dest": [
20.0,
0.0,
-0.0
]
}
},
{
"name": "up_supported",
"input": {
"speed": 0.0,
"bank": 0.0,
"keyboard": false,
"up": true,
"down": false,
"left": false,
"right": false,
"supported": true,
"dt": 0.01666666753590107
},
"observed": {
"speed": 391.666656,
"bank": 0.0,
"keyboard": false,
"up": true,
"down": false,
"dest": [
20.0,
0.0,
-0.0
]
}
},
{
"name": "up_down_air",
"input": {
"speed": 0.0,
"bank": 0.0,
"keyboard": false,
"up": true,
"down": true,
"left": false,
"right": false,
"supported": false,
"dt": 0.01666666753590107
},
"observed": {
"speed": 399.899994,
"bank": 0.0,
"keyboard": false,
"up": true,
"down": false,
"dest": [
20.0,
0.0,
-0.0
]
}
},
{
"name": "up_down_supported",
"input": {
"speed": 0.0,
"bank": 0.0,
"keyboard": false,
"up": true,
"down": true,
"left": false,
"right": false,
"supported": true,
"dt": 0.01666666753590107
},
"observed": {
"speed": 391.649994,
"bank": 0.0,
"keyboard": false,
"up": true,
"down": false,
"dest": [
20.0,
0.0,
-0.0
]
}
},
{
"name": "coast_high",
"input": {
"speed": 1400.0,
"bank": 0.0,
"keyboard": false,
"up": false,
"down": false,
"left": false,
"right": false,
"supported": false,
"dt": 0.01666666753590107
},
"observed": {
"speed": 1399.5,
"bank": 0.0,
"keyboard": false,
"up": false,
"down": false,
"dest": [
0.0,
0.0,
-0.0
]
}
},
{
"name": "coast_low",
"input": {
"speed": 1200.0,
"bank": 0.0,
"keyboard": false,
"up": false,
"down": false,
"left": false,
"right": false,
"supported": false,
"dt": 0.01666666753590107
},
"observed": {
"speed": 1200.0,
"bank": 0.0,
"keyboard": false,
"up": false,
"down": false,
"dest": [
0.0,
0.0,
-0.0
]
}
},
{
"name": "down_air",
"input": {
"speed": 1000.0,
"bank": 0.0,
"keyboard": false,
"up": false,
"down": true,
"left": false,
"right": false,
"supported": false,
"dt": 0.01666666753590107
},
"observed": {
"speed": 999.900024,
"bank": 0.0,
"keyboard": false,
"up": false,
"down": true,
"dest": [
-20.0,
0.0,
-0.0
]
}
},
{
"name": "down_supported",
"input": {
"speed": 1000.0,
"bank": 0.0,
"keyboard": false,
"up": false,
"down": true,
"left": false,
"right": false,
"supported": true,
"dt": 0.01666666753590107
},
"observed": {
"speed": 991.650024,
"bank": 0.0,
"keyboard": false,
"up": false,
"down": true,
"dest": [
-20.0,
0.0,
-0.0
]
}
},
{
"name": "left_precedence",
"input": {
"speed": 0.0,
"bank": 0.0,
"keyboard": false,
"up": false,
"down": false,
"left": true,
"right": true,
"supported": false,
"dt": 0.10000000149011612
},
"observed": {
"speed": 0.0,
"bank": 16.0,
"keyboard": true,
"up": false,
"down": false,
"dest": [
0.0,
0.0,
0.0
]
}
},
{
"name": "keyboard_recenter",
"input": {
"speed": 0.0,
"bank": 10.0,
"keyboard": true,
"up": false,
"down": false,
"left": false,
"right": false,
"supported": false,
"dt": 0.10000000149011612
},
"observed": {
"speed": 0.0,
"bank": 0.0,
"keyboard": true,
"up": false,
"down": false,
"dest": [
0.0,
0.0,
0.0
]
}
},
{
"name": "mouse_origin_hold",
"input": {
"speed": 0.0,
"bank": 10.0,
"keyboard": false,
"up": false,
"down": false,
"left": false,
"right": false,
"supported": false,
"dt": 0.10000000149011612
},
"observed": {
"speed": 0.0,
"bank": 10.0,
"keyboard": false,
"up": false,
"down": false,
"dest": [
0.0,
0.0,
0.0
]
}
},
{
"name": "bank_cap",
"input": {
"speed": 0.0,
"bank": 44.0,
"keyboard": true,
"up": false,
"down": false,
"left": true,
"right": false,
"supported": false,
"dt": 0.10000000149011612
},
"observed": {
"speed": 0.0,
"bank": 45.0,
"keyboard": true,
"up": false,
"down": false,
"dest": [
0.0,
0.0,
0.0
]
}
},
{
"name": "negative_down",
"input": {
"speed": -2.0,
"bank": 0.0,
"keyboard": false,
"up": false,
"down": true,
"left": false,
"right": false,
"supported": false,
"dt": 0.10000000149011612
},
"observed": {
"speed": -1.0,
"bank": 0.0,
"keyboard": false,
"up": false,
"down": true,
"dest": [
-20.0,
0.0,
-0.0
]
}
}
]
}
@@ -0,0 +1,329 @@
{
"scope": "Copied41A470..41A6A8 vertical publication, synthetic body getters/setters, no integration",
"source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
"generator_sha256": "07afdc2dad05fd659485bc670deac9f141fce87b7e938ab07f60648bb0fd8512",
"executable_sha256": "42fd409ca24e694f1c96e285a3de7f0af21f5a697605afb64e5874f575fd29da",
"log_sha256": "7b8d7079112826613ddc4fe115e7326a8a36c21444e9289bceda17743297b601",
"source_input_body_sha256": "20fc706986e58791dc19334a01a772dd517cbd260079382dac2f009fc8707bb7",
"tuning": {
"acceleration": 400.0,
"deceleration": 1.0,
"maximum_speed": 1400.0,
"acceleration_lean": 20.0,
"deceleration_lean": -20.0,
"maximum_height": 3900.0,
"up_rate": 650.0,
"down_rate": -650.0,
"maximum_vertical_speed": 650.0
},
"cases": [
{
"name": "low_speed_retained",
"input": {
"speed": 99.0,
"height": 5000.0,
"velocity": 900.0,
"command": 123.0,
"up": false,
"down": false,
"gravity": -800.0
},
"observed": {
"height": 5000.0,
"velocity": 650.0,
"command": 123.0,
"bodyacceleration": 923.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "up_below",
"input": {
"speed": 100.0,
"height": 100.0,
"velocity": 0.0,
"command": 0.0,
"up": true,
"down": false,
"gravity": -800.0
},
"observed": {
"height": 100.0,
"velocity": 0.0,
"command": 650.0,
"bodyacceleration": 1450.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "down_below",
"input": {
"speed": 100.0,
"height": 100.0,
"velocity": 0.0,
"command": 0.0,
"up": false,
"down": true,
"gravity": -800.0
},
"observed": {
"height": 100.0,
"velocity": 0.0,
"command": -650.0,
"bodyacceleration": 150.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "neutral_positive",
"input": {
"speed": 100.0,
"height": 100.0,
"velocity": 60.0,
"command": 0.0,
"up": false,
"down": false,
"gravity": -800.0
},
"observed": {
"height": 100.0,
"velocity": 60.0,
"command": -160.0,
"bodyacceleration": 640.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "neutral_negative",
"input": {
"speed": 100.0,
"height": 100.0,
"velocity": -60.0,
"command": 0.0,
"up": false,
"down": false,
"gravity": -800.0
},
"observed": {
"height": 100.0,
"velocity": -60.0,
"command": 160.0,
"bodyacceleration": 960.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "neutral_snap_positive",
"input": {
"speed": 100.0,
"height": 100.0,
"velocity": 59.9900016784668,
"command": 0.0,
"up": false,
"down": false,
"gravity": -800.0
},
"observed": {
"height": 100.0,
"velocity": 0.0,
"command": 0.0,
"bodyacceleration": 800.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "neutral_snap_negative",
"input": {
"speed": 100.0,
"height": 100.0,
"velocity": -59.9900016784668,
"command": 0.0,
"up": false,
"down": false,
"gravity": -800.0
},
"observed": {
"height": 100.0,
"velocity": 0.0,
"command": 0.0,
"bodyacceleration": 800.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "neutral_zero",
"input": {
"speed": 100.0,
"height": 100.0,
"velocity": 0.0,
"command": 99.0,
"up": false,
"down": false,
"gravity": -800.0
},
"observed": {
"height": 100.0,
"velocity": 0.0,
"command": 0.0,
"bodyacceleration": 800.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "ceiling_up",
"input": {
"speed": 100.0,
"height": 5000.0,
"velocity": 300.0,
"command": 0.0,
"up": true,
"down": false,
"gravity": -800.0
},
"observed": {
"height": 3900.0,
"velocity": 300.0,
"command": 0.0,
"bodyacceleration": 800.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "ceiling_down",
"input": {
"speed": 100.0,
"height": 5000.0,
"velocity": -900.0,
"command": 0.0,
"up": false,
"down": true,
"gravity": -800.0
},
"observed": {
"height": 3900.0,
"velocity": -650.0,
"command": -650.0,
"bodyacceleration": 150.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "velocity_cap_up",
"input": {
"speed": 100.0,
"height": 100.0,
"velocity": 900.0,
"command": 0.0,
"up": true,
"down": false,
"gravity": -800.0
},
"observed": {
"height": 100.0,
"velocity": 650.0,
"command": 650.0,
"bodyacceleration": 1450.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "velocity_cap_down",
"input": {
"speed": 100.0,
"height": 100.0,
"velocity": -900.0,
"command": 0.0,
"up": false,
"down": true,
"gravity": -800.0
},
"observed": {
"height": 100.0,
"velocity": -650.0,
"command": -650.0,
"bodyacceleration": 150.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "zero_gravity_up",
"input": {
"speed": 100.0,
"height": 100.0,
"velocity": 0.0,
"command": 0.0,
"up": true,
"down": false,
"gravity": 0.0
},
"observed": {
"height": 100.0,
"velocity": 0.0,
"command": 650.0,
"bodyacceleration": 650.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
},
{
"name": "low_speed_gravity",
"input": {
"speed": 0.0,
"height": 100.0,
"velocity": -10.0,
"command": -33.0,
"up": true,
"down": false,
"gravity": -800.0
},
"observed": {
"height": 100.0,
"velocity": -10.0,
"command": -33.0,
"bodyacceleration": 767.0,
"vx": 11.0,
"vz": 22.0,
"ax": 33.0,
"az": 44.0
}
}
]
}
+86
View File
@@ -0,0 +1,86 @@
"""Original-byte guards and bounded Grappler scalar references; no gameplay run."""
from pathlib import Path
import sys
import unittest
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'tools/binary'))
from grappler import (attach_scalars, collect, f32, fast_reel, held_reel,
jump_detaches, material_blocks_aim, swing_scalars)
class GrapplerSourceTests(unittest.TestCase):
def test_original_identity_dispatchers_and_constants(self):
report=collect(ROOT.parent/'Original')
self.assertEqual(len(report['bodies']),12)
self.assertEqual(len(report['constants']),16)
self.assertEqual(report['raw_mode'],7)
self.assertEqual(report['aim_local_point'],[0,2400,2400])
self.assertTrue(all(int(b['va'],16)-int(b['file_offset'],16)==0x400000
for b in report['bodies']))
def test_material_ranges_are_inclusive_and_have_real_holes(self):
for value in [60,69,80,89,210,219,-1,170]:
self.assertTrue(material_blocks_aim(value),value)
for value in [59,70,79,90,209,220,-2,0,111,169,171]:
self.assertFalse(material_blocks_aim(value),value)
def test_material_absence_is_not_equivalent_to_definition_absence(self):
self.assertTrue(material_blocks_aim(0,material_present=False))
self.assertFalse(material_blocks_aim(60,definition_present=False))
self.assertFalse(material_blocks_aim(60,polygon=False,material_present=False))
def test_attach_sets_vertical100_and_first_scale_from_distance_minus100(self):
result=attach_scalars((0,0,0),(0,300,400),(10,-200,20))
self.assertEqual(result.length,400.)
self.assertEqual(result.initial_length,400.)
self.assertEqual(result.scale_z,f32(400*f32(1/600)))
self.assertEqual(result.reel_target,100.)
self.assertEqual(result.velocity,(10,100,20))
def test_reattach_retains_first_scale_even_when_length_changes(self):
result=attach_scalars((0,0,0),(0,600,800),initial_length=400.)
self.assertEqual(result.length,900.)
self.assertEqual(result.initial_length,400.)
self.assertIsNone(result.scale_z)
def test_held_reel_can_undershoot250_and_stays_afterward(self):
length=held_reel(251.,.1)
self.assertEqual(length,226.)
self.assertEqual(held_reel(length,.1),226.)
self.assertEqual(held_reel(250.,.1),250.)
def test_fast_reel_can_undershoot_target(self):
self.assertEqual(fast_reel(251.,250.,.1),156.)
self.assertEqual(fast_reel(250.,250.,.1),250.)
def test_swing_acceleration_precedes_discrete_damping(self):
x,z,t=swing_scalars(10.,20.,0.,.1,100.,-200.,400.)
self.assertAlmostEqual(x,8.3,places=5)
self.assertAlmostEqual(z,23.4,places=5)
self.assertEqual(t,f32(.1))
def test_swing_350_boundary_and_clamp(self):
short=swing_scalars(100.,-100.,.2,0.,0.,0.,349.)
long=swing_scalars(100.,-100.,.2,0.,0.,0.,350.)
self.assertEqual(short[:2],(f32(50*f32(.95)),f32(-50*f32(.95))))
self.assertEqual(long[:2],(f32(50*f32(.98)),f32(-50*f32(.98))))
def test_long_tick_damps_only_once_and_retains_elapsed_remainder(self):
x,z,t=swing_scalars(50.,50.,0.,.6,0.,0.,400.)
self.assertEqual(x,f32(50*f32(.98)))
self.assertEqual(z,x)
self.assertAlmostEqual(t,.4,places=6)
def test_jump_release_requires_no_primary_fire(self):
self.assertTrue(jump_detaches(jump_held=True,fire_held=False,attached=True))
for values in [(True,True,True),(False,False,True),(True,False,False)]:
self.assertFalse(jump_detaches(jump_held=values[0],fire_held=values[1],attached=values[2]))
def test_nonfinite_and_negative_time_rejected_by_projection_boundary(self):
for function,args in [(held_reel,(300.,-.1)),(fast_reel,(300.,250.,float('nan')))]:
with self.assertRaises(ValueError):function(*args)
with self.assertRaises(ValueError):attach_scalars((0,0),(0,0,0))
if __name__=='__main__':unittest.main()
+49
View File
@@ -0,0 +1,49 @@
"""Original source identity/ABI guards and rejected component-capture ingestion."""
from pathlib import Path
import sys
import tempfile
import unittest
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT/'tools/binary'))
from rocketship import collect, probe_results
class RocketSourceTests(unittest.TestCase):
def test_original_spans_and_pointer_bases(self):
report = collect(ROOT.parent/'Original')
self.assertEqual(len(report['bodies']), 10)
self.assertEqual(len(report['vtables']), 6)
self.assertEqual(report['rider_pointer'], 'complete rocket+740 = game interface+680')
self.assertEqual(report['radius'], 50)
self.assertEqual(report['item'], report['raw_mode'])
self.assertTrue(all(int(b['va'], 16)-int(b['file_offset'], 16) == 0x400000
for b in report['bodies']))
self.assertTrue(any(v['table'] == '0x4cdd30' and v['slot'] == '0x134'
and v['target'] == '0x475cd0' for v in report['vtables']))
def test_changed_executable_is_rejected(self):
data = bytearray((ROOT.parent/'Original/Neutron.exe').read_bytes())
data[0x1a8dc] ^= 1
with tempfile.TemporaryDirectory() as temp:
path = Path(temp)/'Neutron.exe'
path.write_bytes(data)
with self.assertRaisesRegex(ValueError, 'identity'):
collect(Path(temp))
def test_missing_or_repeated_original_samples_are_rejected(self):
report = collect(ROOT.parent/'Original')
with tempfile.TemporaryDirectory() as temp:
log = Path(temp)/'wine.log'
executable = Path(temp)/'absent.exe'
log.write_text('CASE up_air speed=400\n')
with self.assertRaisesRegex(ValueError, 'Incomplete'):
probe_results(report, log, executable)
line = 'CASE up_air speed=400 bank=0 keyboard=0 up=1 down=0 dest=20,0,0\n'
log.write_text(line*2+'ROCKET_INPUT_COMPONENT_COMPLETE:\n')
with self.assertRaisesRegex(ValueError, 'repeated'):
probe_results(report, log, executable)
if __name__ == '__main__':
unittest.main()
+101
View File
@@ -0,0 +1,101 @@
from pathlib import Path
import hashlib
import json
import sys
import tempfile
import unittest
from unittest.mock import patch
ROOT = Path(__file__).resolve().parents[1]
ORIGINAL = ROOT.parent/'Original'
sys.path.insert(0, str(ROOT/'tools/extractors'))
from rocketship_resources import CLIPS, SOURCES, TEXTURES, export_rocketship
from ase import expand_mesh, read_ase
from entities import resolve_asset
from omt import FormatError
@unittest.skipUnless(ORIGINAL.exists(), 'Original assets are local integration fixtures')
class RocketshipResourceTests(unittest.TestCase):
def test_exact_original_pixels_and_authored_sampling(self):
with tempfile.TemporaryDirectory() as directory:
output = Path(directory)/'rocketship'
manifest = export_rocketship(ORIGINAL, output)
self.assertEqual(manifest, json.loads((output/'rocketship.json').read_text()))
self.assertEqual((manifest['schema'], manifest['sources']), (1, SOURCES))
expected_textures = {name: (width, height, sha) for name, width, height, sha in TEXTURES}
for entry, (stem, _, texture, vertices, faces, times) in zip(manifest['animations'], CLIPS):
animation = json.loads((output/entry['path']).read_text())
self.assertEqual([frame['time'] for frame in animation['frames']], list(times))
self.assertEqual((entry['indexedVertices'], entry['polygons']), (vertices, faces))
rgba = (output/stem/animation['texture']['path']).read_bytes()
self.assertEqual((animation['texture']['width'], animation['texture']['height'],
hashlib.sha256(rgba).hexdigest()), expected_textures[texture])
for frame in animation['frames']:
mesh = json.loads((output/stem/frame['path']).read_text())
self.assertEqual(len(mesh['vertices']), faces*3)
self.assertEqual(mesh['indices'], list(range(faces*3)))
def test_morphs_use_exact_base_uv_topology_and_sample_positions(self):
with tempfile.TemporaryDirectory() as directory:
output = Path(directory)/'rocketship'
export_rocketship(ORIGINAL, output)
for stem, base in (('jimdrive', 'jimstop'), ('godrocket', 'godpoint')):
source = read_ase(resolve_asset(ORIGINAL, f'ASE/{stem}.ASE'))
topology = read_ase(resolve_asset(ORIGINAL, f'ASE/{base}.ASE'))['objects'][0]['samples'][0]
self.assertFalse(source['objects'][0]['samples'][0]['textureFaces'])
manifest = json.loads((output/stem/'animation.json').read_text())
self.assertEqual(manifest['morphBase']['sha256'], SOURCES[f'ASE/{base}.ASE'])
for sample, frame in zip(source['objects'][0]['samples'], manifest['frames']):
expected = expand_mesh({**sample, 'faces': topology['faces'],
'textureFaces': topology['textureFaces'], 'uvs': topology['uvs']})
actual = json.loads((output/stem/frame['path']).read_text())
self.assertEqual(actual['vertices'], [list(p) for p in expected['vertices']])
self.assertEqual(actual['uvs'], [list(p) for p in expected['uvs']])
def test_vr02_preserves_source_offsets_duplicate_tags_and_null_polygons(self):
with tempfile.TemporaryDirectory() as directory:
manifest = export_rocketship(ORIGINAL, Path(directory)/'rocketship')
entities = manifest['tutorial']['entities']
self.assertEqual(len(entities), 18)
rocket = next(e for e in entities if e['kind'] == '3ROC')
self.assertEqual((rocket['ordinal'], rocket['offset']), (1, 0x1cd))
values = {p['name']: p['value'] for p in rocket['properties']}
self.assertEqual((values['MaxHeight'], values['MaxSpeed'], values['AccelRate'],
values['DecelRate'], values['NewGravity']), (3900, 1400, 400, 1, 0))
points = [e for e in entities if e['kind'] == '3PAT']
tags = [next(p['value'] for p in e['properties'] if p['name'] == 'ObjectTag') for e in points]
self.assertEqual(tags, ['rs1', 'rs1', 'rs2', 'rs3'])
self.assertEqual(manifest['staticGeometry']['materialPolygons'],
{'0': 160, '2': 96, '3': 192, '5': 400, 'null': 32})
def test_original_ancestors_and_descendant_symlinks_rejected(self):
for output in (ORIGINAL, ORIGINAL/'generated', ORIGINAL.parent):
with self.subTest(output=output), self.assertRaises(ValueError):
export_rocketship(ORIGINAL, output)
with tempfile.TemporaryDirectory() as directory:
output = Path(directory)/'rocketship'
output.mkdir()
target = Path(directory)/'unchanged'
target.write_bytes(b'unchanged')
(output/'strato.rgba').symlink_to(target)
with self.assertRaises(ValueError):
export_rocketship(ORIGINAL, output)
self.assertEqual(target.read_bytes(), b'unchanged')
def test_changed_source_and_bad_pixels_rejected_before_output(self):
with tempfile.TemporaryDirectory() as directory:
output = Path(directory)/'rocketship'
with patch('rocketship_resources.digest', return_value='0'*64), \
patch('rocketship_resources.read_ase') as decoder, self.assertRaises(FormatError):
export_rocketship(ORIGINAL, output)
decoder.assert_not_called()
self.assertFalse(output.exists())
with patch('rocketship_resources.read_png', return_value=dict(width=1, height=1, rgba=b'\0'*4)), \
self.assertRaises(FormatError):
export_rocketship(ORIGINAL, output)
self.assertFalse(output.exists())
if __name__ == '__main__':
unittest.main()
+188
View File
@@ -0,0 +1,188 @@
#!/usr/bin/env python3
"""Guarded Grappler evidence and isolated scalar projections, no target execution.
The projections omit ray traversal, Euler/table precision, body dispatch and
camera scheduling. They are not a live gadget or original-runtime oracle.
"""
from __future__ import annotations
import argparse
from dataclasses import dataclass
import hashlib
import json
import math
from pathlib import Path
import struct
from checkpoint_script_state import EXE_SHA256, find_case, read_va
from pe_inspect import PE
BODIES = (
('cursor_owner', 0x42255b, 0x4225a0, '86c2500c8105768c3568faacb4001b3713639806c68961e6af00411b4388789c'),
('rope_owner', 0x4227fc, 0x422831, '53178e76063eb6400f277b91a63a38ebd6d65f1e0e73af86bf5ca99e5f4b82d4'),
('constructor_globals', 0x422761, 0x4227be, 'e914d43a038f8f4e99996a58f9cb9041c691b6a412ef64ed2a7c7a0357d1a091'),
('update_gate', 0x426030, 0x4260a6, 'bf3bcca296c7fc5d3c7dd5e79bdd9311b5fcee7606842978346706dbdab9d1b7'),
('primary_order', 0x42668f, 0x4266e9, '7774c6cb2aa7d6784bb0c74490c6f67ac9b96c9724dca9f4f2856519103bf320'),
('fire_attach', 0x426a70, 0x426e35, 'b4f77baf95e5f3b2b9cb07c58b3fa771d064ac2720346e1e04c90bad7aea76ac'),
('cleanup', 0x4287ac, 0x42882f, 'e59ec9d7f88f250552ca090897899be125dbf4b3b6194106755646d7d4b689ca'),
('equip', 0x4297dd, 0x4298bf, '77ddf32d73f9b387f2d4375e4f7c16c893ae5452eef1f57fd24d4ff0b52e50a5'),
('detach', 0x429c10, 0x429cf7, 'aad9706ec19de0d162827fe957e91fb4a513423d6e6901de9a29e4c780f7df97'),
('swing', 0x429d00, 0x42a660, '9f4f17bafbca614ee64094df4d951c53cb122f8e15adb9fd7f8a58be589cc2f3'),
('collision', 0x42a660, 0x42a714, 'd52831057c35afbdb73babff81857a6a3cfb2466f639b8be0a80e6300d386b0c'),
('jump_predicate', 0x42a730, 0x42a7a0, '8a736de3111c9c803d0748e2d3a385fda2156894467a335a3e5e55df7fa046e2'),
)
CONSTANTS = (
(0x48d96c, 'f', 100.), (0x4a3e58, 'f', 250.),
(0x4a3e5c, 'f', 0.0016666667070239782),
(0x4a3e64, 'f', 0.9599999785423279),
(0x4a3e68, 'f', 450.), (0x4a3e6c, 'f', 0.20000000298023224),
(0x4a3e70, 'f', 0.9800000190734863),
(0x4a3e74, 'f', 0.949999988079071), (0x4a3e78, 'f', -50.),
(0x4a3e80, 'd', .17), (0x4a3e88, 'f', 950.),
(0x4a3e8c, 'f', 116.), (0x4a2ad0, 'd', .2),
(0x49fae4, 'f', 350.), (0x48d400, 'f', 50.),
(0x49d5b4, 'f', 60.),
)
def collect(original: Path | str):
pe = PE(find_case(Path(original), 'Neutron.exe'))
digest = hashlib.sha256(pe.data).hexdigest()
if digest != EXE_SHA256:
raise ValueError('Unexpected original EXE identity')
bodies = []
for name, start, end, expected in BODIES:
actual = hashlib.sha256(read_va(pe, start, end-start)).hexdigest()
if actual != expected:
raise ValueError(f'Changed source span {name}')
bodies.append(dict(name=name, va=hex(start), end_va=hex(end),
file_offset=hex(pe.offset(start-pe.base)), sha256=actual))
virtuals = ((0x188, 0x429d00), (0x1c0, 0x426a70), (0x204, 0x429c10))
for slot, expected in virtuals:
if struct.unpack('<I', read_va(pe, 0x4a3bdc+slot, 4))[0] != expected:
raise ValueError(f'Changed Jimmy virtual {slot:x}')
for va, fmt, value in CONSTANTS:
if struct.unpack('<'+fmt, read_va(pe, va, struct.calcsize(fmt)))[0] != value:
raise ValueError(f'Changed constant {va:x}')
for va, expected in ((0x4298e8+8*4, 0x4297dd), (0x428844+7*4, 0x4287ac)):
if struct.unpack('<I', read_va(pe, va, 4))[0] != expected:
raise ValueError('Changed Grappler dispatcher')
for va, value in ((0x4ef010, b'C3DGraplingHook'), (0x4ef03c, b'C3DTargetCursor'),
(0x4ef3e8, b'FALL'), (0x4ef6d8, b'SWING')):
if read_va(pe, va, len(value)+1) != value+b'\0':
raise ValueError(f'Changed source string {va:x}')
return dict(sha256=digest, bodies=bodies,
virtuals=[dict(table='0x4a3bdc', slot=hex(s), target=hex(t)) for s,t in virtuals],
constants=[dict(va=hex(a), format=f, value=v) for a,f,v in CONSTANTS],
item=7, raw_mode=7, practice='vr08.gam',
aim_local_point=[0,2400,2400], anchor_global='0x4f8214',
attached_global='0x4f8210', index_global='0x4f82cc',
model_scope='isolated scalar projections; no live or original-runtime claim')
def f32(value):
return struct.unpack('<f', struct.pack('<f', value))[0]
def finite(*values):
if not all(math.isfinite(v) for v in values):
raise ValueError('Finite inputs required')
def material_blocks_aim(material_id: int, *, polygon=True,
material_present=True, definition_present=True):
"""42A497..42A4E7 after successful ray and distance>=450.
Missing selected polygon passes this material check; present polygon without
material blocks. A present material without definition passes. This predicate
does not reproduce ray admission or the enclosing helper's return value.
"""
if not polygon:
return False
if not material_present:
return True
if not definition_present:
return False
return (60 <= material_id <= 69 or 80 <= material_id <= 89 or
210 <= material_id <= 219 or material_id in (-1, 170))
@dataclass(frozen=True)
class AttachmentScalars:
length: float
initial_length: float
scale_z: float | None
reel_target: float
velocity: tuple[float, float, float]
def attach_scalars(root, hit, velocity=(0.,0.,0.), *, initial_length=0.):
"""426BE8..426D85 accepted hit; no clamping or negative-length repair.
Host sqrt and explicit float stores are a bounded arithmetic projection,
not a bit-exact x87 execution oracle. Initial scale is assigned only when
global4F82B4 is zero; unequip/detach do not clear that global.
"""
if len(root) != 3 or len(hit) != 3 or len(velocity) != 3:
raise ValueError('Three-vectors required')
finite(*root, *hit, *velocity, initial_length)
length = f32(math.sqrt(sum((a-b)**2 for a,b in zip(hit,root)))-100.)
scale = f32(length*f32(1/600)) if initial_length == 0. else None
return AttachmentScalars(length, length if initial_length == 0. else initial_length,
scale, f32(hit[1]-root[1]-200.),
(velocity[0],100.,velocity[2]))
def held_reel(length, dt):
"""426DAC..426DFD: strict old length>250, no final minimum clamp."""
finite(length, dt)
if dt < 0:
raise ValueError('Nonnegative dt required')
return f32(length-dt*250.) if length > 250. else length
def fast_reel(length, target, dt):
"""429DCB..429DE8: target<length, no final target clamp."""
finite(length, target, dt)
if dt < 0:
raise ValueError('Nonnegative dt required')
return f32(length-dt*950.) if target < length else length
def swing_scalars(x, z, timer, dt, rope_offset_x, rope_offset_z, length):
"""42A077..42A198 after body dispatch, no position/collision emulation.
Accumulate elapsed dt; subtract constrained rope offset*dt*.17; at elapsed>=double .2,
clamp50, multiply .95/.98, then subtract float .2 ONCE (not a loop).
"""
finite(x,z,timer,dt,rope_offset_x,rope_offset_z,length)
if dt < 0:
raise ValueError('Nonnegative dt required')
timer = f32(timer+dt)
x = f32(x-rope_offset_x*dt*.17)
z = f32(z-rope_offset_z*dt*.17)
if timer >= .2:
gain = f32(.95 if length < 350. else .98)
x = f32(max(-50., min(50., x))*gain)
z = f32(max(-50., min(50., z))*gain)
timer = f32(timer-f32(.2))
return x,z,timer
def jump_detaches(*, jump_held, fire_held, attached):
"""429DF9..429E2C uses independent jump/fire predicates."""
return bool(jump_held and attached and not fire_held)
if __name__ == '__main__':
cli = argparse.ArgumentParser(description=__doc__)
cli.add_argument('original', type=Path)
cli.add_argument('--output', type=Path)
args = cli.parse_args()
result = json.dumps(collect(args.original), indent=2)+'\n'
if args.output:
args.output.parent.mkdir(parents=True, exist_ok=True)
args.output.write_text(result)
else:
print(result, end='')
+311
View File
@@ -0,0 +1,311 @@
#!/usr/bin/env python3
"""Read-only Rocketship contracts and isolated input/vertical probe generators.
The input probe executes copied41A6C0 only through41AC0E, with synthetic
mouse/support/transform/audio dependencies. The vertical probe executes only
41A470..41A6A8 with synthetic body accessors. Neither runs the original game.
"""
from __future__ import annotations
import argparse
import hashlib
import json
import math
from pathlib import Path
import re
import struct
from checkpoint_script_state import EXE_SHA256, find_case, read_va
from pe_inspect import PE
BODIES = (
('ctor', 0x43d840, 0x43da40, '33d27053c2070f0c278bf3e14808d16c4479893d1ccb16c1ac8e199dfd9e53ba'),
('init', 0x43dd10, 0x43dd92, 'cd6e843749b7c87db7df223fd98f5f16c5b01b7097c0b0d4a661dd28eb1bd494'),
('flying_ctor', 0x419b70, 0x419db0, '85c0e74764282ed55e2c7268a0dec5944097b16f1a9df71054e5458b446ee2c0'),
('flight_apply', 0x41a140, 0x41a6b1, '20fc706986e58791dc19334a01a772dd517cbd260079382dac2f009fc8707bb7'),
('flight_input', 0x41a6c0, 0x41ade1, '4c68ae3cf48aecf266ef0a9e8ec81646bd4b774251aac4e38563765a51db2625'),
('rocket_input', 0x43e7e0, 0x43e854, 'db973aebd9dad23de493d79606b3016e3e04c7ba029452ee07a6fd6e9abfd5b9'),
('mount', 0x42944d, 0x429686, '2e8e15c52bf02a06afe2a56ccf8b31551368aefcde046c444ddb01a3ef978c70'),
('cleanup', 0x428512, 0x42871d, 'e35f82a6b4e791e77278cdf84bc3878237d57c54355254cfbeff3923d2c70ee6'),
('vr02_ctor', 0x456270, 0x456360, '058e77e27d8dbb2de5306c0582ccc1c7caf81cf29ae64caa43d3d1cd174b63c8'),
('fire_ctor', 0x4192e0, 0x41944c, 'e66ca12f68c3fc87bd855d0865871d387627684e31429460b84139f28e77afdb'),
)
VTABLES = ((0x4b25ac, 0x110, 0x471240), (0x4b25ac, 0x264, 0x471b40),
(0x4b25ac, 0x3c4, 0x43df70), (0x4b25ac, 0x3cc, 0x43e7e0),
(0x4b2a4c, 0x128, 0x43ea80), (0x4cdd30, 0x134, 0x475cd0))
CONSTANTS = ((0x49d5b0, -60.), (0x49d5b4, 60.), (0x49d5b8, 0.0181818176060915),
(0x49d5d4, 0.10000000149011612), (0x49d5dc, 0.9090909361839294),
(0x49d5e4, 160.), (0x49b1fc, 130.), (0x48e5bc, 500.))
PROBE_GLOBALS = (0x509a50, 0x50985d, 0x50985f, 0x509aa0, 0x509aa4,
0x48d914, 0x48d948, 0x48d94c, 0x49b1fc, 0x49d5e4,
0x509882, 0x509881, 0x509885, 0x509891, 0x509848,
0x50985e, 0x509834, 0x49d5e0, 0x49d5dc, 0x48e5bc,
0x509860, 0x50993a, 0x49d5d8, 0x49d5d4, 0x48e5ec,
0x495324, 0x49d5d0, 0x49d5cc, 0x49d5c8)
VERTICAL_GLOBALS = (0x48d96c, 0x48d914, 0x49d5b4, 0x49d5b0, 0x5cfc04)
def collect(original: Path | str):
pe = PE(find_case(Path(original), 'Neutron.exe'))
if hashlib.sha256(pe.data).hexdigest() != EXE_SHA256:
raise ValueError('Unexpected original EXE identity')
bodies = []
for name, start, end, expected in BODIES:
digest = hashlib.sha256(read_va(pe, start, end-start)).hexdigest()
if digest != expected:
raise ValueError(f'Changed source span {name}')
bodies.append(dict(name=name, va=hex(start), file_offset=hex(pe.offset(start-pe.base)),
length=end-start, sha256=digest))
for table, slot, target in VTABLES:
if struct.unpack('<I', read_va(pe, table+slot, 4))[0] != target:
raise ValueError(f'Changed virtual {table:x}+{slot:x}')
for va, value in CONSTANTS:
if struct.unpack('<f', read_va(pe, va, 4))[0] != value:
raise ValueError(f'Changed constant {va:x}')
def operands(start, end, targets):
result = []
code = read_va(pe, start, end-start)
for target in targets:
encoded = struct.pack('<I', target)
for i in range(len(code)-3):
if code[i:i+4] == encoded:
result.append(dict(va=start+i, target=target))
return sorted(result, key=lambda r:r['va'])
return dict(sha256=EXE_SHA256, bodies=bodies,
probe_operands=operands(0x41a6c0, 0x41ac0e, PROBE_GLOBALS),
vertical_operands=operands(0x41a470, 0x41a6a8, VERTICAL_GLOBALS),
vtables=[dict(table=hex(t), slot=hex(s), target=hex(v)) for t,s,v in VTABLES],
constants=[dict(va=hex(a), value=v) for a,v in CONSTANTS],
item=1, raw_mode=1, owned_pointer='complete Jimmy+AB0',
rider_pointer='complete rocket+740 = game interface+680', radius=50.,
factor=0.6000000238418579, friction=0.800000011920929,
scope='Static recovery and isolated input/vertical probes; no live vehicle fidelity claim')
def probe_source(report, *, vertical=False):
operands = report['probe_operands'] + (report['vertical_operands'] if vertical else [])
relocations = ',\n'.join(f'{{0x{r["va"]:x},0x{r["target"]:x}}}' for r in operands)
return (VERTICAL_PROBE if vertical else PROBE).replace('/* RELOCATIONS */', relocations)
def probe_results(report, log: Path, executable: Path, *, vertical=False):
"""Pair observed copied-source outputs with the generator's literal cases."""
content = log.read_text()
marker = 'ROCKET_VERTICAL_COMPONENT_COMPLETE:' if vertical else 'ROCKET_INPUT_COMPONENT_COMPLETE:'
if marker not in content:
raise ValueError('Incomplete original input probe')
names = ('speed', 'height', 'velocity', 'command', 'up', 'down', 'gravity') if vertical else (
'speed', 'bank', 'keyboard', 'up', 'down', 'left', 'right', 'supported', 'dt')
literal = VERTICAL_PROBE if vertical else PROBE
cases = []
for name, values in re.findall(r'run(?:_vertical)?\("(\w+)",([^;]+)\);', literal):
def number(value):
value = value.strip()
parsed = 1/60 if value == '1.f/60' else float(value.removesuffix('f'))
return struct.unpack('<f', struct.pack('<f', parsed))[0]
inputs = dict(zip(names, map(number, values.split(',')), strict=True))
for key in ('keyboard', 'up', 'down', 'left', 'right', 'supported'):
if key in inputs:
inputs[key] = bool(inputs[key])
lines = re.findall(rf'^CASE {re.escape(name)} (.+)$', content, re.MULTILINE)
if len(lines) != 1:
raise ValueError(f'Missing or repeated original case {name}')
output = {}
for entry in lines[0].split():
key, value = entry.split('=', 1)
output[key] = [float(v) for v in value.split(',')] if ',' in value else float(value)
expected = {'height', 'velocity', 'command', 'bodyacceleration', 'vx', 'vz', 'ax', 'az'} if vertical else {
'speed', 'bank', 'keyboard', 'up', 'down', 'dest'}
if set(output) != expected:
raise ValueError(f'Unexpected original output fields {name}')
if not all(math.isfinite(v) for value in output.values()
for v in (value if isinstance(value, list) else [value])):
raise ValueError('Nonfinite original output')
for key in ('keyboard', 'up', 'down'):
if key in output:
output[key] = bool(output[key])
cases.append(dict(name=name, input=inputs, observed=output))
if len(cases) != 14 or len(re.findall(r'^CASE ', content, re.MULTILINE)) != len(cases):
raise ValueError('Unexpected original input case inventory')
return dict(scope=('Copied41A470..41A6A8 vertical publication, synthetic body getters/setters, no integration' if vertical else
'Copied41A6C0 input prefix, synthetic mouse/support/Euler/audio, camera tail skipped'),
source_sha256=report['sha256'], generator_sha256=hashlib.sha256(probe_source(report, vertical=vertical).encode()).hexdigest(),
executable_sha256=hashlib.sha256(executable.read_bytes()).hexdigest(),
log_sha256=hashlib.sha256(log.read_bytes()).hexdigest(),
source_input_body_sha256=next(b['sha256'] for b in report['bodies'] if b['name'] == ('flight_apply' if vertical else 'flight_input')),
tuning=dict(acceleration=400., deceleration=1., maximum_speed=1400.,
acceleration_lean=20., deceleration_lean=-20., maximum_height=3900.,
up_rate=650., down_rate=-650., maximum_vertical_speed=650.), cases=cases)
PROBE = r'''/* Generated isolated copied41A6C0 input prefix. No game entrypoint/import init.
* Mouse, support, Euler and audio are synthetic; camera tail is not executed. */
#include <windows.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TC __attribute__((thiscall))
static unsigned char *mapped,object[0x1000],camera[0x100];
static uintptr_t table[0x400/4],outer[0x200/4];
static int grounded;
static short mouse_x,mouse_y;
static float euler[4],destination[3];
#define AT(va) (mapped+(va)-0x400000)
#define F(g,off) (*(float*)((g)+(off)))
static void require(int condition,const char*message){if(!condition){fprintf(stderr,"FAIL %s\n",message);exit(2);}}
static void __cdecl mouse(short*x,short*y){*x=mouse_x;*y=mouse_y;}
static int TC supported(void*self){(void)self;return grounded;}
static float* TC rotation(void*self,float*out){(void)self;memcpy(out,euler,sizeof(euler));return out;}
static void TC desired(void*self,float x,float y,float z){(void)self;destination[0]=x;destination[1]=y;destination[2]=z;}
static void TC sound(void*self,int mode){(void)self;(void)mode;}
static void TC missing(void*self){(void)self;require(0,"unexpected virtual");}
static const struct{uint32_t va,target;} relocations[]={
/* RELOCATIONS */
};
static void map_copy(void){
mapped=VirtualAlloc(NULL,0x299000,MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE);
require(mapped!=NULL,"map copied source");
FILE*f=fopen("Neutron.exe","rb");require(f!=NULL,"copied EXE");
fseek(f,0,SEEK_END);long size=ftell(f);rewind(f);require(size==1019904,"bounded EXE size");
unsigned char*data=malloc(size);require(data!=NULL,"file buffer");
require(fread(data,1,size,f)==(size_t)size,"read source");fclose(f);
require(*(uint16_t*)data==IMAGE_DOS_SIGNATURE,"DOS header");
uint32_t offset=*(uint32_t*)(data+0x3c);require(offset<(uint32_t)size-sizeof(IMAGE_NT_HEADERS32),"NT bounds");
IMAGE_NT_HEADERS32*nt=(void*)(data+offset);
require(nt->Signature==IMAGE_NT_SIGNATURE&&nt->FileHeader.Machine==IMAGE_FILE_MACHINE_I386&&nt->OptionalHeader.ImageBase==0x400000&&nt->OptionalHeader.SizeOfImage==0x299000,"PE identity");
IMAGE_SECTION_HEADER*sections=IMAGE_FIRST_SECTION(nt);
require((unsigned char*)(sections+nt->FileHeader.NumberOfSections)<=data+size,"section table");
for(unsigned i=0;i<nt->FileHeader.NumberOfSections;i++){
IMAGE_SECTION_HEADER*s=&sections[i];
require((uint64_t)s->PointerToRawData+s->SizeOfRawData<=(uint64_t)size&&(uint64_t)s->VirtualAddress+s->SizeOfRawData<=0x299000,"section bounds");
memcpy(mapped+s->VirtualAddress,data+s->PointerToRawData,s->SizeOfRawData);
}
free(data);
for(unsigned i=0;i<sizeof(relocations)/sizeof(relocations[0]);i++){
uint32_t*operand=(void*)AT(relocations[i].va);require(*operand==relocations[i].target,"relocation guard");
*operand=(uint32_t)AT(relocations[i].target);
}
/* Stub the mouse API dependency and replace ONLY the unobserved camera tail.
* Full original numeric input prefix and its support/transform calls remain. */
unsigned char*stub=AT(0x46a460);stub[0]=0xb8;*(uint32_t*)(stub+1)=(uint32_t)mouse;stub[5]=0xff;stub[6]=0xe0;
const unsigned char finish[]={0x5f,0x5e,0x5b,0x83,0xc4,0x68,0xc2,0x04,0x00};
memcpy(AT(0x41ac0e),finish,sizeof(finish));
*(void**)AT(0x509a50)=camera;
for(unsigned i=0;i<sizeof(table)/sizeof(table[0]);i++)table[i]=(uintptr_t)missing;
for(unsigned i=0;i<sizeof(outer)/sizeof(outer[0]);i++)outer[i]=(uintptr_t)missing;
table[0x218/4]=(uintptr_t)supported;table[0x328/4]=(uintptr_t)rotation;
table[0x36c/4]=(uintptr_t)desired;outer[0x128/4]=(uintptr_t)sound;
}
static void run(const char*name,float speed,float lean,int prior_keyboard,int up,int down,int left,int right,int support,float dt){
memset(object,0,sizeof(object));unsigned char*g=object+0xc0;*(uintptr_t**)object=outer;*(uintptr_t**)g=table;
memset(AT(0x509830),0,0x1d0);*(void**)AT(0x509a50)=camera;
*(unsigned char*)AT(0x50985e)=up;*(unsigned char*)AT(0x509860)=down;
*(unsigned char*)AT(0x50985d)=left;*(unsigned char*)AT(0x50985f)=right;grounded=support;
F(g,0x5fc)=400;F(g,0x600)=1;F(g,0x604)=1400;F(g,0x608)=speed;F(g,0x614)=lean;g[0x63a]=prior_keyboard;
F(g,0x660)=20;F(g,0x664)=-20;mouse_x=mouse_y=0;
((void(TC*)(void*,float))AT(0x41a6c0))(g,dt);
printf("CASE %s speed=%.9g bank=%.9g keyboard=%d up=%d down=%d dest=%.9g,%.9g,%.9g\n",name,F(g,0x608),F(g,0x614),g[0x63a],g[0x638],g[0x639],destination[0],destination[1],destination[2]);
}
int main(void){
setbuf(stdout,NULL);map_copy();
run("up_air",0,0,0,1,0,0,0,0,1.f/60);
run("up_air_dt",0,0,0,1,0,0,0,0,.1f);
run("up_supported",0,0,0,1,0,0,0,1,1.f/60);
run("up_down_air",0,0,0,1,1,0,0,0,1.f/60);
run("up_down_supported",0,0,0,1,1,0,0,1,1.f/60);
run("coast_high",1400,0,0,0,0,0,0,0,1.f/60);
run("coast_low",1200,0,0,0,0,0,0,0,1.f/60);
run("down_air",1000,0,0,0,1,0,0,0,1.f/60);
run("down_supported",1000,0,0,0,1,0,0,1,1.f/60);
run("left_precedence",0,0,0,0,0,1,1,0,.1f);
run("keyboard_recenter",0,10,1,0,0,0,0,0,.1f);
run("mouse_origin_hold",0,10,0,0,0,0,0,0,.1f);
run("bank_cap",0,44,1,0,0,1,0,0,.1f);
run("negative_down",-2,0,0,0,1,0,0,0,.1f);
puts("ROCKET_INPUT_COMPONENT_COMPLETE: copied41A6C0 prefix; synthetic dependencies, no camera/game runtime");return 0;
}
'''
VERTICAL_PROBE = PROBE[:PROBE.index('static void run(')] + r'''
/* Source entry41A470 expects the41A140 frame and saved callee registers.
* This thunk builds that frame and jumps into the unchanged vertical suffix;
* original epilogue restores it. Horizontal/animated prefixes do not execute. */
typedef struct{float x,y,z,w;} Vec;
static Vec root,velocity,acceleration;
static Vec* TC root_get(void*self,Vec*out){(void)self;*out=root;return out;}
static Vec* TC velocity_get(void*self,Vec*out){(void)self;*out=velocity;return out;}
static Vec* TC acceleration_get(void*self,Vec*out){(void)self;*out=acceleration;return out;}
static void TC root_xyz(void*self,float x,float y,float z){(void)self;root.x=x;root.y=y;root.z=z;}
static void TC velocity_xyz(void*self,float x,float y,float z){(void)self;velocity.x=x;velocity.y=y;velocity.z=z;}
static void TC acceleration_xyz(void*self,float x,float y,float z){(void)self;acceleration.x=x;acceleration.y=y;acceleration.z=z;}
static void TC velocity_set(void*self,Vec value){(void)self;velocity=value;}
static unsigned char*thunk;
static void setup_vertical(void){
table[0x310/4]=(uintptr_t)root_get;table[0x318/4]=(uintptr_t)root_xyz;
table[0x2bc/4]=(uintptr_t)velocity_get;table[0x2c0/4]=(uintptr_t)velocity_set;
table[0x2c4/4]=(uintptr_t)velocity_xyz;table[0x270/4]=(uintptr_t)acceleration_get;
table[0x278/4]=(uintptr_t)acceleration_xyz;
const unsigned char code[]={0x83,0xec,0x38,0x53,0x56,0x57,0x8b,0xf1,0x33,0xdb,0xe9,0,0,0,0};
thunk=VirtualAlloc(NULL,sizeof(code),MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE);
require(thunk!=NULL,"vertical thunk");memcpy(thunk,code,sizeof(code));
*(int32_t*)(thunk+11)=(int32_t)(AT(0x41a470)-(thunk+15));
}
static void run_vertical(const char*name,float speed,float height,float vy,float command,int up,int down,float gravity){
memset(object,0,sizeof(object));unsigned char*g=object+0xc0;*(uintptr_t**)g=table;
root=(Vec){1,height,2,1};velocity=(Vec){11,vy,22,0};acceleration=(Vec){33,55,44,0};
F(g,0x608)=speed;F(g,0x620)=3900;F(g,0x624)=650;F(g,0x628)=-650;F(g,0x62c)=650;
F(g,0x65c)=command;g[0x638]=up;g[0x639]=down;*(float*)AT(0x5cfc04)=gravity;
((void(TC*)(void*,float))thunk)(g,1.f/60);
printf("CASE %s height=%.9g velocity=%.9g command=%.9g bodyacceleration=%.9g vx=%.9g vz=%.9g ax=%.9g az=%.9g\n",name,root.y,velocity.y,F(g,0x65c),acceleration.y,velocity.x,velocity.z,acceleration.x,acceleration.z);
}
int main(void){
setbuf(stdout,NULL);map_copy();setup_vertical();
run_vertical("low_speed_retained",99,5000,900,123,0,0,-800);
run_vertical("up_below",100,100,0,0,1,0,-800);
run_vertical("down_below",100,100,0,0,0,1,-800);
run_vertical("neutral_positive",100,100,60,0,0,0,-800);
run_vertical("neutral_negative",100,100,-60,0,0,0,-800);
run_vertical("neutral_snap_positive",100,100,59.99f,0,0,0,-800);
run_vertical("neutral_snap_negative",100,100,-59.99f,0,0,0,-800);
run_vertical("neutral_zero",100,100,0,99,0,0,-800);
run_vertical("ceiling_up",100,5000,300,0,1,0,-800);
run_vertical("ceiling_down",100,5000,-900,0,0,1,-800);
run_vertical("velocity_cap_up",100,100,900,0,1,0,-800);
run_vertical("velocity_cap_down",100,100,-900,0,0,1,-800);
run_vertical("zero_gravity_up",100,100,0,0,1,0,0);
run_vertical("low_speed_gravity",0,100,-10,-33,1,0,-800);
puts("ROCKET_VERTICAL_COMPONENT_COMPLETE: copied41A470 suffix; synthetic body, no integration/game runtime");return 0;
}
'''
if __name__ == '__main__':
cli = argparse.ArgumentParser(description=__doc__)
cli.add_argument('original', type=Path)
cli.add_argument('--probe-source', type=Path)
cli.add_argument('--probe-log', type=Path)
cli.add_argument('--probe-executable', type=Path)
cli.add_argument('--vertical-probe-source', type=Path)
cli.add_argument('--vertical-probe-log', type=Path)
cli.add_argument('--vertical-probe-executable', type=Path)
args = cli.parse_args()
report = collect(args.original)
if bool(args.probe_log) != bool(args.probe_executable):
cli.error('Use --probe-log and --probe-executable together')
if args.probe_source:
output = args.probe_source.resolve()
if output.is_relative_to(args.original.resolve()):
cli.error('Probe source must be generated outside originals')
output.write_text(probe_source(report))
if args.probe_log:
report['original_input_probe'] = probe_results(report, args.probe_log, args.probe_executable)
if args.vertical_probe_source:
output = args.vertical_probe_source.resolve()
if output.is_relative_to(args.original.resolve()):
cli.error('Probe source must be generated outside originals')
output.write_text(probe_source(report, vertical=True))
if bool(args.vertical_probe_log) != bool(args.vertical_probe_executable):
cli.error('Use --vertical-probe-log and --vertical-probe-executable together')
if args.vertical_probe_log:
report['original_vertical_probe'] = probe_results(report, args.vertical_probe_log,
args.vertical_probe_executable, vertical=True)
print(json.dumps(report, indent=2))
+141
View File
@@ -0,0 +1,141 @@
#!/usr/bin/env python3
"""Export original Rocketship geometry and compatible morph resources, unchanged.
Resource compatibility does not establish runtime attachments, material flags,
animation timing or collision registration. Those belong to binary recovery.
"""
from __future__ import annotations
import argparse
from collections import Counter
from dataclasses import asdict
import hashlib
import json
from pathlib import Path
from ase import export_ase, read_ase
from entities import resolve_asset
from gam import parse
from omt import Database, FormatError, read_shape
from png import read_png
SOURCES = {
'ASE/strato.ASE': '80f7f25783b49243ff52048807b11949a1f8700da99ad1d6d434ab74277fc804',
'ASE/firestrato.ASE': '40a5e88dfb02bc230b3467c3a084eb7121c5262c9a9ec0d821543bdad2b607d3',
'ASE/jimdrive.ASE': '0b70a66fc8a75ce6ef96b9eb3ce46121ae98c5d8ca086556120979e4f811eff3',
'ASE/jimstop.ASE': 'b294d090ac5c4ec449d845db6d837f2cbedf5f7b812f5b6ed2bb70f85246f1d0',
'ASE/godrocket.ASE': 'd3787715d40fa03e2d746a7c3be04c4f4e053a8581495814e5017e4b0244cce0',
'ASE/godpoint.ASE': 'd8db5fc8929531fd0e60f4125f016bc75bbbd637c5bdc44b8d0d20a8729e653b',
'png/strato.png': '850756970c646431c1b3f0c2da1bb7eddd74c0673b51b0624c1822cee4a8e690',
'png/fire.png': 'ca98cb03feef6b6cf4266895ec26fbc8372f1cf60c342ee1316b17f668311f16',
'png/jimycarl.png': '55ed165aaffe177cb62558a08d13fc3b2210da6e353065b108849d46df9dacb6',
'png/goddard02.png': '4c89f34aa5dc2ae72b64c1efd76695fd56a7cef7ee850a5958f9b38b92ac9e9b',
'gam/VR02.gam': '3be92e270bd14e6fc41db702e68c894562128d23d46704b89f7abb1914bebc5c',
'omt/VR02.omt': 'ab041f663cd5e68d58e590feeb7661f308a70ccc682a32c49ccd82b74bec61c0',
}
# Stem, original textured base, explicit texture candidate, indexed count,
# polygon count and exact source samples. Caller owns gameplay/action binding.
CLIPS = (
('strato', None, 'strato', 159, 262, (0,)),
('firestrato', None, 'fire', 7, 6, (0, 480, 960)),
('jimdrive', 'jimstop', 'jimycarl', 426, 814, (0, 480)),
('godrocket', 'godpoint', 'goddard02', 222, 411, (0, 960, 1920)),
)
TEXTURES = (
('strato', 256, 256, 'b1b18454fe0413e3ce885a61e4407c808060da0fe29ef2aec26ccd4e39437f31'),
('fire', 100, 100, '07dbbc4c6b99b6fa5fe424f2f917e03352a9c635fdc1593fc12f354be83a9a7f'),
('jimycarl', 256, 256, '5e54ccb99e9e060843cd7f80fd93ff8bf47f8779666e41d4240398354a278a3f'),
('goddard02', 256, 256, '9eb24c8fa41ddf08d2f33dd7b7513b632d4262cfc26cab3383c54258b9647a62'),
)
def digest(data: bytes) -> str:
return hashlib.sha256(data).hexdigest()
def _json(path: Path, value):
path.write_text(json.dumps(value, separators=(',', ':'), allow_nan=False)+'\n', encoding='utf-8')
def export_rocketship(original: Path, output: Path) -> dict:
original, output = original.resolve(), output.resolve()
if output.is_relative_to(original) or original.is_relative_to(output):
raise ValueError('Output must be separate from the original installation')
if output.exists() and any(p.is_symlink() for p in output.rglob('*')):
raise ValueError('Generated Rocketship paths must not contain symlinks')
paths = {name: resolve_asset(original, name) for name in SOURCES}
for name, path in paths.items():
if digest(path.read_bytes()) != SOURCES[name]:
raise FormatError(f'Unexpected original Rocketship source identity: {name}')
animations = {name: read_ase(path) for name, path in paths.items() if name.startswith('ASE/')}
for stem, base, _, vertices, faces, times in CLIPS:
animation = animations[f'ASE/{stem}.ASE']
if len(animation['objects']) != 1:
raise FormatError('Unexpected Rocketship animation object count')
samples = animation['objects'][0]['samples']
if tuple(s['time'] for s in samples) != times or any(
(len(s['vertices']), len(s['faces'])) != (vertices, faces) for s in samples):
raise FormatError('Unexpected Rocketship source mesh or sample times')
topology = animations[f'ASE/{base}.ASE']['objects'][0]['samples'][0] if base else samples[0]
if len(topology['vertices']) != vertices or not topology['textureFaces']:
raise FormatError('Rocketship morph base lacks compatible textured topology')
textures, rgba_pixels = {}, {}
for stem, width, height, rgba_sha in TEXTURES:
decoded = read_png(paths[f'png/{stem}.png'])
rgba = decoded.pop('rgba')
if (decoded['width'], decoded['height'], len(rgba), digest(rgba)) != (
width, height, width*height*4, rgba_sha):
raise FormatError('Unexpected Rocketship decoded pixels')
textures[stem] = dict(path=f'../{stem}.rgba', source=paths[f'png/{stem}.png'].name,
sourceSha256=SOURCES[f'png/{stem}.png'], rgbaSha256=rgba_sha, **decoded)
rgba_pixels[stem] = rgba
level = parse(paths['gam/VR02.gam'].read_bytes())
entities = [dict(ordinal=index, **asdict(entity)) for index, entity in enumerate(level.entities)]
rockets = [e for e in entities if e['kind'] == '3ROC']
if len(entities) != 18 or len(rockets) != 1 or rockets[0]['offset'] != 0x1cd:
raise FormatError('Unexpected VR02 authored Rocketship identity')
database = Database(paths['omt/VR02.omt'])
shape_entries = [entry for entry in database.entries if entry.type == '3DSh']
if len(shape_entries) != 1:
raise FormatError('Unexpected VR02 static shape set')
entry = shape_entries[0]
shape = read_shape(database.payload(entry))
if (entry.id, entry.name, entry.offset, entry.size, len(shape['vertices']), len(shape['polygons'])) != (
0, 'Box01', 74464, 93802, 424, 880):
raise FormatError('Unexpected VR02 static mesh metadata')
material_counts = Counter(str(p['material']['id']) if p['material'] else 'null' for p in shape['polygons'])
static = dict(source='VR02.omt', sha256=SOURCES['omt/VR02.omt'], shapeId=entry.id,
shapeName=entry.name, sourceOffset=entry.offset, sourceBytes=entry.size,
indexedVertices=424, polygons=880, materialPolygons=dict(sorted(material_counts.items())),
registrationPolicy='Asset inventory only; game-class filter and actor body admission require source proof')
manifest = dict(schema=1, sources=SOURCES.copy(), animations=[],
tutorial=dict(source='VR02.gam', sha256=SOURCES['gam/VR02.gam'], entities=entities),
staticGeometry=static,
bindingPolicy='Original resource data; caller owns verified action selection, attachment, transforms, material flags and timing')
output.mkdir(parents=True, exist_ok=True)
for stem, rgba in rgba_pixels.items():
(output/f'{stem}.rgba').write_bytes(rgba)
for stem, base, texture, vertices, faces, times in CLIPS:
animation = export_ase(paths[f'ASE/{stem}.ASE'], output/stem,
paths[f'ASE/{base}.ASE'] if base else None)
animation['texture'] = textures[texture]
_json(output/stem/'animation.json', animation)
manifest['animations'].append(dict(source=paths[f'ASE/{stem}.ASE'].name,
path=f'{stem}/animation.json', texture=texture,
indexedVertices=vertices, polygons=faces, sourceTimes=list(times)))
_json(output/'rocketship.json', manifest)
return manifest
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('original', type=Path)
parser.add_argument('--output', type=Path, required=True)
args = parser.parse_args()
export_rocketship(args.original, args.output)
print(f'Original Rocketship resources exported: {args.output}/rocketship.json')
if __name__ == '__main__':
main()