mirror of
https://github.com/gbdev/rgbds.git
synced 2026-08-22 14:54:33 +00:00
Fix a flaky/random-seed rgbgfx_test test failure
Commit 21eaa2d2cc missed some
intentional unsigned underflow that is needed to set `nbTilesInBank`.
Without it, some of the randomly-seeded RGBGFX tests, such as
`./rgbgfx_test seed8.bin -b 207 -N 54,256`, can fail with "Color
mismatch after round-tripping" errors.
This commit is contained in:
+5
-3
@@ -320,9 +320,11 @@ void reverse() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (uint8_t tileID = (*tilemap)[index];
|
// The unsigned underflow for `tileOfs` is intentional, since a nonzero
|
||||||
tileID >= nbTilesInBank[bank] + options.baseTileIDs[bank]) {
|
// base tile ID may overflow and continue with IDs from 0.
|
||||||
nbTilesInBank[bank] = tileID - options.baseTileIDs[bank] + 1;
|
if (uint8_t tileOfs = (*tilemap)[index] - options.baseTileIDs[bank];
|
||||||
|
tileOfs >= nbTilesInBank[bank]) {
|
||||||
|
nbTilesInBank[bank] = tileOfs + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user