Merge pull request #635 from fmahnke/ppu-viewer-fix

Don't divide by 0 when PPU/sprite viewer windows are small.
This commit is contained in:
thor2016 2023-04-20 06:23:36 -04:00 committed by GitHub
commit 7666f1f7aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -635,8 +635,8 @@ QPoint ppuPatternView_t::convPixToTile( QPoint p )
w = pattern->w;
h = pattern->h;
i = x / (w*8);
j = y / (h*8);
i = w == 0 ? 0 : x / (w*8);
j = h == 0 ? 0 : y / (h*8);
if ( PPUView_sprite16Mode[ patternIndex ] )
{
@ -3336,8 +3336,8 @@ QPoint oamPatternView_t::convPixToTile( QPoint p )
w = oamPattern.w;
h = oamPattern.h;
i = x / (w*8);
j = y / (h*16);
i = w == 0 ? 0 : x / (w*8);
j = h == 0 ? 0 : y / (h*16);
//printf("(x,y) = (%i,%i) w=%i h=%i $%X%X \n", x, y, w, h, jj, ii );