diff --git a/Core/SaveStateManager.cpp b/Core/SaveStateManager.cpp index 31bb0229..02e26bc0 100644 --- a/Core/SaveStateManager.cpp +++ b/Core/SaveStateManager.cpp @@ -178,7 +178,9 @@ bool SaveStateManager::LoadState(istream &stream, bool hashCheckRequired) #ifndef LIBRETRO vector frameData; if(GetScreenshotData(frameData, stream)) { - _console->GetVideoDecoder()->UpdateFrameSync(frameData.data()); + if(_console->IsPaused()) { + _console->GetVideoDecoder()->UpdateFrameSync(frameData.data()); + } } #endif } diff --git a/Core/VideoDecoder.cpp b/Core/VideoDecoder.cpp index 8954a0e3..ed8433fe 100644 --- a/Core/VideoDecoder.cpp +++ b/Core/VideoDecoder.cpp @@ -163,6 +163,14 @@ void VideoDecoder::UpdateFrameSync(void *ppuOutputBuffer, HdScreenInfo *hdScreen return; } + if(_frameChanged) { + //Last frame isn't done decoding yet - sometimes Signal() introduces a 25-30ms delay + while(_frameChanged) { + //Spin until decode is done + } + //At this point, we are sure that the decode thread is no longer busy + } + _frameNumber = _console->GetFrameCount(); _hdScreenInfo = hdScreenInfo; _ppuOutputBuffer = (uint16_t*)ppuOutputBuffer; diff --git a/Core/stdafx.h b/Core/stdafx.h index a2bb0612..50386d69 100644 --- a/Core/stdafx.h +++ b/Core/stdafx.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include