Skip to content

Boss Rush: add X3 Mavericks, starting with Tunnel Rhino - #123

Closed
KamiSquadX wants to merge 12 commits into
mstan:fix/boss-rush-coop-damagefrom
KamiSquadX:feat/x3-boss-rush
Closed

KamiSquadX wants to merge 12 commits into
mstan:fix/boss-rush-coop-damagefrom
KamiSquadX:feat/x3-boss-rush

Conversation

@KamiSquadX

Copy link
Copy Markdown

Summary

Boss Rush can now include Mavericks from Mega Man X3, starting with Tunnel Rhino. He runs on his original X3 code, art and sound effects, all read at runtime from the player's own X3 ROM. The roster grows from 8 to 24 slots (X1 + X2 + X3). X2 slots and the other X3 slots stay unavailable until those bosses are ported.

Enable Boss Rush plus the new X3 Mavericks in Boss Rush package (megaman-x.boss-rush.x3-bosses), and give it an X3 USA ROM. Rhino then joins normal runs.

How it works

  • Relocation, not reimplementation. tools/relocate_boss.py traces Rhino's controller, drill projectile and the X3 engine helpers he calls. It emits src/mmx_boss_rush_x3_rhino.inc, which holds addresses and the original operand values only: no code, graphics or audio bytes. At activation, mmx_boss_rush_relocate.c checks those values against the user's ROM, then copies the code into X1's unused LoROM padding banks $30-$3F and his $86 tables into bank $86's padding.
  • Patches. RAM, profile, player-state and helper calls are patched to their X1 equivalents. X3-only behavior (music, refight checks, screen shake and similar) goes through small shims.
  • Rush integration. Foreign controllers are dispatched through the existing Boss Rush seat hooks. Art is decoded from the X3 ROM and drawn by the custom renderer with per-seat palettes. Sound effects come from his own X3 SPC driver and bank through the isolated Rush SPC renderer.
  • Weakness. His original X3 weakness is kept: Acid Burst (X3 weapons pack) makes him flinch. Extra X1/X2 weaknesses will be assigned once all 24 bosses exist.
  • All characters. He works with X, Zero, Modern Zero and Saber Zero.
  • Docs. docs/x3-bosses/tunnel-rhino.md is the source trace. docs/x3-bosses/foundation.md covers the memory layout and each X3-to-X1 adaptation.

Fixes found along the way

These affect existing Boss Rush and Zero play, not only Rhino:

  • Player invulnerable for the rest of a run after a native boss death. A native boss's death scene sets the hurt latches $0BD8/$0C32 until the stage ends. A boss killed during its own update now leaves them as it found them. Test: MMX_BOSS_RUSH_DEATH_LATCH_TEST.
  • MSVC builds registered no mod plugins. The launcher reported "The executable does not provide this trusted plugin". MSVC drops snesrecomp's unreferenced static .CRT$XCU pointer. src/mods/mmx_mod_constructor.h keeps an external pointer plus a /include directive. The proper home for this fix is snesrecomp's mod_runtime.h.
  • Visual Studio 2022 build fixes: NOMINMAX, S_ISDIR, and the small macro.

Developer aids

  • MMX_REPLAY_WATCH=<addr,range,...> prints chosen WRAM bytes whenever they change during --replay-diagnostic playback. It is documented in the README, and it found the pin and invulnerability bugs from a playtest capture.
  • MMX_REPLAY_SCAN is a state-test mode that prints the player's hurt state and both Rush bosses at each segment's checkpoint.

Testing

State-test fixtures (MMX_STATE_TESTS=ON), all passing on Windows / MSVC Release:

  • Full suite: MMX_BOSS_RUSH_TEST (28-pair suite).
  • Existing regressions: hit visual, foreign spike, state format, audio, Chameleon replacement, drops.
  • New death-latch test: MMX_BOSS_RUSH_DEATH_LATCH_TEST.
  • MMX_BOSS_RUSH_RHINO_TEST with MMX_BOSS_RUSH_X3_ROM:
    • His intro, combat and sounds.
    • Weakness and deflects.
    • Drill-charge pin with exactly one carrier.
    • Stop-and-fire spread with three drills at X3's offsets.
    • A 6000-frame fight: damage keeps landing, volleys repeat, he stays inside the arena, projectile slots are freed, and the saber collision windows stay intact.
    • Deterministic snapshot replay.
  • Character matrix: the same Rhino fixture driven through the real launcher provider and catalog, with MMX_BOSS_RUSH_RHINO_CHARACTER set to x, zero, modern and saber.
  • Manual: playtested by the owner of this branch.

Known gaps

  • Netplay with relocated bosses is untested.
  • A small leftover-graphics glitch remains around his desperation charge. It is deferred.
  • One replay segment diverged on its first frame after checkpoint restore (frame 47400 of a playtest capture). It is being investigated separately, since it may be state that snapshots don't capture.
  • Bank $86 space is laid out for one relocated boss. A second boss needs its own region.

🤖 Generated with Claude Code

KamiSquadX and others added 12 commits October 17, 2026 00:44
Static trace of the X3 USA controller, drill projectiles, shared helpers,
art, palette and sound sources for porting Rhino into Boss Rush.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Define NOMINMAX before windows.h, supply S_ISDIR for MSVC, and rename a
test parameter that collides with the Windows 'small' macro. No
behavior change on MinGW, Linux or macOS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Roster ids cover X1, X2 and X3 Mavericks by native weapon order. A new
roster state holds the shuffle queue and the run's available set, saved
in game chunk v23; v18-v22 snapshots import their X1 queue unchanged and
the original Rush state layout is untouched.

Add the experimental megaman-x.boss-rush.x3-bosses package. Its plugin
validates the user's X3 ROM and keeps it in memory only; a boss is
offered only once its body is implemented, so runs stay X1-only for now.
Netplay refuses to start if an enabled Maverick pack failed to load.

Document the foundation and the relocated-code plan for X2/X3 bodies,
and update the snapshot-format fixture for v22/v23.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grow X1's padded 2 MB LoROM image to 4 MB at runtime, mirroring the
original so every existing read is unchanged, and allow built code in
banks $F0-$FD. A pre-opcode hook at the enemy class dispatch ($80:D544)
enters a registered controller for a non-X1 roster seat with a JSL frame
returning to a native RTS, matching the stock JSL/RTS stubs.

The MMX_BOSS_RUSH_FOREIGN_SPIKE_TEST fixture runs a bank-$F0 controller
in seat 1 beside a native Penguin: once per frame, native X1 helper calls
return correctly, and snapshot replay is byte-exact. The full 28-pair
Rush suite still passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/relocate_boss.py traces Rhino's body, drill projectile and the X3
helpers they need, and emits an address-only descriptor: X3 helpers map to
X1 equivalents, relocated copies or shims; X3 RAM maps to X1 RAM or a
zero/sink area. Unclassified calls or RAM fail generation.

src/mmx_boss_rush_relocate.c rebuilds Rhino from the user's X3 ROM when
the pack loads: code banks go to X1's unused $30-$3F padding, his $86
tables and shims to the $FF tail of X1's bank $86 (X1's enemy loop uses
the same data bank), and every rewritten operand is verified first.
Hooks at the enemy and enemy-projectile class dispatches run registered
controllers for a foreign seat; foreign bodies report their own combat
and death states.

The ROM-backed Rhino fixture covers his intro, charges, drill volley,
replay determinism, defeat and cleanup beside a native Penguin. He stays
out of normal runs (MMX_BOSS_RUSH_PREVIEW=1 opts in) until his art, sound
and weaknesses are done. The full 28-pair suite still passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decode a relocated body's compressed OBJ resource, palette and pose
layouts from the in-memory source ROM and rasterize poses once. The
renderer replaces the pieces X1's sprite builder makes for foreign-owned
objects and draws each body and projectile whole from its +$16 set and
+$17 pose, with +$11 facing, priority and palette-zero hit flash.

Fix the projectile redirect: X1's enemy-projectile actor dispatches at
$80:D4E7 (not $D48A) and has a compiled body, so route $D4D3/$D4DD
through the interpreter during Rush. Rhino's drills previously ran X1's
own class $26.

The Rhino fixture checks his body and drills draw in his own palette,
that drills run the relocated controller, and saves private captures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
X3's SPC driver shares X1's upload table and boot protocol, so the
isolated Rush SPC renderer now takes a per-game bank list. Relocated
bodies load their source ROM's banks 0-2 plus their own sound bank ($5D
for Rhino) and pre-render the effects their code requests. The
relocation tool finds both from the traced code, and turns the X3 sound
routines into hooked shims that queue the boss's cached clip, panned like
X3's positional call. Cues name the roster id in their spare field, so
the snapshot layout is unchanged.

The Rhino fixture checks all six effects render audibly and that his fill,
wall crash, spread, stop and drill grind cues fire. The X1 native audio,
28-pair, spike and state-format fixtures still pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Map Rhino's X3 damage profiles to X1 rows during relocation: normal to
Kuwanger's row, drill charge to the deflect row, flinch to the no-damage
row. His weakness test reads X1's reaction class ($1F1D) and compares
against the Torpedo reaction classes.

Boss Rush hooks X1's damage helper for relocated bodies: X3 Acid Burst
takes the row's weakness column and reaction, so his own code flinches;
X1 Homing Torpedo is moved to an ordinary column. The X2/X3 weapon pack
no longer applies its X1-class table to relocated bodies and defers to
their native row. Extra X1/X2 weaknesses are left for the owner to assign
once all 24 bosses exist.

The Rhino fixture fires the buster, Homing Torpedo and a real X3 Acid
Burst from the pack built from the same ROM, and checks the deflect row.
Full, native hit, audio, spike and format fixtures pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pinning: X1 shares X3's player-state numbers (hurt $0E, death $0C,
scripted lock $1E). Rhino's X3 lock/release become shims around X1's
entrance lock ($84:9FEB) and release ($84:A003, only from $1E); Rush
still skips the lock during entrances. X3's caught state $12 has no X1
counterpart, so his pin test compares the hurt state the drill leaves.

Palette: his relocated rotate/fade helpers run on the seat's private
colors (shared with Chameleon's snapshotted state); the fade reports carry
while colors differ, and the renderer draws foreign bodies with them.

Frame counters: X3's $09CB/$09CC have the same NMI and scene-loop
increment sites as X1's $0B9B/$0B9C, confirming the mapping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tunnel Rhino now appears in normal Boss Rush runs once the X3 Mavericks
pack has loaded the X3 ROM.

- Move the relocated zero/sink area to $86:FD80-$FF7F and stop the $86
  patch window at $FF7F. The old $FE00-$FFFF area overlapped the weapon,
  Zero and saber collision tables at $86:FF80-$FFFF: Saber Zero's slash
  did 0 damage, and as X the weapon code's $FF fill froze Rhino.
- Register mod plugins in MSVC builds (mmx_mod_constructor.h keeps the
  .CRT$XCU pointer), so the launcher can commit plans.
- Launcher-driven character matrix for X, Zero, Modern Zero and Saber Zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Zero's air and dash slashes: the relocated zero/sink area overlapped the
  air-saber collision window at $86:FF40, so the saber disabled it. The
  sink moves to $86:FD40-$FF3F and the patch window ends at $FF3F.
- Rhino stopped taking damage after his first hit flash: the flash restores
  his profile from X3 $1F57, which read 0 (X1's deflect row) from the sink.
  It now maps to X1 $1FD5, swapped per Rush seat.
- Rhino slid through the right wall: X3 rooms start on 256-pixel
  boundaries and his stop-and-fire charge stops at that midline without a
  wall check. His four midline reads are answered relative to the arena.
- Rhino stopped firing drills and never did his stop-and-fire spread: the
  delete shim cleared only byte 0, so dead drills kept their projectile
  slots; and spawns that fail when the other boss fills the shared pool
  are now taken back out of his live-drill count.
- The player became invulnerable after a native boss died: its death scene
  sets the hurt latches $0BD8/$0C32. A boss killed during its own update
  now leaves them as it found them.
- Regression checks: a long Rhino fight (damage, volleys, spreads, arena
  bounds, slot reuse, saber windows) and MMX_BOSS_RUSH_DEATH_LATCH_TEST.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found by replaying the playtest capture frame by frame.

- Stuck invulnerability: X3's caught state $12 maps to X1's ordinary hurt,
  so Rhino's pin locked the player after any hit during his recoil. The
  lock skipped the end of X1's hurt state, which starts the countdown
  ($0C13) that clears the hurt latches $0BD8/$0C32, so nothing could hurt
  the player again. The pin now requires his live pin carrier, and the
  release shim starts that countdown when it frees a latched player.
- Leftover drill graphics: his drill charge spawned a pin carrier on every
  frame it overlapped the player (X3's caught player stops overlapping),
  filling the projectile pool. It now spawns one while none is alive.
- Spread drills: their start offsets ($86:EFE7 + 4*index) ran past the
  copied table, so the shoulder drills started in the wrong places or off
  screen. The copy now covers $86:EFB8-$EFF6.
- Developer aids: MMX_REPLAY_WATCH prints chosen WRAM bytes during replay
  playback; MMX_REPLAY_SCAN prints the state at each segment's checkpoint.
- Checks: one carrier per catch, no pin without it, latches clear after a
  pin, and the spread's hand and shoulder drills at X3's offsets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mstan

mstan commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Independent review of this work as included in PR #128, combined head ff6a204a6c5a3698299c936a4ea8fb8ea7549a9d: changes needed before source-fidelity signoff.

Confirmed damage defect: Tunnel Rhino's original X3 damage directory $86:E4A5, profile $18, gives Acid Burst 3 HP normal / 5 HP charged for classes $07/$10. Relocating that profile onto X1 Kuwanger row $0A supplies 3 / 4. I confirmed the mismatch through the native collision routine on an owned Rush actor, then with actual fired Acid Burst projectiles: normal takes 3, charged takes 4. The normal-only weakness check passes while missing the charged regression.

Please import the actual used source damage profiles rather than treating a superficially similar X1 row as equivalent. Preserve damage separately from reaction classes, and include alternate projectile phases, immunity/reflection and child profiles. This is also the cause of several Wire Sponge discrepancies in #128; I have posted the detailed findings and a proposed per-boss workflow there. Expectations should come independently from the verified source ROM, with exact normal/charged HP assertions and real projectile tests.

Validation completed so far on Windows MinGW/SDL3 with the exact pinned framework/UI:

  • The Rhino relocation descriptor regenerates byte for byte from the supplied USA X3 ROM.
  • Existing ROM-backed Rhino fixture passes for X, X3 Zero and Saber Zero, including the pin/release and latch recovery, forced spread offsets, repeated damage, bounds/slot reuse, source art/audio checks, snapshot replay and its defeat/cleanup case.
  • The Modern Zero fixture fails its long-fight spread coverage assertion: volleys=13 spreads=0, hand=0 shoulder=0 misplaced=0. Its separately forced spread case passes (hand=-44,-8, shoulders 10,-24 and -22,-24). This is currently a coverage/test-reproducibility failure, not evidence that the spread implementation itself is broken. Make required attack coverage deterministic instead of depending on a random 6000-frame fight to select every attack.
  • A separate fixture runs Rhino and Sponge together in both seat orders. The tested pauses freeze the bodies/projectiles, the X pause menu matches the native PPU pixels, unpause resumes both seats, and the following 60-frame full snapshots replay byte exactly. Both bosses can continue damaging the player after these pauses.
  • The clean game build succeeds; the completed general CTest run has 20 passes and two optional ROM-asset skips. These are separate from the import-fidelity failures.

Keep the X3 toggle inside the existing Boss Rush package (megaman-x.mode.boss-rush / x3_bosses), default off, with currently Tunnel Rhino only (1/8) in the description. Reuse megaman-x.source.x3 so Zero, co-op, X3 weapons and X3 bosses share one selected source. The matching X2 toggle belongs in that same package. That integration and its missing/wrong/shared-source provider checks are implemented and passing locally.

The reported desperation-charge graphics gap and native visual fidelity still need complete review. No two-peer netplay qualification is claimed. These results are not a merge or final gameplay approval.


Final review artifacts and implementation are available in commit ab6aa9f, on "integrate/boss-rush-x2-x3". See the full review and reproduction commands and independent fixture.

Completed checks additionally confirm a real buster killing one-HP Rhino with one defeat/replacement, and natural fatal contact with each import reaching Game Over. All 28 native X1 boss pairs and the separate pause, state-format, audio, death-latch, hit-visual and drop regressions pass. The initially skipped Saber render/wave checks also pass when supplied their private source fixtures. The independent source-fidelity fixture still reports 21 failing assertions (including overlapping live/focused reproductions); these are retained as regressions for the fixes. Other-game contacts without an assigned source expectation are explicitly recorded as unverified, not passes. Lightning-controller captures confirm the missing Sponge background darkening; natural anger entry, the reported intermittent Rhino visual remnant, and two-peer netplay remain unverified. Final owner QA handoff is withheld pending corrections; neither PR has been merged or approved.

@mstan

mstan commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Superseded by #128, which includes all changes from this PR. Follow-up work continues there.

@mstan mstan closed this Nov 8, 2026
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