Skip to content

Claude/fix project restore 7jguvs - #5

Merged
AgentMystia merged 45 commits into
mainfrom
claude/fix-project-restore-7jguvs
Jul 27, 2026
Merged

AgentMystia merged 45 commits into
mainfrom
claude/fix-project-restore-7jguvs

Conversation

@AgentMystia

Copy link
Copy Markdown
Owner

No description provided.

claude added 30 commits July 26, 2026 08:04
… included

Player::UpdateShots (FUN_0043a290) releases a shot slot when the VM update
FUN_0044aa20 reports the script over — which happens for both authored
spellings of "end": op1 remove and op2 static. The port only honored remove,
so every impact script that closes on static kept its slot forever.

Decoding the shipped ANMs shows which forms that hits: ReimuB's orb impacts
(player00 98-101) and MarisaA's missile impacts (player01 97-104) all end
static at 20-45f, exactly when their fade reaches alpha 0. Reimu/Sakuya
impacts end on remove and were unaffected, which is why every converged
replay stayed converged while ReimuB alone lost DPS: its spent, invisible
impacts squatted the fixed 96-slot pool (measured 96/96 across th7_udFi03
Hard stage 3 frames 509-528), and firePlayerBullets drops new spawns when the
pool is full, so kills landed late.

Flight scripts also end static, but at t=10000/20000 — unreachable, so a
flying shot still only dies by bounds. Tests pin all three rules: the
static-ending impacts end on their authored tick without ever setting
removed, every shipped non-beam impact ends within 64 ticks (covering
MarisaA, which no replay exercises yet), and no flight script ends on its own.

replay-verify --all, earliest diverging frame per stage:
  Hard/reimuB st2 2165->7624, st3 537->3087, st5 617->2090, st6 1330->1727
  Lunatic 6/6 PASS, Extra PASS, Easy/Normal/Phantasm unchanged (no regression)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…t 30

The post-miss lock was one 30-tick death squish plus a full 30-tick
materialize ramp, so the player regained movement and firing 60 ticks after a
miss. The native recordings put it at 55: the state-1 -> state-3 handoff fires
25 ticks in, while the scale/alpha ramp keeps its cited 30.0 divisor and is
therefore still mid-flight when control returns.

Evidence, since reference/ and wine are both unavailable here: th7_udYo01
(Normal, sakuyaA) misses at stage-2 frame 8578 and stage-5 frame 2205. At 60
ticks every post-respawn collect in both bursts lands late (2 frames at stage
2, 5 at stage 5) and the earliest divergence sits at 8747 / 2280. At 55 both
bursts reproduce exactly and those stages carry to 9104 / 2320. Intermediate
totals were measured rather than assumed: 56-58 ticks fix the collects but
still miss the stage-5 kill stream at 2282, because the unlock re-arms FIRING
as well as movement. The squish stays 30, where the exe writes the miss bit 30
frames before the life counter drops (all.c:28596), which leaves 25 for the
materialize. Flagged replay-validated with an exe recheck pending.

The change cannot disturb anything already converged: every passing replay
stage records zero misses, so none of them reaches this path. Confirmed by the
full matrix — Lunatic 6/6 PASS, Extra PASS, and Hard/Easy/Phantasm byte for
byte unchanged.

The existing slowmo test pinned the old 30-tick handoff and now pins the 25;
a new test pins the 55-tick total per character family, including that firing
returns with movement.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
Updates both alignment documents to the state the measurements actually
support, so the next session starts from evidence instead of the old framing.

- New matrix: Hard st2 2165->7624, st3 537->3087, st5 617->2090, st6
  1330->1727 (shot-slot lifetime), Normal st2 8747->9104, st5 2280->2320
  (55-tick post-miss lock). Lunatic 6/6 and Extra still PASS.
- Adds the cheapest triage available: every PASSing stage records zero oracle
  misses, and the recording's own miss frames can be listed without simulating
  anything, which sorts the open cells into a post-respawn family and a
  no-death family. The old "Easy/Normal are all item-pipeline bugs" framing was
  wrong — Normal st5 looked exactly like a +-1-frame auto-collect bug and was
  really the respawn control lock, needing no item change at all.
- Records three refuted hypotheses with the measurements that killed them
  (ReimuB bomb double-slot damage, pre-move grab corners, and the mid-pass
  this.items splice), so they are not re-derived.
- Registers the 55-tick lock and the surviving dense-array item scan in the
  section 7 approximations registry, both with their validation status stated
  plainly: the lock is replay-validated with an exe recheck pending, and the
  item scan is a known-divergent-in-principle shape that is deliberately left
  alone until a converging witness exists.
- Rewrites the Hard/ReimuB and Easy/Normal leads around what is now open,
  including st3's remaining two-consecutive-kill mismatch at 3086/3087 and the
  1-2 frame early bias that follows it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…cell is not

Independent re-measurement of the post-miss lock narrowed it further than the
original commit could, and two cells that looked like the same defect turned
out not to be. Recording both so the next session does not retrace them.

- 55 ticks is unique from BOTH directions, not just better than 60: at 54 the
  Normal stage-5 kill stream goes early (2279), at 56 it breaks late (2282),
  and only 55 reproduces stage 5's kills at 2282/2283 together with stage 2's
  collect at 9104. The decisive stage-5 collect has a 0.141 px margin with the
  preceding non-event at -1.415 px.
- The unlock must re-arm firing as well as movement: freeing only
  `controllable` fixes the collects and leaves the kills broken, because
  Player.fire() also disarms the shot cycle while materializing.
- Flags the one thing the evidence cannot separate: 30 squish + 25 materialize
  (implemented) versus 25 + 30 are observationally identical on both cells and
  differ only in the respawn teleport frame, which opens the 60-frame silent
  bullet clear 5 frames apart.
- Easy st4 is proven NOT an item-pipeline bug. Its 181-item cherry burst is
  independent pure pursuit, and an offline simulator reproduces all 181 engine
  collect frames exactly; matching the oracle needs two items ~2.3 px and
  ~0.13 px farther while another is ~0.9-1.7 px closer, so no uniform change to
  speed, box size or player offset can do it. The spawn positions differ, i.e.
  the bullets were misplaced upstream before the bomb cancelled them.
- Easy st5 is not respawn timing either: its collect mismatch is insensitive to
  the lock length (index 191, ~38 frames late at locks of 60, 57 and 36).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
The remaining post-respawn cell now has a number instead of a suspicion. The
late collect is death-drop power item slot 841 (spawned at the 2507 miss, age
221 at 2727), falling straight down at terminal vy=3 with x fixed at 328.095,
and Y is the binding axis: at 2727 the player sits at (321.85, 381.00) so
|dx|=6.25 passes the 22 px box half-extent while |dy|=27.84 does not, and we
only collect at 2730 once |dy| reaches 21.95. Matching the oracle needs the item
5.84 px lower at 2727 — almost exactly two frames of extra fall at terminal
speed.

Two candidates survive and this cell cannot separate them: the drop starts
falling ~2 frames earlier, or its RNG-derived tween target y is 5.84 px lower
(the target is rng.f()*192-64, so that is a 3% shift of the range — the per-item
draw order in spawnDeathDrop is the thing to check). Completing the lerp at
elapsed 60 so the item lands on its exact target rather than stopping at t=59/60
was measured and does not move the cell.

Also records that tween items are only ever death drops, so that whole branch is
unreachable for every currently-passing replay.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
The previous entry was wrong and is replaced. Reading the collect stream by
INDEX rather than by frame shows the oracle running 2727, 2730, 2765 against our
2730, 2765, 3140: our 2730 and 2765 sit on the oracle's own frame values, so the
defect is one MISSING collect event at 2727, not three collects arriving late.
The earlier "slot 841 needs to be 5.84 px lower" arithmetic assumed our 2730 was
the oracle's 2727 and does not survive that alignment.

What the window really contains: the six death drops from the 2507 miss, all past
their 60-frame tween and falling at terminal speed. The original collects two of
them across 2727-2730; we collect exactly one, and our other five are 36 to 250 px
away in x and fall off the bottom uncollected. So one drop's tween target differs
enough that the original picked it up and we never do, which points at the death
frame's RNG draw count/order upstream of the six target pairs rather than at the
item pass or the fall physics.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
The previous entry guessed the drop-target divergence came from the death
frame's RNG draw count. That was tested and is not supported, so the entry now
says so instead.

Probing per-drop stride (k = 0..10 extra raw draws inside spawnDeathDrop, i.e.
stride 4..14, testing whether the exe spends draws per drop that we do not)
produced a collect at 2727 only at k=3 and k=10, and both then broke at 2730
rather than carrying further, while k=9 broke earlier at 2703. Two isolated hits
scattered across eleven values with no continuation is what re-rolling twelve
random targets looks like by chance, so neither k is a lead.

What remains is the harder reading: the RNG position at the drops is wrong
because of drift accumulated somewhere in the preceding ~2500 frames, invisible
until it moved an item target. That is the same shape as Easy st4 and needs a
position-level native trace, not more event-stream bisection. The one cheap thing
left to rule out is whether the exe spawns something at the miss commit that we
omit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
Saves the next session from re-running the ReimuB pool theory on a cell where it
does not apply. Across frames 2335-2365 the player-shot pool peaks at 82/96 and
the entire stage drops only 4 spawns, so nothing is starved. It is
spent-dominated (70-80 post-impact slots, fired falling to 0-2) because almost
every needle reaches the boss immediately and then holds its slot for its impact
script's 20 ticks — the correct behavior after the script-end fix.

The actual shape: the oracle kills at 2360 and registers a contact at 2362,
dying at 2375, which is 13 frames into ReimuB's 15-frame deathbomb window. We
kill at 2362 and never take that contact. So the earliest signal is a 2-frame
damage-cadence difference with settlement well under the 70 cap — arrival cadence
and per-frame settlement, not the pool.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
Performance evidence for the current tree, measured like-for-like against the
pre-session merge-base 314bdfb on the desync=0 control arm (the arm AGENTS.md
says to profile game-code cost on):

  metric            314bdfb    HEAD
  cadence p50        16.70      16.70
  draw p99           15.1       14.9
  draw dropRate      0.0021     0
  total p99          15.7       15.1
  total dropRate     0.0042     0

So no throughput regression and frame drops go to zero — expected, since freeing
a shot slot when its script ends leaves fewer live shots to integrate and draw.
Only src/game/player.ts and src/game/stage-scene.ts changed; nothing in the
renderer, loop, input or canvas layers.

Also documents that under Xvfb neither latency probe can adjudicate the
desynchronized default: the granted arm reads 17.93 ms steady while the
--no-desync control reads 9.54 ms, which is the backbuffer flush-accounting
artifact already described in the section 8 pitfall, with no real scanout to
measure against. perf:smoke's cadence gate fails identically on pristine
314bdfb here, so it is environmental — A/B the merge-base before believing a
cadence regression.

Three further refutations added to the baseline list: the item homing angle's f32
narrowing (no evidence either way, so the exe-cited form stays), the enemy
offscreen cull testing a pre-integration position (breaks the fixture at 1775 and
moves Hard st3 back to 2649), and the tween lerp completion.

Verified: chromium browser-matrix both passes, desync stage-5 presentation probe
exit 0 with blackPresents 0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
Gives the one remaining untouched cell a starting point instead of just a
stream name. The oracle registers a contact at 1628; ours does not arrive until
1710, 82 frames later. Through that window the player is motionless at
(171.51, 56.00) — top of the field, in the auto-collect zone — with hitboxHalf
1.1, no invuln and no border, while live enemy bullets climb 126 to 148. Our
nearest bullet at 1628 is 5.54 px away on the binding axis, so nothing is
marginal: whatever touched the original is elsewhere in our run.

The prime suspect is bullet slot 197, which approaches the player at speed
1.4316 on angle -3.0091 and then has its speed drop to exactly 0 at frame 1629,
freezing at (177.05, 54.04) for good. Its bullet-EX deceleration ramp is the
thing to check, along with the one-promotion-per-tick rule. A ramp clamping to
zero where native keeps the bullet moving would explain both the frozen bullet
and a real contact at 1628. Also flags the cheaper alternative to rule out
first: a dialogue freeze active in our run when it should not be, since an
82-frame offset is the right size for a mis-scheduled MSG wait.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
… theory

The dialogue-freeze theory for Easy st6 is refuted: no MSG runner is active
anywhere in 1600-1720 and the player is motionless only because the recorded
input word is 1 (shoot, no direction) from 1620 to 1709, so its position track is
exactly input-determined. The window is really a dense pattern — live bullets
climb 125 to 342 while the player holds still — where any small upstream position
error decides whether a contact lands.

That makes three cells with the same measured conclusion, each on independent
evidence: Easy st4 (a pursuit simulator reproduces all 181 collect frames, and the
oracle needs mixed-direction offsets no uniform change can produce), Normal st6
(tween targets are a pure function of RNG position; a stride probe gave only
chance hits) and Easy st6 (nothing marginal — 5.54 px against a 1.1 px half-box
amid 137+ bullets). Grouping them under one heading with the reason events cannot
close them, so the next session goes after per-frame native state instead of
bisecting kill/collect frames again. Notes explicitly that a static exe read will
not settle these either — they are accumulated-state questions, not constant
questions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
The standing claim that every difficulty-gated ECL branch had "only ever
executed under Lunatic" was wrong, and the fix is methodological: a converged
STAGE validates a branch just as well as a converged replay, and Easy st1-3 plus
Normal st1 all pass. Instrumenting the four gated effect sites and counting
firings per stage gives:

  effect 6, difficulty < 3 arm  -> 32 firings in Easy st3, a PASSING stage
  effect 6, >= 3 arm            -> 96 firings in Lunatic st3, PASSING
  effect 1, difficulty < 3 arm  ->  2 firings in Easy st2, a PASSING stage
  effect 8, effects 12/21       -> fire in none of the sampled stages

So effect 6's `difficulty < 3 ? 4 : 2` with its pi/6-vs-pi/2 pair is correct as
written, despite reading as non-monotonic. Confirmed independently by sweeping six
candidate (count, spread) pairs against Normal st3, where every alternative was
worse: (2,pi/6) 8306, (2,pi/2) 8290, (4,pi/2) 7617, against the current (4,pi/6)
11863. Sweeps of that arm carry no risk to the converged rows because the fixture
is d3 and Extra is d4, so both take the >= 3 branch.

Consequence for the open work: Normal st3 @11863 is NOT an ECL-gate problem —
effect 6 is the only gated site that fires before that frame and it is now
validated. Only effect 8 and effects 12/21 remain genuinely unexercised.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
Measuring the Hard st1 midboss spell reframes every boss-spell cell. The spell
divisor is applied once per enemy per frame as
`dmg >= 8 ? trunc(dmg/7) : dmg > 0 ? 1 : 0`, so the fractional part is discarded
at every settlement. Over that spell (enemy slot 2, hp 203, 58 settlements across
frames 5153-5460) raw damage sums to 1629 while only 207 lands — 87% discarded —
with zero settlements reaching the 70 cap and a median raw of 24, losing 0.43 per
settle. We also only damage on 58 of the spell's 307 frames.

Two things follow. A spell kill landing N frames late is a small raw deficit
amplified by the divisor, so the thing to hunt is a missing or late shot rather
than a damage-formula error — which makes Phantasm's "~2 HP excess" about 14 raw
damage, roughly ONE extra shot arriving somewhere across the spell. And because
truncation is per settlement, arrival distribution matters independently of
totals: four hits of 12 on separate frames yield 4, the same four clumped yield 6.
Any change to shot cadence or slot lifetime therefore moves spell kills more than
its effect on total damage suggests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…arget

steerHomingBullet's two float64 residues were this cell's standing prime
suspect and they are not the cause. All three stagings leave the divergence at
exactly 51989: frounding the unrounded `dist`, comparing >= maxSpeed against the
f32 `mag` instead of float64 `magExact`, and both together. Those experiments
carry no risk to the converged rows, since shotTypes 1/2 are ReimuA-only — the
fixture is sakuyaA and Extra is marisaB, so neither can be moved by editing that
function.

Also restates the target in the units that matter: 2 HP through the /7 spell
divisor is about 14 raw damage, i.e. roughly one extra shot landing somewhere
across the spell, rather than a rate or formula error. With the steering
exonerated, that shot has to come from spawn cadence, pool occupancy or the
collision AABB.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
… edge

Measured the kill exactly. Boss is enemy slot 1, sub 69 running spell sub 127;
hp falls 36-26-25-17-13-12-11-10 and then to 0 at f51989. That last settlement is
three shots, 30 + 30 + 28 = 88 raw, which the 70 cap turns into trunc(70/7) = 10 —
exactly enough to kill a 10-hp boss. One fewer shot (60 raw, 8 settled) leaves it
at 2 hp and it dies later, which is the entire divergence.

The AABB is ruled out as well as the steering: one frame earlier all three shots
sit only 0.7-2.4 px outside on Y while travelling at vy about -12, so on the hit
frame they are ~10 px inside the box. No edge rounding can drop one of them.

So the 2 hp accumulated earlier in the spell, and the target is two extra hp of
settled damage rather than one mis-timed shot at the kill. That is a weaker signal
than it sounds: the divisor floors raw < 8 to exactly 1, so a single tiny hit is
worth a whole hp regardless of its raw value — our own curve shows four such 1-hp
steps, each from one 5-damage shot. Two extra small hits anywhere across the spell
explain the cell, which puts it in the upstream-drift family in practice.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…n-squish

Now verified against the real Th07.exe v1.00b rather than inferred from replays.
The binary is confirmed to be the one every citation in this tree refers to:
`cmp DWORD PTR [ebp-0x14],0x1e` sits exactly at 0x43a8d5, the shot-cycle constant
AGENTS.md cites.

What the disassembly shows:
  0x43e043  cmp DWORD PTR [ebp-0x14],0x1e / jl   <- state-2 clock, from player+0x16a08
  0x43e050  mov BYTE PTR [eax+0x2408],0x1        <- hand off to state 1, materialize
  0x43e24d  cmp DWORD PTR [ebp-0x10],0x1e / jl   <- materialize clock
  0x43e256  mov BYTE PTR [eax+0x2408],0x3        <- hand off to state 3, invuln

So BOTH phases are 30, and the previous revision's 25-tick materialize was wrong.
The 55-tick total the replays proved is real, but it arises differently: state 2
runs ONE 30-tick clock started at the hit, and the deathbomb window burns the
front of it. The squish after the miss is therefore 31 - window and the whole
post-miss control lock is 61 - window — Reimu 46, Marisa 53, Sakuya 55.

That distinction was invisible before because only Sakuya replays exercise a
death, so the fitted constant (a flat 55 for everyone) happened to be right for
Sakuya and wrong for the other four shot types. th7_udYo01's stage-2 (miss 8578)
and stage-5 (miss 2205) respawns still pin the Sakuya value and this rule
reproduces them; Reimu and Marisa now come from the executable instead of a fit.

Full matrix is unchanged — every replay with a death diverges before its first
one, so this is a correctness fix with no current behavioural delta. Tests updated
to assert the per-character lock and, in the slowmo case, that the wall-clock
meter and the rate-scaled clock scale differently (the 15-call window eats only
7.5 ticks, so the remainder is 45 calls).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
The original executable is now available locally, so five load-bearing facts move
from cited-by-comment to directly verified with objdump. The binary is confirmed
to be the one this tree's citations refer to: the shot-cycle `cmp 0x1e` sits
exactly at 0x43a8d5.

  damage cap 70          cmp/mov 0x46 @ 0x41f94f            matches min(70, ...)
  spell divisor          cmp 0x7 @ 0x41fac6, idiv 7 @        matches
                         0x41fad5, else mov 1 @ 0x41fae2     dmg>=8 ? trunc(dmg/7)
                                                             : dmg>0 ? 1 : 0
  ReimuA stage reduction stage vs 5/6 then sar 1 @ 0x41f9da  matches /2 and 11/16
  state-2 clock          player+0x16a08 vs cmp 0x1e @        ONE 30-tick clock
                         0x43e043 -> state 1 @ 0x43e050      started at the HIT
  materialize clock      cmp 0x1e @ 0x43e24d -> state 3      30 ticks, not 25

The min-1 floor in the spell divisor is confirmed, which matters: a single tiny
hit is worth a whole hp during a spell.

The practical consequence is for Phantasm — its kill arithmetic is now confirmed
CORRECT (raw 88 -> cap 70 -> trunc(70/7) = 10, exactly killing a 10-hp boss), so
that divergence sits upstream of the damage formula and nobody should go hunting
for a cap or divisor bug there.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…traces

This was the blocker across several sessions and it is no longer one. Verified
2026-07-26 on Ubuntu noble: Wine 9.0 with 32-bit support runs Th07.exe under Xvfb
for 90s without crashing, and winedbg --gdb (what the PRE-trace procedure needs)
is present.

The install order is the non-obvious part, so it is written down verbatim:
p7zip-full comes from apt (pip is blocked by the tooling classifier); i386 must be
added as a foreign architecture; and wine32:i386 pulls libgphoto2-6t64:i386, whose
libgd3:i386 dependency apt refuses to auto-resolve — installing libgd3:i386 first
fixes it. Installing wine32:i386 also REMOVES the amd64 wine package, so
/usr/bin/wine disappears and the loader to use afterwards is /usr/lib/wine/wine.

Why it matters: the upstream-drift cells (Easy st4, Easy st6, Normal st6, and
Phantasm in practice) are measured to be unclosable from event streams, so they
need per-frame native state. That procedure is now executable in this environment
rather than deferred to one where wine exists.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
IsInBounds @ 0x42bdc7 divides the size by 2.0 (0x48eac0) and compares against
0.0 (0x48ea9c) and 384.0 (0x48eabc), which is exactly the [0,384] rect with
half-extents that updatePlayerBullets uses. That matters for the Hard group: the
player-shot offscreen cull is confirmed correct and is therefore not the residual
ReimuB DPS suspect.

Also reads back 30.0 @ 0x48eb60 and 64.0 @ 0x48eb68, confirming the materialize
ramp divisor and the spawn-Y offset the comments already cited.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…t arithmetic

The death-drop tween targets match the executable exactly: 0x430adf calls the RNG
float routine then fmul 288.0 / fadd 48.0 into +0x264, and 0x430afe calls it again
then fmul 192.0 / fsub 64.0 into +0x268. X first, Y second, exactly two draws per
drop with no hidden third — which also validates the k=0 baseline of the earlier
per-drop stride probe on Normal st6.

With that, everything the open cells depend on arithmetically is confirmed against
the binary: the damage cap and spell divisor (including the min-1 floor), the
ReimuA per-stage reductions, the player-shot bounds cull, both death/respawn
clocks, and now the drop targets. So none of the remaining divergences is a
constant or formula bug. What is left is accumulated state divergence — a wrong
RNG position or slightly wrong entity position when a correct formula is applied —
which the AUX streams cannot see until it moves an event. Recorded so the next
session goes straight to the Wine PRE traces rather than re-auditing formulas.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
The enemy offscreen cull calls the same IsInBounds at 0x42bdc7 (from 0x41f32a)
that the player-shot cull uses, and follows it with the op138 trail-history check
at 0x41f39e — both matching updateEnemyCull. That confirms slot-vacate timing,
which is what the AUX kill bit records when an enemy leaves the field, so Hard
st3's missing 3086/3087 kill pair is not a cull-boundary bug either.

This exhausts the static-verification avenue: every formula and constant the open
cells could depend on now matches the executable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
Adds the last missing piece to the recipe: xdotool, for the menu key injection the
PRE-trace procedure needs. Verified that with the game running on a dedicated Xvfb
display, xdotool enumerates its windows and delivers keys without killing it.

Explicitly records what is still undone so nobody mistakes this for a working
trace: the menu schedule itself (title -> Replay -> file -> stage -> mode) and
confirming the reached stage before trusting any captured rows. AGENTS.md's warning
that a valid trace of the wrong stage is worse than no trace still stands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
winedbg attaches to a live process and enumerates it, so
`printf 'info proc\nquit\n' | /usr/lib/wine/wine winedbg` gives the Windows pid
needed to read 0x62583c (stage), 0x4afe28 (frame) and 0x495e00/04 (RNG) without
launching under the debugger and slowing the game down.

More importantly: PCB only lists replays in its NUMBERED slots, so a third-party
filename like th7_udMt01.rpy never shows up in the Replay menu. It must be copied
to a slot name (replay/th7_01.rpy) before launching. Not doing that is what killed
the first attempt here — the list was empty, the injected keys walked past it into
Quit, and the game had already exited by the time winedbg attached.

Both recorded because they are the kind of detail that otherwise costs an hour of
a fresh session's budget.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
The core mechanism the PRE trace needs is now confirmed, not assumed. With the
game alive on its own Xvfb display, taking the wpid from `info proc` and running

  printf "attach 0x<pid>\nprint *(int*)0x62583c\ndetach\nquit\n" \
    | /usr/lib/wine/wine winedbg

prints the stage variable. Verified by attaching to wpid 0x20 and reading stage 0,
i.e. still in the menu — which also means the numbered-slot fix kept the process
alive through the injected keypresses, unlike the first attempt.

So the only unfinished piece is the key schedule that walks Replay -> file ->
stage -> mode, and `stage != 0` is the cheap check that it landed. Everything
downstream (frame at 0x4afe28, seed/draws at 0x495e00/04) reads the same way.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
The read path is fully verified — attaching to the live game and printing
0x62583c/0x495e00/0x495e04 all return values. Two gotchas that cost attempts are
now written down: winedbg appends `print` results to its `Wine-dbg>` prompt so a
line-anchored grep silently matches nothing (pipe through tr), and 0x495e00 reads
0 before a run starts, so stage at 0x62583c is the correct "in gameplay yet" probe.

Also records the negative result so it is not repeated: `Down Down Down z` then
`z z z` from the title leaves stage at 0, i.e. that schedule does not reach
playback. The cheap iteration loop is one launch plus one attach per candidate
schedule, checking stage != 0 — including verifying that Z reaches the game as a
confirm key under Wine at all.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
The Wine bring-up is finished and working: the game runs at a steady 60 fps
under Xvfb, takes injected input, and its globals read straight out of
/proc/<pid>/mem. Three things had to be found to get there, all recorded:

- the game is 32-bit, so wined3d needs the i386 Mesa GL stack; without it
  Direct3DCreate8 returns NULL, the game shows a Shift-JIS message box titled
  "log" and sits at 0.0% CPU forever. Zero accumulated CPU time is the
  cheapest "never started" vs "not taking input" discriminator.
- xdotool key presses and releases in ~12 ms, which falls between two 60 fps
  DirectInput polls, so the game never sees it. Keys must be HELD
  (keydown / sleep 0.1 / keyup). This mimics "input not reaching the app".
- no window manager runs, so X focus is PointerRoot: move the pointer onto the
  window and set focus explicitly.

The replays still cannot be played natively, and the reason is the binary.
Every one of the six replays -- the five local-evidence files and the committed
fixture -- records the recording executable's fingerprint at image +0xE0/+0xD8/
+0xDC: tag "0100b", size 650752, checksum 0xAEC5445C. The extracted binary
self-identifies as v1.00: tag "0100_" at .rdata 0x48D230, title string
"ver 1.00", 607744 bytes, SizeOfCode 530432. FUN_004402d0's final gate
(FUN_00437ab4) compares those fields and rejects all six, so the Replay list
comes up with its header and zero rows. Magic, the 0x1100 version word, the
additive checksum and image[0x95] == 0 all pass first -- verified byte-exact --
and the gate is live in the running process ([0x56bbfc] = 36445856, not 0).

Needed to unblock: a Th07.exe of exactly 650752 bytes with tag "0100b". The
gate must not be patched out; a v1.00 trace measures neither the build that
recorded the replays nor the build the port targets.

Also corrects provenance across both documents. reference/Th07.exe is v1.00,
so this session's "exe-verified" constants table is v1.00-verified with a
v1.00b recheck pending -- its findings were independently corroborated by the
replay matrix, so they stand, but they must not be re-cited as v1.00b. Cited
decompile addresses do resolve against this binary (six spot-checked function
starts are exact prologues), which keeps static reads usable. A v1.00-vs-v1.00b
build difference is now on the record as an open hypothesis for the residual
drift: it presents exactly as observed -- thousands of frame-exact events, then
a lone shifted one that no constant audit explains -- and is unfalsifiable from
v1.00 alone.

Two earlier claims in the handoff are retracted as wrong: PCB does enumerate
th7_ud????.rpy via FindFirstFile (so third-party filenames are listed, and the
copy-to-th7_01.rpy workaround was unnecessary), and 0x62583c is not confirmed
to be the stage variable -- it read 4 on the title screen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
Started an Easy/ReimuA run from the title under Wine (no replay needed, so this
is re-verifiable without the missing v1.00b binary) and confirmed by measurement
which globals the future PRE trace should read:

  0x625838  per-stage frame counter  (+61 per 1.0 s wall clock)
  0x62583c  stage number             (reads 1 in stage 1)
  0x495e00  live RNG state           (43986 -> 59576, non-monotonic)
  0x56ba80  app uptime               (advances even when the stage clock stops)

The frame/uptime pair is what distinguishes a hung game from a paused one; no
single counter does. 0x62583c is the stage but is NOT a usable "in gameplay yet"
probe -- it held 4 on the title screen, which is what made the earlier menu
automation look broken when it was actually the input hold time.

Corrects two more earlier notes: 0x495e04 is not a per-frame draw counter (0 ->
22 across an entire run) and 0x4afe28 is a pointer, matching the DAT_004afe28
recorder-context reading already in src/formats/rpy.ts.

Also records the delta-scan recipe for locating unknown counters (two snapshots
one second apart, keep dwords with delta 50..70 -- ~12 candidates out of 2.5 MB)
and the fact that the game plays unattended to a continue prompt in ~2600
frames, which is free native stage-1 coverage but no substitute for replay
playback.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
ItemManager::OnUpdate walks its ITEM_POOL_CAP physical slots and tests each
one's occupancy byte; it never walks a compacted list. updateItems was the last
manager still iterating the dense array, which let a mid-pass spawn --
collectItem -> power crossing 128 or a border latch -> cancelBulletsToItems ->
spawnItem -> insertByPoolSlot -- splice() into this.items at or below the live
iterator position, so for...of handed back the CURRENT item a second time: it
integrated twice and got a second collect test in one frame. The ascending slot
scan reproduces all three native properties instead -- each slot visited at most
once, a spawn into a lower slot waits a frame, a spawn into a higher slot (or one
reusing a slot the y>=464 cull vacated earlier in the same pass) still ticks now.

updateItems now calls syncItemSlots() at its head so the invariant holds however
it was entered: syncFixedPools() establishes it once per tick for the live scene,
but focused unit harnesses call updateItems() directly with only the dense array
populated, and the old code papered over that with optional chaining on
itemSlots. slotsConsistent() is allocation-free and early-returns, so the
steady-state cost is one walk of the live items.

This is a structural-fidelity fix, NOT a convergence fix, and it is recorded that
way: the full replay matrix is byte-identical before and after, so the
double-visit provably never fires at any current divergence frame -- consistent
with the earlier Easy st4 refutation already noted in AGENTS.md. Landing it
without a converging witness is the documented exception to the usual bar,
justified by the neutrality measurement rather than waived. 336 tests green
(335 pass / 1 skipped), tsc clean, and update p50/p95/p99 unchanged -- ~1050
extra null checks per frame is microseconds, and a first reading of p99 1.5 ms
was noise (repeats gave 0.9 and 1.1 ms against a 1.0 ms baseline).

Also fixes two now-stale AGENTS.md notes: the materialize/squish "open
sub-question" cited MATERIALIZE_EXIT_FRAMES, a Sakuya-fitted constant removed
earlier this session -- both phases are 30 and state 2 is one 30-tick clock, so
the post-miss lock is 61 - deathbombWindow (46/53/55 for windows 15/8/6).

Investigated and refuted along the way: per-shot-type item constants as the
cause of the "collect one frame early" signature. Decoding all twelve SHT
headers shows Reimu's itemRadius (20), pocLineY (128) and autocollectSpeed (8)
are identical to Sakuya's, which passes all of Lunatic -- so the fact that every
Reimu cell diverges is not explained by the item table.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
No Reimu cell has ever passed (Hard/reimuB 6/6 diverge, Phantasm/reimuA 1/1)
while sakuyaA passes all six Lunatic stages. Since each stage is verified from
its own recorded entry snapshot, the six Hard cells are six INDEPENDENT
fresh-start divergences, all early (1727-7624) -- the shape of a systematic
per-character bug rather than accumulated drift.

Decoding all twelve SHT files shows why that looked promising: ReimuB's option
needles are the only player shots in the game with hitbox 12x40 at speed 22,
against 12x12 or 12x24 at speed 10-12 for everyone else. A full-vs-half extent
error would cost ReimuB 20 px where it costs sakuyaA 6, and the divergence
direction fits (kills 2 frames early = slightly too much DPS).

All three candidates are refuted, and recorded so they are not re-walked:
collidePlayerShotsInBox already halves hitboxW/H per the SHT header note;
anchorBeamBullet does clobber hitboxH but its only call site is gated to
shotType 4/5 and ReimuB is shotType 0; and ReimuB's itemRadius/pocLineY/
autocollectSpeed are identical to Sakuya's, which passes Lunatic 6/6.

Also warns against unifying the two characters -- ReimuA's cell is homing
(shotType 1/2) while ReimuB fires ordinary shotType 0 needles, so this is more
likely two bugs than one, and treating it as one is what generated the dead ends
above. Restates what is actually unexplained at Hard st6: at the earliest
divergence all 140 preceding kills are frame-exact, so spawn frame, spawn
position, item constants and player position are all exact, leaving the state-1
homing recurrence and the PoC/border latch as the surviving candidates.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
claude added 15 commits July 26, 2026 17:46
Hard st6 is the earliest divergence in the matrix and now has its context pinned.
The player is stationary at (315.3975830078125, 421.48236083984375) for the whole
window, so no player-position error is possible -- position comes straight from
recorded input. Recorded input flips to bomb at 1726, the oracle's AUX stream
records the bomb at exactly 1726, ours agrees, and cherry drains from 1727 on both
sides. Oracle itemCollect starts at 1728 and runs near-continuously to 1800; ours
starts at 1727. All 140 preceding kills are frame-exact.

The useful negative result: that collect is NOT one of the bomb's cancel items.
The frame-1726 dump shows 184 items alive, all still at their spawn positions with
state 1, nearest 95.47 px from the player -- at autocollectSpeed 8 the first cannot
arrive before ~1738 and the farthest (466 px) not before ~1784, which matches the
shape of the 1728-1800 burst but not its start. So both sides' first collect is
something else, most plausibly an ordinary falling drop from the 1716/1717 kills
reaching a player parked at the bottom edge. Identifying it needs a scratch driver
on the onScene hook, because --dump-frame's itemDump caps at 12 of 184 entries.

Also records a refutation. The dialogue-drop note citing native Phantasm PRE3966
("state=1, age=1; pre-homing it moved it 8 px too soon") reads like evidence that
a freshly latched item skips its first homing step. It is not -- it describes an
ordering bug, force-collect running before updateItems instead of after. Gating
the homing integration off for state===1 && age===1 destroys the whole matrix,
including all six Lunatic PASSes and Extra (Lunatic drops to
2673/1411/2096/3175/1157/1926, Extra to 1153).

That failure is informative in its own right: item homing is exercised constantly
and precisely in every replay, so any incorrect change to its timing surfaces
within ~600-3000 frames of every stage. The current timing is therefore strongly
validated by the eight passing cells, and this is a bad place to guess.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…rame

A scratch driver on the onScene hook wrapping collectItem/spawnItem settles it.
At frame 1726 cancelBulletWithBombSlots -> beginBombClearFade converts 122
bullets to cherry items (then a trickle 1727-1734 as the box expands), and at
1727 three of them are collected on their FIRST pass (age 1, state 1). Slot 198
spawned at ~(324.0,410) against a player at (315.398,421.482); the grab test is
|dx| <= 12 + itemRadius/2 = 22 on both axes, so it was ALREADY inside the grab
box at its spawn position. It must be collected on whatever frame it is first
visited -- no homing change can move it. It can only collect at 1728 if it does
not yet exist at 1727.

Our prepareBombEffects() is gated on p.bombTimer > 0 AFTER tryBomb() set it,
whereas the cherry drain three lines above deliberately uses the frame-entry
snapshot because "a newly triggered bomb does not pay until the following player
tick". Deferring the clear confirms the mechanism: Hard st6 moves 1727 -> 1747.

Both variants are net-negative and neither should be re-landed as-is. Gating all
of prepareBombEffects regresses Extra from PASS to 10067. Deferring only the
bullet clear holds Lunatic 6/6 and Extra but collapses Phantasm from 51989 to
10406 -- and Phantasm's first recorded bomb is at 10405, exactly one frame
earlier. So ReimuA's bomb DOES clear bullets on its trigger frame while ReimuB's
does not, and MarisaB's is insensitive to the bullet-clear deferral but sensitive
to deferring the whole effects pass.

Conclusion: bomb clear timing is per-character, set by that character's bomb
script, not by a global rule. The fix belongs in the bomb form/choreography --
which frame each character's bomb publishes live attack slots -- and any global
gate trades one cell for another. Both experiments reverted; matrix, 336 tests
and tsc all back at baseline.

Also retracts a wrong claim from the previous commit: that the 1727 collect was
not a cancel item, argued from the nearest of 184 items being 95 px away.
--dump-frame's itemDump caps at 12 of 184 entries sampled by slot, not distance,
so it was an unrepresentative sample. Use a driver, not the dump, for item
questions.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
FUN_00408f10's slot writes are odd-frame gated. This routine's comment claimed
that gating "only halves the cosmetic position refresh" -- it does not. Bomb
attack slots persist until cleared (marisaAUnfocused gates the same way on
frame % 3 and explicitly clears on the off-frames), so gating the writes leaves
bomb frame 0 with NO live slot and every frame from 1 onward active.

That one-frame deferral is exactly what the trigger frame needs. th7_udFi03 Hard
st6 bombs at 1726; the ungated write cleared 122 bullets into cherry items during
1726, and three of those items -- one already inside the player's grab box at its
spawn position -- were collected at 1727, while the oracle's first cancel-item
collect is 1728. An item that spawns inside the grab box must be collected on
whatever frame it is first visited, so the only way to move it is for it not to
exist yet.

Crucially this is character-local, which is what the two earlier attempts got
wrong. Deferring the clear globally in prepareBombEffects (either the whole
effects pass or just cancelBulletWithBombSlots) also moved Hard st6, but broke
ReimuA: Phantasm's first bomb is at 10405 and those builds diverged at 10406,
because ReimuA's bomb does clear on its trigger frame. Gating it inside ReimuB's
own form touches nothing else.

Result -- strict improvement, no regressions anywhere:

  Hard st6  1727 -> 1791
  Hard st3  3087 -> 3092
  all other cells byte-identical, including Lunatic 6/6 PASS, Extra PASS,
  Phantasm 51989, and every Easy/Normal cell

336 tests green (335 pass / 1 skipped), tsc clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…ence

Built the bomb/divergence proximity map from auxEventFrames against each cell's
earliest diverging frame. Bombs precede 7 of the 14 diverging cells, three of
them within 14 frames (Hard st2 gap 3, st3 gap 6, st5 gap 14), which is why the
bomb forms are currently the highest-yield place to look. The table records the
gap and the cast type (input bit 0x4 at the bomb frame, which decides which form
ran). Equally useful: six cells have NO preceding bomb at all -- Hard st1/st4,
Easy st5, Normal st2/st5/st6 -- so they cannot be bomb-timing bugs and bomb
effort should not be spent on them.

Two negative results recorded so they are not retried.

The odd-frame gate that fixed reimuBUnfocused does NOT extend to reimuBFocused,
despite FUN_004094e0 sitting beside FUN_00408f10 and the two casts sharing the
opening 2->6 shake. Gating the focused cast the same way makes both focused-bomb
cells worse (Hard st2 7624->7622, st5 2090->2077, everything else unchanged), so
FUN_004094e0 does publish its r256/d18 box every frame including frame 0, as
already implemented. Both directions are now pinned by measurement. The corollary
matters for Hard st2: with the focused box confirmed correct, whatever diverges
three frames after that bomb is not attack-slot timing -- look at the start()
path, the shake, the drain deferral, or spawnBombEffects' flagged approximations.

Shifting sakuyaBUnfocused's freeze pulses from bomb frames 0/60/120 to 1/61/121
leaves the matrix byte-identical, so those pulses have no observable effect on any
cell and the path is ruled out rather than merely unhelpful. That routine also
publishes no bullet-clear regions when unfocused, so there is no early-clear
mechanism there at all: Easy st6's missing player contact at 1628 needs a
different explanation.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
The gate itself is unchanged and still witnessed by Hard st6 (1727 -> 1791) and
st3 (3087 -> 3092), but the comment I shipped with it explained it wrongly: it
claimed bomb attack slots "persist until cleared", so gating the writes would
merely defer the cross by one frame. BombEngine.beginFrame contradicts that --
FUN_0043d8f0 zeroes dims.x on all 112 entries at the head of every player tick,
so a slot not REWRITTEN this frame is not live this frame.

The real mechanism is a 50% duty cycle: half the damage frames and half the
bullet-clear frames, the same shape marisaAUnfocused already models on frame % 3
(two frames in three, explicit clear on the third). Same code, correct reason.

The distinction is not academic -- it separates two hypotheses that a one-frame
deferral reading conflates, and testing them apart is what pinned the focused
cast. Neither gating reimuBFocused on odd frames NOR merely skipping its frame 0
helps: both make Hard st2 7624 -> 7622 and st5 2090 -> 2077. So native does apply
the focused r256/d18 box on the bomb's trigger frame, confirmed two independent
ways, and that box is correct as implemented.

Hard st2 is worth noting as the closest cell in the matrix: kills 383/383 all
within 3 frames, playerHits/misses/bombs/borderBreaks exact, RNG residue exact
(delta 0), stage completes. It fails on one kill one frame early (7624 vs 7625),
one collect one frame late (7636 vs 7635) and one border start (13874 vs 13889),
with score off 509 and cherry off 90. Since the frame-0 box is confirmed correct,
the ~18 points of excess damage come from somewhere else -- the per-slot hitTally
cap is the untested candidate (cf. sakuyaAFocused's documented "d12 until its own
tally reaches 80"), but the cap value for FUN_004094e0 is not known and must not
be fitted.

Behaviour-neutral: matrix byte-identical, 336 tests green, tsc clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
… fit

I read FUN_00408f10 in the binary instead of trusting the inherited comment, and
the exe justification I shipped for this gate does not hold up. Disassembling
0x408f10-0x4093c0 shows the frame-0 init, a frame-60 (0x3c) shake, four
UNCONDITIONAL `call 0x43e730` bullet-clear allocations with exactly our geometries
(62x448 twice, 384x62 twice), and a 4-iteration loop writing the attack slots at
stride 0x20 -- with no `and 1`, `idiv`, `sar` or any other parity test anywhere in
the routine. The "odd-frame write gating" the previous comment attributed to the
exe could not be located. ZunTimer::HasTicked, the one documented per-tick gate
for these forms, is rate-dependent and always true at rate 1, so it cannot
produce a 50% duty cycle either.

The gate stays, because zero regressions across 22 cells plus two converged
frames is a genuine witness and §7 explicitly provides for replay-validated
entries pending exe recheck. But it is now labelled for what it is -- an
empirical fit, not decoded behavior -- at the code site and in the §7 registry,
flagged as a prime candidate to re-derive or delete once FUN_00408f10 can be read
against the v1.00b build. Nothing further should be inferred from it.

Two things verified correct along the way, needing no change:

- All twelve bomb forms call FUN_00431d10 (force-collect every live item) in
  their frame-0 init -- 12 call sites in 12 distinct routines -- which matches
  our unconditional forceCollectAllItems() in onBombUsed().
- Every readable per-form duration written to +0x16a28 matches BOMB_PARAMS
  exactly: reimuB 140/190, marisaA 200/260, marisaB 300/340, sakuyaA 160/250,
  sakuyaB 160/300. That also confirms the routine-to-form address map
  (0x408f10, 0x4094e0, 0x409900, 0x40a050, 0x40a910, 0x40af70, 0x40b440,
  0x40bbb0, 0x40c620, 0x40cbf0).

Behaviour-neutral: matrix byte-identical, 336 tests green, tsc clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…m the binary

Static reads against the v1.00 binary answer more than my earlier "blocked on
v1.00b" framing implied, so I read the attack-slot consumer instead of guessing.

FUN_0043a980 decodes cleanly. It walks the 96 player-shot slots first (stride
0x364, alive flag +0x34a, with the [+0x34c] == 3 MarisaA missile exception our
collidePlayerShotsInBox already models), then the 112 attack slots (stride 0x20
via shl 5, base player+0x9dc, dims +0x9e8). Liveness is dims.x > 0 and the FULL
widths are halved by a const/const load before the AABB test -- both match our
implementation. Damage lives at +0x9f4 and hitTally at +0x9f8, and at
0x43af8d-0x43afa0 the tally simply accumulates damage with NO cap applied in the
consumer: an overlapping slot really does deal its damage every frame.

Caps are per-form. Scanning all twelve forms for +0x9f8 references: reimuA
unfocused zeroes it; reimuA focused compares against 0x6; marisaA focused against
0x5; sakuyaA unfocused against 0x1 and 0x3; sakuyaA focused against 0x0 and 0x3;
and the remaining seven forms never touch it.

Crucially NEITHER ReimuB form references the tally at all, so Hard st2's ~18
points of excess damage is not a per-slot tally cap. That closes the hypothesis I
left open last round -- there is no FUN_004094e0 cap value to find, so nobody
should go looking for one.

Two follow-ups this opens, both readable without v1.00b: sakuyaAFocused's comment
claims its slot runs "d12 until its own tally reaches 80" while the exe compares
that form's tally against 0x0 and 0x3, so either the 80 is a different field or
the comment is wrong (sakuyaA is the character behind Normal st2-6); and the four
capped forms' thresholds are concrete constants to check our implementations
against.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…no bug

Retracts the threshold values in the previous commit. They were truncated by my
own grep of a wide objdump and are wrong: what I reported as 0x6/0x5/0x1/0x3 are
actually 0x64 (100), 0x50 (80), 0x1e (30) and 0x3e7 (999). Read operands from a
realigned objdump window, never from a grep of a wide dump.

That also dissolves the "sakuyaA says 80 but the exe says 3" discrepancy I flagged
as the next lead: it never existed. The "d12 until its own tally reaches 80" note
belongs to marisaAFocused (FUN_0040a050), not sakuyaA, and 80 is exactly right --
cmp …,0x50 with jge skipping the slot write, plus dims 0x43000000 = 128.0f on both
axes, matching engine.set(i, x, y, 128, 128, 12) under hitTally < 80.

Checked all four implemented thresholds against the binary, and every one matches:

  reimuA focused     exe 0x64 (100)  ours hitTally > 99    (player-bombs.ts:341)
  marisaA focused    exe 0x50 (80)   ours hitTally < 80    (:458)
  sakuyaA unfocused  exe 0x1e (30)   ours hitTally < 30    (:577)
  sakuyaA focused    exe 0x0         ours hitTally === 0   (:688)

Only remaining unmodelled piece is the 0x3e7 (999) guard present on both sakuyaA
forms, which at d22-d24 is dozens of hits and so is low priority.

Docs-only; no code touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
Closes the last gap I had identified. At 0x40b9f1-0x40ba24 (sakuyaA unfocused;
0x40c3fd is the focused twin) the shape is: compare the slot's tally against
0x3e7, and if it is BELOW, attach impact script 0x460 to the knife's visual and
then write 999 into the tally so the branch can never run again. So 999 is a
one-shot "impact already played" latch, not a damage threshold -- which also means
my "effectively unlimited, dozens of hits at d22-d24" reading of it was wrong.

We already implement the same one-shot, via knifeFx[slotId] = null after
setScript(96). Nothing to add, and no threshold to model.

That leaves every tally reference in all twelve bomb forms accounted for: four
real caps (reimuA focused 100, marisaA focused 80, sakuyaA unfocused 30, sakuyaA
focused 0), all matching our code; two sentinel latches at 999; one zeroing in
reimuA unfocused; and no reference whatsoever in either ReimuB form or in
marisaA unfocused, marisaB, or sakuyaB.

Docs-only; no code touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
… case

Characterized the one cell class I had not looked at: Hard st1 has no bomb
anywhere in the stage (bombs oracle 0, ours 0, exact) and no oracle deaths, so
bomb timing and respawn timing are both excluded by construction. It is pure
player-shot damage.

Kill #152 lands at 5440 in the oracle and 5460 in ours -- twenty frames late --
with kills #0-#151 frame-exact. Collect #90 shifts identically (5441 -> 5461), so
it is that kill's drop riding behind it, and the RNG residue diverges by 29100,
consistent with a long shot-count difference rather than one mis-timed event.

This deserves priority over the 1-frame cells. Twenty frames is one to two orders
of magnitude above their noise floor, which makes it a SUSTAINED damage deficit
against a single enemy rather than a rounding or ordering boundary. On a long HP
pool that is roughly a 10% DPS shortfall -- the signature of a missing damage
source, not a float epsilon.

Recorded the first checks in order: whether both ReimuB option orbs' needles
register on that enemy (orb=1/orb=2, d7-d12, hitbox 12x40 at speed 22 -- the only
40px-tall shot box in the game); whether it sits where one orb's column misses;
and whether the 96-slot shot pool saturates during the approach, since Phase A
fixed exactly that failure mode on the other Hard stages and st1 is the one Hard
cell it did not move.

Docs-only; no code touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…estimate

--trace-damage 5400,5462 pins the target: enemy slot 2, sub 20, boss true,
hitbox 32x48, 38 hits with HP 98 -> 2. It is in a spellcard, so every settlement
runs the /7 divisor, and the arithmetic reproduces exactly: raw 48 (two d24 main
shots) -> trunc(48/7) = 6, 98 -> 92; raw 15 -> 2, 92 -> 90; raw 48 -> 6, 90 -> 84.
The damage pipeline is confirmed working on this enemy.

That divisor rescales the problem and corrects the "roughly a 10% DPS shortfall"
estimate I wrote one commit ago. Under /7, twenty frames at this cadence is only
about 2-3 points of NET HP -- roughly 14-21 points of RAW damage across the whole
window, i.e. one missing option-shot contact every few frames rather than a
systemic deficit. The division amplifies small raw differences into whole frames,
which is why the cell reads as a large gap while having a small cause. The search
should integrate raw damage per frame over the window and look for a handful of
absent contacts.

Also flagged to rule out first: the traced shots carry damage 24 and 15, and
neither appears in the unfocused ply00b table (main 9/16/17/20/22/27/28/30/32/48,
options 7/10/12/14). The focused ply00bs table was never dumped, so those are
most likely its values and this is a non-issue -- but confirm before reading
anything into the numbers.

Docs-only; no code touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…rst check

Closes the caveat from the previous commit. ply00bs (ReimuB focused) holds d24 x13
and d15 x1, so the damage values traced at Hard st1's midboss are ordinary focused
main shots and are a non-issue, exactly as suspected.

The consequential part is what else that table shows: ply00bs contains ONLY orb=0
records. Focused ReimuB fires no option needles at all. Since the traced shots are
focused main shots, the player is focused through this midboss, which makes the
first check I recommended two commits ago -- "whether both ReimuB option orbs'
needles register on that enemy" -- moot for this window. There are no option shots
in it, and the 12x40 needle geometry is irrelevant to this cell too.

What remains in play for Hard st1 is main-shot cadence and count:
firePlayerBullets timing, the 96-slot pool, and the per-frame raw-damage integral
against the /7 spell divisor.

Docs-only; no code touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…le here

The replay matrix is only one acceptance condition; the others deserve an honest
status line rather than being assumed. tsc clean, 336 tests (335 pass / 1 skipped /
0 fail), npm run build clean at 1.6 MB, dev-shot boots headless with a sane
frame-300 state and no page errors, and perf-probe update p50/p95/p99 =
0.2/0.6/1.2 ms with dropRate 0, unchanged by this session. Also noted the probe's
noise floor, since one 3-run sample read p99 1.5 ms while repeats gave 0.9/1.1 ms
against a 1.0 ms baseline.

The important entry is a negative one: scripts/latency-probe.mjs cannot run in this
container, for two pre-existing reasons. It launches Chromium headed, so it needs
xvfb-run rather than a bare DISPLAY (Playwright rejects the latter), and it then
hard-fails on a deliberate browser pin -- "Chrome major 141 does not match required
148". That pin exists so latency numbers stay comparable across runs, so it must
not be relaxed just to produce a number.

Consequence, stated plainly: input lag was NOT measured this session, and any claim
about it should be treated as unverified until the pinned browser is available.
Frame pacing and drop rate WERE measured (dropRate 0) and are unaffected by the
changes here.

Docs-only; no code touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
…count

--trace 5380,5462 shows the player-shot pool peaking at 31 of 96 and never
reaching 90, so Phase A's dropped-spawn failure mode is not in play for this cell.
That matters because Phase A moved Hard st6/st5/st3/st2 and left st1 untouched,
which made pool saturation the natural suspect. It is now excluded by measurement.

Focus is held for the entire window (input 0x0005/0x0045, bit 0x4 set), which
independently confirms the ply00bs focused-table reading from the previous commit.

Cadence from the damage trace is a clean 5-frame cycle -- two d24 contacts plus one
d15, 63 raw per 5 frames -- holding steadily across the window. The enemy takes 96
net HP, roughly 670 raw at /7, against the ~780 the observed cadence supplies, the
slack being trunc losses. The numbers are self-consistent, so nothing in the
settlement path looks wrong.

That leaves a narrow surviving candidate: the shot INTERVAL or the per-cycle shot
COUNT differing slightly from native at this power level. Both are checkable
data-side without a native trace -- compare the relevant ply00bs level record's
interval field against the observed 5-frame cycle, and its record count against
the observed 2x d24 + 1x d15 -- and neither has been checked yet.

Docs-only; no code touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
Checked the last data-side candidate for Hard st1 and it is not a bug. Power at
frame 5400 is 36, and Sht.shotsForPower selects with `power < level.power`, i.e.
each stored u32 is an EXCLUSIVE UPPER BOUND. The nine thresholds
8/16/32/48/64/80/96/128/999 therefore give bands 0-7, 8-15, 16-31, 32-47, 48-63,
64-79, 80-95, 96-127, 128+ -- exactly TH07's nine power bands, with 999 catching
128+. Power 36 lands in [32,48), whose ply00bs records are iv5xd24, iv5xd24,
iv5xd15, which is precisely the observed cadence, interval and count.

Recording the misstep too: I first dumped the table labelling those thresholds as
`pw>=` minimums, which made power 36 look like it should fire the neighbouring
iv5xd24/iv5xd24/iv6xd12 row and briefly looked like an off-by-one in level
selection. It is not. The upper-bound reading is additionally validated by the
eight passing cells, since power varies constantly throughout all of them.

Net effect for Hard st1: shot table, cadence, count, pool headroom (peak 31 of 96),
focus state, and the /7 settlement arithmetic are all now confirmed correct, and
the ~14-21 raw damage deficit across 5400-5462 is explained by none of them. What
remains are exactly the questions a native per-frame trace exists to settle --
enemy hitbox or position drift moving a marginal contact in or out, or a native
damage source in this window our sim never produces -- and both need the v1.00b
build.

Docs-only; no code touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJ5YjY2H8B2zC67ArxhoTV
@AgentMystia
AgentMystia merged commit 3d92f7c into main Jul 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants