1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-06-08 17:41:56 +00:00

Document SysCfb_GetFbPtr bug

This commit is contained in:
mzxrules 2025-06-03 23:25:28 -04:00
parent db2c08a51f
commit 922389fd6b

View file

@ -141,6 +141,9 @@ void Graph_InitTHGA(GraphicsContext* gfxCtx) {
gfxCtx->overlayBuffer = pool->overlayBuffer;
gfxCtx->workBuffer = pool->workBuffer;
//! @bug fbIdx is a signed integer that can overflow into the negatives. When compiled with IDO, the remainder
//! operator will yield -1 for odd negative values of fbIdx (i.e. the same as C99 onwards).
//! This results in an out of bounds array access in SysCfb_GetFbPtr due to the negative index value.
gfxCtx->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx->fbIdx % 2);
gfxCtx->unk_014 = 0;
}