HD Packs: Fixed crash when loading save states

This commit is contained in:
Sour 2020-02-11 22:56:38 -05:00
parent 3cc5398165
commit f2112dbadc
3 changed files with 12 additions and 2 deletions

View file

@ -178,7 +178,9 @@ bool SaveStateManager::LoadState(istream &stream, bool hashCheckRequired)
#ifndef LIBRETRO
vector<uint8_t> frameData;
if(GetScreenshotData(frameData, stream)) {
_console->GetVideoDecoder()->UpdateFrameSync(frameData.data());
if(_console->IsPaused()) {
_console->GetVideoDecoder()->UpdateFrameSync(frameData.data());
}
}
#endif
}

View file

@ -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;

View file

@ -12,7 +12,7 @@
#include <cctype>
#include <memory>
#include <vector>
#include <array>
#include <algorithm>
#include <sstream>
#include <list>
#include <atomic>