Fixed Ganondorf's lair and Spirit Temple crashes on 64 bits

This commit is contained in:
Kevin Alexis Contreras 2022-06-15 09:09:17 -05:00
parent 3dc33b6f84
commit 19ac30b918

View File

@ -1516,11 +1516,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
if (globalCtx->sceneNum == SCENE_MALON_STABLE) {
// "/* BGCheck LonLon Size %dbyte */\n"
osSyncPrintf("/* BGCheck LonLonサイズ %dbyte */\n", 0x3520);
#ifdef _SOH64
colCtx->memSize = 0x3520 * (sizeof(void*) / 4);
#else
colCtx->memSize = 0x3520;
#endif
} else {
// "/* BGCheck Mini Size %dbyte */\n"
osSyncPrintf("/* BGCheck ミニサイズ %dbyte */\n", 0x4E20);
@ -1588,6 +1584,11 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
&colCtx->subdivLength.y, &colCtx->subdivLengthInv.y);
BgCheck_SetSubdivisionDimension(colCtx->minBounds.z, colCtx->subdivAmount.z, &colCtx->maxBounds.z,
&colCtx->subdivLength.z, &colCtx->subdivLengthInv.z);
#ifdef _SOH64
colCtx->memSize *= (sizeof(void*) / 4);
#endif
memSize = colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z +
colCtx->colHeader->numPolygons * sizeof(u8) + colCtx->dyna.polyNodesMax * sizeof(SSNode) +
colCtx->dyna.polyListMax * sizeof(CollisionPoly) + colCtx->dyna.vtxListMax * sizeof(Vec3s) +