More Pause/Lock fixes

This commit is contained in:
NovaSquirrel 2020-10-07 23:10:29 -04:00
parent b8afcb79df
commit 92005f89c0
2 changed files with 9 additions and 5 deletions

View file

@ -140,6 +140,10 @@ void Console::Run()
RunFrameWithRunAhead(); RunFrameWithRunAhead();
} else { } else {
RunFrame(); RunFrame();
if (_historyViewer) {
_historyViewer->ProcessEndOfFrame();
}
_rewindManager->ProcessEndOfFrame(); _rewindManager->ProcessEndOfFrame();
ProcessSystemActions(); ProcessSystemActions();
} }
@ -568,16 +572,16 @@ HistoryViewer* Console::GetHistoryViewer()
void Console::CopyRewindData(shared_ptr<Console> sourceConsole) void Console::CopyRewindData(shared_ptr<Console> sourceConsole)
{ {
sourceConsole->Pause(); sourceConsole->Lock();
Pause(); Lock();
//Disable battery saving for this instance //Disable battery saving for this instance
_batteryManager->SetSaveEnabled(false); _batteryManager->SetSaveEnabled(false);
_historyViewer.reset(new HistoryViewer(shared_from_this())); _historyViewer.reset(new HistoryViewer(shared_from_this()));
sourceConsole->GetRewindManager()->CopyHistory(_historyViewer); sourceConsole->GetRewindManager()->CopyHistory(_historyViewer);
Resume(); Unlock();
sourceConsole->Resume(); sourceConsole->Unlock();
} }
void Console::PauseOnNextFrame() void Console::PauseOnNextFrame()

View file

@ -46,7 +46,7 @@ namespace Mesen.GUI.Forms
base.OnShown(e); base.OnShown(e);
HistoryViewerApi.HistoryViewerInitialize(this.Handle, ctrlRenderer.Handle); HistoryViewerApi.HistoryViewerInitialize(this.Handle, ctrlRenderer.Handle);
trkPosition.Maximum = (int)(HistoryViewerApi.HistoryViewerGetHistoryLength() / 60); trkPosition.Maximum = (int)(HistoryViewerApi.HistoryViewerGetHistoryLength() / 60 / 2);
UpdatePositionLabel(0); UpdatePositionLabel(0);
EmuApi.Resume(EmuApi.ConsoleId.HistoryViewer); EmuApi.Resume(EmuApi.ConsoleId.HistoryViewer);
tmrUpdatePosition.Start(); tmrUpdatePosition.Start();