Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkered room crash workaround #615

Merged
merged 4 commits into from
Jul 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions soh/src/code/z_bgcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -1584,9 +1584,19 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
BgCheck_SetSubdivisionDimension(colCtx->minBounds.z, colCtx->subdivAmount.z, &colCtx->maxBounds.z,
&colCtx->subdivLength.z, &colCtx->subdivLengthInv.z);

#ifdef _SOH64 // BGCheck needs more memory on 64 bits because it crashes on some areas
// OTRTODO: Re-enable when the below DynaPoly workaround is removed.
// #ifdef _SOH64 // BGCheck needs more memory on 64 bits because it crashes on some areas
// colCtx->memSize *= 2;
// #endif

// BGCheck needs a higher polygon and vertex count due to removed object dependencies.
// Otherwise Forest Temple checkered room will crash due to the hallway actor being killed a frame late.
//
// OTRTODO: This is a workaround. The proper solution to fix this crash is to manage object loading / unloading
// the same as N64.
colCtx->memSize *= 2;
#endif
colCtx->dyna.polyListMax *= 2;
colCtx->dyna.vtxListMax *= 2;

memSize = colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z +
colCtx->colHeader->numPolygons * sizeof(u8) + colCtx->dyna.polyNodesMax * sizeof(SSNode) +
Expand Down