From aa350ea5b7a4048f98c128cae1644cedbfa5a65e Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 3 Sep 2017 22:15:48 -0700 Subject: [PATCH] GB, GBA: Fix sync to video with frameskip --- CHANGES | 1 + src/gb/video.c | 2 +- src/gba/video.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index e8776c851..1c6c9873c 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,7 @@ Bugfixes: - GB Video: Fix potential hang when ending mode 0 - GB Memory: Fix HDMA count starting in mode 0 (fixes mgba.io/i/855) - GB Memory: Actually load latch time from savestate + - GB, GBA: Fix sync to video with frameskip Misc: - Qt: Don't rebuild library view if style hasn't changed - SDL: Fix 2.0.5 build on macOS under some circumstances diff --git a/src/gb/video.c b/src/gb/video.c index 49bbff1f8..dd0f5c2a3 100644 --- a/src/gb/video.c +++ b/src/gb/video.c @@ -265,10 +265,10 @@ void _updateFrameCount(struct mTiming* timing, void* context, uint32_t cyclesLat } GBFrameEnded(video->p); + mCoreSyncPostFrame(video->p->sync); --video->frameskipCounter; if (video->frameskipCounter < 0) { video->renderer->finishFrame(video->renderer); - mCoreSyncPostFrame(video->p->sync); video->frameskipCounter = video->frameskip; } ++video->frameCounter; diff --git a/src/gba/video.c b/src/gba/video.c index db0614342..87af353d1 100644 --- a/src/gba/video.c +++ b/src/gba/video.c @@ -157,9 +157,9 @@ void _startHdraw(struct mTiming* timing, void* context, uint32_t cyclesLate) { GBARaiseIRQ(video->p, IRQ_VBLANK); } GBAFrameEnded(video->p); + mCoreSyncPostFrame(video->p->sync); --video->frameskipCounter; if (video->frameskipCounter < 0) { - mCoreSyncPostFrame(video->p->sync); video->frameskipCounter = video->frameskip; } ++video->frameCounter;