Skip to content

Fix/opening crash - #62

Merged
Adubbz merged 2 commits into
TheMoonPeople:portfrom
Tororoi:fix/opening-crash
Oct 6, 2026
Merged

Adubbz merged 2 commits into
TheMoonPeople:portfrom
Tororoi:fix/opening-crash

Conversation

@Tororoi

@Tororoi Tororoi commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Fixes a crash partway through the opening, during the couple's dance. It's a bug in the original game that the port happens to expose.

The crash

LoadMotionData plays the dance as ten motion files, each pair read in the background into read_buffer before it's needed. The script's object loads (LoadCharaData) also read into read_buffer, and when one lands in between, the second dancer's pack is overwritten. Retail doesn't notice: LoadPackData finds no pack and leaves that dancer's motion as it was, pointing into CharaDataBuffer__2[6], which the first dancer's new step has just been loaded over. On the PS2 the data it then reads has the same layout as its own; on 64-bit it doesn't, and the port crashes in MotionProc at the last step on either disc.

The port now reads each dancer's steps into a buffer of its own: LoadMotionData (PC_OVERRIDE, port/src/title/op_b.cpp) and the first pair's read in OpA_InitProcess.

Also

  • Placeholder classes: the title units' local CFireOmni, CEffectGroup, OBJ_ANIME_SEQ, CObjectFrame/CMapObject and CWater used byte arrays sized for 4-byte pointers, so on 64-bit builds the objects were smaller than the code that runs them expects. They now have their real members. MWCC output is unchanged for both PAL and NTSC.
  • Depth of field: OpA_DrawProcess passed DepthOfField a one-element array, but it always reads two distances.

Testing

macOS (Apple Silicon) Debug build, July 12 PAL data: the opening runs to the end headless (27,000 frames) where it crashed before, every dance step now finds both dancers' packs, and an AddressSanitizer build is clean over the same run. With the single-disc changes (#) merged in, the opening also runs to the end on NTSC 1.02 data. All 94 tests pass.

The opening, title and attract-movie units each declare their own CFireOmni, CEffectGroup,
OBJ_ANIME_SEQ, CObjectFrame/CMapObject and CWater with byte arrays sized for 4-byte pointers, so
on a 64-bit build the objects are smaller than the code that constructs and runs them expects.
The arrays are replaced with the members they stand for; MWCC output is unchanged for PAL and NTSC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Tororoi Tororoi mentioned this pull request Oct 6, 2026
The couple's dance swaps in each step from a pair of packs read in the background into
read_buffer, which the script's object loads also use. One that lands between a pair's read and
its swap leaves the second dancer with no pack, so it keeps its old motion and steps through keys
the first dancer's new data has replaced; the port crashes in MotionProc at the last step. The
port reads each dancer's steps into a buffer of its own.

The level-one depth of field in OpA_DrawProcess also passes a single distance where DepthOfField
reads two.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Tororoi
Tororoi force-pushed the fix/opening-crash branch from c618766 to 4a5b068 Compare October 6, 2026 05:38
@Adubbz
Adubbz merged commit 4e99d76 into TheMoonPeople:port Oct 6, 2026
9 checks passed
Adubbz added a commit that referenced this pull request Oct 6, 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