GBA Video: Fix cache updating with proxy and GL renderers

This commit is contained in:
Vicki Pfau 2021-11-17 17:33:18 -08:00
parent 4b4eef373f
commit fdd03e505e
3 changed files with 11 additions and 2 deletions

View File

@ -29,6 +29,7 @@ Other fixes:
- GB Video: Fix memory leak when reseting SGB games
- GBA: Fix out of bounds ROM accesses on patched ROMs smaller than 32 MiB
- GBA: Fix maximum tile ID in caching for 256-color modes
- GBA Video: Fix cache updating with proxy and GL renderers
- Libretro: Fix crash when using Game Boy codes (fixes mgba.io/i/2281)
- Qt: Fix corrupted savestate and fatal error text
- Qt: Fix sprite compositing when sprite tiles go out of bounds (fixes mgba.io/i/2348)

View File

@ -8,6 +8,7 @@
#include <mgba/core/cache-set.h>
#include <mgba/internal/gba/gba.h>
#include <mgba/internal/gba/io.h>
#include <mgba/internal/gba/renderers/cache-set.h>
static void GBAVideoProxyRendererInit(struct GBAVideoRenderer* renderer);
static void GBAVideoProxyRendererReset(struct GBAVideoRenderer* renderer);
@ -267,6 +268,9 @@ uint16_t GBAVideoProxyRendererWriteVideoRegister(struct GBAVideoRenderer* render
if (address > REG_BLDY) {
return value;
}
if (renderer->cache) {
GBAVideoCacheWriteVideoRegister(renderer->cache, address, value);
}
mVideoLoggerRendererWriteVideoRegister(proxyRenderer->logger, address, value);
if (!proxyRenderer->logger->block) {

View File

@ -948,6 +948,9 @@ void GBAVideoGLRendererReset(struct GBAVideoRenderer* renderer) {
void GBAVideoGLRendererWriteVRAM(struct GBAVideoRenderer* renderer, uint32_t address) {
struct GBAVideoGLRenderer* glRenderer = (struct GBAVideoGLRenderer*) renderer;
if (renderer->cache) {
mCacheSetWriteVRAM(renderer->cache, address);
}
glRenderer->vramDirty |= 1 << (address >> 12);
}
@ -959,8 +962,9 @@ void GBAVideoGLRendererWriteOAM(struct GBAVideoRenderer* renderer, uint32_t oam)
void GBAVideoGLRendererWritePalette(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) {
struct GBAVideoGLRenderer* glRenderer = (struct GBAVideoGLRenderer*) renderer;
UNUSED(address);
UNUSED(value);
if (renderer->cache) {
mCacheSetWritePalette(renderer->cache, address >> 1, mColorFrom555(value));
}
glRenderer->paletteDirty = true;
int r = M_R5(value);
int g = M_G5(value) << 1;