Skip to content

Commit

Permalink
Do not load texture if tile width or height is negative.
Browse files Browse the repository at this point in the history
See #2839 for details.
  • Loading branch information
gonetz committed May 25, 2024
1 parent 4972e76 commit ac9afda
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Textures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,12 @@ void doubleTexture(T* pTex, u32 width, u32 height)

void TextureCache::_loadFast(u32 _tile, CachedTexture *_pTexture)
{
// Sanity check
if (auto pTile = gSP.textureTile[_tile]; (int)pTile->lrs - (int)pTile->uls < 0 || (int)pTile->lrt - (int)pTile->ult < 0) {
activateDummy(_tile);
return;
}

u64 ricecrc = 0;
u64 strongcrc = 0;
if (_loadHiresTexture(_tile, _pTexture, ricecrc, strongcrc))
Expand Down Expand Up @@ -1604,6 +1610,12 @@ void TextureCache::_loadFast(u32 _tile, CachedTexture *_pTexture)

void TextureCache::_loadAccurate(u32 _tile, CachedTexture *_pTexture)
{
// Sanity check
if (auto pTile = gSP.textureTile[_tile]; (int)pTile->lrs - (int)pTile->uls < 0 || (int)pTile->lrt - (int)pTile->ult < 0) {
activateDummy(_tile);
return;
}

u64 ricecrc = 0;
u64 strongcrc = 0;
if (_loadHiresTexture(_tile, _pTexture, ricecrc, strongcrc))
Expand Down

0 comments on commit ac9afda

Please sign in to comment.