From b28030c98ced576def581f2f3ead551fc890890b Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 9 Aug 2016 23:34:36 -0700 Subject: [PATCH] GBA Video: More threaded renderer fixes --- src/gba/renderers/thread-proxy.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gba/renderers/thread-proxy.c b/src/gba/renderers/thread-proxy.c index 733c6701d..4600c3589 100644 --- a/src/gba/renderers/thread-proxy.c +++ b/src/gba/renderers/thread-proxy.c @@ -75,6 +75,7 @@ void GBAVideoThreadProxyRendererInit(struct GBAVideoRenderer* renderer) { proxyRenderer->backend->palette = proxyRenderer->paletteProxy; proxyRenderer->backend->vram = proxyRenderer->vramProxy; proxyRenderer->backend->oam = &proxyRenderer->oamProxy; + proxyRenderer->backend->cache = NULL; proxyRenderer->backend->init(proxyRenderer->backend); @@ -87,6 +88,7 @@ void GBAVideoThreadProxyRendererReset(struct GBAVideoRenderer* renderer) { struct GBAVideoThreadProxyRenderer* proxyRenderer = (struct GBAVideoThreadProxyRenderer*) renderer; MutexLock(&proxyRenderer->mutex); while (proxyRenderer->threadState == PROXY_THREAD_BUSY) { + ConditionWake(&proxyRenderer->toThreadCond); ConditionWait(&proxyRenderer->fromThreadCond, &proxyRenderer->mutex); } memcpy(&proxyRenderer->oamProxy.raw, &renderer->oam->raw, SIZE_OAM); @@ -173,6 +175,9 @@ void GBAVideoThreadProxyRendererWritePalette(struct GBAVideoRenderer* renderer, 0xDEADBEEF, }; RingFIFOWrite(&proxyRenderer->dirtyQueue, &dirty, sizeof(dirty)); + if (renderer->cache) { + GBAVideoTileCacheWritePalette(renderer->cache, address); + } } void GBAVideoThreadProxyRendererWriteOAM(struct GBAVideoRenderer* renderer, uint32_t oam) {