Skip to content

Boss Rush: add Wire Sponge (X2) - #128

Draft
KamiSquadX wants to merge 22 commits into
mstan:mainfrom
KamiSquadX:feat/x2-boss-rush
Draft

KamiSquadX wants to merge 22 commits into
mstan:mainfrom
KamiSquadX:feat/x2-boss-rush

Conversation

@KamiSquadX

Copy link
Copy Markdown

Adds the first X2 Maverick, Wire Sponge, to Boss Rush, alongside X3's Tunnel Rhino from #123. This branch builds on #123 and merges current main (2.2.8), so it contains #123's commits as well. It can replace #123, or be reviewed after it.

Everything is read from the player's own ROMs at runtime. No ROM data or ROM-derived assets are committed.

Wire Sponge (X2)

  • His original X2 code is relocated from the player's X2 ROM into X1's padding banks. A new Boss Rush: X2 Mavericks pack (Game Modes, off by default) loads the X2 ROM and offers him in Boss Rush.
  • Sonic Slicer (X2 weapons pack) is his weakness: 3 damage and a flinch. A Sonic Slicer kill splits him in two as in X2, and so does a kill with any Zero's saber.
  • His graphics are drawn from X2's own sprite VRAM rules:
    • his room's two graphics slots (body; vine and lightning) and all three palettes
    • each object's tile base and palette
    • only the parts his code asks to draw (the vine shortens as he climbs)
  • Entrance: his vine always releases him after landing, even on Rush's shorter fall.

Shared relocation and Boss Rush work

  • tools/relocate_boss.py takes a per-game config (X2 and X3). New rules cover:
    • hardware registers and block moves
    • hitbox pointers and windowed data tables
    • conditional profile loads and animation banks
    • source slot tables (copied to padding bank $3C)
  • New per-boss runtime hooks: effect-list children with an ownership filter, room-origin reads, per-seat scratch RAM (save chunk v24), saber kills, a boss's own death sequence, and pokes.
  • The renderer draws relocated bodies' effect-list children from their source art.

Fixes found in playtests (all bosses)

  • Hurt latches: a hit during a health pickup's refill no longer leaves the player unhittable for the rest of the run.
  • Combo sounds: every landed combo hit (for example Saber Zero's priority combos) plays the boss-hurt sound, not just the first.
  • Test build: the Saber renderer draw test target links again.

Tests

  • Full Boss Rush regressions pass (full run, hit visuals, spike, state format, audio, Chameleon, death latch, drops, Rhino).
  • The Rhino and Wire Sponge matrices pass for X, Zero, Modern Zero and Saber Zero.
  • The new combo-sound check passes for every character on Flame Mammoth and Wire Sponge.
  • All unit tests pass. mmx_reset_reboots also fails on unmodified upstream main here.
  • Docs: docs/x2-bosses/wire-sponge.md, docs/x3-bosses/foundation.md, docs/boss-rush.md.

Known gaps

  • His lightning's screen darkening isn't reproduced. Boss Rush keeps the color math private per boss seat.
  • Extra X1/X2/X3 weaknesses for all 24 bosses come once every boss is in.

🤖 Generated with Claude Code

KamiSquadX and others added 22 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>
mmx_renderer.c draws relocated Boss Rush bodies through
MmxBossRushForeignPose/MmxBossRushForeignColors, which this test target
does not link, so it failed to build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Wire Sponge's original X2 code is relocated from the user's own X2 ROM
into X1's padding banks, like Tunnel Rhino's X3 code. A new X2 Mavericks
pack (Game Modes, off by default) loads the X2 ROM and offers him to
Boss Rush runs.

- relocate_boss.py takes a per-game config; X2 helpers map onto the same
  X1 routines as X3's, and the X3 config still reproduces Rhino.
- New relocation rules: hardware registers, MVN block moves, hitbox
  pointers, windowed data tables, conditional profile loads and
  per-set animation directory banks.
- New per-boss runtime hooks: effect-list children, room-origin reads
  (his entrance starts below the arena ceiling), per-seat scratch RAM
  (save chunk v24), saber kills and a boss's own death sequence.
- Sonic Slicer (X2 weapon pack) is his weakness; a Sonic Slicer kill
  splits him in two as in X2, and so does a kill with any Zero's saber.
- The fixture passes for X, Zero, Modern Zero and Saber Zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Playtest: Wire Sponge and his attacks were invisible. X2's class init
copies a graphics slot's OBJ attributes from $7F:8300 into +$11, which
Rush sinks to zero; priority 0 put him behind the arena and palette 0
read as a permanent hit flash. The init shim now writes $29 (priority 2,
palette 4, as Rhino's own init does) and his children inherit it.

The renderer also draws a relocated boss's own effect-list classes (his
whip segments and split halves) from the source art. X1-native effects
a boss spawns keep their native art.

The Wire Sponge fixture renders combat and his halves and checks both
draw with his X2 art; halves count only after he starts dying.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Playtest (Saber Zero): after collecting a health drop, a hit during the
refill left the player unhittable for the rest of the run. The refill
took the player out of the hurt reaction ($0E) before it started the
invulnerability countdown $0C13, which is what clears the hurt latches
$0BD8/$0C32. X1 freezes enemies while refilling; Rush's bosses keep
fighting. Rush now starts the native countdown when the latches are set
outside a hurt reaction with no countdown running.

- The death latch fixture covers the stuck-latch case.
- The hit-visual fixture keeps its shooter in post-hit protection on
  purpose; it had relied on a stuck latch against Mammoth's stomp.
- MMX_REPLAY_PLAY plays a captured segment's inputs on the current code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Playtest: his body drew but his vine, seeds, lightning and whip did not.
They build +$11 from X2's per-slot OBJ attributes ($7F:8345/$8346),
which relocation sank to zero (priority 0, palette 0). The relocator
now supports constant long reads (Game.long_const): those two bytes
read $29 from bytes after his $86 tables, matching his body.

The fixture renders his shots and whip and checks both draw with his
X2 art.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Playtest: Saber Zero combos played the hurt sound only on the first hit
(and a last hit after the flash ended). Follow-up hits land inside the
boss's damage flash, where X1 only queues the impact sound, re-queued
every frame the saber overlaps. Rush now queues the native boss-hurt
sound $13 for a fighting boss that lost HP in a frame without one.

MMX_BOSS_RUSH_COMBO_SOUND_TEST (MMX_COMBO_BOSS picks the boss) checks
every landed hit queues it; it passes for X, Zero, Modern Zero and Saber
Zero on Flame Mammoth and Wire Sponge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Playtest: Wire Sponge sometimes never left his entrance. While falling he
lowers his 11 whip segments, one every 6 frames ($7F:CD90 counts them
down), and his vine waits for 0 before it climbs to him. X2 drops him
from far above; Rush's arena fall takes 62-66 frames, and a 62-frame
fall landed him with one segment left, so the vine waited forever.

A new per-boss poke (MmxBossRushPoke) writes a work-RAM byte before a
relocated instruction; his landing ($04:9BD5) lowers the remaining
segments. Lowering them faster instead brings the vine during his
landing pose, whose $0F flag its store overwrites. The fixture shortens
his fall by 24 pixels to cover this.

Also: MMX_REPLAY_SCAN lists projectile owners, and MMX_REPLAY_PLAY_WATCH
prints chosen WRAM bytes during MMX_REPLAY_PLAY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Playtest: his vine, seeds and lightning drew wrong and the vine stayed
full length below him while he climbed.

- Slot tables: X2 builds +$18/+$11 from the stage's slot tables
  $7F:8200/$7F:8300. Relocation copies both whole to padding bank $3C
  with his room's values (slot $45 body at tile $100, attribute $29;
  slot $46 vine/lightning at tile $48, attribute $28; 0 elsewhere).
- Renderer: relocated objects draw from a model of the source game's
  sprite VRAM (each resource at its tile, all palettes of the list) using
  each object's own tile base and palette.
- Draw requests: only objects whose +$0E bit 7 says they asked to draw
  this frame are drawn; X2 hides the vine below him that way.
- Effect ownership: X1's terrain helper spawns X1 rubble (class $2B like
  his halves) in his seat when the vine hits the ceiling. An effect of his
  classes is his own only with his set $3E or his spawn variants; Rush
  frees the rest, which X2 never shows in his room.

The fixture renders his shots, whip and halves, keeps renders for review
(MMX_SPONGE_FRAMES) and can force a behavior (MMX_SPONGE_FORCE).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts:
- Boss Rush globals: keep this branch's $1FD5/$0C32 slots and upstream's
  new rule; $0BD8, $0C32 and $0C16 (ice/grab lock) are never swapped.
- After-frame loop: keep the per-seat hurt-sound bookkeeping and
  upstream's Flame Mammoth arena clamp.
- Generated-code hook targets: both lists.
- Runtime test: both the replay tools and upstream's report mstan#124 checks.

Rhino fixture: the post-pin latch check accepts $0BD8 dropping (its
$0C32 follows a frame later and contact can hit X again first), and the
spread check verifies drill positions rather than an exact count, since
a spread fires only into free projectile slots.

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

mstan commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Independent review of combined head ff6a204a6c5a3698299c936a4ea8fb8ea7549a9d: changes needed before gameplay signoff.

The original-code relocation approach is useful. Both generated relocation descriptors reproduce byte for byte from the supplied USA ROMs. I also built the exact pinned framework/UI on Windows with MinGW/SDL3 and ran the launcher and native collision paths. The shared source-ROM keys are already the right reusable mechanism.

Confirmed source-fidelity defects

  1. Wire Sponge has the wrong Sonic Slicer damage. X2's original damage directory $86:F3A4, profile $09, supplies 2 HP normal / 5 HP charged for projectile classes $0B/$14. This port maps his profile to X1 row $08, yielding 3 / 4. I reproduced both through the original X1 collision routine with owned Rush actors, then independently with actual fired normal and charged Slicer projectiles. Both methods report 3 / 4. The current slicer.damage >= 2 assertion accepts this incorrect result.

  2. Chameleon Sting becomes an unintended weakness. X1 row $08 is Storm Eagle's row, not Penguin's as the comments state. A native Chameleon Sting contact consequently takes 3 / 4 HP and publishes $0B/$14, exactly the reaction classes Sponge interprets as Slicer. The Fire Wave exception does not neutralize Chameleon Sting. This also exposes his Slicer-specific death branch to an unintended X1 attack. Extra cross-game weaknesses were explicitly deferred; they should not appear as a side effect of choosing a convenient native row.

  3. The child defense mapping loses a native exception. X2 profile $0A accepts a normal Slicer hit for 2 HP while reflecting other attacks. Mapping it to X1 row 0 reflects every attack. Please preserve child profiles as well as the boss body's normal/hurt profiles; this is a source-table finding that needs a live vine/whip destruction regression.

The same row-substitution issue causes other differences in the direct source-projectile matrix. Please don't resolve this by changing only the three expected numbers in the current tests.

Suggested implementation and next-boss workflow

  • Keep source damage values and source reaction classes separate. Import each used source defense profile from the verified user ROM, including normal/charged/alternate projectile classes, immunity, reflection, hurt states and child actors. A valid X1 row is an ABI bridge, not evidence of equivalent behavior.
  • Map each actual imported projectile phase to its source class. For other-game weapons, use explicit owner-approved mappings; otherwise keep them neutral. Don't inherit an X1 boss's elemental reactions accidentally.
  • Derive expectations independently from the original ROM tables. Check exact HP deltas with real fired projectiles as well as focused native collision calls. Include charged attacks, repeat-hit protection, flash restoration, source-specific death and child destruction.
  • Reach each controller branch systematically, especially low-health attacks. Use cheats to establish position/health/attack prerequisites, then let the real controller, collision and death code produce the outcome. A timed random fight is supplementary coverage.
  • Test each boss in both Rush seats, next to a native boss and another imported boss, with occupied projectile/effect pools, pause/unpause, snapshot replay, natural player death and replacement cleanup. Retain frame/object evidence per branch. Keep source scratch RAM and palettes isolated per seat.

For the requested packaging, I have locally moved both default-off import features into megaman-x.mode.boss-rush, as x2_bosses and x3_bosses, keeping the existing activation plugin IDs. Their descriptions explicitly say Wire Sponge (1/8) and Tunnel Rhino (1/8), and their required resources retain megaman-x.source.x2 / .x3. Real provider tests pass for no imports/no extra ROMs, either import alone, selection through the weapons/Zero pickers, missing/wrong ROM rejection and clearing a shared source. They should not be separate downloadable packages.

The original Sponge fixture passes for X, X3 Zero, Modern Zero and Saber Zero, which demonstrates why passing the existing suite alone does not establish source parity. Both imports together pass the tested pause freeze, native pause-menu pixel comparison, unpause and byte-exact post-unpause replay checks in both seat orders. Full visual review is still being completed; the declared missing lightning darkening remains a fidelity gap. No merge or final QA approval yet.


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.

KamiSquadX pushed a commit to KamiSquadX/MegaManXSNESRecomp-KamiSquad_X-Releases that referenced this pull request Nov 6, 2026
…ap-triage-80

Add SD3 interpreter-cap diagnostic tooling
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