Skip to content

Fix the windmill slash crash after visiting the weapon menu - #245

Open
SirFancyBacon wants to merge 1 commit into
TheMoonPeople:masterfrom
SirFancyBacon:fix/windmill-effect-crash
Open

SirFancyBacon wants to merge 1 commit into
TheMoonPeople:masterfrom
SirFancyBacon:fix/windmill-effect-crash

Conversation

@SirFancyBacon

@SirFancyBacon SirFancyBacon commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Toan's windmill slash (level-2 charged attack) crashed once the weapon menu had been opened and closed.
fixes #246

When the weapon menu opens, InitMenuWeaponModelReference clears twelve entries of the ten-entry MenuWeaponModelInfo table, just as retail does. On the PS2 the two extra entries landed on MenuCharaOldAmbient, which the item menu saves again before it restores it, so the overrun did no harm. The port doesn't keep the globals' order, so the overrun landed on WepEffectMenuReadBuf and set it to -1. Leaving the menu then reloaded the character's effect from that pointer and found no model (not found c01_fuusya.cfg). The next windmill slash crashed in CSHOT_EFFECT::Set on a null frame, from ToanKey_Play.

The port's copy of InitMenuWeaponModelReference now clears only the table's own ten entries.

Tested:

  • I found the overrun with a hardware watchpoint on WepEffectMenuReadBuf.
  • I ran a scripted headless run that opens and closes the weapon menu, then performs the windmill slash. The crash reproduces without the fix and doesn't happen with it.
  • New unit test MenuWeaponModel.ClearingTheReferencesStaysInTheTable: clearing the table resets all ten entries and leaves WepEffectMenuReadBuf untouched.

InitMenuWeaponModelReference clears twelve entries of the ten-entry weapon model
table, as retail does. On the PS2 the extra two landed on the item menu's saved
ambient, which it saves again before use; in the port they landed on
WepEffectMenuReadBuf. Leaving the weapon menu then reloaded the character's
effect from that pointer, found no model ("not found c01_fuusya.cfg"), and
Toan's windmill slash crashed on the effect's missing frame.

This branch has not been deployed

No deployments
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.

Crash after changing weapons and performing Windmill slash

1 participant