Restore Goddard leveling and Scooter positional pitch processing

This commit is contained in:
UnixNight committed 2026-11-04 18:27:56 -05:00
1 parent 74be19eb15
commit fccc0b9d1b
24 files changed
+967 -8

No files matched your search

@@ -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"
}
}