Restore Goddard leveling and Scooter positional pitch processing
This commit is contained in:
1 parent
74be19eb15
commit
fccc0b9d1b
24 files changed
+967
-8
No files matched your search
@@ -46,6 +46,13 @@ 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.
|
||||
Scooter feedback fixes: docs/gameplay/scooter-dismount-leveling.md and
|
||||
scooter-pitch.md. Preserve dismount Euler copy; source4096E0 levels Goddard X/Z
|
||||
in the bounded follow bridge. ScooterAudio adds47D9D0 positional frequency/history
|
||||
after the unchanged engine formula; current shared listener includes parked/script
|
||||
cameras.11 native facing +11 frequency traces,13 Scooter/2 audio/10 Patrol groups
|
||||
and24 Python guards pass; both native input replays pass with zero validation
|
||||
errors. Whole-original/audible Windows comparison remains open.
|
||||
Latest gadget continuation: docs/gameplay/scooter-live.md. Scooter is live in
|
||||
VR05 and outsideLEV1 through normal owned tile/F1. Separate C3DJEEP body and four
|
||||
real wheel supports, source drive/input/impact/default camera, exact source-pivot
|
||||
|
||||
@@ -250,3 +250,11 @@ The wall response is still the port's swept sphere, not the original47BD80 solve
|
||||
Visuals use those actor roots without an additional sole-based correction.
|
||||
The remaining raw-sole/root clearance difference is documented in collision notes.
|
||||
Primary added a tenth test group for Carl's profile, speed, yaw factor and state9.
|
||||
|
||||
2026-11-04 Scooter follow-up: the opt-in VR05/LEV1 Goddard follow bridge now
|
||||
applies recovered4096E0 pitch/yaw/roll smoothing toward its ordinary supported
|
||||
follow target, rather than preserving dismount tilt indefinitely. Cleanup keeps
|
||||
the full source Euler handoff. Nine active copied-original angle cases plus two
|
||||
gate observations and actual tilted-dismount tests support this correction;
|
||||
general patrol/Carl and airborne target selection retain their earlier limits.
|
||||
See [scooter-dismount-leveling](../gameplay/scooter-dismount-leveling.md).
|
||||
@@ -1,5 +1,15 @@
|
||||
# Compatibility and validation
|
||||
|
||||
Scooter feedback follow-up (2026-11-04): missing Goddard follow pitch/roll leveling
|
||||
and source positional engine-frequency correction are implemented.13 Scooter/2
|
||||
ScooterAudio/10 Patrol groups,24 targeted Python checks, route/audio regressions
|
||||
and both10-phase native Linux SDL replays pass; zero validation errors.11 new
|
||||
native facing traces and11 frequency traces distinguish source math from port
|
||||
composition. The correction lowers engine pitch slightly; audible parity/native
|
||||
Windows confirmation remains unverified. Reports: gameplay/scooter-pitch.md and
|
||||
scooter-dismount-leveling.md. Package provenance follows in scooter-live.md.
|
||||
|
||||
|
||||
Scooter (2026-11-04): live in VR05 and outside LEV1 through normal owned gadget
|
||||
selection and F1 grant.53 copied-original component observations match managed
|
||||
math; actual-level tests cover mount, wheel/body phases, drive/jump, head-on
|
||||
|
||||
@@ -301,3 +301,10 @@
|
||||
face-only camera clip and exact unscaled art. Preserve parked Jimmy collision.
|
||||
Native component comparison, managed integration and port rendering establish
|
||||
separate coverage; no complete original/Windows parity is inferred.
|
||||
|
||||
47. **Fix Scooter handoff consumers and sound channel processing.** Preserve
|
||||
copied dismount Euler, then run source Goddard X/Z leveling with.3 factors
|
||||
in the supported follow bridge. Preserve the nominal engine pitch command,
|
||||
then apply recovered47D9D0 positional frequency/history and DX bounds.
|
||||
Use shared listener state for mounted/parked/script cameras; global audio
|
||||
cadence and attenuation remain separate. See the focused gameplay reports.
|
||||
@@ -0,0 +1,59 @@
|
||||
# Goddard leveling after Scooter dismount
|
||||
|
||||
2026-11-04. User reports that Goddard retains the dismount angle. Reproduced in
|
||||
managed integration with actual VR05 steering/lean and normal selection cleanup.
|
||||
The cleanup copy itself is recovered behavior; the missing later AI phase caused
|
||||
pitch and roll to remain unchanged indefinitely.
|
||||
|
||||
## Original contract and implementation
|
||||
|
||||
-4281B3..4284FB (file offsets281B3..284FB) copies vehicle root and full Euler to
|
||||
the restored companion. Preserve that handoff; do not flatten at unequip.
|
||||
-4096E0..40988D (86E0..888D) is the AI game-interface facing update. It checks
|
||||
gameplay gate475CA0, interface+5 enabled and+A dirty, reads current Euler224/228/
|
||||
22C and destination274/278/27C, wraps each delta strictly>180 or<−180, multiplies
|
||||
axis factors810/814/818 by dt, and calls334→458F90→472480. The wrapper repeats the gameplay gate. All three axes participate.
|
||||
-41C8DB..41C90C (1C8DB..1C90C) overrides Goddard's complete8D0/8D4/8D8 factors to
|
||||
(.3,3.2,.3). These are interface810/814/818; the complete/game displacement isC0.
|
||||
-Ordinary supported moving AI4093BD..4093D0 (93BD..93D0) calls36C with pitch0,
|
||||
target yaw and roll0. Airborne and other AI branches differ; they are not added
|
||||
by this fix. The prior base/facing phase consumes the preceding destination.
|
||||
-472480..472570 (72480..72570) adds Euler with the source asymmetric negative
|
||||
truncation and strict>360 wrap. The existing RocketOrientation.Add reproduces
|
||||
that shared leaf, including canonical360 and unusual negative-input rounding.
|
||||
|
||||
ActorPatrol previously changed Y alone. Its opt-in Goddard follow bridge (VR05/
|
||||
LEV1) now applies the full original axis step toward its ordinary upright X/Z
|
||||
follow target. Heading selection/order and non-follow lab/Carl patrol stay in
|
||||
their existing bounded adapters. Disabled companions remain frozen. Cleanup
|
||||
still copies the actual lean; enabled subsequent updates gradually level it.
|
||||
At60Hz the.3 factor gives about22% of the original tilt after five seconds.
|
||||
|
||||
## Evidence and validation
|
||||
|
||||
Original EXE SHA256
|
||||
f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8.
|
||||
`tools/binary/goddard_leveling.py` guards the complete identity and records four
|
||||
bounded spans/hashes/PE offsets. Committed fixture
|
||||
`tests/GamePort.ScooterTests/original-leveling-reference.json` records source,
|
||||
probe generator/shared harness/executable/log hashes and11 copied-original
|
||||
observations. Nine active cases compare against the managed facing step: tilt,
|
||||
opposite signs, seams, negative angles, exact/over180, one60Hz tick, five seconds,
|
||||
and upright. Two additional native enabled/dirty gate observations remain separate
|
||||
from the pure step. The synthetic probe executes copied4096E0 and472480 only,
|
||||
with source Goddard factors; no original body/AI target selection/game entrypoint.
|
||||
The initialized-prefix run exits0 and prints GODDARD_LEVELING_COMPLETE. An earlier
|
||||
fresh-prefix15-second run did not finish startup and establishes no observations.
|
||||
|
||||
REA/Ghidra requests4096E0/409140 returned explicit procedure lookup failures.
|
||||
Complete replies, exported bundle and closed snapshot are retained under
|
||||
artifacts/scooter-dismount-followup/rea. No successful pseudocode or Evidence ID is
|
||||
attributed to these failed selectors and they were not repeated. Supporting
|
||||
instruction extracts and successful native numeric traces are retained alongside
|
||||
that directory. This does not claim whole-original gameplay comparison.
|
||||
|
||||
Scooter integration adds actual tilted dismount, exact cleanup copy, gradual
|
||||
next-phase decay, five-second recovery and disabled freeze, plus nine native
|
||||
numeric comparisons (13 groups total). Existing10 Patrol groups still pass.
|
||||
Native rendering/build/package follow-up is recorded in scooter-live.md. Native
|
||||
Windows/user-visible confirmation of this correction remains separate.
|
||||
@@ -185,3 +185,19 @@ The final post-package audit verifies all539 originals unchanged. The Windows
|
||||
package was cross-published and its resources checked; native Windows execution,
|
||||
audible quality and whole-original comparison remain pending. Validation notes
|
||||
are copied into each package; BUILD-INFO.txt separately identifies their commit.
|
||||
|
||||
## User feedback: pitch and angled dismount
|
||||
|
||||
The follow-up fixes the missing consumers rather than changing the original
|
||||
handoff: Goddard keeps the source copied Euler at release, then his enabled
|
||||
follow update gradually levels X/Z with source.3 axis factors. ScooterAudio
|
||||
applies recovered positional frequency/history after the nominal engine command,
|
||||
using the shared listener (including script and parked Jimmy camera). The nominal
|
||||
pitch ramp already matches the original.11 new original facing traces and11
|
||||
frequency traces are retained separately from the earlier53 drive observations.
|
||||
13 Scooter,2 audio,10 Patrol and24 targeted Python groups pass, as do lab/
|
||||
underground navigation and SDL dummy audio regressions. Native Linux GTX1070
|
||||
1920×1080 replays pass both10-phase scenes with zero enabled validation errors.
|
||||
The sound correction is slight; audible/native Windows comparison is still open.
|
||||
See [leveling](scooter-dismount-leveling.md) and [pitch](scooter-pitch.md) for the
|
||||
source/evidence, phase boundaries and limits.
|
||||
@@ -0,0 +1,86 @@
|
||||
# Scooter pitch: engine command and positional channel update
|
||||
|
||||
2026-11-04. User reported that engine sound rises too high. The existing engine
|
||||
formula is supported by the original instructions; the directly evidenced missing
|
||||
step is the separate positional channel update. No invented Scooter pitch ceiling
|
||||
or reduced acceleration/speed is introduced.
|
||||
|
||||
## Recovered source
|
||||
|
||||
EXE SHA256 `f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`;
|
||||
OMT2.dll SHA256 `3ec41ead011adf56387a6dbd4580e5b5a9721b5f8020c8a56420f42824354943`.
|
||||
`tools/binary/scooter_pitch.py` checks both identities, four bounded code ranges
|
||||
and three constants, with independently mapped PE offsets. For the listed EXE
|
||||
code, file offset=VA−400000; DLL code offset=VA−10000000.
|
||||
|
||||
| Original location / offset | Contract |
|
||||
|---|---|
|
||||
|412ED0 /12ED0;412F2D..412F60 /12F2D..12F60|Jeep's engine update calls game268→471B50 to read scalar speed, multiplies double495310=0.5263157894736842 then double495308=51, adds captured complete694 base frequency, truncates toward zero, floors at7000, writes channel command695E3C. Engine channel is complete690. First frame starts SFX46 and captures base without the later-frame pitch update.|
|
||||
|47D5DB /7D5DB;47D6E0 /7D6E0|Positional channel creation initializes frequency command695E3C to11025 and enables frequency adjustment byte695E1C. This matches Scooter's original Wave46 sample rate11025; WAV extraction is not resampling it.|
|
||||
|47D5CB /7D5CB;47D5EE /7D5EE|Store initial emitter/listener distance into history695F84, then invoke positional update47D9D0. At nonzero initial distance this first update writes nominal frequency and replaces history with integer0.|
|
||||
|47D9D0 /7D9D0;47DA0C..47DA7E /7DA0C..7DA7E|Read emitter root through310 and listener viewport509A50 eye+44/+48/+4C; compute original quick magnitude. Zero distance returns before frequency/history update.|
|
||||
|47DBB1..47DC1D /7DBB1..7DC1D|When adjustment enabled, correction=trunc((distance−history)*float.75). If distance>history, apply nominal−correction; otherwise nominal+correction. Thus the ordinary finite correction lowers pitch in both directions. The final FILD/FSTP stores the signed integer correction into history, **not distance**. This unusual source behavior is independently executed below.|
|
||||
|47D8F0 /7D8F0|Global sound update enumerates active channels and calls47D9D0. Source callers include44DF9A and47E57A. Its cadence relative to vehicle and render registry is a separate global scheduling contract.|
|
||||
|DLL1003BBA0..1003BBF9 /3BBA0..3BBF9|OMediaDXSoundChannel::set_frequency stores requested unsigned Hz, clamps nonzero values to100..100000 with a native buffer, and forwards to DirectSound slot44. Zero means source frequency. There is no lower hidden Scooter-specific maximum.|
|
||||
|
||||
Existing REA/Ghidra12.1.4 engine evidence:
|
||||
`ev_0001ffbd4f35880bb9fe9c53985f1953f475984404b5be77753031e07a77bfca`
|
||||
under artifacts/scooter-lifecycle-live/rea-camera. Its pseudocode loses x87
|
||||
frequency producers; the saved sound.asm and constant bytes establish the formula.
|
||||
|
||||
New REA evidence, exported with closed snapshots under artifacts/scooter-pitch:
|
||||
|
||||
-47D9D0: `ev_1b042ef49ef4615de500303bde18eb9da879d00a2e8ae9dfde76cfdfb31a2ec6`
|
||||
in rea-position/evidence.json. The decompiler aliases x87/local values incorrectly;
|
||||
instruction47DBFC and47DC11 establish which integer is published to history.
|
||||
-DLL1003BBA0: `ev_7439bef8e2bb303a2acba66af75a3513ab2ea007ebdb187732b9c7d4ab6cfe6c`
|
||||
in rea-dll/evidence.json.
|
||||
-DLL100EFF20: `ev_6cdab21683335bcecdc6e96aa42b96b63456cfa1ab02b64a283b07f91dc46a15`;
|
||||
shared inherited no-op export, not the active DX setter.
|
||||
|
||||
The MCP session reported GHIDRA_INSTALL_DIR unset. The established local
|
||||
scripts/rea.sh launcher has the configured Ghidra/JDK, so new analysis used that
|
||||
CLI with copied targets. No MCP registration/configuration was changed. No target
|
||||
entrypoint was executed during static analysis.
|
||||
|
||||
## Implementation and verification
|
||||
|
||||
`ScooterAudio` owns per-channel history and last applied device frequency. Its
|
||||
EngineFrequency preserves the original scalar slope/floor. Frequency applies the
|
||||
positional correction using emitter root and current rendered listener eye, then
|
||||
DX's unsigned/nonzero bounds; zero-distance calls retain applied Hz/history.
|
||||
Reset runs when a new engine stream starts. SDL maps resulting Hz to the original
|
||||
WAV input rate through SDL_SetAudioStreamFrequencyRatio; local SDL_audio.h confirms
|
||||
higher ratio raises pitch. No cumulative multiplication or input-rate inversion
|
||||
was found in SdlAudio/SceneAudio.
|
||||
|
||||
A copied-original47D9D0 harness uses synthetic actor/engine/channel/camera and
|
||||
original OMT quick-magnitude/trig exports; no game entrypoint, sound playback or
|
||||
DirectSound hardware is invoked. Eleven cases execute successfully in isolated
|
||||
Wine32, including zero-distance early return, positive and negative signed history,
|
||||
constant-distance recurrence, fractional truncation, reverse floor ordering and
|
||||
maximum-speed command. Native Wine exit0/capture success are saved under
|
||||
artifacts/scooter-pitch/probe. The committed reference fixture identifies source,
|
||||
generator, shared map helper, generated EXE and original-output log by hash.
|
||||
|
||||
Examples: nominal50885 at distance800/history0 applies50285 and stores600; next
|
||||
same-distance update applies50735 and stores150. Reverse nominal7000 at distance500
|
||||
applies6625: the7000 floor precedes positional adjustment and must not be repeated.
|
||||
Source positional update does not modify nominal command695E3C.
|
||||
|
||||
Two Python groups guard source/provenance and eleven native cases. Two managed
|
||||
ScooterAudio groups match those eleven observations and verify engine arithmetic,
|
||||
stream-reset history, zero-distance device retention and reverse ordering.
|
||||
|
||||
Integration API: create a scene-local ScooterAudio; on EngineStarted call Reset
|
||||
before starting SFX46. On EngineSpeedChanged pass Frequency(baseHz,speed,vehicle.Root,
|
||||
listenerEye) to SceneAudio.TuneLoop. Use the actual shared listener, including
|
||||
scripted eye and Jimmy eye when parked; summon-time Scooter.CameraEye alone is
|
||||
stale for parked engine sound.
|
||||
|
||||
Boundaries: this is the recovered engine+frequency path, not complete positional
|
||||
volume/pan, channel allocation/bank failure handling or exact scene-wide47D8F0
|
||||
scheduling. Applying once per engine-frame update is a bounded port composition.
|
||||
Native original audible comparison, speaker quality and native Windows playback
|
||||
remain unverified. The correction lowers pitch slightly; static/source-component
|
||||
evidence does not establish that every perceived pitch difference is resolved.
|
||||
@@ -1,5 +1,21 @@
|
||||
# Progress — 2026-11-04
|
||||
|
||||
## Scooter pitch and dismount follow-up
|
||||
|
||||
User confirmed Scooter works, then reported high pitch and Goddard retaining an
|
||||
angled dismount. Keep the recovered Euler handoff; add missing4096E0 full-axis
|
||||
leveling in the bounded Goddard follow bridge. The engine's nominal formula is
|
||||
correct; add original47D9D0 positional frequency correction, per-channel history
|
||||
and zero-distance device retention, using the shared listener eye. Source audio
|
||||
global scheduling/attenuation and audible Windows comparison remain open.
|
||||
|
||||
11 native leveling traces (9 active/2 gates) and11 native positional-frequency
|
||||
observations are recorded.13 Scooter/2 ScooterAudio/10 Patrol groups,24 targeted
|
||||
Python checks, lab/underground routes and SDL dummy pause/lifecycle pass. Both
|
||||
1920×1080 native SDL Scooter replays pass10 phases with validation enabled and
|
||||
zero errors. Findings: [leveling](gameplay/scooter-dismount-leveling.md) and
|
||||
[pitch](gameplay/scooter-pitch.md). Final package verification follows there.
|
||||
|
||||
## Live Scooter in VR05 and outside LEV1
|
||||
|
||||
Implemented independent vehicle/wheel bodies, summon-at-Goddard and strict contact
|
||||
|
||||
@@ -46,6 +46,12 @@ compile, runtime and original-fidelity verification are separate.
|
||||
|
||||
## Immediate continuation
|
||||
|
||||
- [x] Scooter feedback: Goddard gradually levels pitch/roll after tilted dismount;
|
||||
engine uses missing source positional frequency/history correction.13 Scooter,
|
||||
2 audio,10 Patrol and24 Python groups plus native input replays pass. See
|
||||
gameplay/scooter-dismount-leveling.md and scooter-pitch.md. Audible/native
|
||||
Windows comparison remains open; the recovered nominal engine formula stands.
|
||||
|
||||
- [x] Bounded liveVR08 Grappler: shared body context/full base callback, follow
|
||||
camera, original rope/SWING/cursor/audio, ownership/RETURN/retained scalars,
|
||||
normal/debug selection.13 managed groups/40 Python checks and9-phase native
|
||||
|
||||
@@ -23,6 +23,7 @@ dotnet run --project tests/GamePort.RocketFlightTests
|
||||
dotnet run --project tests/GamePort.RocketshipTests
|
||||
dotnet run --project tests/GamePort.GrapplerLiveTests
|
||||
dotnet run --project tests/GamePort.ScooterTests
|
||||
dotnet run --project tests/GamePort.ScooterAudioTests
|
||||
dotnet run --project tests/GamePort.GrapplerTests
|
||||
dotnet run --project tests/GamePort.HeadingTests
|
||||
dotnet run --project tests/GamePort.BlendTests
|
||||
|
||||
@@ -96,10 +96,15 @@ public sealed class ActorPatrol
|
||||
throw new InvalidOperationException("Goddard body solver produced nonfinite state");
|
||||
actor.Position = body.Position;
|
||||
Velocity = body.Velocity;
|
||||
var yawError = (desiredYaw - actor.Rotation.Y) % 360;
|
||||
if (yawError > 180) yawError -= 360;
|
||||
if (yawError < -180) yawError += 360;
|
||||
actor.Rotation = actor.Rotation with { Y = actor.Rotation.Y + yawError * yawFactor * dt };
|
||||
if(FollowPlayer&&actor.Kind=="3DOG")
|
||||
actor.Rotation=GoddardFacing(actor.Rotation,desiredYaw,dt);
|
||||
else
|
||||
{
|
||||
var yawError = (desiredYaw - actor.Rotation.Y) % 360;
|
||||
if (yawError > 180) yawError -= 360;
|
||||
if (yawError < -180) yawError += 360;
|
||||
actor.Rotation = actor.Rotation with { Y = actor.Rotation.Y + yawError * yawFactor * dt };
|
||||
}
|
||||
|
||||
switch (actor.AIstate)
|
||||
{
|
||||
@@ -120,6 +125,16 @@ public sealed class ActorPatrol
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>4096E0 with41C8DB Goddard factors and the ordinary supported
|
||||
/// follow target (pitch/roll0). Dismount copies tilt; this later AI phase
|
||||
/// gradually levels it. Full airborne AI target selection remains separate.</summary>
|
||||
public static Vector3 GoddardFacing(Vector3 rotation,float yaw,float dt)
|
||||
{
|
||||
static float Arc(float delta)=>delta>180?delta-360:delta< -180?delta+360:delta;
|
||||
var delta=new Vector3(Arc(-rotation.X)*.3f*dt,Arc(yaw-rotation.Y)*3.2f*dt,Arc(-rotation.Z)*.3f*dt);
|
||||
return RocketOrientation.Add(rotation,delta);
|
||||
}
|
||||
|
||||
private void StepFollow()
|
||||
{
|
||||
var target=findActor("JIM1");if(target==null||!target.Active)return;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.Numerics;
|
||||
namespace GamePort.Game;
|
||||
|
||||
/// <summary>412ED0 engine command followed by bounded47D9D0 positional pitch.
|
||||
/// Owns source695F84 channel history; scene/global audio scheduling stays separate.</summary>
|
||||
public sealed class ScooterAudio
|
||||
{
|
||||
private int appliedFrequency;
|
||||
public float History { get; private set; }
|
||||
public void Reset(){History=0;appliedFrequency=0;}
|
||||
|
||||
public static int EngineFrequency(int baseFrequency,float speed)
|
||||
=>Math.Max(7000,(int)(baseFrequency+(double)speed*0.5263157894736842*51));
|
||||
|
||||
public int Frequency(int baseFrequency,float speed,Vector3 source,Vector3 listener)
|
||||
{
|
||||
float distance=OriginalBodySupport.QuickMagnitude(listener-source);
|
||||
//A zero-distance source exits before set_frequency, retaining device Hz.
|
||||
if(distance==0)return appliedFrequency==0?baseFrequency:appliedFrequency;
|
||||
var history=History;
|
||||
int nominal=EngineFrequency(baseFrequency,speed);
|
||||
int adjusted=PositionalFrequency(nominal,distance,ref history);
|
||||
History=history;
|
||||
//DX accepts unsigned Hz, clamps nonzero to100..100000;0 means source rate.
|
||||
uint hz=unchecked((uint)adjusted);
|
||||
appliedFrequency=hz==0?baseFrequency:(int)Math.Clamp(hz,100u,100000u);
|
||||
return appliedFrequency;
|
||||
}
|
||||
|
||||
public static int PositionalFrequency(int nominal,float distance,ref float history)
|
||||
{
|
||||
if(distance==0)return nominal; //47DA7E returns without the channel write/history update.
|
||||
int correction=(int)(((double)distance-history)*.75);
|
||||
int result=distance>history?unchecked(nominal-correction):unchecked(nominal+correction);
|
||||
//47DBFC/47DC11 fild the integer correction, not the current distance.
|
||||
history=correction;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,6 @@ internal static class Program
|
||||
catch (Exception error) { Console.Error.WriteLine(error); return 1; }
|
||||
}
|
||||
|
||||
private static int ScooterEngineFrequency(int baseFrequency,float speed)=>Math.Max(7000,(int)(baseFrequency+(double)speed*(1/1.9)*51));
|
||||
|
||||
private static string? Option(string[] args, string name)
|
||||
{
|
||||
var i = Array.IndexOf(args, name);
|
||||
@@ -622,9 +620,12 @@ internal static class Program
|
||||
}
|
||||
if(scooter!=null)
|
||||
{
|
||||
scooter.EngineStarted+=()=>sceneAudio?.Effect(46,"scooter");
|
||||
var scooterAudio=new ScooterAudio();
|
||||
scooter.EngineStarted+=()=>{scooterAudio.Reset();sceneAudio?.Effect(46,"scooter");};
|
||||
scooter.EngineStopped+=()=>sceneAudio?.StopLoop("scooter");
|
||||
scooter.EngineSpeedChanged+=speed=>sceneAudio?.TuneLoop("scooter",baseFrequency=>ScooterEngineFrequency(baseFrequency,speed));
|
||||
scooter.EngineSpeedChanged+=speed=>sceneAudio?.TuneLoop("scooter",baseFrequency=>
|
||||
scooterAudio.Frequency(baseFrequency,speed,scooter.Root,
|
||||
director?.CameraEye??(scooter.Mounted?scooter.CameraEye:simulation!.CameraEye)));
|
||||
}
|
||||
if(baseballs!=null)baseballs.Sound+=id=>sceneAudio?.Effect(id);
|
||||
if(rocketship!=null)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<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/Game/ScooterAudio.cs"/>
|
||||
<Compile Include="../../src/GamePort/Game/OriginalBodySupport.cs"/>
|
||||
<None Include="original-frequency-reference.json" CopyToOutputDirectory="PreserveNewest"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Numerics;
|
||||
using System.Text.Json;
|
||||
using GamePort.Game;
|
||||
|
||||
using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-frequency-reference.json")));
|
||||
int count=0;
|
||||
foreach(var c in doc.RootElement.GetProperty("cases").EnumerateArray())
|
||||
{
|
||||
var i=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
|
||||
var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
|
||||
float history=i[2];int frequency=ScooterAudio.PositionalFrequency((int)i[0],i[1],ref history);
|
||||
Check(frequency==(int)o[0]&&history==o[1],$"Copied original position case{count}: {frequency}/{history} != {o[0]}/{o[1]}");count++;
|
||||
}
|
||||
Check(count==11,"complete native positional cases");
|
||||
Console.WriteLine("PASS eleven copied-original positional frequency observations, including zero-distance and signed history");
|
||||
Check(ScooterAudio.EngineFrequency(11025,1485)==50885,"recovered maximum-speed engine command preserved");
|
||||
Check(ScooterAudio.EngineFrequency(11025,-594)==7000,"engine-only reverse floor");
|
||||
var audio=new ScooterAudio();
|
||||
int adjusted=audio.Frequency(11025,1485,Vector3.Zero,new(0,0,800));
|
||||
Check(adjusted==50285&&audio.History==600,"listener correction follows nominal engine command");
|
||||
Check(audio.Frequency(11025,1485,Vector3.Zero,new(0,0,800))==50735&&audio.History==150,"history is last correction rather than distance");
|
||||
audio.Reset();Check(audio.History==0,"new channel clears history");
|
||||
Check(audio.Frequency(11025,-594,Vector3.Zero,new(0,0,500))==6625,"positional correction follows7000 engine floor, not a second7000 clamp");
|
||||
Check(audio.Frequency(11025,1485,Vector3.Zero,Vector3.Zero)==6625&&audio.History==375,"zero distance retains preceding device frequency/history");
|
||||
Console.WriteLine("PASS engine command, source position adjustment, channel reset and reverse ordering");
|
||||
|
||||
static void Check(bool condition,string name){if(!condition)throw new Exception(name);}
|
||||
@@ -0,0 +1,180 @@
|
||||
{
|
||||
"exe_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
|
||||
"dll_sha256": "3ec41ead011adf56387a6dbd4580e5b5a9721b5f8020c8a56420f42824354943",
|
||||
"ranges": [
|
||||
{
|
||||
"kind": "engine",
|
||||
"va": "0x412ed0",
|
||||
"file_offset": "0x12ed0",
|
||||
"length": 185,
|
||||
"sha256": "c9274c2d5dd0ee80dd96d43840dcd4981e296705f32eca0c1b6a894bed142f42"
|
||||
},
|
||||
{
|
||||
"kind": "channel_start",
|
||||
"va": "0x47d561",
|
||||
"file_offset": "0x7d561",
|
||||
"length": 149,
|
||||
"sha256": "621a9b9802bf37238103922923bbc56272aeac4d41a58e05dc555c4e3d247854"
|
||||
},
|
||||
{
|
||||
"kind": "position",
|
||||
"va": "0x47d9d0",
|
||||
"file_offset": "0x7d9d0",
|
||||
"length": 590,
|
||||
"sha256": "8a1ef6303a32a33d95b3cf8ecbdc01b2cebbfa66460bd99294a182e1d1ca73e9"
|
||||
},
|
||||
{
|
||||
"kind": "dx_frequency",
|
||||
"va": "0x1003bba0",
|
||||
"file_offset": "0x3bba0",
|
||||
"length": 90,
|
||||
"sha256": "d40d2dab6a1f1bce28438e38aa24e2e226eea7993a7fa3def93bed34f77b8024"
|
||||
}
|
||||
],
|
||||
"constants": {
|
||||
"0x495310": 0.5263157894736842,
|
||||
"0x495308": 51.0,
|
||||
"0x49d5ac": 0.75
|
||||
},
|
||||
"scope": "Copied original47D9D0 with synthetic actor/channel/engine/camera and original OMT vector/trig; no game entrypoint. Engine formula and DX bounds are statically recovered.",
|
||||
"cases": [
|
||||
{
|
||||
"input": [
|
||||
11025.0,
|
||||
200.0,
|
||||
200.0
|
||||
],
|
||||
"observed": [
|
||||
11025.0,
|
||||
0.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": [
|
||||
11025.0,
|
||||
200.0,
|
||||
0.0
|
||||
],
|
||||
"observed": [
|
||||
10875.0,
|
||||
150.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": [
|
||||
11025.0,
|
||||
200.0,
|
||||
150.0
|
||||
],
|
||||
"observed": [
|
||||
10988.0,
|
||||
37.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": [
|
||||
11025.0,
|
||||
200.0,
|
||||
37.0
|
||||
],
|
||||
"observed": [
|
||||
10903.0,
|
||||
122.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": [
|
||||
50885.0,
|
||||
800.0,
|
||||
0.0
|
||||
],
|
||||
"observed": [
|
||||
50285.0,
|
||||
600.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": [
|
||||
50885.0,
|
||||
800.0,
|
||||
600.0
|
||||
],
|
||||
"observed": [
|
||||
50735.0,
|
||||
150.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": [
|
||||
11025.0,
|
||||
100.0,
|
||||
200.0
|
||||
],
|
||||
"observed": [
|
||||
10950.0,
|
||||
-75.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": [
|
||||
7000.0,
|
||||
500.0,
|
||||
0.0
|
||||
],
|
||||
"observed": [
|
||||
6625.0,
|
||||
375.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": [
|
||||
11025.0,
|
||||
0.0,
|
||||
200.0
|
||||
],
|
||||
"observed": [
|
||||
11025.0,
|
||||
200.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": [
|
||||
11025.0,
|
||||
123.75,
|
||||
100.0
|
||||
],
|
||||
"observed": [
|
||||
11008.0,
|
||||
17.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"input": [
|
||||
11025.0,
|
||||
100.0,
|
||||
123.75
|
||||
],
|
||||
"observed": [
|
||||
11008.0,
|
||||
-17.0,
|
||||
1.0
|
||||
]
|
||||
}
|
||||
],
|
||||
"files": {
|
||||
"tools/binary/scooter_pitch.py": "dc46cc2cc73362e1e44fddfdeb68d2b89b21ce69fb4ea376d031ee40a124ef99",
|
||||
"tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810",
|
||||
"artifacts/scooter-pitch/scooter_pitch_probe.exe": "0b09a95fe4287f79e8c110be5c9d1cf3dbab4cc057db6f9be728003aa3a1b917",
|
||||
"artifacts/scooter-pitch/probe/wine.log": "3cbce35209b32332cdd86e6b464df4c42781fdc505e635b1116040c1f5c585ba"
|
||||
}
|
||||
}
|
||||
@@ -6,5 +6,6 @@
|
||||
<Compile Include="../../src/GamePort/Application/PlayerGadgetMaterial.cs"/>
|
||||
<Compile Include="../../src/GamePort/Application/ScooterVisuals.cs"/>
|
||||
<None Include="original-motion-reference.json" CopyToOutputDirectory="PreserveNewest"/>
|
||||
<None Include="original-leveling-reference.json" CopyToOutputDirectory="PreserveNewest"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -15,6 +15,8 @@ var tests=new(string,Action)[]{("copied-original drive/input/facing/terrain obse
|
||||
("actual tutorial RETURN accepts the passenger and cleans vehicle",Return),
|
||||
("original vehicle/wheel/rider geometry stays unit scale",Visuals),
|
||||
("outside companion follows, freezes while summoned, and returns near Jimmy",Companion),
|
||||
("tilted dismount preserves handoff then Goddard gradually levels",DismountTilt),
|
||||
("copied-original Goddard leveling rates and seams",GoddardOriginal),
|
||||
};
|
||||
foreach(var(name,test)in tests){test();Console.WriteLine("PASS "+name);}Console.WriteLine($"Scooter integration: {tests.Length} groups passed.");
|
||||
static void Original()
|
||||
@@ -132,6 +134,35 @@ static void Companion()
|
||||
NearV(dog.Position,jimmy.Position+RocketOrientation.Rotate(new(0,0,-800),jimmy.Rotation),"far follow warp");
|
||||
f.D.EnsureCompanion(jimmy.Position,Vector3.Zero);NearV(dog.Position,jimmy.Position,"explicit reset placement updates existing actor");
|
||||
}
|
||||
static void DismountTilt()
|
||||
{
|
||||
using var f=new Fixture("VR05");var dog=f.D.FindActor("C3DGODDARD")!;
|
||||
var patrol=new ActorPatrol(dog,f.D.FindActor,(b,_)=>b){FollowPlayer=true};
|
||||
f.Summon();f.Mount();
|
||||
for(int i=0;i<20;i++)f.Frame(new(true,false,true,false,false));
|
||||
var rotation=f.S.Rotation;Check(Math.Abs(rotation.Z)>10,"actual steering produces vehicle lean");
|
||||
f.I.Inventory.SelectGadget(-1);NearV(dog.Rotation,rotation,"cleanup copies full source Euler");
|
||||
static float Tilt(float degrees)=>MathF.Abs((degrees+540)%360-180);
|
||||
float before=Tilt(dog.Rotation.Z);patrol.Step(.1f);
|
||||
Check(Tilt(dog.Rotation.Z)<before&&Tilt(dog.Rotation.Z)>before*.9f,"leveling is gradual in next AI phase");
|
||||
for(int i=0;i<300;i++)patrol.Step(FixedStepClock.Step);
|
||||
Check(Tilt(dog.Rotation.Z)<before*.25f,"companion does not retain scooter lean");
|
||||
dog.MovementEnabled=false;rotation=dog.Rotation;patrol.Step(.1f);Check(dog.Rotation==rotation,"disabled companion does not update facing");
|
||||
}
|
||||
static void GoddardOriginal()
|
||||
{
|
||||
using var document=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-leveling-reference.json")));
|
||||
int compared=0;
|
||||
foreach(var c in document.RootElement.GetProperty("cases").EnumerateArray())
|
||||
{
|
||||
var p=c.GetProperty("input").EnumerateArray().Select(v=>v.GetSingle()).ToArray();
|
||||
if(p[6]==0||p[7]==0)continue; //Native gate observations are guarded separately.
|
||||
var o=c.GetProperty("observed").EnumerateArray().Select(v=>v.GetSingle()).ToArray();
|
||||
var rotation=new Vector3(p[0],p[1],p[2]);for(int i=0;i<(int)p[5];i++)rotation=ActorPatrol.GoddardFacing(rotation,p[3],p[4]);
|
||||
NearV(rotation,new(o[0],o[1],o[2]),c.GetProperty("name").GetString()!);compared++;
|
||||
}
|
||||
Check(compared==9,"nine active native leveling observations");
|
||||
}
|
||||
static void Check(bool ok,string name){if(!ok)throw new Exception(name);}
|
||||
static void Near(float a,float b,string name)=>Check(float.IsFinite(a)&&Math.Abs(a-b)<.02f,$"{name}: {a} != {b}");
|
||||
static void NearV(Vector3 a,Vector3 b,string name)=>Check(Vector3.Distance(a,b)<.04f,$"{name}: {a} != {b}");
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
{
|
||||
"source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
|
||||
"ranges": [
|
||||
{
|
||||
"va": "0x4096e0",
|
||||
"file_offset": "0x96e0",
|
||||
"length": 429,
|
||||
"sha256": "16008268af9cb0e2a04891d3743cb9c9fa36b42e55f67f807c0f97df716cec1d"
|
||||
},
|
||||
{
|
||||
"va": "0x4093bd",
|
||||
"file_offset": "0x93bd",
|
||||
"length": 27,
|
||||
"sha256": "66249ec334f140cd090fe7e25c6476ebfbff6be31a7346c234d10d1ff1e496ee"
|
||||
},
|
||||
{
|
||||
"va": "0x41c8db",
|
||||
"file_offset": "0x1c8db",
|
||||
"length": 49,
|
||||
"sha256": "d30bf58fc7fc8d9b51c6fe88b9135fb33856f5bb53f2ded2a23d7c2000606639"
|
||||
},
|
||||
{
|
||||
"va": "0x472480",
|
||||
"file_offset": "0x72480",
|
||||
"length": 240,
|
||||
"sha256": "406c3904538abe07d88ca440e39ca56c00765d0871943991ba7b792da4803c16"
|
||||
}
|
||||
],
|
||||
"scope": "Copied4096E0 plus472480, Goddard factors, synthetic enabled/dirty actor; no original AI/body/game entrypoint.",
|
||||
"files": {
|
||||
"tools/binary/goddard_leveling.py": "ea082906a5b2cb799238f1c4f4d04ac23e5a672f3665cbcf8c4de11ffd4c22ae",
|
||||
"tools/binary/goddard_leveling_probe.c": "5fb6ce399234fbaaa54f64365f899384c16876fb3722cd90561aeb43786061c5",
|
||||
"tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810",
|
||||
"artifacts/scooter-dismount-followup/goddard_leveling_probe.exe": "51bdc2b13fda9865b5ad67184195e057396fd339f3bca16f37975c42e01e2270",
|
||||
"artifacts/scooter-dismount-followup/probe-ready/wine.log": "dac3580123ff07f7c5d97a2d66f3a314b660cbc2ab434bed984f5e910c985584"
|
||||
},
|
||||
"cases": [
|
||||
{
|
||||
"name": "tilted",
|
||||
"input": [
|
||||
20.0,
|
||||
90.0,
|
||||
30.0,
|
||||
90.0,
|
||||
0.100000001,
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"observed": [
|
||||
19.3999996,
|
||||
90.0,
|
||||
29.1000004
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "opposite",
|
||||
"input": [
|
||||
340.0,
|
||||
90.0,
|
||||
330.0,
|
||||
90.0,
|
||||
0.100000001,
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"observed": [
|
||||
340.600006,
|
||||
90.0,
|
||||
330.899994
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "seam",
|
||||
"input": [
|
||||
350.0,
|
||||
359.0,
|
||||
350.0,
|
||||
1.0,
|
||||
0.100000001,
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"observed": [
|
||||
350.299988,
|
||||
359.640015,
|
||||
350.299988
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "negative",
|
||||
"input": [
|
||||
-20.0,
|
||||
-10.0,
|
||||
-30.0,
|
||||
20.0,
|
||||
0.100000001,
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"observed": [
|
||||
341.0,
|
||||
360.0,
|
||||
331.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "equal180",
|
||||
"input": [
|
||||
180.0,
|
||||
180.0,
|
||||
180.0,
|
||||
0.0,
|
||||
0.100000001,
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"observed": [
|
||||
174.600006,
|
||||
122.399994,
|
||||
174.600006
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "over180",
|
||||
"input": [
|
||||
181.0,
|
||||
181.0,
|
||||
181.0,
|
||||
0.0,
|
||||
0.100000001,
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"observed": [
|
||||
186.369995,
|
||||
238.279999,
|
||||
186.369995
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "tick",
|
||||
"input": [
|
||||
20.0,
|
||||
90.0,
|
||||
30.0,
|
||||
90.0,
|
||||
0.0166666675,
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"observed": [
|
||||
19.8999996,
|
||||
90.0,
|
||||
29.8500004
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "five_seconds",
|
||||
"input": [
|
||||
20.0,
|
||||
90.0,
|
||||
30.0,
|
||||
90.0,
|
||||
0.0166666675,
|
||||
300.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"observed": [
|
||||
4.44584179,
|
||||
90.0,
|
||||
6.6687665
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "upright",
|
||||
"input": [
|
||||
0.0,
|
||||
90.0,
|
||||
0.0,
|
||||
90.0,
|
||||
0.100000001,
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"observed": [
|
||||
0.0,
|
||||
90.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "disabled",
|
||||
"input": [
|
||||
20.0,
|
||||
90.0,
|
||||
30.0,
|
||||
90.0,
|
||||
0.100000001,
|
||||
1.0,
|
||||
0.0,
|
||||
1.0
|
||||
],
|
||||
"observed": [
|
||||
20.0,
|
||||
90.0,
|
||||
30.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "clean",
|
||||
"input": [
|
||||
20.0,
|
||||
90.0,
|
||||
30.0,
|
||||
90.0,
|
||||
0.100000001,
|
||||
1.0,
|
||||
1.0,
|
||||
0.0
|
||||
],
|
||||
"observed": [
|
||||
20.0,
|
||||
90.0,
|
||||
30.0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
"""Source identity and saved original Goddard facing observations."""
|
||||
from pathlib import Path
|
||||
import hashlib,json,sys,unittest
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0,str(ROOT/'tools/binary'))
|
||||
from goddard_leveling import collect
|
||||
class GoddardLevelingEvidence(unittest.TestCase):
|
||||
def test_source_ranges_and_original_offsets(self):
|
||||
source=collect(ROOT.parent/'Original');fixture=json.loads((ROOT/'tests/GamePort.ScooterTests/original-leveling-reference.json').read_text())
|
||||
self.assertEqual(source['source_sha256'],fixture['source_sha256']);self.assertEqual(source['ranges'],fixture['ranges'])
|
||||
for span in source['ranges']:self.assertEqual(int(span['file_offset'],16),int(span['va'],16)-0x400000)
|
||||
def test_probe_source_provenance_and_gates(self):
|
||||
fixture=json.loads((ROOT/'tests/GamePort.ScooterTests/original-leveling-reference.json').read_text());self.assertEqual(len(fixture['cases']),11)
|
||||
for file,hash_ in fixture['files'].items():
|
||||
if file.startswith('tools/'):self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),hash_)
|
||||
for case in fixture['cases']:
|
||||
if case['name'] in ('clean','disabled'):self.assertEqual(case['observed'],case['input'][:3])
|
||||
if __name__=='__main__':unittest.main()
|
||||
@@ -0,0 +1,35 @@
|
||||
"""Original engine/positional frequency guards and probe provenance."""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import json
|
||||
import sys
|
||||
import unittest
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0,str(ROOT/'tools/binary'))
|
||||
from scooter_pitch import collect
|
||||
|
||||
class ScooterPitchEvidence(unittest.TestCase):
|
||||
def test_original_sources_constants_ranges_and_offsets(self):
|
||||
source=collect(ROOT.parent/'Original')
|
||||
fixture=json.loads((ROOT/'tests/GamePort.ScooterAudioTests/original-frequency-reference.json').read_text())
|
||||
for key in ('exe_sha256','dll_sha256','ranges','constants'):self.assertEqual(source[key],fixture[key])
|
||||
self.assertEqual(len(source['ranges']),4)
|
||||
self.assertEqual(source['constants'],{'0x495310':1/1.9,'0x495308':51.,'0x49d5ac':.75})
|
||||
for row in source['ranges']:
|
||||
base=0x10000000 if row['kind']=='dx_frequency' else 0x400000
|
||||
self.assertEqual(int(row['file_offset'],16),int(row['va'],16)-base)
|
||||
|
||||
def test_provenance_and_complete_copied_original_cases(self):
|
||||
fixture=json.loads((ROOT/'tests/GamePort.ScooterAudioTests/original-frequency-reference.json').read_text())
|
||||
self.assertEqual(len(fixture['cases']),11)
|
||||
for path,digest in fixture['files'].items():
|
||||
self.assertEqual(len(digest),64)
|
||||
if path.startswith('tools/'):
|
||||
self.assertEqual(hashlib.sha256((ROOT/path).read_bytes()).hexdigest(),digest)
|
||||
cases=fixture['cases']
|
||||
self.assertEqual(cases[0]['observed'],[11025,0,1])
|
||||
self.assertEqual(cases[4]['observed'],[50285,600,1])
|
||||
self.assertEqual(cases[6]['observed'],[10950,-75,1])
|
||||
self.assertEqual(cases[8]['observed'],[11025,200,0])
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Original Goddard facing guards and isolated copied-code probe preparation."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
from checkpoint_script_state import EXE_SHA256,find_case,read_va
|
||||
from pe_inspect import PE
|
||||
RANGES=((0x4096e0,0x40988d),(0x4093bd,0x4093d8),(0x41c8db,0x41c90c),(0x472480,0x472570))
|
||||
def collect(original):
|
||||
pe=PE(find_case(Path(original),'Neutron.exe'))
|
||||
if hashlib.sha256(pe.data).hexdigest()!=EXE_SHA256:raise ValueError('Unexpected original EXE')
|
||||
return dict(source_sha256=EXE_SHA256,ranges=[dict(va=hex(a),file_offset=hex(pe.offset(a-pe.base)),length=b-a,
|
||||
sha256=hashlib.sha256(read_va(pe,a,b-a)).hexdigest()) for a,b in RANGES])
|
||||
def generate(original,output):
|
||||
original=Path(original).resolve();output=Path(output).resolve()
|
||||
if output.is_relative_to(original) or original.is_relative_to(output):raise ValueError('Separate output required')
|
||||
report=collect(original);output.mkdir(parents=True,exist_ok=True)
|
||||
(output/'source.json').write_text(json.dumps(report,indent=2)+'\n')
|
||||
(output/'goddard_leveling_probe.c').write_text(Path(__file__).with_name('goddard_leveling_probe.c').read_text())
|
||||
return report
|
||||
if __name__=='__main__':
|
||||
p=argparse.ArgumentParser();p.add_argument('original',type=Path);p.add_argument('--generate-probe',type=Path);a=p.parse_args()
|
||||
print(json.dumps(generate(a.original,a.generate_probe) if a.generate_probe else collect(a.original),indent=2))
|
||||
@@ -0,0 +1,38 @@
|
||||
/* Copied4096E0/472480, source Goddard axis factors, synthetic enabled/dirty actor.
|
||||
No original game entrypoint, AI target selection, body or rendering. */
|
||||
#define main unused_grappler_main
|
||||
#include "grappler_scalar_probe.c"
|
||||
#undef main
|
||||
static uintptr_t table[0x340/4];
|
||||
#define OF(o) (*(float*)(object+(o)))
|
||||
static void fix(uint32_t start,uint32_t end){
|
||||
const uint32_t targets[]={0x48d914,0x48e5b0,0x48e5c0,0x48e5c4};
|
||||
for(uint32_t at=start;at+4<=end;at++){
|
||||
uint32_t v;memcpy(&v,AT(at),4);
|
||||
for(unsigned i=0;i<4;i++)if(v==targets[i]){v=(uintptr_t)AT(v);memcpy(AT(at),&v,4);at+=3;break;}
|
||||
}
|
||||
}
|
||||
static void run(const char*name,float x,float y,float z,float targetYaw,float dt,int ticks,int enabled,int dirty){
|
||||
memset(object,0,sizeof(object));*(void**)object=table;object[5]=enabled;object[10]=dirty;
|
||||
OF(0x224)=x;OF(0x228)=y;OF(0x22c)=z;OF(0x278)=targetYaw;
|
||||
OF(0x810)=.3f;OF(0x814)=3.2f;OF(0x818)=.3f;
|
||||
for(int i=0;i<ticks;i++)((void(TC*)(void*,float))AT(0x4096e0))(object,dt);
|
||||
printf("LEVEL %s in=%.9g,%.9g,%.9g,%.9g,%.9g,%d,%d,%d out=%.9g,%.9g,%.9g\n",name,x,y,z,targetYaw,dt,ticks,enabled,dirty,OF(0x224),OF(0x228),OF(0x22c));
|
||||
}
|
||||
int main(void){
|
||||
map_source();fix(0x4096e0,0x40988d);fix(0x472480,0x472570);
|
||||
const unsigned char ready[]={0xb0,1,0xc3};memcpy(AT(0x475ca0),ready,3);
|
||||
table[0x334/4]=(uintptr_t)AT(0x472480);
|
||||
run("tilted",20,90,30,90,.1f,1,1,1);
|
||||
run("opposite",340,90,330,90,.1f,1,1,1);
|
||||
run("seam",350,359,350,1,.1f,1,1,1);
|
||||
run("negative",-20,-10,-30,20,.1f,1,1,1);
|
||||
run("equal180",180,180,180,0,.1f,1,1,1);
|
||||
run("over180",181,181,181,0,.1f,1,1,1);
|
||||
run("tick",20,90,30,90,1.f/60,1,1,1);
|
||||
run("five_seconds",20,90,30,90,1.f/60,300,1,1);
|
||||
run("upright",0,90,0,90,.1f,1,1,1);
|
||||
run("disabled",20,90,30,90,.1f,1,0,1);
|
||||
run("clean",20,90,30,90,.1f,1,1,0);
|
||||
puts("GODDARD_LEVELING_COMPLETE");return 0;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Guard Scooter frequency ownership and prepare copied positional sound probe."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import struct
|
||||
import subprocess
|
||||
from checkpoint_script_state import find_case, read_va
|
||||
from checkpoint_camera_audio_ui import EXE_SHA256, DLL_SHA256
|
||||
from pe_inspect import PE
|
||||
|
||||
RANGES=(('engine',0x412ed0,0x412f89),('channel_start',0x47d561,0x47d5f6),
|
||||
('position',0x47d9d0,0x47dc1e))
|
||||
DLL_RANGE=(0x1003bba0,0x1003bbfa)
|
||||
|
||||
def collect(original):
|
||||
original=Path(original);exe=PE(find_case(original,'Neutron.exe'));dll=PE(find_case(original,'OMT2.dll'))
|
||||
if hashlib.sha256(exe.data).hexdigest()!=EXE_SHA256 or hashlib.sha256(dll.data).hexdigest()!=DLL_SHA256:
|
||||
raise ValueError('Unexpected source identity')
|
||||
ranges=[dict(kind=k,va=hex(a),file_offset=hex(exe.offset(a-exe.base)),length=b-a,
|
||||
sha256=hashlib.sha256(read_va(exe,a,b-a)).hexdigest()) for k,a,b in RANGES]
|
||||
a,b=DLL_RANGE;ranges.append(dict(kind='dx_frequency',va=hex(a),file_offset=hex(dll.offset(a-dll.base)),length=b-a,
|
||||
sha256=hashlib.sha256(read_va(dll,a,b-a)).hexdigest()))
|
||||
constants={hex(va):struct.unpack('<'+fmt,read_va(exe,va,struct.calcsize(fmt)))[0]
|
||||
for va,fmt in ((0x495310,'d'),(0x495308,'d'),(0x49d5ac,'f'))}
|
||||
if constants!={'0x495310':1/1.9,'0x495308':51.,'0x49d5ac':.75}:raise ValueError('Changed pitch constants')
|
||||
return dict(exe_sha256=EXE_SHA256,dll_sha256=DLL_SHA256,ranges=ranges,constants=constants)
|
||||
|
||||
TEMPLATE=r'''
|
||||
#define main unused_grappler_main
|
||||
#include "grappler_scalar_probe.c"
|
||||
#undef main
|
||||
typedef struct{float x,y,z,w;}Vec;
|
||||
static unsigned char engine[0x80],channel[0x80],actor[0x100],camera[0x80];
|
||||
static uintptr_t channels[1],vtable[0x320/4],cvtable[0x30/4];
|
||||
static int frequency,calls;
|
||||
static Vec TC*root(void*self,Vec*out){(void)self;*out=(Vec){0,0,0,1};return out;}
|
||||
static void TC volume(void*self,int value){(void)self;(void)value;}
|
||||
static void TC pan(void*self,int value){(void)self;(void)value;}
|
||||
static void TC pitch(void*self,unsigned value){(void)self;frequency=value;calls++;}
|
||||
int main(void){
|
||||
map_source();
|
||||
const struct{uint32_t va,target;} reloc[]={/* RELOCATIONS */};
|
||||
for(unsigned i=0;i<sizeof(reloc)/sizeof(reloc[0]);i++){
|
||||
uint32_t value;memcpy(&value,AT(reloc[i].va),4);require(value==reloc[i].target,"absolute operand");
|
||||
value=(uintptr_t)AT(value);memcpy(AT(reloc[i].va),&value,4);
|
||||
}
|
||||
HMODULE dll=LoadLibraryA("Z:\\work\\game\\OMT2.dll");require(dll!=NULL,"copied OMT");
|
||||
*(void**)AT(0x48d104)=GetProcAddress(dll,"?quick_magnitude@OMedia3DVector@@QBEMXZ");
|
||||
*(void**)AT(0x48d10c)=GetProcAddress(dll,"?global@OMediaCosSinTable@@2V1@A");
|
||||
require(*(void**)AT(0x48d104)&&*(void**)AT(0x48d10c),"OMT exports");
|
||||
*(void**)AT(0x69600c)=engine;*(void**)(engine+0x40)=channels;channels[0]=(uintptr_t)channel;
|
||||
*(void**)channel=cvtable;cvtable[0x18/4]=(uintptr_t)volume;cvtable[0x1c/4]=(uintptr_t)pitch;cvtable[0x20/4]=(uintptr_t)pan;
|
||||
*(void**)actor=vtable;vtable[0x310/4]=(uintptr_t)root;*(void**)AT(0x695d9c)=actor;
|
||||
*(void**)AT(0x509a50)=camera;*AT(0x695e1c)=1;*(int*)AT(0x4f6b38)=255;
|
||||
const struct{int nominal;float distance,history;} cases[]={
|
||||
{11025,200,200},{11025,200,0},{11025,200,150},{11025,200,37},
|
||||
{50885,800,0},{50885,800,600},{11025,100,200},{7000,500,0},
|
||||
{11025,0,200},{11025,123.75f,100},{11025,100,123.75f}};
|
||||
for(unsigned i=0;i<sizeof(cases)/sizeof(cases[0]);i++){
|
||||
*(int*)AT(0x695e3c)=cases[i].nominal;F(0x695f84)=cases[i].history;
|
||||
*(float*)(camera+0x4c)=cases[i].distance;frequency=cases[i].nominal;calls=0;
|
||||
((void(*)(int))AT(0x47d9d0))(0);
|
||||
printf("POSITION in=%d,%.9g,%.9g out=%d,%.9g,%d\n",cases[i].nominal,cases[i].distance,cases[i].history,frequency,F(0x695f84),calls);
|
||||
}
|
||||
puts("SCOOTER_PITCH_COMPLETE");return 0;
|
||||
}
|
||||
'''
|
||||
|
||||
def generate(original,output):
|
||||
original=Path(original).resolve();output=Path(output).resolve()
|
||||
if output.is_relative_to(original) or original.is_relative_to(output):raise ValueError('Separate output required')
|
||||
report=collect(original);exe=PE(find_case(original,'Neutron.exe'))
|
||||
asm=subprocess.run(['objdump','-d','-Mintel','--start-address=0x47d9d0','--stop-address=0x47dc1e',str(exe.path)],capture_output=True,text=True,check=True).stdout
|
||||
targets={int(s,16) for s in re.findall(r'ds:0x([a-f0-9]+)',asm)}
|
||||
targets.update((0x695d9c,0x695e1c,0x695f84,0x695e3c))
|
||||
data=read_va(exe,0x47d9d0,0x24e);reloc=[]
|
||||
for t in sorted(targets):
|
||||
reloc.extend((0x47d9d0+m.start(),t) for m in re.finditer(re.escape(struct.pack('<I',t)),data))
|
||||
output.mkdir(parents=True,exist_ok=True)
|
||||
(output/'scooter_pitch_probe.c').write_text(TEMPLATE.replace('/* RELOCATIONS */',','.join('{0x%x,0x%x}'%r for r in reloc)))
|
||||
(output/'source.json').write_text(json.dumps(report,indent=2)+'\n')
|
||||
return report
|
||||
if __name__=='__main__':
|
||||
p=argparse.ArgumentParser();p.add_argument('original',type=Path);p.add_argument('--generate-probe',type=Path);a=p.parse_args()
|
||||
print(json.dumps(generate(a.original,a.generate_probe) if a.generate_probe else collect(a.original),indent=2))
|
||||
Reference in new issue
Block a user