GBA Video: Fix mode 5 frame 1 caching (fixes #2075)

This commit is contained in:
Vicki Pfau 2021-03-30 22:39:10 -07:00
parent 02b814d3bb
commit 7740295a6c
2 changed files with 5 additions and 4 deletions

View File

@ -6,6 +6,7 @@ Emulation fixes:
Other fixes: Other fixes:
- GBA: Fix non-USA 1.0 FireRed misdetecting as a ROM hack (fixes mgba.io/i/2100) - GBA: Fix non-USA 1.0 FireRed misdetecting as a ROM hack (fixes mgba.io/i/2100)
- GBA: Fix crash when ROM loading fails - GBA: Fix crash when ROM loading fails
- GBA Video: Fix mode 5 frame 1 caching (fixes mgba.io/i/2075)
Misc: Misc:
- GBA: Default-enable VBA bug compat for Ruby and Emerald ROM hacks - GBA: Default-enable VBA bug compat for Ruby and Emerald ROM hacks
- Qt: Add ROM filename and size to bug reporter - Qt: Add ROM filename and size to bug reporter

View File

@ -139,18 +139,18 @@ void mBitmapCacheCleanRow(struct mBitmapCache* cache, struct mBitmapCacheEntry*
return; return;
} }
size_t offset = cache->bitsStart[cache->buffer] + y * mBitmapCacheSystemInfoGetWidth(cache->sysConfig); size_t offset = y * mBitmapCacheSystemInfoGetWidth(cache->sysConfig);
void* vram; void* vram;
int bpe = mBitmapCacheSystemInfoGetEntryBPP(cache->sysConfig); int bpe = mBitmapCacheSystemInfoGetEntryBPP(cache->sysConfig);
uint32_t (*lookupEntry)(void*, uint32_t); uint32_t (*lookupEntry)(void*, uint32_t);
switch (bpe) { switch (bpe) {
case 3: case 3:
lookupEntry = _lookupEntry8; lookupEntry = _lookupEntry8;
vram = &cache->vram[offset]; vram = &cache->vram[offset + cache->bitsStart[cache->buffer]];
break; break;
case 4: case 4:
lookupEntry = _lookupEntry15; lookupEntry = _lookupEntry15;
vram = &cache->vram[offset << 1]; vram = &cache->vram[offset * 2 + cache->bitsStart[cache->buffer]];
break; break;
default: default:
abort(); abort();