Files
Neutron/docs/gameplay/scooter-pitch.md
T

87 lines
6.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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.