Core: Return null for out of bounds cached tile VRAM querying

This commit is contained in:
Vicki Pfau 2019-12-18 18:21:01 -08:00
parent f4c657c537
commit 1002dfd0db
3 changed files with 8 additions and 0 deletions

View File

@ -95,6 +95,7 @@ Emulation fixes:
Other fixes:
- 3DS: Fix screen darkening (fixes mgba.io/i/1562)
- Core: Fix uninitialized memory issues with graphics caches
- Core: Return null for out of bounds cached tile VRAM querying
- Vita: Fix analog controls (fixes mgba.io/i/1554)
- Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574)
- Qt: Fix scrollbar arrows in memory view (fixes mgba.io/i/1558)

View File

@ -281,5 +281,9 @@ const color_t* mTileCacheGetPalette(struct mTileCache* cache, unsigned paletteId
}
const uint16_t* mTileCacheGetVRAM(struct mTileCache* cache, unsigned tileId) {
unsigned tiles = mTileCacheSystemInfoGetMaxTiles(cache->sysConfig);
if (tileId >= tiles) {
return NULL;
}
return &cache->vram[tileId << (cache->bpp + 2)];
}

View File

@ -66,6 +66,9 @@ void AssetView::showEvent(QShowEvent*) {
}
void AssetView::compositeTile(const void* tBuffer, void* buffer, size_t stride, size_t x, size_t y, int depth) {
if (!tBuffer) {
return;
}
const uint8_t* tile = static_cast<const uint8_t*>(tBuffer);
uint8_t* pixels = static_cast<uint8_t*>(buffer);
size_t base = stride * y + x;