Match Jimmy controller arithmetic and facing to original probes

This commit is contained in:
UnixNight committed 2026-11-05 09:47:28 -05:00
1 parent 42ea2b8cd5
commit 0e2f426d42
60 files changed
+6027 -48

No files matched your search

@@ -84,6 +84,7 @@ var player=Simulation();
Check(player.UsesOriginalBody && player.PublishedSpeed==0,"tutorial explicitly selects source body");
for(var i=0;i<120;i++)player.Step(default);
Check(player.Grounded && player.Landings==0,"steady source support must not chatter");
Check(player.Velocity.Y==-250,"source support polygon admits the ground controller's downward pressure");
var sole=standing.Vertices.Min(v=>Vector3.Transform(v.Position,player.Model).Y);
Check(MathF.Abs(sole-player.Position.Y)<.001f,"modern sole/root render bridge remains explicit and stable");
var rootBefore=player.ActorRoot;
+1 -1
View File
@@ -80,7 +80,7 @@ Test("Bubble fire throttles without starting the ordinary ray",()=>{
var world=Floor();var p=Player("LV1B",world);var director=new SceneDirector(new("LV1B",[Entity("3JIM","JIM1")]),new TaskStates([]),(_,_)=>1);
var bag=new SceneInventory(new int[19]);bag.SetState(0,3,1);using var ray=new SceneGadgets(director,bag,p,world);
p.GadgetMode=0;for(var i=0;i<20;i++)p.Step(new(false,false,true,false,false,Fire:true));
Check(p.Speed>0&&p.TurnRate>0&&p.Pitch<0&&!ray.Ray.Visible&&!p.Shooting,"shared fire predicate is Bubble throttle, not shoot");
Check(p.Speed>0&&p.TurnRate>0&&MathF.IEEERemainder(p.Pitch,360)<0&&!ray.Ray.Visible&&!p.Shooting,"shared fire predicate is Bubble throttle, not shoot");
});
Test("lava bypass, retained entry and strict4-second debounce",()=>{
var state=new Vr01FloorState();var e=state.Visit(111,0);
+6 -3
View File
@@ -25,7 +25,8 @@ static void Attach()
using var f=new Fixture();f.Attach();
Check(f.G.Attached&&f.G.Attachments==1&&f.P.GadgetMode==7,"owned raw7");
Check(f.P.PhysicsSteps==1&&f.P.ControllerSteps==1,"both phases run once");
Check(f.P.Velocity.Y==100&&f.P.JumpState==0&&!f.G.SwingPose,"attachment impulse and next-input SWING");
Check(f.P.Velocity.Y==-150&&f.P.JumpState==0&&!f.G.SwingPose,
"fresh input writes attachment100 before supported ground apply subtracts250; SWING starts next input");
int body=f.P.PhysicsSteps;f.Binding.Step(default);
Check(f.P.PhysicsSteps==body+1&&f.G.SwingPose&&f.P.Pose==PlayerPose.Swing,"ordinary body and swing pose continue");
Check(float.IsFinite(f.P.ActorRoot.Length()),"finite attached root");
@@ -109,8 +110,10 @@ static void CameraStates()
}
static void Ownership()
{
using var f=new Fixture();f.Attach();var root=f.P.ActorRoot;
f.P.Step(default,false,false);Check(f.G.Attached&&f.G.Equipped&&f.P.ActorRoot!=root,"controlfalse still body, no generic release");
using var f=new Fixture();f.Attach();var physics=f.P.PhysicsSteps;
f.P.Step(default,false,false);
Check(f.G.Attached&&f.G.Equipped&&f.P.PhysicsSteps==physics+1&&f.P.Grounded,
"controlfalse still integrates the supported body without a generic gadget release or invented takeoff");
f.D.ReleasePlayerGadget();Check(!f.G.Attached&&!f.G.Equipped&&f.P.GadgetMode==-1,"namedJimmy selected cleanup");
f.I.Inventory.SelectGadget(7);f.D.Trigger("gr");Check(!f.G.Equipped,"actualVR08 intro MCA/CAM cleanup");
}
@@ -34,5 +34,8 @@
<Compile Include="../../src/GamePort/Game/GrapplerRay.cs" />
<Compile Include="../../src/GamePort/Game/RocketOrientation.cs" />
<Compile Include="../../src/GamePort/Game/OriginalHeading.cs" />
<Compile Include="../../src/GamePort/Game/JimmyGroundMotion.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyAirMotion.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyOrientation.cs"/>
</ItemGroup>
</Project>
@@ -0,0 +1,6 @@
<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"/>
<None Include="original-air-reference.json" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup>
</Project>
+26
View File
@@ -0,0 +1,26 @@
using System.Numerics;
using System.Text.Json;
using GamePort.Game;
using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-air-reference.json")));
int inputs=0,applies=0;
foreach(var c in doc.RootElement.GetProperty("cases").EnumerateArray())
{
var p=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray();string name=c.GetProperty("name").GetString()!;
if(c.GetProperty("kind").GetString()=="INPUT")
{
var result=JimmyAirMotion.Input(new(p[0],p[1],p[2]!=0),new(p[3]!=0,p[4]!=0,p[5]!=0,p[6]!=0,false),p[7]!=0,p[9],p[8]);
Near(result.Speed,o[0],name+" speed");Near(result.TurnRate,o[1],name+" turn");Check(result.KeyboardTurn==(o[2]!=0),name+" keyboard latch");inputs++;
}
else
{
var result=JimmyAirMotion.Apply(p[0],p[7],new(p[4],p[5],p[6]),new(p[1],p[2],p[3]),p[9],p[8]);
NearV(result.Velocity,new(o[0],o[1],o[2]),name+" velocity");NearV(result.Rotation,new(o[3],o[4],o[5]),name+" Euler");Near(result.AppliedTurnRate,o[6],name+" rate");applies++;
}
}
Check(inputs==22&&applies==13,"complete original observations");
Console.WriteLine("PASS22 copied-original airborne keyboard-input observations, including supported mode1, coast boundary and latch");
Console.WriteLine("PASS13 copied-original air velocity/Euler observations, including zero velocity, pitch, seam and original vertical preservation");
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)<.005f,$"{name}: {a} != {b}");
static void NearV(Vector3 a,Vector3 b,string name)=>Check(float.IsFinite(a.X+a.Y+a.Z)&&Vector3.Distance(a,b)<.04f,$"{name}: {a} != {b}");
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,510 @@
{
"source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
"ranges": [
{
"va": "0x439900",
"file_offset": "0x39900",
"length": 1207,
"sha256": "e6fd687cd797d004d9584bb7b6c004def933b9c496ef17a19a607be5c05e1236"
},
{
"va": "0x437f90",
"file_offset": "0x37f90",
"length": 410,
"sha256": "0d65625eea1015707e9d5001196c15a945cb93b14b03cd022d98687778c9846c"
},
{
"va": "0x4723f0",
"file_offset": "0x723f0",
"length": 48,
"sha256": "ae10074b5ae2ff3d2d2ce8c16358476acdba2f2a166be8ad5c9f05e3f55ffc23"
},
{
"va": "0x472480",
"file_offset": "0x72480",
"length": 240,
"sha256": "406c3904538abe07d88ca440e39ca56c00765d0871943991ba7b792da4803c16"
},
{
"va": "0x472b10",
"file_offset": "0x72b10",
"length": 256,
"sha256": "ee9516aef07738fcf7da370af74185f7522686759218ad1bf4d93be46f0c28b2"
}
],
"relocations": [
{
"va": 4431078,
"target": 4772864
},
{
"va": 4431266,
"target": 4772868
},
{
"va": 4430132,
"target": 4774164
},
{
"va": 4430237,
"target": 4774164
},
{
"va": 4430275,
"target": 4774164
},
{
"va": 4430306,
"target": 4774164
},
{
"va": 4430344,
"target": 4774164
},
{
"va": 4430786,
"target": 4774164
},
{
"va": 4430885,
"target": 4774164
},
{
"va": 4430957,
"target": 4774164
},
{
"va": 4430978,
"target": 4774164
},
{
"va": 4431009,
"target": 4774164
},
{
"va": 4430443,
"target": 4774180
},
{
"va": 4430202,
"target": 4774216
},
{
"va": 4430495,
"target": 4774216
},
{
"va": 4430608,
"target": 4774216
},
{
"va": 4430738,
"target": 4774216
},
{
"va": 4430805,
"target": 4774216
},
{
"va": 4430939,
"target": 4774216
},
{
"va": 4430167,
"target": 4774220
},
{
"va": 4430845,
"target": 4774220
},
{
"va": 4430257,
"target": 4774252
},
{
"va": 4430326,
"target": 4774252
},
{
"va": 4430372,
"target": 4774252
},
{
"va": 4430396,
"target": 4774252
},
{
"va": 4430713,
"target": 4838876
},
{
"va": 4430512,
"target": 4848340
},
{
"va": 4431047,
"target": 4865656
},
{
"va": 4431235,
"target": 4914472
},
{
"va": 4431115,
"target": 4914476
},
{
"va": 4431162,
"target": 4914476
},
{
"va": 4430862,
"target": 4914480
},
{
"va": 4430149,
"target": 5281885
},
{
"va": 4430471,
"target": 5281886
},
{
"va": 4430594,
"target": 5281886
},
{
"va": 4430184,
"target": 5281887
},
{
"va": 4430831,
"target": 5281888
},
{
"va": 4430161,
"target": 5282464
},
{
"va": 4430196,
"target": 5282464
},
{
"va": 4430489,
"target": 5282468
},
{
"va": 4430602,
"target": 5282468
},
{
"va": 4430839,
"target": 5282468
},
{
"va": 4423800,
"target": 4772108
},
{
"va": 4423682,
"target": 4774164
},
{
"va": 4423741,
"target": 4774180
},
{
"va": 4423789,
"target": 4777448
},
{
"va": 4423753,
"target": 4838840
},
{
"va": 4662415,
"target": 4774164
},
{
"va": 4662490,
"target": 4774164
},
{
"va": 4662565,
"target": 4774164
},
{
"va": 4662455,
"target": 4777412
},
{
"va": 4662468,
"target": 4777412
},
{
"va": 4662530,
"target": 4777412
},
{
"va": 4662543,
"target": 4777412
},
{
"va": 4662613,
"target": 4777412
},
{
"va": 4662626,
"target": 4777412
},
{
"va": 4664145,
"target": 4772108
},
{
"va": 4664108,
"target": 4777448
},
{
"va": 4664119,
"target": 4777448
},
{
"va": 4664132,
"target": 4777448
}
],
"target_range": {
"va": "0x439db7",
"file_offset": "0x39db7",
"length": 124,
"sha256": "202e8ef05e362b5745f6a501d69aa840f06bd348df4c3377d72fc64d0b0e7310"
},
"scope": "Copied439900 through439E33; synthetic destination writer, actor/body/input and zero mouse; no camera, facing update, physics, game entrypoint or full trajectory.",
"cases": [
{
"input": [
0.0,
0.0,
0.0,
0.0,
300.0,
0.0,
-40.0,
10.0
],
"observed": [
0.0,
45.0,
-0.0,
1.0
]
},
{
"input": [
1.0,
0.0,
0.0,
0.0,
300.0,
0.0,
-40.0,
10.0
],
"observed": [
-40.0,
45.0,
-0.0,
1.0
]
},
{
"input": [
0.0,
1.0,
0.0,
0.0,
300.0,
0.0,
-40.0,
10.0
],
"observed": [
10.0,
45.0,
-0.0,
1.0
]
},
{
"input": [
1.0,
1.0,
0.0,
0.0,
300.0,
0.0,
-40.0,
10.0
],
"observed": [
-40.0,
45.0,
-0.0,
1.0
]
},
{
"input": [
0.0,
0.0,
1.0,
0.0,
300.0,
0.0,
-40.0,
10.0
],
"observed": [
0.0,
45.0,
-1.66666675,
1.0
]
},
{
"input": [
0.0,
0.0,
0.0,
1.0,
300.0,
0.0,
-40.0,
10.0
],
"observed": [
0.0,
45.0,
1.66666675,
1.0
]
},
{
"input": [
1.0,
0.0,
1.0,
0.0,
300.0,
0.0,
-40.0,
10.0
],
"observed": [
-40.0,
45.0,
-1.66666675,
1.0
]
},
{
"input": [
0.0,
1.0,
0.0,
1.0,
300.0,
0.0,
-40.0,
10.0
],
"observed": [
10.0,
45.0,
1.66666675,
1.0
]
},
{
"input": [
0.0,
1.0,
0.0,
0.0,
0.0,
1.0,
-40.0,
10.0
],
"observed": [
10.0,
45.0,
-0.0,
1.0
]
},
{
"input": [
1.0,
0.0,
0.0,
0.0,
700.0,
1.0,
-40.0,
10.0
],
"observed": [
-40.0,
45.0,
-0.0,
1.0
]
},
{
"input": [
1.0,
0.0,
0.0,
0.0,
300.0,
0.0,
0.0,
0.0
],
"observed": [
0.0,
45.0,
-0.0,
1.0
]
},
{
"input": [
0.0,
1.0,
0.0,
0.0,
300.0,
0.0,
-13.0,
7.0
],
"observed": [
7.0,
45.0,
-0.0,
1.0
]
}
],
"files": {
"tools/binary/jimmy_air_targets.py": "393a30df077845f55f3ba6e9f93ecbf206a73cae5a77eee9ff7ba9d0c2db8bf7",
"tools/binary/jimmy_air_targets_probe.c": "c63d98fb4a28c0e77da15a6c49dd8cc87ae5516358f35784ebc32957a7c02471",
"tools/binary/jimmy_air_motion_probe.c": "4f825d33dcf161d2a119d06f288db384ecb2468d36c4ae8f668fbeacbfc8eb6e",
"tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810",
"artifacts/jimmy-air-targets/jimmy_air_targets_probe.exe": "c491683ae810d9d44fb31ed0fdab319016d9a3bea6654412737ecf1db10103ae",
"artifacts/jimmy-air-targets/probe/wine.log": "1de345403a421435211e389d2b16c5f1b8bd9914a6de7eb2e6f75f4cb7cb08a2"
}
}
@@ -0,0 +1,7 @@
<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"/>
<None Include="original-ground-reference.json" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup>
</Project>
@@ -0,0 +1,29 @@
using System.Numerics;
using System.Text.Json;
using GamePort.Game;
using var document=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-ground-reference.json")));
int inputs=0,applies=0;
foreach(var c in document.RootElement.GetProperty("cases").EnumerateArray())
{
var p=c.GetProperty("input").EnumerateArray().Select(v=>v.GetSingle()).ToArray();
var o=c.GetProperty("observed").EnumerateArray().Select(v=>v.GetSingle()).ToArray();string name=c.GetProperty("name").GetString()!;
if(c.GetProperty("kind").GetString()=="INPUT")
{
var r=JimmyGroundMotion.Input(new(p[0],0,p[6],p[7]!=0),p[5],new(p[1]!=0,p[2]!=0,p[3]!=0,p[4]!=0,false));
Near(r.State.Speed,o[0],name+" scalar");Near(r.Lateral,o[1],name+" side");Near(r.State.TargetYaw,o[2],name+" heading");
Check(r.State.AutoTurning==(o[3]!=0),name+" latch");inputs++;
}
else
{
var r=JimmyGroundMotion.Apply(p[0],new(p[1],p[2],p[3]),new(p[4],p[5],p[6]),p[7],p[8],p[9]!=0,p[10]!=0,p[11]);
Near(r.Velocity.X,o[0],name+" X");Near(r.Velocity.Y,o[1],name+" Y");Near(r.Velocity.Z,o[2],name+" Z");Near(r.Rotation.Y,o[3],name+" yaw");applies++;
}
}
Check(inputs==17&&applies==8,"complete25 native observations");Console.WriteLine("PASS17 original ground-input observations and8 ground-apply observations");
var active=JimmyGroundMotion.Input(new(100,130),90,new(true,false,false,false,false));Check(active.State.TargetYaw==90,"active forward stops previous destination-yaw drift");
var idle=JimmyGroundMotion.Input(new(100,130),90,default);Check(idle.State.TargetYaw==130,"idle retains prior destination yaw");
var fire=JimmyGroundMotion.Input(new(100,90),90,new(false,true,false,false,false,Fire:true),blockBackward:true);
Check(fire.State.Speed==65&&!fire.HeadingUpdated,"source parent fire acceptance gate suppresses backward");
Console.WriteLine("PASS heading publication and caller-owned backward/fire gate");
static void Check(bool condition,string name){if(!condition)throw new Exception(name);}
static void Near(float value,float expected,string name)=>Check(float.IsFinite(value)&&Math.Abs(value-expected)<.02f,$"{name}: {value} != {expected}");
@@ -0,0 +1,584 @@
{
"source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
"ranges": [
{
"va": "0x43915d",
"file_offset": "0x3915d",
"length": 1138,
"sha256": "5d59e3d539ed3cd160bbbe5f49c03b2bd7085167fecfc9319aa1a73d98422bad"
},
{
"va": "0x437c40",
"file_offset": "0x37c40",
"length": 831,
"sha256": "d61d6696fe5ca9ae955fb8c4a5ed551582e709ce914b7e25e26c7fe5721630b6"
},
{
"va": "0x4723f0",
"file_offset": "0x723f0",
"length": 48,
"sha256": "ae10074b5ae2ff3d2d2ce8c16358476acdba2f2a166be8ad5c9f05e3f55ffc23"
},
{
"va": "0x472480",
"file_offset": "0x72480",
"length": 240,
"sha256": "406c3904538abe07d88ca440e39ca56c00765d0871943991ba7b792da4803c16"
},
{
"va": "0x472b10",
"file_offset": "0x72b10",
"length": 256,
"sha256": "ee9516aef07738fcf7da370af74185f7522686759218ad1bf4d93be46f0c28b2"
},
{
"va": "0x476ff0",
"file_offset": "0x76ff0",
"length": 1184,
"sha256": "fb184f561d9aace113da3a8bff9dd2d2effceb9233507aeb1018b5cbde82cb94"
}
],
"scope": "Copied43915D keyboard suffix and complete437C40, synthetic actor/body/support/animations and original OMT vector/trig. No input prefix/camera/game entrypoint; back-timer values are explicit test inputs.",
"files": {
"tools/binary/jimmy_ground_motion.py": "24ac3673c567f3c2d1cb2010a7cffa2ec4feb600144ffc739a52e8eba9124ed1",
"tools/binary/jimmy_ground_motion_probe.c": "9d331a791e5a52ccf03cd566abb44b211a978d47903f3a428ccd1ad44e3e55ee",
"tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810",
"artifacts/jimmy-ground-audit/jimmy_ground_motion_probe.exe": "04eb9135202420d6c6639f060fa3d1272c6e4bf4ee336de7c4a2f6d916d54f94",
"artifacts/jimmy-ground-audit/probe/wine.log": "2f4aa1d3050629214257012e213682de585a6d7a2db82becffb276cf188ee3ad"
},
"cases": [
{
"kind": "INPUT",
"name": "up",
"input": [
0.0,
1.0,
0.0,
0.0,
0.0,
90.0,
0.0,
0.0
],
"observed": [
30.0,
0.0,
90.0,
0.0
]
},
{
"kind": "INPUT",
"name": "left",
"input": [
0.0,
0.0,
0.0,
1.0,
0.0,
90.0,
0.0,
0.0
],
"observed": [
0.0,
-1000.0,
110.0,
0.0
]
},
{
"kind": "INPUT",
"name": "right",
"input": [
0.0,
0.0,
0.0,
0.0,
1.0,
90.0,
0.0,
0.0
],
"observed": [
0.0,
1000.0,
70.0,
0.0
]
},
{
"kind": "INPUT",
"name": "upleft",
"input": [
100.0,
1.0,
0.0,
1.0,
0.0,
90.0,
0.0,
0.0
],
"observed": [
160.0,
-1000.0,
100.0,
0.0
]
},
{
"kind": "INPUT",
"name": "upright",
"input": [
100.0,
1.0,
0.0,
0.0,
1.0,
90.0,
0.0,
0.0
],
"observed": [
160.0,
1000.0,
80.0,
0.0
]
},
{
"kind": "INPUT",
"name": "bothturn",
"input": [
100.0,
1.0,
0.0,
1.0,
1.0,
90.0,
0.0,
0.0
],
"observed": [
160.0,
-1000.0,
100.0,
0.0
]
},
{
"kind": "INPUT",
"name": "back",
"input": [
0.0,
0.0,
1.0,
0.0,
0.0,
90.0,
0.0,
0.0
],
"observed": [
-52.5,
0.0,
90.0,
0.0
]
},
{
"kind": "INPUT",
"name": "all",
"input": [
100.0,
1.0,
1.0,
1.0,
1.0,
90.0,
0.0,
0.0
],
"observed": [
107.5,
-1000.0,
100.0,
0.0
]
},
{
"kind": "INPUT",
"name": "release",
"input": [
100.0,
0.0,
0.0,
0.0,
0.0,
90.0,
0.0,
0.0
],
"observed": [
65.0,
0.0,
0.0,
0.0
]
},
{
"kind": "INPUT",
"name": "negative",
"input": [
-20.0,
0.0,
0.0,
0.0,
0.0,
90.0,
0.0,
0.0
],
"observed": [
0.0,
0.0,
0.0,
0.0
]
},
{
"kind": "INPUT",
"name": "cross",
"input": [
20.0,
0.0,
0.0,
0.0,
0.0,
90.0,
0.0,
0.0
],
"observed": [
0.0,
0.0,
0.0,
0.0
]
},
{
"kind": "INPUT",
"name": "overcap",
"input": [
700.0,
1.0,
0.0,
0.0,
0.0,
90.0,
0.0,
0.0
],
"observed": [
700.0,
0.0,
90.0,
0.0
]
},
{
"kind": "INPUT",
"name": "turnovercap",
"input": [
700.0,
1.0,
0.0,
1.0,
0.0,
90.0,
0.0,
0.0
],
"observed": [
700.0,
-1000.0,
100.0,
0.0
]
},
{
"kind": "INPUT",
"name": "backcap",
"input": [
-299.0,
0.0,
1.0,
0.0,
0.0,
90.0,
0.0,
0.0
],
"observed": [
-300.0,
0.0,
90.0,
0.0
]
},
{
"kind": "INPUT",
"name": "backequal",
"input": [
0.0,
0.0,
1.0,
0.0,
0.0,
90.0,
1.5,
0.0
],
"observed": [
-52.5,
0.0,
90.0,
0.0
]
},
{
"kind": "INPUT",
"name": "backturn",
"input": [
0.0,
0.0,
1.0,
0.0,
0.0,
90.0,
1.50999999,
0.0
],
"observed": [
600.0,
0.0,
270.0,
1.0
]
},
{
"kind": "INPUT",
"name": "latched",
"input": [
0.0,
0.0,
1.0,
1.0,
0.0,
90.0,
2.0,
1.0
],
"observed": [
600.0,
-1000.0,
80.0,
1.0
]
},
{
"kind": "APPLY",
"name": "rest",
"input": [
300.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.100000001
],
"observed": [
0.0,
0.0,
300.0,
0.0
]
},
{
"kind": "APPLY",
"name": "stationaryturn",
"input": [
300.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
20.0,
0.0,
0.0,
0.0,
0.100000001
],
"observed": [
0.0,
0.0,
300.0,
0.0
]
},
{
"kind": "APPLY",
"name": "side",
"input": [
300.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
-1000.0,
0.0,
0.0,
0.100000001
],
"observed": [
-100.0,
0.0,
300.0,
0.0
]
},
{
"kind": "APPLY",
"name": "turn",
"input": [
300.0,
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
20.0,
0.0,
0.0,
0.0,
0.100000001
],
"observed": [
-7.80225086,
0.0,
299.9104,
2.0
]
},
{
"kind": "APPLY",
"name": "tilt",
"input": [
300.0,
0.0,
13.0,
1.0,
30.0,
45.0,
20.0,
0.0,
0.0,
0.0,
0.0,
0.100000001
],
"observed": [
-183.725281,
13.0,
183.725281,
45.0
]
},
{
"kind": "APPLY",
"name": "ground",
"input": [
300.0,
0.0,
13.0,
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
1.0,
0.100000001
],
"observed": [
0.0,
-237.0,
300.0,
0.0
]
},
{
"kind": "APPLY",
"name": "ground_nopoly",
"input": [
300.0,
0.0,
13.0,
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.100000001
],
"observed": [
0.0,
13.0,
300.0,
0.0
]
},
{
"kind": "APPLY",
"name": "fall",
"input": [
300.0,
0.0,
-13.0,
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.100000001
],
"observed": [
0.0,
-13.0,
300.0,
0.0
]
}
],
"dll_sha256": "3ec41ead011adf56387a6dbd4580e5b5a9721b5f8020c8a56420f42824354943"
}
@@ -0,0 +1,6 @@
<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/JetpackBurst.cs"/>
<None Include="original-jump-reference.json" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup>
</Project>
+18
View File
@@ -0,0 +1,18 @@
using System.Text.Json;
using GamePort.Game;
using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-jump-reference.json")));
int compared=0;
foreach(var c in doc.RootElement.GetProperty("cases").EnumerateArray())
{
var p=c.GetProperty("input").EnumerateArray().ToArray();var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
float F(int i)=>p[i].GetSingle();bool B(int i)=>F(i)!=0;
var input=new JetpackBurstInput(B(3),B(4),F(5),F(6),(int)F(7),F(8),p[9].GetString()!,(int)F(10),F(11),F(12),B(13));
var r=JetpackBurst.Step(new((int)F(0),F(1),F(2)),input);string name=c.GetProperty("name").GetString()!;
Near(r.State.JumpState,o[0],name+" state");Near(r.State.HoldSeconds,o[1],name+" hold");Near(r.State.EffectRemaining,o[2],name+" timer");
Near(r.ImpulseY,o[3],name+" impulse");Near(r.VelocityYOverride??input.VelocityY,o[4],name+" vertical");Near(r.ExtraAccelerationY,o[5],name+" acceleration");
Near((int)r.Pose,o[6],name+" animation");Check(r.StartGadget==(o[7]!=0)&&r.StopGadget==(o[8]!=0),name+" effect calls");
Near(r.RadiusOverride??60,o[9],name+" radius");Check(r.RadiusOverride.HasValue==(o[10]!=0),name+" radius write");compared++;
}
Check(compared==32,"complete native fixture");Console.WriteLine("PASS32 copied-original jump/hold/release/landing/jetpack suffix observations");
static void Check(bool condition,string message){if(!condition)throw new Exception(message);}
static void Near(float a,float b,string message)=>Check(MathF.Abs(a-b)<.0002f,$"{message}: {a} != {b}");
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,6 @@
<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/JimmyOrientation.cs"/><Compile Include="../../src/GamePort/Game/RocketOrientation.cs"/>
<None Include="original-orientation-reference.json" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup>
</Project>
@@ -0,0 +1,24 @@
using System.Numerics;
using System.Text.Json;
using GamePort.Game;
using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-orientation-reference.json")));
int count=0;
foreach(var c in doc.RootElement.GetProperty("cases").EnumerateArray())
{
var p=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
var current=new Vector3(p[0],p[1],p[2]);var target=new Vector3(p[3],p[4],p[5]);
bool dirty=p[9]!=0;
for(int i=0;i<(int)p[7];i++)
{
var before=current;current=JimmyOrientation.Step(current,target,p[6],p[8]!=0,dirty);
if(p[8]!=0&&dirty)dirty=before!=target;
}
Check(Vector3.Distance(current,new(o[0],o[1],o[2]))<.001f,$"{c.GetProperty("name").GetString()}: {current} != {o[0]},{o[1]},{o[2]}");count++;
}
Check(count==16,"all original orientation cases");
Console.WriteLine("PASS16 copied-original Jimmy facing observations: shortest arcs,180 boundaries, negative normalization, gate retention and repeated settling");
var retained=new Vector3(0,10,0);JimmyOrientation.Step(new(350),retained,1f/60);
Check(retained==new Vector3(0,10,0),"step does not mutate destination state");
Console.WriteLine("PASS retained target state remains independent of current Euler");
static void Check(bool ok,string name){if(!ok)throw new Exception(name);}
@@ -0,0 +1,374 @@
{
"source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
"ranges": [
{
"va": "0x43a420",
"file_offset": "0x3a420",
"length": 431,
"sha256": "e052ee855e625d03a3317dcc7d507081c7519576381afa5741572157e5ffb988"
},
{
"va": "0x458f90",
"file_offset": "0x58f90",
"length": 38,
"sha256": "7f014c2a630c2e257513df09ab56595ad0fdcf892ea623d483148c002c6931c2"
},
{
"va": "0x472480",
"file_offset": "0x72480",
"length": 240,
"sha256": "406c3904538abe07d88ca440e39ca56c00765d0871943991ba7b792da4803c16"
}
],
"constants": {
"0x4afcf0": 3.7,
"0x4afd38": 4.5
},
"scope": "Copied43A420/458F90/472480, synthetic enabled/dirty actor; no original AI/body/game entrypoint.",
"rea_evidence": "ev_0d64cc58fa8f5573fc8e61e0f2c20e36288099212bd2257d3a3121361fd6c904",
"files": {
"tools/binary/jimmy_orientation.py": "3dab00935c844af6b8792d87923294ae3eb660e4a0a1744836b02e9e81152964",
"tools/binary/jimmy_orientation_probe.c": "b3c194090e58665fbd071e0515a93221057a8a385b0f34e76e57ee5a9274e241",
"tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810",
"artifacts/jimmy-orientation-audit/jimmy_orientation_probe.exe": "b58b0f9bf54c9201abd911a6da75375f9d14422378f3bbf48ff25676b398fc78",
"artifacts/jimmy-orientation-audit/probe/wine.log": "9bc970a46ac7bed33507d4f1388680d478f306667fda3256041fbcdc4f2354b4"
},
"cases": [
{
"name": "ordinary",
"input": [
10.0,
20.0,
30.0,
0.0,
30.0,
0.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
5.5,
23.7000008,
16.5,
1.0
]
},
{
"name": "level",
"input": [
338.0,
90.0,
338.0,
0.0,
90.0,
0.0,
0.0166666675,
1.0,
1.0,
1.0
],
"observed": [
339.649994,
90.0,
339.649994,
1.0
]
},
{
"name": "seam",
"input": [
359.0,
359.0,
359.0,
1.0,
1.0,
1.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
359.899994,
359.73999,
359.899994,
1.0
]
},
{
"name": "opposite_seam",
"input": [
1.0,
1.0,
1.0,
359.0,
359.0,
359.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
0.0999999642,
0.25999999,
0.0999999642,
1.0
]
},
{
"name": "negative",
"input": [
-20.0,
-10.0,
-30.0,
0.0,
20.0,
0.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
349.0,
1.10000038,
344.0,
1.0
]
},
{
"name": "equal180",
"input": [
180.0,
180.0,
180.0,
0.0,
0.0,
0.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
99.0,
113.400002,
99.0,
1.0
]
},
{
"name": "positive180",
"input": [
0.0,
0.0,
0.0,
180.0,
180.0,
180.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
81.0,
66.5999985,
81.0,
1.0
]
},
{
"name": "over180",
"input": [
181.0,
181.0,
181.0,
0.0,
0.0,
0.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
261.549988,
247.230011,
261.549988,
1.0
]
},
{
"name": "canonical360",
"input": [
360.0,
360.0,
360.0,
0.0,
0.0,
0.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
360.0,
360.0,
360.0,
1.0
]
},
{
"name": "fractional",
"input": [
0.00100000005,
359.998993,
0.00100000005,
359.998993,
0.00100000005,
359.998993,
0.370000005,
1.0,
1.0,
1.0
],
"observed": [
360.0,
0.00175030529,
360.0,
1.0
]
},
{
"name": "tiny",
"input": [
0.00999999978,
0.00999999978,
0.00999999978,
0.0,
0.0,
0.0,
0.0166666675,
1.0,
1.0,
1.0
],
"observed": [
0.00925000012,
0.00938333292,
0.00925000012,
1.0
]
},
{
"name": "settle",
"input": [
338.0,
359.0,
338.0,
0.0,
1.0,
0.0,
0.0166666675,
120.0,
1.0,
1.0
],
"observed": [
359.998077,
0.999036431,
359.998077,
1.0
]
},
{
"name": "upright",
"input": [
0.0,
90.0,
0.0,
0.0,
90.0,
0.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
0.0,
90.0,
0.0,
0.0
]
},
{
"name": "disabled",
"input": [
20.0,
90.0,
30.0,
0.0,
0.0,
0.0,
0.100000001,
1.0,
0.0,
1.0
],
"observed": [
20.0,
90.0,
30.0,
1.0
]
},
{
"name": "clean",
"input": [
20.0,
90.0,
30.0,
0.0,
0.0,
0.0,
0.100000001,
1.0,
1.0,
0.0
],
"observed": [
20.0,
90.0,
30.0,
0.0
]
},
{
"name": "zero_dt",
"input": [
20.0,
90.0,
30.0,
0.0,
0.0,
0.0,
0.0,
1.0,
1.0,
1.0
],
"observed": [
20.0,
90.0,
30.0,
1.0
]
}
]
}
+37 -4
View File
@@ -18,6 +18,7 @@ var tests = new (string Name, Action Check)[]
("turn-only speed, forward acceleration/cap and release", SpeedLimits),
("backpedal cap and release", Backpedal),
("yaw sign, forward half-turn and left precedence", Turning),
("active heading clears stale turn while control lock retains facing", FacingOwnership),
("fixed-step input replay independent of presentation rate", ReplayRates),
("jump rises, falls and returns to support", JumpLanding),
("held zero-burn jump repeats and release stops repetition", HeldJump),
@@ -358,8 +359,9 @@ static void Turning()
left.Step(new(false, false, true, false, false));
right.Step(new(false, false, false, true, false));
forwardLeft.Step(new(true, false, true, false, false));
Check(left.Yaw > 0 && right.Yaw < 0, "left/right yaw signs");
Near(left.Yaw, -right.Yaw, .00001f, "opposed keyboard yaw symmetry");
Check(left.Yaw > 0 && MathF.IEEERemainder(right.Yaw,360)<0, "left/right yaw directions across source wrap");
Near(left.Yaw, 1.2333333f, .00001f, "left facing increment");
Near(right.Yaw, 359, .00001f, "source negative-add truncation at zero seam");
Near(forwardLeft.Yaw, left.Yaw / 2, .00001f, "Up halves target turn offset");
Near(forwardLeft.Speed, 60, 0, "Up plus turn performs both speed increments");
Check(left.Velocity.X < 0 && right.Velocity.X > 0, "keyboard side-velocity signs for next physics pass");
@@ -375,6 +377,37 @@ static void Turning()
SameState(both, leftOnly, "Left has precedence when Left and Right are held together");
}
static void FacingOwnership()
{
var active = FlatSimulation();
var neutral = FlatSimulation();
foreach (var simulation in new[] { active, neutral })
for (var tick = 0; tick < 12; tick++) simulation.Step(new(false, false, true, false, false));
var heading = active.Yaw;
active.Step(new(true, false, false, false, false));
neutral.Step(default);
Near(active.Yaw, heading, .0001f, "Up writes current heading instead of retaining the old turn destination");
Check(neutral.Yaw > heading, "neutral input retains the prior facing destination");
var locked = FlatSimulation();
locked.Step(new(false, false, true, false, false));
locked.PrepareForScript();
var before = locked.Yaw;
locked.Step(new(true, false, false, true, true), controlled: false);
Check(locked.Yaw > before && locked.Speed == 0 && locked.ControllerSteps == 1 && locked.Jumps == 0,
"base facing advances its retained target during control lock while input and jump remain gated");
var tilted = FlatSimulation();
tilted.SeedBubbleTilt(new(350, 0, 10));
tilted.Step(new(true, false, false, false, false));
Check(tilted.Pitch > 350 && tilted.Pitch < 351 && tilted.Roll < 10 && tilted.Roll > 9,
"ground heading levels all axes by the shortest arc through the zero seam");
var pitch = tilted.Pitch;
tilted.Step(default, controlled: false);
Check(tilted.Pitch > pitch && tilted.Roll < 9.25f,
"pitch and roll settling belong to the same control-independent facing phase");
}
static void ReplayRates()
{
LabSimulation? reference = null;
@@ -412,7 +445,7 @@ static void JumpLanding()
Check(sawFall && largestHeight - floor > 100, "jump rises and enters descending phase");
Check(simulation.Grounded && simulation.Jumps == 1 && simulation.Landings == 1, "released jump lands once");
Near(simulation.Position.Y, floor, .01f, "landing returns feet to supporting floor");
Near(simulation.Velocity.Y, 0, 0, "landing clears downward velocity");
Near(simulation.Velocity.Y, 0, 0, "capsule compatibility landing retains its baseline vertical velocity");
}
static void HeldJump()
@@ -489,7 +522,7 @@ static void JetpackControl()
right.Step(new(true, false, false, true, true));
Check(!left.Grounded && left.JetpackEffectVisible, "steering occurs during powered flight");
}
Check(straight.Position.Z > 400 && left.Yaw > 20 && right.Yaw < -20,
Check(straight.Position.Z > 400 && left.Yaw > 20 && MathF.IEEERemainder(right.Yaw,360)<-20,
"powered Up moves from rest and Left/Right turn while airborne");
Check(left.Position.X < -50 && right.Position.X > 50 && left.Position.Y > initialHeight,
"powered paths change direction and retain vertical lift");
@@ -42,5 +42,8 @@
<Compile Include="../../src/GamePort/Game/ScooterCamera.cs"/>
<Compile Include="../../src/GamePort/Game/ScooterMotion.cs"/>
<Compile Include="../../src/GamePort/Game/ScooterWheels.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyGroundMotion.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyAirMotion.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyOrientation.cs"/>
</ItemGroup>
</Project>
+42
View File
@@ -0,0 +1,42 @@
"""Authoritative source guards and copied-original airborne probe provenance."""
from pathlib import Path
import collections,hashlib,json,sys,unittest
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'tools/binary'))
from jimmy_air_motion import collect
from jimmy_air_targets import collect as collect_targets
class JimmyAirMotionEvidence(unittest.TestCase):
def test_destination_writer_original_observations(self):
fixture=json.loads((ROOT/'tests/GamePort.JimmyAirTests/original-air-targets-reference.json').read_text())
actual=collect_targets(ROOT.parent/'Original')
for key in ('source_sha256','ranges','relocations','target_range'):
self.assertEqual(actual[key],fixture[key])
self.assertEqual(len(fixture['cases']),12)
for file,digest in fixture['files'].items():
if file.startswith('tools/'):
self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),digest)
# These are recovered target writes, not a live-port conformance claim.
cases=fixture['cases']
self.assertEqual(cases[1]['observed'],[-40,45,0,1])
self.assertEqual(cases[2]['observed'],[10,45,0,1])
self.assertEqual(cases[3]['observed'],[-40,45,0,1])
self.assertEqual(cases[10]['observed'],[0,45,0,1])
self.assertEqual(cases[11]['observed'],[7,45,0,1])
def test_source_identity_ranges_and_offsets(self):
actual=collect(ROOT.parent/'Original');fixture=json.loads((ROOT/'tests/GamePort.JimmyAirTests/original-air-reference.json').read_text())
self.assertEqual(actual['source_sha256'],fixture['source_sha256']);self.assertEqual(actual['ranges'],fixture['ranges'])
self.assertEqual(actual['relocations'],fixture['relocations'])
self.assertEqual(len(actual['ranges']),5)
for row in actual['ranges']:self.assertEqual(int(row['file_offset'],16),int(row['va'],16)-0x400000)
def test_complete_observations_and_generator_provenance(self):
fixture=json.loads((ROOT/'tests/GamePort.JimmyAirTests/original-air-reference.json').read_text())
self.assertEqual(collections.Counter(c['kind'] for c in fixture['cases']),dict(INPUT=22,APPLY=13))
for file,digest in fixture['files'].items():
self.assertEqual(len(digest),64)
if file.startswith('tools/'):self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),digest)
cases={(c['kind'],c['name']):c for c in fixture['cases']}
self.assertEqual(cases['INPUT','overspeed']['observed'][0],700)
self.assertEqual(cases['INPUT','ground_small']['observed'][0],-12.5)
self.assertEqual(cases['INPUT','no_latch']['observed'][1],20)
self.assertEqual(cases['APPLY','rest']['observed'],[0,0,300,0,0,0,0])
if __name__=='__main__':unittest.main()
+24
View File
@@ -0,0 +1,24 @@
"""Source/provenance guards for original Jimmy keyboard-ground components."""
from pathlib import Path
import collections,hashlib,json,sys,unittest
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'tools/binary'))
from jimmy_ground_motion import collect
class JimmyGroundEvidence(unittest.TestCase):
def test_original_identity_ranges_and_offsets(self):
source=collect(ROOT.parent/'Original');fixture=json.loads((ROOT/'tests/GamePort.JimmyGroundTests/original-ground-reference.json').read_text())
for field in ('source_sha256','dll_sha256','ranges'):self.assertEqual(source[field],fixture[field])
self.assertEqual(len(source['ranges']),6)
for row in source['ranges']:self.assertEqual(int(row['file_offset'],16),int(row['va'],16)-0x400000)
def test_probe_provenance_and_complete_native_observations(self):
fixture=json.loads((ROOT/'tests/GamePort.JimmyGroundTests/original-ground-reference.json').read_text())
for path,digest in fixture['files'].items():
if path.startswith('tools/'):self.assertEqual(hashlib.sha256((ROOT/path).read_bytes()).hexdigest(),digest)
self.assertEqual(collections.Counter(c['kind'] for c in fixture['cases']),dict(INPUT=17,APPLY=8))
rows={c['name']:c for c in fixture['cases']}
self.assertEqual(rows['overcap']['observed'][0],700)
self.assertEqual(rows['ground']['observed'][1],-237)
self.assertEqual(rows['ground_nopoly']['observed'][1],13)
self.assertEqual(rows['backequal']['observed'][0],-52.5)
self.assertEqual(rows['backturn']['observed'][0],600)
if __name__=='__main__':unittest.main()
+20
View File
@@ -0,0 +1,20 @@
"""Source/range/probe provenance for original Jimmy jump 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 jimmy_jump_motion import collect
class JimmyJumpEvidence(unittest.TestCase):
def test_original_identity_ranges_and_offsets(self):
f=json.loads((ROOT/'tests/GamePort.JimmyJumpTests/original-jump-reference.json').read_text());s=collect(ROOT.parent/'Original')
self.assertEqual(f['source_sha256'],s['source_sha256']);self.assertEqual(f['ranges'],s['ranges']);self.assertEqual(f['relocations'],s['relocations'])
for r in s['ranges']:self.assertEqual(int(r['file_offset'],16),int(r['va'],16)-0x400000)
self.assertTrue(all(0x400000<=r['target']<0x699000 for r in s['relocations']))
def test_provenance_and_native_threshold_cases(self):
f=json.loads((ROOT/'tests/GamePort.JimmyJumpTests/original-jump-reference.json').read_text());self.assertEqual(len(f['cases']),32)
for file,digest in f['files'].items():
if file.startswith('tools/'):self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),digest)
cases={c['name']:c for c in f['cases']}
self.assertEqual(cases['hold_equal']['observed'][1],cases['hold_tick']['observed'][1])
self.assertEqual(cases['hold_equal']['observed'][0],3);self.assertEqual(cases['hold_tick']['observed'][0],1)
if __name__=='__main__':unittest.main()
+23
View File
@@ -0,0 +1,23 @@
"""Jimmy facing source/constant identity and copied-original observation provenance."""
from pathlib import Path
import hashlib,json,sys,unittest
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'tools/binary'))
from jimmy_orientation import collect
class JimmyOrientationEvidence(unittest.TestCase):
def test_identity_ranges_offsets_and_double_factors(self):
source=collect(ROOT.parent/'Original');fixture=json.loads((ROOT/'tests/GamePort.JimmyOrientationTests/original-orientation-reference.json').read_text())
for field in ('source_sha256','ranges','constants'):self.assertEqual(source[field],fixture[field])
self.assertEqual(source['constants'],{'0x4afcf0':3.7,'0x4afd38':4.5})
for row in source['ranges']:self.assertEqual(int(row['file_offset'],16),int(row['va'],16)-0x400000)
def test_native_provenance_case_completeness_and_gates(self):
fixture=json.loads((ROOT/'tests/GamePort.JimmyOrientationTests/original-orientation-reference.json').read_text())
self.assertEqual(len(fixture['cases']),16)
for file,digest in fixture['files'].items():
self.assertEqual(len(digest),64)
if file.startswith('tools/'):self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),digest)
cases={c['name']:c for c in fixture['cases']}
for name in ('clean','disabled','zero_dt'):self.assertEqual(cases[name]['observed'][:3],cases[name]['input'][:3])
self.assertGreater(cases['level']['observed'][0],338)
self.assertGreater(cases['positive180']['observed'][1],0)
if __name__=='__main__':unittest.main()
+511
View File
@@ -0,0 +1,511 @@
"""Jimmy special material dispatch: source guards and copied-original observations."""
from pathlib import Path
import hashlib,json,sys,unittest,tempfile
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'tools/binary'))
from jimmy_special_contact import collect,classify,generate
# Original-code observations are committed here; generated logs remain ignored.
FIXTURE=json.loads(r'''{
"source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
"ranges": [
{
"va": "0x43aa40",
"file_offset": "0x3aa40",
"length": 1443,
"sha256": "2acd114eb62fe67490d9301bc8e68f196830be74eb9076f52f79111467344a78"
},
{
"va": "0x42a7e0",
"file_offset": "0x2a7e0",
"length": 140,
"sha256": "b999b3f9eb20ea2be18843048f8695e34e014e54b989e45f71d4113d9a81cf18"
},
{
"va": "0x42a8d0",
"file_offset": "0x2a8d0",
"length": 72,
"sha256": "88a303b3ae7cca7fc4c3935848077bbaf5393f83ed184b8e042e67803c3c4863"
},
{
"va": "0x43a900",
"file_offset": "0x3a900",
"length": 320,
"sha256": "73185486b7c1f3b972757db81837c495491144623f2944a82d564bb0d72626f4"
},
{
"va": "0x43aff0",
"file_offset": "0x3aff0",
"length": 1456,
"sha256": "5c641e54e5e854c965e652aa2a63d3249de8d0ebe6a3317caeaa5f5ebdac47c6"
}
],
"bindings": [
{
"table": "0x4a3bdc",
"slot": "0x160",
"target": "0x42a7e0"
},
{
"table": "0x4a3bdc",
"slot": "0x164",
"target": "0x42a8d0"
},
{
"table": "0x4a373c",
"slot": "0x374",
"target": "0x42a660"
},
{
"table": "0x4af6c4",
"slot": "0x374",
"target": "0x43aa40"
}
],
"scope": "Copied43AA40 only, synthetic actor/material records, no-op160/164 damage callbacks and miss-only rays. No successful climb, damage, body or game entrypoint.",
"cases": [
{
"input": [
-1.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
59.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
60.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
2
]
},
{
"input": [
69.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
2
]
},
{
"input": [
70.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
109.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
110.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
1,
0
]
},
{
"input": [
119.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
1,
0
]
},
{
"input": [
120.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
1,
0,
0
]
},
{
"input": [
129.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
1,
0,
0
]
},
{
"input": [
130.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
179.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
180.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
1
]
},
{
"input": [
181.0,
4.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
120.0,
3.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
120.0,
3.0000999,
0.0,
0.0,
1.0,
1.0
],
"observed": [
1,
0,
0
]
},
{
"input": [
120.0,
2.0,
0.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
120.0,
4.0,
1.0,
0.0,
1.0,
1.0
],
"observed": [
1,
0,
0
]
},
{
"input": [
110.0,
4.0,
2.0,
0.0,
1.0,
1.0
],
"observed": [
0,
1,
0
]
},
{
"input": [
60.0,
4.0,
1.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
180.0,
4.0,
1.0,
0.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
120.0,
4.0,
0.0,
1.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
120.0,
4.0,
0.0,
2.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
120.0,
4.0,
0.0,
3.0,
1.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
180.0,
4.0,
0.0,
0.0,
0.0,
1.0
],
"observed": [
0,
0,
0
]
},
{
"input": [
120.0,
4.0,
0.0,
0.0,
1.0,
0.0
],
"observed": [
1,
0,
0
]
},
{
"input": [
60.0,
4.0,
0.0,
0.0,
1.0,
0.0
],
"observed": [
0,
0,
2
]
}
],
"files": {
"tools/binary/jimmy_special_contact.py": "bf0d690aa5dd79265718e46ff5bbeca86c7ca0e71a2b894e4ef0515f7cbd8cf1",
"tools/binary/jimmy_special_contact_probe.c": "553e77b6a175cd42a4fbdd98222dcbffed0cf26d4f516a09f982d264c213be95",
"tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810",
"artifacts/jimmy-special-contact/jimmy_special_contact_probe.exe": "4a759864c4ea3e9e478af28a6ef4f70f7e48da4102fb6dad3418fb9b02d1c019",
"artifacts/jimmy-special-contact/probe/wine.log": "e680314e9dd8098aa2f4ce3650f0be21072d6ae0e120f5b92b7d3d029a166aa0"
}
}
''')
class JimmySpecialContacts(unittest.TestCase):
def test_source_ranges_bindings_and_offsets(self):
source=collect(ROOT.parent/'Original')
for key in ('source_sha256','ranges','bindings'):self.assertEqual(source[key],FIXTURE[key])
for row in source['ranges']:self.assertEqual(int(row['file_offset'],16),int(row['va'],16)-0x400000)
def test_twenty_seven_original_dispatch_observations(self):
self.assertEqual(len(FIXTURE['cases']),27)
for case in FIXTURE['cases']:
material,elapsed,mode,missing,support,controlled=case['input']
policy=classify(None if missing else int(material),elapsed,int(mode))
actual=[int(policy=='damage160'),int(policy=='damage164'),
2 if policy=='fence_candidate' else 1 if policy=='ladder_candidate' and support else 0]
self.assertEqual(actual,case['observed'],case)
def test_generated_probe_cannot_target_originals_or_symlinks(self):
original=ROOT.parent/'Original'
for target in (original,original/'generated',ROOT.parent):
with self.assertRaises(ValueError):generate(original,target)
with tempfile.TemporaryDirectory() as directory:
root=Path(directory);(root/'jimmy_special_contact_probe.c').symlink_to(original/'Neutron.exe')
with self.assertRaises(ValueError):generate(original,root)
def test_source_provenance(self):
for file,digest in FIXTURE['files'].items():
self.assertEqual(len(digest),64)
if file.startswith('tools/'):
self.assertEqual(hashlib.sha256((ROOT/file).read_bytes()).hexdigest(),digest)
if __name__=='__main__':unittest.main()