mirror of
https://github.com/SourMesen/Mesen2.git
synced 2025-04-02 10:21:44 -04:00
NES: HD Packs - Fixed crash when starting/stopping hd pack recorder
This commit is contained in:
parent
600d4bf5b2
commit
a3aedd2f2a
3 changed files with 14 additions and 0 deletions
|
@ -659,6 +659,8 @@ void NesConsole::StartRecordingHdPack(HdPackBuilderOptions options)
|
|||
{
|
||||
auto lock = _emu->AcquireLock();
|
||||
|
||||
_emu->GetVideoDecoder()->WaitForAsyncFrameDecode();
|
||||
|
||||
std::stringstream saveState;
|
||||
_emu->Serialize(saveState, false, 0);
|
||||
|
||||
|
@ -679,6 +681,8 @@ void NesConsole::StopRecordingHdPack()
|
|||
{
|
||||
if(_hdPackBuilder) {
|
||||
auto lock = _emu->AcquireLock();
|
||||
|
||||
_emu->GetVideoDecoder()->WaitForAsyncFrameDecode();
|
||||
|
||||
std::stringstream saveState;
|
||||
_emu->Serialize(saveState, false, 0);
|
||||
|
|
|
@ -168,6 +168,14 @@ uint32_t VideoDecoder::GetFrameCount()
|
|||
return _frameCount;
|
||||
}
|
||||
|
||||
void VideoDecoder::WaitForAsyncFrameDecode()
|
||||
{
|
||||
while(_frameChanged) {
|
||||
//Spin until decode is done
|
||||
std::this_thread::sleep_for(std::chrono::duration<int, std::milli>(15));
|
||||
}
|
||||
}
|
||||
|
||||
void VideoDecoder::UpdateFrame(RenderedFrame frame, bool sync, bool forRewind)
|
||||
{
|
||||
if(_emu->IsRunAheadFrame()) {
|
||||
|
|
|
@ -62,6 +62,8 @@ public:
|
|||
|
||||
void UpdateFrame(RenderedFrame frame, bool sync, bool forRewind);
|
||||
|
||||
void WaitForAsyncFrameDecode();
|
||||
|
||||
bool IsRunning();
|
||||
void StartThread();
|
||||
void StopThread();
|
||||
|
|
Loading…
Add table
Reference in a new issue