all repos — mgba @ b8593bdb7bd2d2c790be24c7b1e94ee88d4f5390

mGBA Game Boy Advance Emulator

Core: Allow video playback to be non-blocking
Vicki Pfau vi@endrift.com
Mon, 17 Apr 2017 02:55:26 -0700
commit

b8593bdb7bd2d2c790be24c7b1e94ee88d4f5390

parent

3f92b1e67f30abfc056df1df141de7c7ccb6df61

M src/feature/video-logger.csrc/feature/video-logger.c

@@ -168,9 +168,9 @@ };

logger->writeData(logger, &dirty, sizeof(dirty)); } -bool mVideoLoggerRendererRun(struct mVideoLogger* logger) { +bool mVideoLoggerRendererRun(struct mVideoLogger* logger, bool block) { struct mVideoLoggerDirtyInfo item = {0}; - while (logger->readData(logger, &item, sizeof(item), false)) { + while (logger->readData(logger, &item, sizeof(item), block)) { switch (item.type) { case DIRTY_REGISTER: case DIRTY_PALETTE:

@@ -186,7 +186,7 @@ default:

return false; } } - return false; + return !block; } static bool _writeData(struct mVideoLogger* logger, const void* data, size_t length) {
M src/feature/video-logger.hsrc/feature/video-logger.h

@@ -107,7 +107,7 @@

void mVideoLoggerRendererDrawScanline(struct mVideoLogger* logger, int y); void mVideoLoggerRendererFlush(struct mVideoLogger* logger); -bool mVideoLoggerRendererRun(struct mVideoLogger* logger); +bool mVideoLoggerRendererRun(struct mVideoLogger* logger, bool block); struct mCore; struct mVideoLogContext* mVideoLoggerCreate(struct mCore* core);
M src/gba/core.csrc/gba/core.c

@@ -769,7 +769,7 @@ struct mCore* core = context;

struct GBACore* gbacore = (struct GBACore*) core; struct GBA* gba = core->board; - if (!mVideoLoggerRendererRun(&gbacore->logProxy.logger)) { + if (!mVideoLoggerRendererRun(&gbacore->logProxy.logger, true)) { GBAVideoProxyRendererUnshim(&gba->video, &gbacore->logProxy); gbacore->logProxy.logger.vf->seek(gbacore->logProxy.logger.vf, 0, SEEK_SET); core->loadState(core, gbacore->logContext->initialState);
M src/gba/renderers/thread-proxy.csrc/gba/renderers/thread-proxy.c

@@ -174,7 +174,7 @@ break;

} proxyRenderer->threadState = PROXY_THREAD_BUSY; MutexUnlock(&proxyRenderer->mutex); - if (!mVideoLoggerRendererRun(&proxyRenderer->d.logger)) { + if (!mVideoLoggerRendererRun(&proxyRenderer->d.logger, false)) { // FIFO was corrupted proxyRenderer->threadState = PROXY_THREAD_STOPPED; mLOG(GBA_VIDEO, ERROR, "Proxy thread queue got corrupted!");