nmarshall commited on
Commit
a4a8e6f
·
1 Parent(s): 238dc89

qvm: ground callees

Browse files
docs/ASSET_PIPELINE_TODO.md CHANGED
@@ -303,3 +303,6 @@ Research progress: [QVM pre/post main environment](research/QVM_MAIN_ENVIRONMENT
303
 
304
 
305
  Research progress: [QVM actual main posture](research/QVM_MAIN_POSTURE.md) completes bounded RE-505–507: live posture transitions/resource, evaluated animation-before-height/timer ordering and derived hull/viewheight consumers across28 fixtures. Native responses/remaining main effects stay supplied or omitted. RE-504/508 retain ground/native/input/resource/other modes/full main/runtime/platform work; broad game/rendering milestones remain open.
 
 
 
 
303
 
304
 
305
  Research progress: [QVM actual main posture](research/QVM_MAIN_POSTURE.md) completes bounded RE-505–507: live posture transitions/resource, evaluated animation-before-height/timer ordering and derived hull/viewheight consumers across28 fixtures. Native responses/remaining main effects stay supplied or omitted. RE-504/508 retain ground/native/input/resource/other modes/full main/runtime/platform work; broad game/rendering milestones remain open.
306
+
307
+
308
+ Research progress: [QVM ground loss and landing prefix](research/QVM_GROUND_CALLEES.md) completes bounded RE-509–511: actual ground-loss body/animation, landing discriminant/time/impact/timer prefix and16 main caller-order chains. Full landing/native/action effects remain open under RE-508/512; broad game/rendering/runtime/platform milestones remain open.
docs/FINDINGS.md CHANGED
@@ -625,3 +625,10 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
625
  **F-239 — Stand animation changes final height:**actual39525/39383 changes starting animation25 to37 before successful stand's final bounds selection, producing height38/maxZ45. The caller writes timer200 after the child; actual main aging yields184. [MAINPOSTURE-002](research/QVM_MAIN_POSTURE.md).
626
 
627
  **F-240 — Derived posture consumers:**ground uses actual bounds, selected step restores derived maxZ rather than assumed45, and final contents uses actual viewheight. Fourteen reached41768 fixtures evaluate28 slide children; other modes/native collision/full runtime remain omitted or unverified. [MAINPOSTURE-003](research/QVM_MAIN_POSTURE.md).
 
 
 
 
 
 
 
 
625
  **F-239 — Stand animation changes final height:**actual39525/39383 changes starting animation25 to37 before successful stand's final bounds selection, producing height38/maxZ45. The caller writes timer200 after the child; actual main aging yields184. [MAINPOSTURE-002](research/QVM_MAIN_POSTURE.md).
626
 
627
  **F-240 — Derived posture consumers:**ground uses actual bounds, selected step restores derived maxZ rather than assumed45, and final contents uses actual viewheight. Fourteen reached41768 fixtures evaluate28 slide children; other modes/native collision/full runtime remain omitted or unverified. [MAINPOSTURE-003](research/QVM_MAIN_POSTURE.md).
628
+
629
+
630
+ **F-241 — Ground-loss policy:**46527 gates flags&12, old-ground sentinel and a supplied64-unit deep trace; fraction1 toggles4096 and evaluates direction-selected animation, while a short trace retains old ground/walk within the helper. Action/native collision effects remain omitted. [GROUNDLOST-001](research/QVM_GROUND_CALLEES.md).
631
+
632
+ **F-242 — Landing prefix/timer ordering:**45912 always initializes PS+440/state220, then derives a discriminant/root/time/impact estimate. Impact<−200 with flag1 clear writes leg timer130 before39525(27); unequal raw animation resets it to0, equality retains130. Severity/event/damage/suffix remains unevaluated. [LANDPREFIX-001](research/QVM_GROUND_CALLEES.md).
633
+
634
+ **F-243 — Caller overrides ground-loss walk:**actual46773 clears walk/plane after46527 even when the deep fraction0.5 helper retained old ground/walk. Sixteen main chains carry those actual effects through timer and selected clear-slide mode; full landing/native/main runtime remains open. [GROUNDCHAIN-001](research/QVM_GROUND_CALLEES.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -615,3 +615,6 @@ Research progress: [QVM pre/post main environment](research/QVM_MAIN_ENVIRONMENT
615
 
616
 
617
  Research progress: [QVM actual main posture](research/QVM_MAIN_POSTURE.md) completes bounded RE-505–507: live posture transitions/resource, evaluated animation-before-height/timer ordering and derived hull/viewheight consumers across28 fixtures. Native responses/remaining main effects stay supplied or omitted. RE-504/508 retain ground/native/input/resource/other modes/full main/runtime/platform work; broad game/rendering milestones remain open.
 
 
 
 
615
 
616
 
617
  Research progress: [QVM actual main posture](research/QVM_MAIN_POSTURE.md) completes bounded RE-505–507: live posture transitions/resource, evaluated animation-before-height/timer ordering and derived hull/viewheight consumers across28 fixtures. Native responses/remaining main effects stay supplied or omitted. RE-504/508 retain ground/native/input/resource/other modes/full main/runtime/platform work; broad game/rendering milestones remain open.
618
+
619
+
620
+ Research progress: [QVM ground loss and landing prefix](research/QVM_GROUND_CALLEES.md) completes bounded RE-509–511: actual ground-loss body/animation, landing discriminant/time/impact/timer prefix and16 main caller-order chains. Full landing/native/action effects remain open under RE-508/512; broad game/rendering/runtime/platform milestones remain open.
docs/RESEARCH_LEDGER.md CHANGED
@@ -391,3 +391,7 @@ Completed bounded RE-501–503 with `analyze_qvm_main_environment.py`:48 main fi
391
  ## 2026-10-16 — Game-QVM actual main posture and animation-derived bounds
392
 
393
  Completed bounded RE-505–507 with `analyze_qvm_main_posture.py`:28 fixtures evaluate47422 at the actual main boundary after first content sampling and before ground/timer/movement, including eight stand queries/eight39525 animation-child invocations and24 reached root requests. MAINPOSTURE-001–003/F-238–240 recover enter/resource clamp, clear/blocked stand, timer-held, unchanged animation25 and special-mode branches; actual39525/39383 effects before parent timer200 and final bounds/viewheight selection; and derived bounds/height/flags/leg timers into both ground invocations, final contents and selected step/wrapper/mode. Successful stand changes animation25 to37 before height selection, yielding38/45 rather than omitted-child model's unchanged-animation25 branch. Main aging yields184 from new200; initial leg timer1 blocks posture query before later aging0. Fourteen selected41768 fixtures evaluate28 actual slide children; seven43626/seven41848 requests retain omitted effects. Reached step restores derived maxZ rather than assumed45. Native stand allsolid/horizontal roots/content/ground/slide/down/overlap responses and initial inputs remain supplied; legal/native/remaining ground-action-other mode-suffix/full main/scheduler/platform effects remain unverified or omitted. No original executable/full QVM/native collision/physics/rendering executes. Main bridge adds optional reached posture effects and preserves explicitly provided leg/torso timer seeds; default reports remain unchanged. Eight tests independently verify every posture output, animation ordering/timer/height, stand bounds/root/special skip, ground/derived hull/content height handoffs, ground and main timer effects,28 slide predictions/step-wrapper-mode outputs, provenance and scope. All623 tests pass. Prior main-contact and main-environment reports regenerate byte-identically; new posture report reproduces twice byte-identically (1140423 bytes). Storage/filter setup, documentation links and whitespace checks pass. No assets or shared instruction evaluator changed. RE-504 remains open for broader scope; RE-508 tracks remaining ground/native/legal/input-resource-animation producer-consumer/action-other mode-suffix effects and complete main/scheduler/macOS/Linux Rust/Bevy/Solari gameplay. Broad game/assets/rendering/protocol milestones remain open.
 
 
 
 
 
391
  ## 2026-10-16 — Game-QVM actual main posture and animation-derived bounds
392
 
393
  Completed bounded RE-505–507 with `analyze_qvm_main_posture.py`:28 fixtures evaluate47422 at the actual main boundary after first content sampling and before ground/timer/movement, including eight stand queries/eight39525 animation-child invocations and24 reached root requests. MAINPOSTURE-001–003/F-238–240 recover enter/resource clamp, clear/blocked stand, timer-held, unchanged animation25 and special-mode branches; actual39525/39383 effects before parent timer200 and final bounds/viewheight selection; and derived bounds/height/flags/leg timers into both ground invocations, final contents and selected step/wrapper/mode. Successful stand changes animation25 to37 before height selection, yielding38/45 rather than omitted-child model's unchanged-animation25 branch. Main aging yields184 from new200; initial leg timer1 blocks posture query before later aging0. Fourteen selected41768 fixtures evaluate28 actual slide children; seven43626/seven41848 requests retain omitted effects. Reached step restores derived maxZ rather than assumed45. Native stand allsolid/horizontal roots/content/ground/slide/down/overlap responses and initial inputs remain supplied; legal/native/remaining ground-action-other mode-suffix/full main/scheduler/platform effects remain unverified or omitted. No original executable/full QVM/native collision/physics/rendering executes. Main bridge adds optional reached posture effects and preserves explicitly provided leg/torso timer seeds; default reports remain unchanged. Eight tests independently verify every posture output, animation ordering/timer/height, stand bounds/root/special skip, ground/derived hull/content height handoffs, ground and main timer effects,28 slide predictions/step-wrapper-mode outputs, provenance and scope. All623 tests pass. Prior main-contact and main-environment reports regenerate byte-identically; new posture report reproduces twice byte-identically (1140423 bytes). Storage/filter setup, documentation links and whitespace checks pass. No assets or shared instruction evaluator changed. RE-504 remains open for broader scope; RE-508 tracks remaining ground/native/legal/input-resource-animation producer-consumer/action-other mode-suffix effects and complete main/scheduler/macOS/Linux Rust/Bevy/Solari gameplay. Broad game/assets/rendering/protocol milestones remain open.
394
+
395
+ ## 2026-10-18 — Game-QVM ground-loss caller and landing kinematics prefix
396
+
397
+ Completed bounded RE-509–511 with `analyze_qvm_ground_callees.py`:32 standalone46527 probes,42 landing45912-prefix probes and16 actual ground-loss/main chains. GROUNDLOST-001/LANDPREFIX-001/GROUNDCHAIN-001/F-241–243 recover initial flags&12/ground1023/deep64-unit query priority, exact fraction1 animation/4096/ground/walk transitions with evaluated39525/39383 children, and actual46773 caller walk/plane clearing after helper short-query retention. Landing prefix zeros PS+440/clears state220 bit4096 before discriminant testing, derives supplied-root time/impact with ordered binary32 arithmetic, and stops before severity/event/damage/suffix. Eight negative-discriminant probes stop46294;34 reach46052, eight request animation27 at strict impact<−200 with flag1 clear. Exact−200/−199.999 skip while−200.001 requests. Parent leg timer130 is reset0 by unequal raw forced animation, retained130 for raw27 equality. Sixteen reached main chains consume actual ground-lost state before timer/selected41768 clear-slide/wrapper/gravity/post environment; post landing request remains omitted, not replaced with a partial prefix. Native deep fraction/root/content/trace responses, initial state and action/logging/other ground/main effects remain supplied or omitted. No original executable/full QVM/native collision/physics/rendering executes. Eight independent tests verify every helper/prefix state/word, geometry/sentinel/call arguments, strict threshold/timer ordering, animation effects, caller override/main/slide state, provenance and scope. All631 tests pass. Prior main-environment report regenerates byte-identically; final new report reproduces twice byte-identically (578318 bytes). Storage/filter setup, documentation links and whitespace checks pass. No assets or existing analyzer/evaluator code changed. RE-508 remains open for broader scope; RE-512 tracks full landing/recovery/action/posture-ground integration/native/legal effects and complete main/scheduler/macOS/Linux Rust/Bevy/Solari gameplay. Broad game/assets/rendering/protocol milestones remain open.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -624,3 +624,9 @@ Purpose: turn the supplied installation into an evidence-backed specification of
624
  - [x] RE-506 Evaluate reached39525/39383 children before caller timer200 and final bounds/height selection; recover changed stand animation branch ([MAINPOSTURE-002](research/QVM_MAIN_POSTURE.md)).
625
  - [x] RE-507 Carry derived bounds/viewheight/flags/leg timers into actual ground, selected movement/step hull and final content resampling ([MAINPOSTURE-003](research/QVM_MAIN_POSTURE.md)).
626
  - [ ] RE-508 Recover ground recovery/lost/landing/animation/event callees, native collision/content/root ABI/side effects/legal domains, real posture input/resource/animation producers-consumers, action/alternative-mode/suffix effects and complete main/scheduler composition; validate macOS/Linux Rust/Bevy/Solari gameplay and continue broader game/assets/rendering/protocol work.
 
 
 
 
 
 
 
624
  - [x] RE-506 Evaluate reached39525/39383 children before caller timer200 and final bounds/height selection; recover changed stand animation branch ([MAINPOSTURE-002](research/QVM_MAIN_POSTURE.md)).
625
  - [x] RE-507 Carry derived bounds/viewheight/flags/leg timers into actual ground, selected movement/step hull and final content resampling ([MAINPOSTURE-003](research/QVM_MAIN_POSTURE.md)).
626
  - [ ] RE-508 Recover ground recovery/lost/landing/animation/event callees, native collision/content/root ABI/side effects/legal domains, real posture input/resource/animation producers-consumers, action/alternative-mode/suffix effects and complete main/scheduler composition; validate macOS/Linux Rust/Bevy/Solari gameplay and continue broader game/assets/rendering/protocol work.
627
+
628
+
629
+ - [x] RE-509 Recover46527 initial-flag/ground-sentinel/deep-trace policy and evaluated animation/flag/leg-timer effects ([GROUNDLOST-001](research/QVM_GROUND_CALLEES.md)).
630
+ - [x] RE-510 Recover45912 initialization/discriminant/root/time/impact prefix and timer130/forced-animation ordering, stopping before severity/event/damage work ([LANDPREFIX-001](research/QVM_GROUND_CALLEES.md)).
631
+ - [x] RE-511 Evaluate46527 at actual46773 main boundary, retaining helper-versus-caller walk priority and derived timer/selected-mode state ([GROUNDCHAIN-001](research/QVM_GROUND_CALLEES.md)).
632
+ - [ ] RE-512 Recover remaining landing severity/event/damage/speed suffix and real landing composition,46296 recovery/native callbacks,54981/action and other omitted callees, posture/ground integration/native collision-content-root ABI/legal domains/impact consumers; complete main/scheduler/macOS/Linux Rust/Bevy/Solari gameplay and broader game/assets/rendering/protocol work.
docs/research/QVM_GROUND.md CHANGED
@@ -72,3 +72,6 @@ Follow-up: [contact-list recovery](QVM_ANIMATION_CONTACTS.md) explains helper392
72
 
73
 
74
  Follow-up: [main environment shared-state recovery](QVM_MAIN_ENVIRONMENT.md) completes bounded RE-501–503, evaluating these content/ground bodies before and after selected movement with actual current vectors, terminal touch effects and derived mode inputs. Native/callee/legal/full runtime limits remain explicit.
 
 
 
 
72
 
73
 
74
  Follow-up: [main environment shared-state recovery](QVM_MAIN_ENVIRONMENT.md) completes bounded RE-501–503, evaluating these content/ground bodies before and after selected movement with actual current vectors, terminal touch effects and derived mode inputs. Native/callee/legal/full runtime limits remain explicit.
75
+
76
+
77
+ Follow-up: [ground-loss and landing-prefix recovery](QVM_GROUND_CALLEES.md) completes bounded RE-509–511, distinguishing46527 short-query retention from46773 caller walk clearing and documenting45912 timer/impact prefix limits.
docs/research/QVM_GROUND_CALLEES.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # QVM ground loss and landing kinematics prefix
2
+
3
+ This batch completes bounded RE-509–511 / F-241–243. It recovers46527 ground-loss policy and connects it at the actual46773 caller boundary, plus evaluates45912's landing kinematics/animation prefix. It extends [main environment recovery](QVM_MAIN_ENVIRONMENT.md); the landing study deliberately stops before severity/event/damage/suffix work.
4
+
5
+ Reproduce with `python3 scripts/analyze_qvm_ground_callees.py`; validate with `python3 scripts/test_qvm_ground_callees.py`. The [machine report](qvm-ground-callees.json) retains verified source identity, helper/prefix instruction partitions, exact words, native requests, animation children and bounded main chains. No original executable, full QVM, native collision, physics or rendering executes.
6
+
7
+ ## GROUNDLOST-001 — Deep query, ground sentinel and animation (RE-509)
8
+
9
+ Thirty-two standalone46527 probes vary flags0/4/4096/4100, old ground7/1023, supplied deep-trace fraction0.5/1 and signed forward direction−1/+1. An initial flags&12 branch clears ground to1023 and plane/walk to0 without action or native query. Otherwise the source sets32, requests54981(1) with its effects omitted, and skips the deep query when the old ground is already1023.
10
+
11
+ For an existing ground value the helper requests a trace64 units downward from current origin with current bounds/entity/mask. Only the consumed fraction output word is supplied; the analysis does not invent or claim other trace fields. A fraction other than1 retains old ground/walk within this helper and clears the plane indicator. Fraction1 toggles4096, chooses animation26/28 for nonnegative forward or30/32 for negative forward according to the old4096 state, evaluates39525/39383, then clears ground/walk and plane.
12
+
13
+ Standalone fixtures issue eight deep native requests and four animation requests. Exact raw animation equality/toggle and forced leg-timer reset follow the recovered animation helpers. Action/logging effects, trace collision/consistency, invalid fractions/counts/pointers and real semantic/legal flag domains remain unverified.
14
+
15
+ ## LANDPREFIX-001 — Discriminant, impact estimate and animation timer ordering (RE-510)
16
+
17
+ Forty-two landing-prefix probes vary previous Z velocity0/−100/−300, current-minus-snapshot deltaZ−10/0/+10, posture flag1 clear/set and raw leg animation25/27, with six additional strict-threshold cases around−200. Gravity800 and finite vectors are supplied. Source45912 first zeros PS+440 and clears4096 in PS+220, even on the negative-discriminant path.
18
+
19
+ Let `v` be the saved previous Z velocity, `a` the binary32 conversion of negative integer gravity, `h=round32(a*0.5)` and `dz` the rounded current/snapshot Z difference. In source order the discriminant is `round32(round32(v*v) - round32(round32(h*4)*round32(-dz)))`. A negative value jumps to46294; no root, time or impact output is claimed on that path. Eight fixtures take it.
20
+
21
+ For nonnegative discriminants, a native root is requested and supplied from finite math. The source evaluates rounded `time=(-v-root)/(h*2)` and `impact=v+time*a`. Thirty-four fixtures reach stop46052 before impact squaring/severity scaling. If impact is strictly below−200 and flag1 is clear, the source stores leg timer130 and requests39525(27). Eight fixtures request that helper; exact−200 and−199.999 skip, while−200.001 requests it.
22
+
23
+ The evaluated forced-animation child exposes ordering: with raw legs25 it resets the newly written130 timer to0 and toggles to animation27; with raw legs already27 the helper skips its reset and130 survives. The caller has no intervening restoration before this prefix boundary. Tests verify both outcomes, including every exact time/root/discriminant/impact word. Zero or exceptional gravity, negative-root/native exceptional behavior, full landing return, severity/event/damage and later crouched-speed suffix behavior remain open.
24
+
25
+ ## GROUNDCHAIN-001 — Actual ground-loss caller and selected main state (RE-511)
26
+
27
+ Sixteen bounded main chains vary initial4096, old ground7/1023, deep fraction0.5/1 and forward direction. At the reached first46773 fraction1 branch, the source requests46527; the new helper executes before caller continuation. Its resulting memory then returns to46773, which clears plane **and walk** after the request regardless of the helper's short-query retention. Thus a fraction0.5 helper result can retain old ground7/walk1 internally while the actual classifier ends with ground7/walk0/plane0. Tests distinguish these two boundaries.
28
+
29
+ Actual flags/leg timer and plane state flow into main timer aging and the selected41768 chain. All16 fixtures reach that mode and evaluate its first-clear slide, wrapper bypass and gravity tail, followed by the existing post-ground/content analysis. Initial impact, viewheight/bounds, native content/trace/root responses and action/query/suffix/other ground effects remain supplied or omitted. The post-ground45912 landing request is not replaced with the separate prefix study: no full landing completion or shared landing effect is claimed there.
30
+
31
+ These chains use the earlier environment path with supplied posture state, not the optional evaluated posture branch from the newer posture report. Full main/action/environment/native runtime composition remains open. Source helper frames for ground loss, landing prefix, animation children and live main/movement callers are disjoint.
32
+
33
+ ## Validation and next tasks
34
+
35
+ Eight tests verify32 standalone plus16 composed ground-loss outcomes, deep geometry/requests/sentinel/strict fraction policy,42 landing-prefix formulas and initialization paths, timer130/forced-animation equality, actual animation children, caller override order, selected main/slide state, source partitions and supplied/partial-native scope. Reproducibility/full-suite/storage/link/whitespace results are recorded in the ledger.
36
+
37
+ RE-508 remains open for its broader ground/native/producer/runtime scope. RE-512 tracks remaining45912 severity/event/damage/speed suffix and real ground landing composition,46296 recovery/native callbacks, actual54981/action and other omitted callee effects, posture/ground integration, collision/content/root ABI/legal domains/impact consumers and complete main/scheduler/macOS/Linux Rust/Bevy/Solari gameplay. Other game/assets/rendering/protocol milestones remain open.
docs/research/QVM_MAIN_ENVIRONMENT.md CHANGED
@@ -38,3 +38,6 @@ RE-500 remains open for its broader missing-producer/native/main/runtime scope.
38
 
39
 
40
  Follow-up: [main posture producer composition](QVM_MAIN_POSTURE.md) completes bounded RE-505–507, replacing selected supplied bounds/viewheight with actual47422/animation-child outputs at the main boundary. This report retains its original omitted-posture scope; broader ground/native/main/runtime work remains open under RE-504/508.
 
 
 
 
38
 
39
 
40
  Follow-up: [main posture producer composition](QVM_MAIN_POSTURE.md) completes bounded RE-505–507, replacing selected supplied bounds/viewheight with actual47422/animation-child outputs at the main boundary. This report retains its original omitted-posture scope; broader ground/native/main/runtime work remains open under RE-504/508.
41
+
42
+
43
+ Follow-up: [ground-loss caller recovery](QVM_GROUND_CALLEES.md) completes bounded RE-509–511, evaluating46527 in selected actual46773/main chains and separately recovering the landing kinematics prefix. Native/action/full landing/main/runtime work remains open under RE-508/512.
docs/research/README.md CHANGED
@@ -216,3 +216,6 @@ The extension collector adds five focused tests for native tail calls, command-r
216
 
217
 
218
  [QVM main posture and animation-derived bounds](QVM_MAIN_POSTURE.md) adds RE-505–507. Reproduce with `python3 scripts/analyze_qvm_main_posture.py`; check with `python3 scripts/test_qvm_main_posture.py`. Actual posture/animation children feed ground/motion/content consumers; native records and remaining main/callee effects remain supplied or omitted.
 
 
 
 
216
 
217
 
218
  [QVM main posture and animation-derived bounds](QVM_MAIN_POSTURE.md) adds RE-505–507. Reproduce with `python3 scripts/analyze_qvm_main_posture.py`; check with `python3 scripts/test_qvm_main_posture.py`. Actual posture/animation children feed ground/motion/content consumers; native records and remaining main/callee effects remain supplied or omitted.
219
+
220
+
221
+ [QVM ground loss and landing kinematics prefix](QVM_GROUND_CALLEES.md) adds RE-509–511. Reproduce with `python3 scripts/analyze_qvm_ground_callees.py`; check with `python3 scripts/test_qvm_ground_callees.py`. Ground loss composes at its actual main classifier boundary; landing stops before severity/events/damage and native effects remain supplied or omitted.
docs/research/qvm-ground-callees.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_ground_callees.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Ground-lost helper and bounded landing kinematics/animation prefix."""
3
+ import itertools,json,math
4
+ from pathlib import Path
5
+ from analyze_bsp_references import trace_fields
6
+ from analyze_deferred_auth import trace_slice
7
+ from analyze_qvm import decode,write_json
8
+ from analyze_qvm_acceleration import PS,FRAME,word,number
9
+ from analyze_qvm_slide_prefix import seed,vec
10
+ from analyze_qvm_animation_contacts import evaluate
11
+ from analyze_qvm_main_environment import contents,ground,env_state
12
+ from analyze_qvm_main_contact import probe
13
+ from analyze_vm_extensions import verified
14
+
15
+ LOST=0x59000000
16
+ LAND=0x5a000000
17
+
18
+
19
+ def state(m):return {'origin':vec(m,PS+20),'velocity':vec(m,PS+32),'flags':m[PS+12]&0xffffffff,'ground':m[PS+68],'plane':m[35023940],'walk':m[35023936],'legs':m[PS+76]&0xffffffff,'leg_timer':m[PS+72],'state220':m[PS+220]&0xffffffff,'field440':m[PS+440]}
20
+
21
+
22
+ def memory(flags=0,oldground=7,legs=25):
23
+ m=seed(flags=flags,velocity=(10,20,0));m.update({PS+4:0,PS+68:oldground,PS+72:17,PS+76:legs,PS+220:0x12345000,PS+440:99,FRAME+32:0,35023936:1,35024012:word(300),35024024:word(-100)});return m
24
+
25
+
26
+ def lost(ins,m,fraction=1,forward=1):
27
+ initial=state(m);pc=46528;trace=[];calls=[];request=None;children=[]
28
+ while True:
29
+ t=trace_slice(ins,46528,46771,m,{},resume_at=pc,stop_targets=[s for s in [46668,46719,46758] if s!=pc],local_base=LOST,byte_memory={FRAME+25:forward&255},limit=1024);m=t['memory'];pc=t['stop'];trace+=t['trace'];calls+=t['calls']
30
+ if pc==46668:
31
+ c=t['calls'][-1];a=c['args'];request={'call':c,'start':vec(m,a[12]),'end':vec(m,a[24]),'bounds':vec(m,a[16])+vec(m,a[20]),'supplied_fraction':word(fraction)};m[a[8]+8]=word(fraction)
32
+ elif pc in [46719,46758]:
33
+ if not t['calls']:continue
34
+ c=t['calls'][-1];before=state(m);child=evaluate(ins,39525,c['args'][8],m);m=child['memory'];children.append({'request':c['args'][8],'before':before,'after':state(m),'calls':child['calls'],**trace_fields(child,False)})
35
+ elif pc==46771:break
36
+ else:raise AssertionError('Unexpected lost boundary')
37
+ return m,{'initial':initial,'forward':forward,'fraction':word(fraction),'request':request,'animation_children':children,'final':state(m),'calls':calls,**trace_fields({'trace':trace},False)}
38
+
39
+
40
+ def landing_prefix(ins,previous,delta,flags,legs):
41
+ m=memory(flags=flags,legs=legs);m[PS+28]=word(300+delta);m[35024024]=word(previous);initial=state(m);pc=45913;trace=[];calls=[];root=None;child_report=None
42
+ while True:
43
+ t=trace_slice(ins,45913,46294,m,{},resume_at=pc,stop_targets=[s for s in [45996,46052] if s!=pc],local_base=LAND,call_results={46001:root or 0},limit=1024);m=t['memory'];pc=t['stop'];trace+=t['trace'];calls+=t['calls']
44
+ if pc==45996:root=word(math.sqrt(number(m[LAND+40])))
45
+ elif pc==46052:
46
+ if t['calls'][-1]['target']==39525:
47
+ before=state(m);child=evaluate(ins,39525,27,m);m=child['memory'];child_report={'before':before,'after':state(m),'calls':child['calls'],**trace_fields(child,False)}
48
+ break
49
+ elif pc==46294:break
50
+ else:raise AssertionError('Unexpected landing boundary')
51
+ return {'previous_velocity':word(previous),'delta_z':word(delta),'gravity':800,'initial':initial,'discriminant':m[LAND+40]&0xffffffff,'supplied_root':root,'time':m[LAND+48]&0xffffffff if pc==46052 else None,'impact_velocity':m[LAND+20]&0xffffffff if pc==46052 else None,'animation_child':child_report,'final':state(m),'stop_instruction':pc,'calls':calls,**trace_fields({'trace':trace},False)}
52
+
53
+
54
+ def ground_with_lost(ins,m,fraction,forward):
55
+ before=env_state(m);pre=trace_slice(ins,46774,47215,m,{},stop_targets=[46847],local_base=0x46000000,limit=512);m=pre['memory'];c=pre['calls'][-1];a=c['args'];record=[0,0,word(1),*vec(m,a[24]),word(0),word(0),word(1),0,0,2,0,8]
56
+ for i,v in enumerate(record):m[a[8]+4*i]=v
57
+ at=trace_slice(ins,46774,47215,m,{},resume_at=46847,stop_targets=[46873],local_base=0x46000000,limit=512);m=at['memory'];m,child=lost(ins,m,fraction,forward);after_child=env_state(m);tail=trace_slice(ins,46774,47215,m,{},resume_at=46873,local_base=0x46000000,limit=512);m=tail['memory']
58
+ return m,{'target':46773,'before':before,'record':record,'lost_child':child,'after_child':after_child,'after':env_state(m),'calls':pre['calls']+at['calls']+tail['calls'],**trace_fields({'trace':pre['trace']+at['trace']+tail['trace']},False)}
59
+
60
+
61
+ def main_chain(ins,flags,oldground,fraction,forward):
62
+ def effect(ins,m,target,phase):
63
+ if target==47217:m,r=contents(ins,m,[0,0,0])
64
+ elif phase=='before':m,r=ground_with_lost(ins,m,fraction,forward)
65
+ else:m,r=ground(ins,m,'flat')
66
+ r['phase']=phase;return m,r
67
+ m=memory(flags=flags,oldground=oldground);m.update({PS+164:38,FRAME+228:-26,FRAME+208:99,35023988:0})
68
+ return probe(ins,1016,0,flags,'clear',initial_memory=m,environment_effect=effect)
69
+
70
+
71
+ def main():
72
+ q=json.loads(Path('docs/research/qvm/qagame.json').read_text());_,ins=decode(verified(Path(q['source']['member']['output']).read_bytes(),q['sha256']))
73
+ out={'source':q['source'],'sha256':q['sha256'],'lost_instructions':ins[46527:46773],'landing_prefix_instructions':ins[45912:46052],'lost_probes':[lost(ins,memory(flags=f,oldground=g),fr,fw)[1] for f,g,fr,fw in itertools.product([0,4,4096,4100],[7,1023],[.5,1],[-1,1])],'landing_probes':[landing_prefix(ins,*v) for v in itertools.product([0,-100,-300],[-10,0,10],[0,1],[25,27])]+[landing_prefix(ins,v,0,0,a) for v,a in itertools.product([-199.999,-200,-200.001],[25,27])],'main_chains':[main_chain(ins,*v) for v in itertools.product([2208,6304],[7,1023],[.5,1],[-1,1])],'limitations':'Bounded finite shipped-QVM evaluation; no original executable/full QVM/native collision/physics/rendering executes. Ground-lost46527 body and reached39525/39383 children evaluate;54981 action/logging effects remain omitted. Its deep trace fraction is supplied only at the consumed field; other trace output fields/native collision are not claimed. Landing45912 prefix stops46052 before severity/event/damage/suffix behavior, or46294 on negative discriminant; no full landing completion is claimed. Landing sqrt is supplied from finite math, gravity800 and finite state are supplied; zero/exceptional gravity/legal domains remain unverified. Reached pre-main ground-lost composes into actual main timer/selected mode and post environment; other main/ground landing/action effects remain omitted and native side effects/full main/runtime/macOS/Linux/Rust/Bevy/Solari gameplay remain open.'};write_json(Path('docs/research/qvm-ground-callees.json'),out);print('Recovered ground-lost and landing kinematics/animation prefix')
74
+
75
+
76
+ if __name__=='__main__':main()
scripts/test_qvm_ground_callees.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Independent lost/landing-prefix formulas and actual caller priority checks."""
3
+ import hashlib,json,math
4
+ from pathlib import Path
5
+ import unittest
6
+ from test_qvm_ground import f,n,word
7
+ from test_qvm_animation_contacts import animation_oracle
8
+ from test_qvm_slide_repeated import oracle as slide_oracle
9
+
10
+
11
+ def lost_expected(p):
12
+ s=dict(p['initial']);request=None;calls=[]
13
+ if s['flags']&12:s.update({'ground':1023,'plane':0,'walk':0})
14
+ else:
15
+ s['flags']|=32;calls.append(54981)
16
+ if s['ground']!=1023:
17
+ calls.append(-25)
18
+ if n(p['fraction'])==1:
19
+ was=bool(s['flags']&4096);s['flags']^=4096;request=(26 if was else 28) if p['forward']>=0 else (30 if was else 32);calls.append(39525)
20
+ if s['legs']!=request:s['leg_timer']=0;s['legs']=(((s['legs']&128)^128)|request)&0xffffffff
21
+ s.update({'ground':1023,'walk':0})
22
+ s['plane']=0
23
+ return s,request,calls
24
+
25
+
26
+ class QvmGroundCalleesTests(unittest.TestCase):
27
+ @classmethod
28
+ def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-ground-callees.json').read_text())
29
+
30
+ def test_all_ground_lost_branch_priority_and_exact_state(self):
31
+ self.assertEqual(len(self.r['lost_probes']),32)
32
+ rows=self.r['lost_probes']+[p['environment'][1]['lost_child'] for p in self.r['main_chains']]
33
+ for p in rows:
34
+ expected,request,calls=lost_expected(p);self.assertEqual(p['final'],expected);self.assertEqual([c['target'] for c in p['calls']],calls);self.assertEqual([c['request'] for c in p['animation_children']],[] if request is None else [request])
35
+
36
+ def test_deep_trace_geometry_sentinel_and_native_fraction(self):
37
+ for p in self.r['lost_probes']:
38
+ reached=not p['initial']['flags']&12 and p['initial']['ground']!=1023;self.assertEqual(p['request'] is not None,reached)
39
+ if reached:
40
+ q=p['request'];self.assertEqual(q['start'],p['initial']['origin']);self.assertEqual(q['end'],q['start'][:2]+[word(f(n(q['start'][2])-64))]);self.assertEqual(q['bounds'],list(map(word,[-15,-15,-24,15,15,45])));self.assertEqual(q['call']['instruction'],46666);self.assertEqual(q['call']['args']['8'],0x59000030);self.assertEqual(q['supplied_fraction'],p['fraction'])
41
+
42
+ def test_every_landing_discriminant_root_time_and_impact_prefix(self):
43
+ self.assertEqual(len(self.r['landing_probes']),42)
44
+ for p in self.r['landing_probes']:
45
+ v=n(p['previous_velocity']);dz=n(p['delta_z']);a=f(-p['gravity']);half=f(a*.5);d=f(f(v*v)-f(f(half*4)*f(-dz)));self.assertEqual(p['discriminant'],word(d));expected=dict(p['initial']);expected.update({'field440':0,'state220':p['initial']['state220']&~4096})
46
+ if d<0:self.assertEqual(p['stop_instruction'],46294);self.assertIsNone(p['supplied_root']);self.assertIsNone(p['time']);self.assertIsNone(p['impact_velocity']);self.assertEqual(p['calls'],[])
47
+ else:
48
+ root=f(math.sqrt(d));time=f(f(-v-root)/f(half*2));impact=f(v+f(time*a));self.assertEqual([p['supplied_root'],p['time'],p['impact_velocity']],[word(root),word(time),word(impact)]);self.assertEqual(p['stop_instruction'],46052)
49
+ if impact<-200 and not expected['flags']&1:
50
+ expected['leg_timer']=130
51
+ if expected['legs']!=27:expected['leg_timer']=0;expected['legs']=(((expected['legs']&128)^128)|27)&0xffffffff
52
+ self.assertEqual(p['calls'][0],{'instruction':46001,'target':-107,'args':{'8':word(d)}})
53
+ self.assertEqual(p['final'],expected)
54
+
55
+ def test_landing_timer130_then_forced_animation_reset_or_raw_equality(self):
56
+ changed=retained=False
57
+ for p in self.r['landing_probes']:
58
+ c=p['animation_child']
59
+ if c:
60
+ self.assertEqual(c['before']['leg_timer'],130)
61
+ if c['before']['legs']==27:self.assertEqual(c['after']['leg_timer'],130);retained=True
62
+ else:self.assertEqual(c['after']['leg_timer'],0);changed=True
63
+ self.assertTrue(changed and retained)
64
+ for value,requested in [(-199.999,False),(-200,False),(-200.001,True)]:
65
+ p=next(p for p in self.r['landing_probes'] if p['previous_velocity']==word(value) and p['delta_z']==0 and p['initial']['flags']==0 and p['initial']['legs']==25);self.assertEqual(p['animation_child'] is not None,requested)
66
+
67
+ def test_actual_animation_child_effects_in_both_helpers(self):
68
+ children=[c for p in self.r['lost_probes'] for c in p['animation_children']]+[p['animation_child'] for p in self.r['landing_probes'] if p['animation_child']]
69
+ for c in children:
70
+ a=c['before'];request=c.get('request',27);legs,_,timer,_,calls=animation_oracle({'entry':39525,'type_word':0,'initial_legs_word':a['legs'],'initial_torso_word':0,'initial_leg_timer_word':a['leg_timer'],'initial_torso_timer_word':0,'request_word':request});expected=dict(a);expected.update({'legs':legs,'leg_timer':timer});self.assertEqual(c['after'],expected);self.assertEqual([x['target'] for x in c['calls']],calls)
71
+
72
+ def test_actual_ground_caller_overrides_walk_after_short_deep_trace(self):
73
+ self.assertEqual(len(self.r['main_chains']),16);short=False
74
+ for p in self.r['main_chains']:
75
+ g=p['environment'][1];child=g['lost_child'];self.assertEqual(g['after_child']['walk'],child['final']['walk']);self.assertEqual(g['after']['walk'],0);self.assertEqual(g['after']['plane'],0);self.assertEqual(g['after']['ground'],child['final']['ground']);self.assertEqual(g['after']['flags'],child['final']['flags']);self.assertEqual([c['target'] for c in g['calls']],[-25,46527])
76
+ if child['request'] and n(child['fraction'])==.5:self.assertEqual(child['final']['ground'],7);self.assertEqual(child['final']['walk'],1);short=True
77
+ self.assertTrue(short)
78
+
79
+ def test_reached_main_mode_and_slide_consume_lost_state(self):
80
+ for p in self.r['main_chains']:
81
+ g=p['environment'][1];self.assertEqual(p['selected_mode'],41768);self.assertEqual(p['timer']['before']['flags'],g['after']['flags']);w=p['mode']['wrapper'];entry=dict(w['before']);entry['ground_normal']=g['after']['normal'];slide_oracle(self,w['first_slide'],entry);self.assertEqual(w['first_slide']['ground'],0);self.assertEqual(w['first_slide']['return_word'],0);self.assertIsNone(w['step']);self.assertEqual(p['timer']['before']['leg'],g['lost_child']['final']['leg_timer'])
82
+ expected=dict(w['final']);vz=f(n(expected['velocity'][2])-f(f(800)*n(p['clock']['float_dt'])));expected['velocity']=expected['velocity'][:2]+[word(vz)]
83
+ if vz<0:expected['flags']&=~192;expected['timer']=0
84
+ self.assertEqual(p['mode']['mode_final'],expected)
85
+
86
+ def test_source_partitions_and_partial_native_runtime_scope(self):
87
+ q=json.loads(Path('docs/research/qvm/qagame.json').read_text());self.assertEqual(self.r['source'],q['source']);self.assertEqual(self.r['sha256'],hashlib.sha256(Path(q['source']['member']['output']).read_bytes()).hexdigest());self.assertEqual(self.r['lost_instructions'][0]['index'],46527);self.assertEqual(self.r['lost_instructions'][-1]['index'],46772);self.assertEqual(self.r['landing_prefix_instructions'][-1]['index'],46051)
88
+ for text in ['no original executable/full QVM/native collision/physics/rendering executes','no full landing completion is claimed','54981 action/logging effects remain omitted','zero/exceptional gravity/legal domains remain unverified']:self.assertIn(text,self.r['limitations'])
89
+
90
+
91
+ if __name__=='__main__':unittest.main()