GB GPU Viewer: Bounds check tile drawing for OBJ window, seems to resolve random crashing

This commit is contained in:
alyosha-tas 2021-01-14 09:50:46 -05:00
parent c0b6bf61b1
commit e65e77e7cd
1 changed files with 8 additions and 4 deletions

View File

@ -375,11 +375,15 @@ namespace BizHawk.Client.EmuHawk
if (cgb && flags.Bit(3))
tile += 8192;
DrawTileHv(tile, dest, pitch, thisPal, hFlip, vFlip);
if (tall)
// only draw tiles that are completely in bounds so to avoid out of bounds accesses
if ((xPos <= 248) && (yPos <= 240))
{
DrawTileHv(tile + 16, dest + pitch * 8, pitch, thisPal, hFlip, vFlip);
DrawTileHv(tile, dest, pitch, thisPal, hFlip, vFlip);
if (tall)
{
DrawTileHv(tile + 16, dest + pitch * 8, pitch, thisPal, hFlip, vFlip);
}
}
dest -= xPos + yPos * pitch;