qvm: resource
Browse files- docs/ASSET_PIPELINE_TODO.md +2 -0
- docs/FINDINGS.md +6 -0
- docs/PROVISIONAL_TODO.md +2 -0
- docs/RESEARCH_LEDGER.md +4 -0
- docs/REVERSE_ENGINEERING_TODO.md +5 -0
- docs/research/QVM_ACCELERATION.md +2 -0
- docs/research/QVM_POSTURE.md +2 -0
- docs/research/QVM_RESOURCE.md +62 -0
- docs/research/README.md +2 -0
- docs/research/qvm-resource.json +0 -0
- scripts/analyze_qvm_resource.py +51 -0
- scripts/test_qvm_resource.py +87 -0
docs/ASSET_PIPELINE_TODO.md
CHANGED
|
@@ -268,3 +268,5 @@ Research progress: [QVM posture bounds and transitions](research/QVM_POSTURE.md)
|
|
| 268 |
Research progress: [QVM animation helpers and contacts](research/QVM_ANIMATION_CONTACTS.md) completes bounded RE-445–447. RE-444/448 retain native collision/resource/semantic producers, live animation tables/contact consumers/full state/runtime/platform work; broad game/rendering milestones remain open.
|
| 269 |
|
| 270 |
Research progress: [QVM animation assets and tables](research/QVM_ANIMATION_TABLES.md) completes bounded RE-449–451: verified variants/symbols/model selectors, loader records/partial EOF and source-derived timed-helper bridges. RE-448/452 retain native preprocessing/live tables/playback/contact/full-state/runtime/platform work; broad game/rendering milestones remain open.
|
|
|
|
|
|
|
|
|
| 268 |
Research progress: [QVM animation helpers and contacts](research/QVM_ANIMATION_CONTACTS.md) completes bounded RE-445–447. RE-444/448 retain native collision/resource/semantic producers, live animation tables/contact consumers/full state/runtime/platform work; broad game/rendering milestones remain open.
|
| 269 |
|
| 270 |
Research progress: [QVM animation assets and tables](research/QVM_ANIMATION_TABLES.md) completes bounded RE-449–451: verified variants/symbols/model selectors, loader records/partial EOF and source-derived timed-helper bridges. RE-448/452 retain native preprocessing/live tables/playback/contact/full-state/runtime/platform work; broad game/rendering milestones remain open.
|
| 271 |
+
|
| 272 |
+
Research progress: [QVM resource update and consumers](research/QVM_RESOURCE.md) completes bounded RE-453–455: reset/drain/recovery/counter policy, selected caller arguments and resource/posture/scale bridges. RE-444/448/452/456 retain native effects/semantic producers/live animation/contact/full-state/runtime/platform work; broad game/rendering milestones remain open.
|
docs/FINDINGS.md
CHANGED
|
@@ -534,3 +534,9 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
|
|
| 534 |
**F-197 — Animation loader records and partial success:**20297 writes32-byte records, integer1000/FPS intervals and duration interval×(count+1), leaves+24 untouched, and consumes three other values without storing. Supplied EOF retains partial writes and closes with return1; failed open returns0. Native preprocessing and malformed-input behavior remain unverified. [TABLE-002](research/QVM_ANIMATION_TABLES.md).
|
| 535 |
|
| 536 |
**F-198 — Source-derived duration consumers:**152 bridges transfer verified asset-derived duration words at actual model table selectors into39552 and its evaluated child. Stand/crouch transition rows derive480/360, but the earlier posture caller separately writes200; complete playback/state/runtime remains open. [TABLE-003](research/QVM_ANIMATION_TABLES.md).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 534 |
**F-197 — Animation loader records and partial success:**20297 writes32-byte records, integer1000/FPS intervals and duration interval×(count+1), leaves+24 untouched, and consumes three other values without storing. Supplied EOF retains partial writes and closes with return1; failed open returns0. Native preprocessing and malformed-input behavior remain unverified. [TABLE-002](research/QVM_ANIMATION_TABLES.md).
|
| 535 |
|
| 536 |
**F-198 — Source-derived duration consumers:**152 bridges transfer verified asset-derived duration words at actual model table selectors into39552 and its evaluated child. Stand/crouch transition rows derive480/360, but the earlier posture caller separately writes200; complete playback/state/runtime remains open. [TABLE-003](research/QVM_ANIMATION_TABLES.md).
|
| 537 |
+
|
| 538 |
+
**F-199 — Resource reset and drain:**39595 gives configuration>=2 reset precedence over bypass; normal negative input clamps before frame+244 bypass. Guarded speed>221 drain caps its local speed to340, scans16 low bytes for17 and applies0.9/0.5 factors before subtraction/truncation/zero floor. Semantic domains remain provisional. [RESOURCE-001](research/QVM_RESOURCE.md).
|
| 539 |
+
|
| 540 |
+
**F-200 — Recovery/counter asymmetry:** fallback resource change can be replaced by a negative change above105, applies only the health-derived upper cap and can remain negative. Drain instead applies a zero floor without that upper cap. Normal zero-speed clears PS+224; nonzero adds dt capped1700, while early paths leave it alone. Runtime/legal domains remain open. [RESOURCE-002](research/QVM_RESOURCE.md).
|
| 541 |
+
|
| 542 |
+
**F-201 — Resource arguments and consumers:** selected helper55465 tail requests a full3D norm for39595; helper43626 slice passes a retained scalar after velocity rescaling. Fourteen caller probes and16 scalar bridges connect resource results to earlier posture and scale arithmetic without claiming full movement ordering/state/collision equivalence. [RESOURCE-003](research/QVM_RESOURCE.md).
|
docs/PROVISIONAL_TODO.md
CHANGED
|
@@ -580,3 +580,5 @@ Research progress: [QVM posture bounds and transitions](research/QVM_POSTURE.md)
|
|
| 580 |
Research progress: [QVM animation helpers and contacts](research/QVM_ANIMATION_CONTACTS.md) completes bounded RE-445–447. RE-444/448 retain native collision/resource/semantic producers, live animation tables/contact consumers/full state/runtime/platform work; broad game/rendering milestones remain open.
|
| 581 |
|
| 582 |
Research progress: [QVM animation assets and tables](research/QVM_ANIMATION_TABLES.md) completes bounded RE-449–451: verified variants/symbols/model selectors, loader records/partial EOF and source-derived timed-helper bridges. RE-448/452 retain native preprocessing/live tables/playback/contact/full-state/runtime/platform work; broad game/rendering milestones remain open.
|
|
|
|
|
|
|
|
|
| 580 |
Research progress: [QVM animation helpers and contacts](research/QVM_ANIMATION_CONTACTS.md) completes bounded RE-445–447. RE-444/448 retain native collision/resource/semantic producers, live animation tables/contact consumers/full state/runtime/platform work; broad game/rendering milestones remain open.
|
| 581 |
|
| 582 |
Research progress: [QVM animation assets and tables](research/QVM_ANIMATION_TABLES.md) completes bounded RE-449–451: verified variants/symbols/model selectors, loader records/partial EOF and source-derived timed-helper bridges. RE-448/452 retain native preprocessing/live tables/playback/contact/full-state/runtime/platform work; broad game/rendering milestones remain open.
|
| 583 |
+
|
| 584 |
+
Research progress: [QVM resource update and consumers](research/QVM_RESOURCE.md) completes bounded RE-453–455: reset/drain/recovery/counter policy, selected caller arguments and resource/posture/scale bridges. RE-444/448/452/456 retain native effects/semantic producers/live animation/contact/full-state/runtime/platform work; broad game/rendering milestones remain open.
|
docs/RESEARCH_LEDGER.md
CHANGED
|
@@ -335,3 +335,7 @@ Completed bounded RE-445–447 with `analyze_qvm_animation_contacts.py`: verifie
|
|
| 335 |
## 2026-10-15 — Verified player animation assets, loader records and timed consumers
|
| 336 |
|
| 337 |
Completed bounded RE-449–451 with `analyze_qvm_animation_tables.py`: verifies all observed player animation config/header payloads against extraction manifests, retains both identical4131-byte config variants, recovers literal registration of Athena selector0/Orion selector1 and source-level animation IDs, and evaluates loader20297 using supplied token integer values from a strict observed-format parser. TABLE-001–003/F-196–198 identify76 distinct rows per model and missing1/77/78/79; recover32-byte record stores, integer1000/FPS intervals, duration interval×(count+1), ignored upper/lower/hit tokens and untouched+24; and connect152 source-derived duration words at actual registered table selectors into the previously recovered timed-animation helper/child. Eleven prefix/failed-open probes recover partial writes, close/return1 on opened-source EOF and return0 on failed open; two synthetic FPS probes cover negative truncation and above1000 yielding zero interval. Zero FPS is an evaluator rejection, not a runtime crash claim. Native preprocessing/token ABI, original executable/full QVM/playback/rendering do not execute. Strict parser is not a general preprocessor; header ambiguity, missing-slot initialization/live table writers, selectors/request legality and malformed/runtime/platform behavior remain open. Eight independent tests verify source identities/variant retention, literal registration, symbols/missing indices, every loaded record and token request/canary, partial/EOF/failed-open effects, signed/zero-FPS boundary,152 timed-consumer bridges, parser failure domains/partitions/scope. All511 tests pass. Direct animation-contact/posture reports regenerate byte-identically; new report reproduces twice byte-identically (622268 bytes). Storage/filter setup, documentation links and whitespace checks pass. No original assets or existing analyzer/evaluator code changed. RE-448 remains open; RE-452 tracks native preprocessing/search/includes/error semantics, missing-index/+24 initialization/live writers, selectors, playback/interpolation/loop/flip/model/skeleton/Bevy conversion and full state/gameplay/macOS/Linux/Solari validation. Resource producers, contact consumers and packet/entity/player/snapshot/rendering milestones remain open.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 335 |
## 2026-10-15 — Verified player animation assets, loader records and timed consumers
|
| 336 |
|
| 337 |
Completed bounded RE-449–451 with `analyze_qvm_animation_tables.py`: verifies all observed player animation config/header payloads against extraction manifests, retains both identical4131-byte config variants, recovers literal registration of Athena selector0/Orion selector1 and source-level animation IDs, and evaluates loader20297 using supplied token integer values from a strict observed-format parser. TABLE-001–003/F-196–198 identify76 distinct rows per model and missing1/77/78/79; recover32-byte record stores, integer1000/FPS intervals, duration interval×(count+1), ignored upper/lower/hit tokens and untouched+24; and connect152 source-derived duration words at actual registered table selectors into the previously recovered timed-animation helper/child. Eleven prefix/failed-open probes recover partial writes, close/return1 on opened-source EOF and return0 on failed open; two synthetic FPS probes cover negative truncation and above1000 yielding zero interval. Zero FPS is an evaluator rejection, not a runtime crash claim. Native preprocessing/token ABI, original executable/full QVM/playback/rendering do not execute. Strict parser is not a general preprocessor; header ambiguity, missing-slot initialization/live table writers, selectors/request legality and malformed/runtime/platform behavior remain open. Eight independent tests verify source identities/variant retention, literal registration, symbols/missing indices, every loaded record and token request/canary, partial/EOF/failed-open effects, signed/zero-FPS boundary,152 timed-consumer bridges, parser failure domains/partitions/scope. All511 tests pass. Direct animation-contact/posture reports regenerate byte-identically; new report reproduces twice byte-identically (622268 bytes). Storage/filter setup, documentation links and whitespace checks pass. No original assets or existing analyzer/evaluator code changed. RE-448 remains open; RE-452 tracks native preprocessing/search/includes/error semantics, missing-index/+24 initialization/live writers, selectors, playback/interpolation/loop/flip/model/skeleton/Bevy conversion and full state/gameplay/macOS/Linux/Solari validation. Resource producers, contact consumers and packet/entity/player/snapshot/rendering milestones remain open.
|
| 338 |
+
|
| 339 |
+
## 2026-10-15 — Game-QVM resource update, argument tails and scalar consumers
|
| 340 |
+
|
| 341 |
+
Completed bounded RE-453–455 with `analyze_qvm_resource.py`: verifies complete shipped qagame helper39595,856 resource probes,14 selected caller probes and16 consumer bridges. RESOURCE-001–003/F-199–201 recover configuration>=2 resource reset, initial negative clamp before frame+244 bypass, signed button/forward/right and mask/speed drain guards, capped local argument and16-word low-byte17 scan with0.9/0.5 factors; exact rounded recovery/replacement change, drain zero floor versus recovery health-derived upper cap, potential negative recovery stores/oversized drain stores and zero/nonzero counter reset/add/cap1700. Helper has no calls. Selected helper55465 tail records full3D-norm/supplied-sqrt-to-resource argument; helper43626 tail rescales supplied velocity using a retained scalar and passes that scalar. Evaluated resource transfers into earlier scale/posture/scale fixtures without claiming complete frame/state or real ordering. Native sqrt and previous caller/collision/normalization effects remain supplied/omitted; no original executable/full QVM/native collision/physics/rendering executes. Semantic meanings, live configuration/resource/health/item/counter/time producers and legal/exceptional/overflow/alias domains remain open. Eight independent tests verify all resource path/arithmetic outputs and immutable words, reset/bypass precedence, drain thresholds/cap/scan bounds, recovery cap/negative asymmetry/counter,14 caller arguments/velocity results,16 scalar handoffs with prior posture/scale oracles, source/constants/partitions and scope. All519 tests pass. Direct posture/acceleration reports regenerate byte-identically; new resource report reproduces twice byte-identically (1223307 bytes). Storage/filter setup, documentation links and whitespace checks pass. No assets or existing analyzer/evaluator code changed. RE-444/448/452 remain open; RE-456 tracks producer/semantic/legal domains, retained scalar/native sqrt/complete callers, consecutive-frame resource behavior/exceptional arithmetic and full movement state/ordering/gameplay/macOS/Linux/Rust/Bevy/Solari validation; packet/entity/player/snapshot/rendering milestones remain open.
|
docs/REVERSE_ENGINEERING_TODO.md
CHANGED
|
@@ -547,3 +547,8 @@ Purpose: turn the supplied installation into an evidence-backed specification of
|
|
| 547 |
- [x] RE-450 Recover bounded helper20297 token/store layout, integer timing/duration formula and EOF/partial-write/open-failure behavior with verified-row and synthetic-prefix probes ([TABLE-002](research/QVM_ANIMATION_TABLES.md)).
|
| 548 |
- [x] RE-451 Bridge all152 asset-derived duration words at registered model selectors into the recovered timed-animation helper/child ([TABLE-003](research/QVM_ANIMATION_TABLES.md)).
|
| 549 |
- [ ] RE-452 Recover native token/preprocessor ABI/search/include/define/error behavior, missing-index/+24 initialization/later table writers, selector/request legality and frame/interpolation/loop/flip playback consumers; map model/skeleton/Bevy conversion and compose complete posture/ground/contact/animation state. Validate gameplay/macOS/Linux/Solari; resource production and packet/entity/player/snapshot/rendering work remain open.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 547 |
- [x] RE-450 Recover bounded helper20297 token/store layout, integer timing/duration formula and EOF/partial-write/open-failure behavior with verified-row and synthetic-prefix probes ([TABLE-002](research/QVM_ANIMATION_TABLES.md)).
|
| 548 |
- [x] RE-451 Bridge all152 asset-derived duration words at registered model selectors into the recovered timed-animation helper/child ([TABLE-003](research/QVM_ANIMATION_TABLES.md)).
|
| 549 |
- [ ] RE-452 Recover native token/preprocessor ABI/search/include/define/error behavior, missing-index/+24 initialization/later table writers, selector/request legality and frame/interpolation/loop/flip playback consumers; map model/skeleton/Bevy conversion and compose complete posture/ground/contact/animation state. Validate gameplay/macOS/Linux/Solari; resource production and packet/entity/player/snapshot/rendering work remain open.
|
| 550 |
+
|
| 551 |
+
- [x] RE-453 Recover bounded helper39595 configuration reset/bypass precedence, signed input drain guards, capped local speed and16-word low-byte array multiplier policy ([RESOURCE-001](research/QVM_RESOURCE.md)).
|
| 552 |
+
- [x] RE-454 Recover exact finite recovery/replacement change, asymmetric lower/upper resource caps and zero/1700 counter policy with independent arithmetic checks ([RESOURCE-002](research/QVM_RESOURCE.md)).
|
| 553 |
+
- [x] RE-455 Recover selected full3D-norm/retained-scalar caller argument tails and bridge evaluated resource into earlier posture/command-scale probes ([RESOURCE-003](research/QVM_RESOURCE.md)).
|
| 554 |
+
- [ ] RE-456 Recover configuration/health/resource/array/counter/timestep semantic producers/legal ranges, retained-scalar producer/native sqrt/complete caller effects, consecutive-frame behavior/exceptional-overflow-alias domains and actual movement ordering/full shared state. Validate gameplay/macOS/Linux/Rust/Bevy/Solari; packet/entity/player/snapshot/rendering work remains open.
|
docs/research/QVM_ACCELERATION.md
CHANGED
|
@@ -52,3 +52,5 @@ Eight tests verify signed command scale and sqrt requests, strict boost boundari
|
|
| 52 |
RE-428 remains open for complete mode/native/runtime work. RE-432 must recover friction and surrounding velocity/speed policy, native sqrt106 ABI/service, field+184/button256 producers and legal movement/coefficient/timestep ranges, real basis/stack/callee/collision effects, complete mode/step composition and gameplay/macOS/Linux validation before Rust/Bevy/Solari compatibility claims. Packet/entity/player/snapshot/rendering milestones remain open.
|
| 53 |
|
| 54 |
Follow-up: [friction policies](QVM_FRICTION.md) recovers shared/mode-specific friction and bridges evaluated velocity into new partial-caller fixtures with source-image coefficient8. This report retains its supplied coefficient10/defaults; live configuration and full mode effects remain open.
|
|
|
|
|
|
|
|
|
| 52 |
RE-428 remains open for complete mode/native/runtime work. RE-432 must recover friction and surrounding velocity/speed policy, native sqrt106 ABI/service, field+184/button256 producers and legal movement/coefficient/timestep ranges, real basis/stack/callee/collision effects, complete mode/step composition and gameplay/macOS/Linux validation before Rust/Bevy/Solari compatibility claims. Packet/entity/player/snapshot/rendering milestones remain open.
|
| 53 |
|
| 54 |
Follow-up: [friction policies](QVM_FRICTION.md) recovers shared/mode-specific friction and bridges evaluated velocity into new partial-caller fixtures with source-image coefficient8. This report retains its supplied coefficient10/defaults; live configuration and full mode effects remain open.
|
| 55 |
+
|
| 56 |
+
Follow-up: [resource update recovery](QVM_RESOURCE.md) identifies helper39595 reset/drain/recovery/counter policy and connects selected outputs to the command-scale resource>10 gate (RE-453–455). Complete mode ordering/state/native effects and resource semantics/legal domains remain open under RE-456.
|
docs/research/QVM_POSTURE.md
CHANGED
|
@@ -45,3 +45,5 @@ RE-440 remains open for native collision and full state composition. RE-444 trac
|
|
| 45 |
Follow-up: [animation-helper recovery](QVM_ANIMATION_CONTACTS.md) evaluates39525 and its guarded child at ten selected posture request boundaries, then applies the caller timer200 store (RE-446). Other native/collision/resource/full-state effects remain open under RE-444/448.
|
| 46 |
|
| 47 |
Follow-up: [shipped animation definitions](QVM_ANIMATION_TABLES.md) name25 as LEGS_SWIM and36/37 as LEGS_STANDCR/LEGS_CRSTAND. The loader derives480/360 for those transition rows; this does not change the posture caller's explicit timer200 stores. Full state/playback remains open.
|
|
|
|
|
|
|
|
|
| 45 |
Follow-up: [animation-helper recovery](QVM_ANIMATION_CONTACTS.md) evaluates39525 and its guarded child at ten selected posture request boundaries, then applies the caller timer200 store (RE-446). Other native/collision/resource/full-state effects remain open under RE-444/448.
|
| 46 |
|
| 47 |
Follow-up: [shipped animation definitions](QVM_ANIMATION_TABLES.md) name25 as LEGS_SWIM and36/37 as LEGS_STANDCR/LEGS_CRSTAND. The loader derives480/360 for those transition rows; this does not change the posture caller's explicit timer200 stores. Full state/playback remains open.
|
| 48 |
+
|
| 49 |
+
Follow-up: [resource producer recovery](QVM_RESOURCE.md) evaluates helper39595 and transfers selected resource outputs into posture and command-scale fixtures (RE-453–455). This recovers one producer of PS+184; complete ordering, semantic/configuration producers and native/state effects remain open under RE-456.
|
docs/research/QVM_RESOURCE.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Game-QVM resource update, caller arguments and consumer bridges
|
| 2 |
+
|
| 3 |
+
RE-453–455 / F-199–201. [qvm-resource.json](qvm-resource.json) retains complete shipped qagame helper39595, two selected caller slices,856 resource probes,14 caller probes and16 scalar consumer bridges. Reproduce with `python3 scripts/analyze_qvm_resource.py`; verify with `python3 scripts/test_qvm_resource.py`.
|
| 4 |
+
|
| 5 |
+
This follows [command scaling](QVM_ACCELERATION.md) and [posture](QVM_POSTURE.md), both of which consume player-state+184. The numeric update policy is recovered through bounded synthetic instruction evaluation. No original executable, complete QVM, native sqrt, collision, physics or renderer executes. Configuration, command bytes, PS fields, array words and time are supplied. Resource/health/item/type/flag names and legal domains remain provisional. Caller and consumer bridges do not establish complete shared-state simulation or real movement ordering.
|
| 6 |
+
|
| 7 |
+
## RESOURCE-001 — Reset, bypass and drain policy (RE-453)
|
| 8 |
+
|
| 9 |
+
Helper39595 receives one binary32 argument, called `s` below. It uses global35024032 to reach the movement frame and PS pointer. Global34065924 is a signed configuration word; global35023932 is a supplied integer timestep `dt`.
|
| 10 |
+
|
| 11 |
+
Priority starts with:
|
| 12 |
+
|
| 13 |
+
1. If configuration >=2, write resource PS+184 = PS+208 ×300 with QVM integer arithmetic, then return. The counter at PS+224 and other resource paths are skipped.
|
| 14 |
+
2. Otherwise clamp a negative starting resource to zero.
|
| 15 |
+
3. If frame+244 is nonzero, return after that initial clamp; leave the counter unchanged.
|
| 16 |
+
|
| 17 |
+
Normal processing defines an input gate: frame button word+20 includes256, signed right byte+26 equals0, and signed forward byte+25 is strictly greater than80. The drain branch requires that gate, no PS+12 bits in mask3, and `s` strictly greater than221.
|
| 18 |
+
|
| 19 |
+
On drain, the helper caps its **local argument copy** to340, then subtracts220. Each subsequent float operation rounds to binary32:
|
| 20 |
+
|
| 21 |
+
`drop = (((min(s,340) - 220) * C1) * 7.5) * float(dt)`
|
| 22 |
+
|
| 23 |
+
Here `C1` is the exact word1008095194 (approximately0.00917431153). It scans16 words starting at PS+376, comparing each low byte against17. A match multiplies drop by the binary32 word1063675494 (approximately0.9); otherwise it multiplies by0.5. The scan short-circuits at a match. A17 in slot16, just beyond those16 words, is ignored in the fixtures; nonzero high bytes do not prevent a low-byte match.
|
| 24 |
+
|
| 25 |
+
It converts the current resource integer to binary32, subtracts drop, truncates toward zero to signed integer, then clamps a negative result to zero. This branch has **no health-derived upper cap**: an initially oversized40000 resource can remain above30000 after drain. This is a branch policy observation, not a claim that the runtime admits oversized resource values. The local `s` rewrite does not mutate the caller's by-value argument.
|
| 26 |
+
|
| 27 |
+
Probes cover exact220/221, just above221,300/340/400; flag masks; item matches in slots0/15 versus excluded16; zero/nonzero timestep; signed command bytes; and reset/bypass ordering. Full source instructions and exact constant words are retained in the JSON.
|
| 28 |
+
|
| 29 |
+
## RESOURCE-002 — Recovery, replacement debit and counter (RE-454)
|
| 30 |
+
|
| 31 |
+
If drain conditions fail, the default signed change is:
|
| 32 |
+
|
| 33 |
+
`change = ((1 - s * C2) * 6) * float(dt)`
|
| 34 |
+
|
| 35 |
+
`C2` is exact word997735952 (approximately0.00378787890). Operations round individually to binary32. If the input gate holds, `s >105`, and PS+12 has no bits in mask12, the helper **replaces** that change with:
|
| 36 |
+
|
| 37 |
+
`change = (float(dt) * 0.125) * C3`
|
| 38 |
+
|
| 39 |
+
`C3` is exact word3255128556 (approximately-33.3300018). It adds change to the float-converted resource and truncates to integer, then applies an upper cap of PS+208 ×300. Unlike drain, this branch does not apply a final zero floor. With suitable supplied flags/input/speed and initially zero resource, it can store a negative value. The next ordinary invocation would perform the initial negative clamp before further processing; this report does not compose consecutive full frames. Even default recovery can be a debit at sufficiently high supplied `s`.
|
| 40 |
+
|
| 41 |
+
After either normal branch, zero local `s` clears counter PS+224. Nonzero local `s` adds integer `dt` to that counter and caps values strictly above1700 to1700. Early reset/bypass paths skip this work. Drain's locally capped/subtracted argument is the value tested here. These finite fixtures use small nonnegative timesteps and bounded counters; overflow/negative/exceptional domains and live timestep/configuration producers remain unresolved.
|
| 42 |
+
|
| 43 |
+
The856 probes include threshold105/just above105,80/81 forward, signed negative movement bytes, masks2/3/8/12, resource below zero/zero/near cap/above cap, and counter0/1699/1700/1800. Independent binary32 formulas verify every resulting resource, local argument/change word, counter, path, unchanged array and canary.
|
| 44 |
+
|
| 45 |
+
## RESOURCE-003 — Caller arguments and resource consumers (RE-455)
|
| 46 |
+
|
| 47 |
+
Two caller boundaries are evaluated separately:
|
| 48 |
+
|
| 49 |
+
| Caller slice | Argument passed to39595 | Explicit omitted inputs/effects |
|
| 50 |
+
| --- | --- | --- |
|
| 51 |
+
| Helper55465 tail56161–56211 | Supplied sqrt return for rounded VX²+VY²+VZ² | Earlier mode helpers/collision/velocity setup; native sqrt |
|
| 52 |
+
| Helper43626 slice45083–45142 | Retained local+60 scalar, after multiplying each supplied starting velocity component by that scalar | Producer of retained local scalar, preceding normalization and other mode work |
|
| 53 |
+
|
| 54 |
+
Five measured probes include zero, horizontal220, vertical-only300,180/240 and1/2/2 vectors. They establish that this tail requests a full3D norm, rather than the horizontal norm used by posture. Nine retained-scalar probes combine three supplied vectors with scalar0/220/340, checking exact rounded rescaling and unchanged scalar handoff. Each recorded argument is passed to the recovered resource helper in a separate synthetic frame with explicitly supplied remaining resource inputs. Those fixtures do not claim that a complete mode's state has been preserved.
|
| 55 |
+
|
| 56 |
+
Sixteen additional bridges transfer evaluated resource into the earlier command-scale helper and posture helper, then transfer posture's resource output into command scaling again. They use speed0/220/300/340, flags0/1, resource0/11 and matching supplied forward81/right0/button256. Independent prior posture/scale oracles check every transferred value and result. This connects the new producer to the earlier strict resource>10 speed policy and potential3000 crouch-entry charge, but does not establish that those operations occur in this order during a real step. Full frame/state/collision composition is still open.
|
| 57 |
+
|
| 58 |
+
## Validation and next tasks
|
| 59 |
+
|
| 60 |
+
Eight tests independently check all856 resource results and immutable words, reset/bypass priority, strict drain thresholds/cap/low-byte inventory scan, recovery negative values and upper-cap asymmetry, zero/1700 counter policy,14 caller arguments/velocity updates,16 resource/posture/scale bridges, source/constants/partitions and explicit scope. Direct posture/acceleration dependencies regenerate unchanged; the new report reproduces twice byte-identically. Full-suite/storage/link/whitespace outcomes are recorded in the research ledger.
|
| 61 |
+
|
| 62 |
+
RE-444/448/452 retain native collision, animation/contact and broad state work. RE-456 tracks semantic/configuration/health/resource/array/counter/timestep producers and legal domains; retained-scalar producer, actual native sqrt and complete caller effects; consecutive-frame resource behavior, exceptional/overflow/alias cases, real movement ordering/full state composition and gameplay/macOS/Linux/Rust/Bevy/Solari compatibility. Packet/entity/player/snapshot/rendering milestones remain open.
|
docs/research/README.md
CHANGED
|
@@ -181,3 +181,5 @@ The extension collector adds five focused tests for native tail calls, command-r
|
|
| 181 |
[QVM animation helpers and contact registration](QVM_ANIMATION_CONTACTS.md) adds RE-445–447. Reproduce with `python3 scripts/analyze_qvm_animation_contacts.py`; check with `python3 scripts/test_qvm_animation_contacts.py`. Animation children are evaluated, table duration words supplied, and selected posture requests composed; full collision/runtime remains open.
|
| 182 |
|
| 183 |
[QVM animation assets, table loader and duration consumers](QVM_ANIMATION_TABLES.md) adds RE-449–451. Reproduce with `python3 scripts/analyze_qvm_animation_tables.py`; check with `python3 scripts/test_qvm_animation_tables.py`. Verified assets supply token integer values; complete native preprocessing, live playback and runtime remain open.
|
|
|
|
|
|
|
|
|
| 181 |
[QVM animation helpers and contact registration](QVM_ANIMATION_CONTACTS.md) adds RE-445–447. Reproduce with `python3 scripts/analyze_qvm_animation_contacts.py`; check with `python3 scripts/test_qvm_animation_contacts.py`. Animation children are evaluated, table duration words supplied, and selected posture requests composed; full collision/runtime remains open.
|
| 182 |
|
| 183 |
[QVM animation assets, table loader and duration consumers](QVM_ANIMATION_TABLES.md) adds RE-449–451. Reproduce with `python3 scripts/analyze_qvm_animation_tables.py`; check with `python3 scripts/test_qvm_animation_tables.py`. Verified assets supply token integer values; complete native preprocessing, live playback and runtime remain open.
|
| 184 |
+
|
| 185 |
+
[QVM resource update, caller arguments and consumer bridges](QVM_RESOURCE.md) adds RE-453–455. Reproduce with `python3 scripts/analyze_qvm_resource.py`; check with `python3 scripts/test_qvm_resource.py`. Resource helper is evaluated completely within its bounded body; native sqrt/collision, preceding callers, full state and runtime remain open.
|
docs/research/qvm-resource.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
scripts/analyze_qvm_resource.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Bounded resource update helper, caller arguments and scalar consumer bridges."""
|
| 3 |
+
import itertools
|
| 4 |
+
import json
|
| 5 |
+
import math
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
from analyze_bsp_references import trace_fields
|
| 8 |
+
from analyze_deferred_auth import trace_slice
|
| 9 |
+
from analyze_qvm import decode,write_json
|
| 10 |
+
from analyze_qvm_acceleration import FRAME,PS,word,number,f,scale_probe
|
| 11 |
+
from analyze_qvm_posture import posture_probe
|
| 12 |
+
from analyze_vm_extensions import verified
|
| 13 |
+
|
| 14 |
+
LOCAL=0x4a000000
|
| 15 |
+
CALLER=0x4b000000
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def resource_probe(ins,speed=300,meter=4000,health=100,mode=0,locked=0,buttons=256,forward=81,right=0,flags=0,item_slot=None,dt=16,counter=1690):
|
| 19 |
+
m={35024032:FRAME,FRAME:PS,34065924:mode,35023932:dt,FRAME+244:locked,FRAME+20:buttons,PS+184:meter,PS+208:health,PS+12:flags,PS+224:counter,PS+228:0x12345678}
|
| 20 |
+
inventory=[0x1200 | (17 if i==item_slot else 0) for i in range(17)]
|
| 21 |
+
for i,v in enumerate(inventory):m[PS+376+i*4]=v
|
| 22 |
+
t=trace_slice(ins,39596,39986,m,{92:word(speed)},byte_memory={FRAME+25:forward&255,FRAME+26:right&255},local_base=LOCAL,limit=2048);mem=t['memory'];path='mode_reset' if 39632 in t['trace'] else 'locked' if 39658 in t['trace'] else 'drain' if 39822 in t['trace'] else 'recovery'
|
| 23 |
+
return {'speed_float_word':word(speed),'initial_meter_word':meter,'health_word':health,'mode_word':mode,'locked_word':locked,'buttons_word':buttons,'movement_bytes':[forward&255,right&255],'ps_flags_word':flags,'inventory_words':inventory,'dt_word':dt,'initial_counter_word':counter,'path':path,'delta_float_word':None if LOCAL+12 not in mem else mem[LOCAL+12]&0xffffffff,'result_argument_float_word':mem[LOCAL+92]&0xffffffff,'result_meter_word':mem[PS+184],'result_counter_word':mem[PS+224],'result_inventory_words':[mem[PS+376+i*4]&0xffffffff for i in range(17)],'canary_word':mem[PS+228],'calls':t['calls'],**trace_fields(t,False)}
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def caller_probe(ins,kind,velocity,speed=300):
|
| 27 |
+
m={35024032:FRAME,FRAME:PS}
|
| 28 |
+
for i,v in enumerate(velocity):m[PS+32+i*4]=word(v)
|
| 29 |
+
squared=f(f(f(velocity[0]*velocity[0])+f(velocity[1]*velocity[1]))+f(velocity[2]*velocity[2]));root=word(math.sqrt(squared))
|
| 30 |
+
start,stop=(56161,56212) if kind=='measured' else (45083,45143)
|
| 31 |
+
t=trace_slice(ins,start,stop,m,{} if kind=='measured' else {60:word(speed)},local_base=CALLER,call_results={56204:root},limit=256);argument=t['calls'][-1]['args'][8];p=resource_probe(ins,speed=number(argument));return {'caller_kind':kind,'initial_velocity_float_words':[word(v) for v in velocity],'supplied_retained_speed_float_word':None if kind=='measured' else word(speed),'supplied_sqrt_word':root if kind=='measured' else None,'result_velocity_float_words':[t['memory'][PS+32+i*4]&0xffffffff for i in range(3)],'calls':t['calls'],'resource_probe':p,**trace_fields(t,False)}
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def consumer_bridge(ins,speed,flags,meter):
|
| 35 |
+
p=resource_probe(ins,speed=speed,flags=flags,meter=meter);scale=scale_probe(ins,81,0,0,256,p['result_meter_word']);posture=posture_probe(ins,up=-1,flags=flags,meter=p['result_meter_word']);after=scale_probe(ins,81,0,0,256,posture['result_meter_word']);return {'resource_probe':p,'scale_probe':scale,'posture_probe':posture,'posture_scale_probe':after}
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def main():
|
| 39 |
+
q=json.loads(Path('docs/research/qvm/qagame.json').read_text());raw=verified(Path(q['source']['member']['output']).read_bytes(),q['sha256']);_,ins=decode(raw)
|
| 40 |
+
probes=[resource_probe(ins,mode=m,meter=r,health=h,locked=l) for m,r,h,l in itertools.product([-1,1,2],[-1,0,4000],[0,100],[0,1])]
|
| 41 |
+
probes += [resource_probe(ins,speed=s,flags=fl,item_slot=i,dt=dt,meter=m) for s,fl,i,dt,m in itertools.product([220,221,221.001,300,340,400],[0,1,4],[None,0,15,16],[0,16],[0,4000])]
|
| 42 |
+
probes += [resource_probe(ins,speed=s,buttons=b,forward=fw,right=rt,flags=fl,meter=m,dt=dt) for s,(b,fw,rt),fl,m,dt in itertools.product([0,105,105.001,220,221,340],[(256,81,0),(0,81,0),(256,80,0),(256,81,1)],[0,1,4],[-1,0,30000],[8,16])]
|
| 43 |
+
probes += [resource_probe(ins,speed=s,buttons=b,forward=fw,right=rt,flags=fl,meter=11) for s,(b,fw,rt),fl in itertools.product([105,106,221,222],[(256,-128,0),(256,127,0),(256,81,-1),(256,81,0),(257,81,0)],[2,3,8,12])]
|
| 44 |
+
probes += [resource_probe(ins,speed=s,counter=c,dt=dt) for s,c,dt in itertools.product([0,1],[0,1699,1700,1800],[8,16])]
|
| 45 |
+
probes += [resource_probe(ins,speed=340,meter=40000),resource_probe(ins,speed=0,meter=40000),resource_probe(ins,speed=300,meter=0,flags=1),resource_probe(ins,speed=0,meter=-1,locked=1)]
|
| 46 |
+
callers=[caller_probe(ins,'measured',v) for v in [(0,0,0),(220,0,0),(0,0,300),(180,240,0),(1,2,2)]]+[caller_probe(ins,'retained',v,s) for v,s in itertools.product([(1,0,0),(.6,.8,0),(0,0,0)],[0,220,340])]
|
| 47 |
+
constants=sorted({i['operand'] for i in ins[39595:39988] if i['opcode']=='CONST' and i['operand'] in [1130168320,1135214592,1130102784,1008095194,1089470464,1056964608,1063675494,1065353216,997735952,1086324736,1121058816,1040187392,-1039838740]})
|
| 48 |
+
out={'source':q['source'],'sha256':q['sha256'],'helper_instructions':ins[39595:39988],'measured_caller_instructions':ins[56161:56214],'retained_caller_instructions':ins[45083:45143],'float_constants':[{'word':v&0xffffffff,'value':number(v)} for v in constants],'resource_probes':probes,'caller_probes':callers,'consumer_bridges':[consumer_bridge(ins,*v) for v in itertools.product([0,220,300,340],[0,1],[0,11])],'limitations':'Bounded finite synthetic shipped-QVM instruction evaluations only; no complete QVM/original executable/native sqrt/collision/physics/rendering executes. Helper39595 has no calls; byte inputs, inventory, configuration/health/dt/counter are supplied. Caller slices omit preceding mode/normalization/collision effects: measured sqrt return supplied from finite math, retained scalar and starting vector supplied. Resource helpers evaluated with separate synthetic frames at recorded argument boundaries. Consumer bridges transfer resource scalars into prior scale/posture probes, not an established full movement ordering or complete shared-state composition. Resource/health/configuration/item/flag semantic meanings, legal ranges, exceptional/alias/control-state/native/runtime/macOS/Linux/Rust/Bevy/Solari compatibility remain open.'};write_json(Path('docs/research/qvm-resource.json'),out);print('Recovered bounded resource reset/drain/recovery/counter and argument/consumer bridges')
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
if __name__=='__main__':main()
|
scripts/test_qvm_resource.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Independent resource branch/arithmetic, caller and scalar bridge oracles."""
|
| 3 |
+
import hashlib
|
| 4 |
+
import json
|
| 5 |
+
import math
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
import unittest
|
| 8 |
+
from test_qvm_ground import n,f,word
|
| 9 |
+
from test_qvm_acceleration import scale_oracle
|
| 10 |
+
from test_qvm_posture import oracle as posture_oracle
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def s8(v):return v if v<128 else v-256
|
| 14 |
+
|
| 15 |
+
def resource_oracle(p):
|
| 16 |
+
speed=n(p['speed_float_word']);meter=p['initial_meter_word'];counter=p['initial_counter_word'];dt=p['dt_word'];maximum=p['health_word']*300
|
| 17 |
+
if p['mode_word']>=2:return 'mode_reset',maximum,counter,None,word(speed)
|
| 18 |
+
meter=max(meter,0)
|
| 19 |
+
if p['locked_word']:return 'locked',meter,counter,None,word(speed)
|
| 20 |
+
forward,right=map(s8,p['movement_bytes']);gate=bool(p['buttons_word']&256) and right==0 and forward>80;flags=p['ps_flags_word']
|
| 21 |
+
if gate and not flags&3 and speed>221:
|
| 22 |
+
speed=f(min(speed,340)-220);drop=f(f(f(speed*n(1008095194))*7.5)*f(dt));drop=f(drop*(n(1063675494) if any(v&255==17 for v in p['inventory_words'][:16]) else .5));meter=max(0,int(f(f(meter)-drop)));path='drain'
|
| 23 |
+
else:
|
| 24 |
+
drop=f(f(f(1-f(speed*n(997735952)))*6)*f(dt))
|
| 25 |
+
if gate and speed>105 and not flags&12:drop=f(f(f(dt)*.125)*n(-1039838740))
|
| 26 |
+
meter=min(int(f(f(meter)+drop)),maximum);path='recovery'
|
| 27 |
+
counter=0 if speed==0 else min(counter+dt,1700)
|
| 28 |
+
return path,meter,counter,word(drop),word(speed)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class QvmResourceTests(unittest.TestCase):
|
| 32 |
+
@classmethod
|
| 33 |
+
def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-resource.json').read_text())
|
| 34 |
+
|
| 35 |
+
def test_all_resource_paths_and_exact_rounded_outputs(self):
|
| 36 |
+
self.assertEqual(len(self.r['resource_probes']),856)
|
| 37 |
+
for p in self.r['resource_probes']:
|
| 38 |
+
self.assertEqual([p['path'],p['result_meter_word'],p['result_counter_word'],p['delta_float_word'],p['result_argument_float_word']],list(resource_oracle(p)));self.assertEqual(p['calls'],[]);self.assertEqual(p['result_inventory_words'],p['inventory_words']);self.assertEqual(p['canary_word'],0x12345678)
|
| 39 |
+
|
| 40 |
+
def test_reset_and_lock_precedence_preserve_counter(self):
|
| 41 |
+
rows=self.r['resource_probes'];self.assertTrue(any(p['mode_word']==2 and p['locked_word'] for p in rows));self.assertTrue(any(p['path']=='locked' and p['initial_meter_word']==-1 for p in rows))
|
| 42 |
+
for p in rows:
|
| 43 |
+
if p['mode_word']>=2:self.assertEqual(p['result_meter_word'],p['health_word']*300);self.assertEqual(p['result_counter_word'],p['initial_counter_word'])
|
| 44 |
+
elif p['locked_word']:self.assertEqual(p['result_meter_word'],max(0,p['initial_meter_word']));self.assertEqual(p['result_counter_word'],p['initial_counter_word'])
|
| 45 |
+
|
| 46 |
+
def test_drain_threshold_cap_low_byte_scan_and_excluded_slot16(self):
|
| 47 |
+
rows=self.r['resource_probes'];base=lambda p:p['ps_flags_word']==0 and p['buttons_word']==256 and p['movement_bytes']==[81,0] and p['initial_meter_word']==4000 and p['dt_word']==16 and p['mode_word']==0
|
| 48 |
+
selected=[p for p in rows if base(p)]
|
| 49 |
+
for speed in [220,221]:self.assertTrue(all(p['path']=='recovery' for p in selected if n(p['speed_float_word'])==speed))
|
| 50 |
+
for speed in [300,340,400]:
|
| 51 |
+
group=[p for p in selected if n(p['speed_float_word'])==speed];self.assertTrue(group);plain=next(p for p in group if all(v&255!=17 for v in p['inventory_words']));outside=next(p for p in group if p['inventory_words'][16]&255==17);last=next(p for p in group if p['inventory_words'][15]&255==17);self.assertEqual(outside['result_meter_word'],plain['result_meter_word']);self.assertLess(last['result_meter_word'],plain['result_meter_word'])
|
| 52 |
+
cap=[p for p in selected if n(p['speed_float_word']) in [340,400] and p['inventory_words'][0]&255==17];self.assertEqual({p['result_meter_word'] for p in cap},{cap[0]['result_meter_word']})
|
| 53 |
+
|
| 54 |
+
def test_recovery_negative_output_cap_and_counter_zero_1700(self):
|
| 55 |
+
rows=self.r['resource_probes'];negative=[p for p in rows if p['path']=='recovery' and p['result_meter_word']<0];self.assertTrue(negative)
|
| 56 |
+
for p in rows:
|
| 57 |
+
if p['path']=='drain':self.assertGreaterEqual(p['result_meter_word'],0)
|
| 58 |
+
if p['path']=='recovery':self.assertLessEqual(p['result_meter_word'],p['health_word']*300)
|
| 59 |
+
if p['path'] in ['drain','recovery']:self.assertEqual(p['result_counter_word'],0 if n(p['result_argument_float_word'])==0 else min(p['initial_counter_word']+p['dt_word'],1700))
|
| 60 |
+
self.assertTrue(any(p['path']=='drain' and p['result_meter_word']>p['health_word']*300 for p in rows))
|
| 61 |
+
self.assertTrue(any(n(p['speed_float_word'])==105 and p['path']=='recovery' and n(p['delta_float_word'])>0 for p in rows));self.assertTrue(any(n(p['speed_float_word'])==106 and p['ps_flags_word']==2 and n(p['delta_float_word'])<0 for p in rows))
|
| 62 |
+
|
| 63 |
+
def test_caller_arguments_full_norm_and_retained_rescaling(self):
|
| 64 |
+
self.assertEqual(len(self.r['caller_probes']),14)
|
| 65 |
+
for p in self.r['caller_probes']:
|
| 66 |
+
velocity=list(map(n,p['initial_velocity_float_words']));calls=p['calls']
|
| 67 |
+
if p['caller_kind']=='measured':
|
| 68 |
+
squared=f(f(f(velocity[0]**2)+f(velocity[1]**2))+f(velocity[2]**2));argument=word(math.sqrt(squared));self.assertEqual(calls[0],{'instruction':56204,'target':-107,'args':{'8':word(squared)}});self.assertEqual(p['result_velocity_float_words'],p['initial_velocity_float_words']);self.assertEqual(calls[-1]['instruction'],56210)
|
| 69 |
+
else:
|
| 70 |
+
argument=p['supplied_retained_speed_float_word'];self.assertEqual(len(calls),1);self.assertEqual(calls[-1]['instruction'],45141);self.assertEqual(p['result_velocity_float_words'],[word(f(v*n(argument))) for v in velocity])
|
| 71 |
+
self.assertEqual(calls[-1]['target'],39595);self.assertEqual(calls[-1]['args'],{'8':argument});self.assertEqual(p['resource_probe']['speed_float_word'],argument);self.assertEqual(p['resource_probe']['result_meter_word'],resource_oracle(p['resource_probe'])[1])
|
| 72 |
+
|
| 73 |
+
def test_resource_to_scale_posture_and_posture_scale_scalar_handoffs(self):
|
| 74 |
+
self.assertEqual(len(self.r['consumer_bridges']),16)
|
| 75 |
+
for b in self.r['consumer_bridges']:
|
| 76 |
+
r,s,p,a=[b[k] for k in ['resource_probe','scale_probe','posture_probe','posture_scale_probe']];self.assertEqual(s['meter_word'],r['result_meter_word']);self.assertEqual(p['initial_meter_word'],r['result_meter_word']);self.assertEqual(p['initial_ps_flags_word'],r['ps_flags_word']);self.assertEqual(p['result_meter_word'],posture_oracle(p)[2]);self.assertEqual(a['meter_word'],p['result_meter_word']);self.assertEqual(s['result_scale_float_word'],scale_oracle(s));self.assertEqual(a['result_scale_float_word'],scale_oracle(a))
|
| 77 |
+
|
| 78 |
+
def test_source_hash_constants_and_helper_caller_partitions(self):
|
| 79 |
+
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['helper_instructions'][0]['index'],39595);self.assertEqual(self.r['helper_instructions'][-1]['index'],39987);self.assertEqual(self.r['measured_caller_instructions'][-1]['index'],56213)
|
| 80 |
+
words={i['operand']&0xffffffff for i in self.r['helper_instructions'] if i['opcode']=='CONST'}
|
| 81 |
+
for row in self.r['float_constants']:self.assertIn(row['word'],words);self.assertEqual(row['value'],n(row['word']))
|
| 82 |
+
|
| 83 |
+
def test_external_effects_and_scalar_scope_remain_explicit(self):
|
| 84 |
+
for text in ['no complete QVM/original executable/native sqrt/collision/physics/rendering executes','measured sqrt return supplied','not an established full movement ordering','legal ranges, exceptional/alias/control-state']:self.assertIn(text,self.r['limitations'])
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
if __name__=='__main__':unittest.main()
|