66 lines
3.8 KiB
Markdown
66 lines
3.8 KiB
Markdown
# Shared player energy and warning sounds
|
||
|
||
2026-11-01. Static recovery reuses the complete local REA/Ghidra12.1.4 record
|
||
`artifacts/shrink-ray/rea-primary-followup/04.json`, Evidence
|
||
`ev_71897af12f4bfa1de946c6f17f3bbed34764fdc84258ce64516c8f1f904b465d`.
|
||
Its exported bundle and closed snapshot remain beside it. No duplicate analysis
|
||
session or original execution was needed. Supplementary instruction cross-checks
|
||
are in `artifacts/gadget-followup/energy.instructions.txt`.
|
||
|
||
`tools/binary/player_energy.py ../Original` checks the full original EXE hash,
|
||
the complete42A920..42AA13 body, ten decisive sites and four constants. Output
|
||
`artifacts/gadget-followup/energy-source.json` records PE-mapped file offsets
|
||
for all preferred VAs below. Original EXE SHA256:
|
||
`f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8`.
|
||
For these .text locations, mapped file offset is VA−400000.
|
||
|
||
## Recovered state and order
|
||
|
||
Global float4F83D4 is the player energy scalar; byte4F83DC is a separate low-warning
|
||
latch. Jimmy constructor42217E clearsEBX,422980 writesBL to the latch. Existing
|
||
retained-loader evidence shows ordinary loads reuse Jimmy without repeating his
|
||
constructor. TSK stores PlayerValue, not this latch; direct scalar load is distinct
|
||
from calling the adjustment helper. Full new-game/load UI ownership remains open.
|
||
|
||
42A92B..42A93D compares the current game's FourCC against numericVR01..VR08 and
|
||
returns for those tutorials without changing scalar, latch or playing sounds.
|
||
Otherwise:
|
||
|
||
1. When old energy>0 and the requested sum<=0,42A967..42A972 requests SFX80 before
|
||
the scalar changes. Staying at zero is not another crossing.
|
||
2.42A975 reloads the live scalar, adds the delta and stores float32. The upper100
|
||
comparison uses the still-live x87 sum. Above100 clamps100, clears the latch
|
||
and returns (42A985..42A9A3).
|
||
3. Negative stored energy clamps0. Stored energy<19 emits SFX182 once if the latch
|
||
is false, then sets it true (42A9C3..42A9F7). The scalar is already published
|
||
when that sound is requested; the latch is written afterward.
|
||
4. Values19..20 inclusive preserve the latch; strictly>20 clears it
|
||
(42A9F8..42AA12). A direct assignment/refill is not itself this helper call.
|
||
|
||
The shared consumers include ordinary ray426F5A (−dt), powered-fire421FB0's active
|
||
phase (−dt×.5), Invisible424F26 (fixed−2 on activation), and Bubble42627C
|
||
(−dt×.5; Bubble runtime remains pending). Tutorial immunity does not bypass the
|
||
individual caller's activation gate; Jimmy PostLoad independently sets its9F8
|
||
energy-override field for VR01..08.
|
||
|
||
## Current implementation and verification boundaries
|
||
|
||
`PlayerEnergy` owns scalar and warning latch. Main retains one instance across
|
||
ordinary scene rebuilds; LabSimulation delegates scalar access and adjustments to
|
||
it. Warning callbacks run in source write order and feed SceneAudio's existing
|
||
SFX bank/gate. The ray and positive jetpack-effect phase now call this owner;
|
||
Invisible spends2 through the same path. The independent JetpackBurst pure helper
|
||
continues to expose its numeric projection for algorithm tests.
|
||
|
||
Modern doubles preserve the relevant two-float sum before stores; exhaustive x87
|
||
rounding/control-word equivalence is not claimed. Nonfinite input is rejected.
|
||
Saved scalar assignment and modern debug refill do not infer a warning reset.
|
||
The modern debug checkpoint/load interface is not an original full save UI.
|
||
|
||
Managed tests cover strict19/20 boundaries, one-shot warning episodes, crossing
|
||
sound before scalar/low sound after scalar, clamp, tutorial bypass and shared
|
||
ordinary-load ownership. Source tests guard constructor, both new callsites,
|
||
body/constants and offsets. They are port/static checks, separate from listening
|
||
to the original whole game or native Windows verification. Whole energy/damage/
|
||
pickup consumers, soundbank timing and exact original scheduler remain open.
|