From b4735a1aea7d3a08066de6b0b0907eda65cc41c3 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Wed, 22 Dec 2021 23:54:14 -0500 Subject: [PATCH] Added missing follow playback cursor if needed function in Qt TAS GUI. --- src/drivers/Qt/TasEditor/TasEditorWindow.cpp | 16 ++++++++++++++++ src/drivers/Qt/TasEditor/TasEditorWindow.h | 1 + src/drivers/Qt/TasEditor/playback.cpp | 12 ++++++++---- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp index 45890ff2..4a523c5f 100644 --- a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp +++ b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp @@ -5533,6 +5533,22 @@ void QPianoRoll::followPlaybackCursor(void) { centerListAroundLine(currFrameCounter); } +//---------------------------------------------------------------------------- +void QPianoRoll::followPlaybackCursorIfNeeded(bool followPauseframe) +{ + if (taseditorConfig->followPlaybackCursor) + { + if (playback->getPauseFrame() < 0) + { + ensureTheLineIsVisible( currFrameCounter ); + } + else if (followPauseframe) + { + ensureTheLineIsVisible( playback->getPauseFrame() ); + } + } +} + //---------------------------------------------------------------------------- void QPianoRoll::followPauseframe(void) { diff --git a/src/drivers/Qt/TasEditor/TasEditorWindow.h b/src/drivers/Qt/TasEditor/TasEditorWindow.h index 98b83b5f..b1e5caba 100644 --- a/src/drivers/Qt/TasEditor/TasEditorWindow.h +++ b/src/drivers/Qt/TasEditor/TasEditorWindow.h @@ -151,6 +151,7 @@ class QPianoRoll : public QWidget void handleColumnSet(int column, bool altPressed); void centerListAroundLine(int rowIndex); void ensureTheLineIsVisible( int lineNum ); + void followPlaybackCursorIfNeeded(bool followPauseframe); void followMarker(int markerID); void followSelection(void); void followPlaybackCursor(void); diff --git a/src/drivers/Qt/TasEditor/playback.cpp b/src/drivers/Qt/TasEditor/playback.cpp index 8934505f..adfdf369 100644 --- a/src/drivers/Qt/TasEditor/playback.cpp +++ b/src/drivers/Qt/TasEditor/playback.cpp @@ -159,7 +159,7 @@ void PLAYBACK::update() bookmarks->redrawChangedBookmarks(currFrameCounter); lastCursorPos = currFrameCounter; // follow the Playback cursor, but in case of seeking don't follow it - //pianoRoll.followPlaybackCursorIfNeeded(false); //pianoRoll.updatePlaybackCursorPositionInPianoRoll(); // an unfinished experiment + tasWin->pianoRoll->followPlaybackCursorIfNeeded(false); //pianoRoll.updatePlaybackCursorPositionInPianoRoll(); // an unfinished experiment // enforce redrawing now //UpdateWindow(pianoRoll.hwndList); // lazy update of "Playback's Marker text" @@ -396,10 +396,12 @@ void PLAYBACK::handleRewindFrame() else { // cursor is at frame 0 - can't rewind, but still must make cursor visible if needed - //pianoRoll.followPlaybackCursorIfNeeded(true); + tasWin->pianoRoll->followPlaybackCursorIfNeeded(true); } if (!pauseFrame) + { pauseEmulation(); + } } void PLAYBACK::handleForwardFrame() { @@ -478,11 +480,13 @@ void PLAYBACK::ensurePlaybackIsInsideGreenzone(bool executeLua) { // since the game state was changed by this jump, we must update possible Lua callbacks and other tools that would normally only update in FCEUI_Emulate if (executeLua) + { ForceExecuteLuaFrameFunctions(); + } //Update_RAM_Search(); // Update_RAM_Watch() is also called. } // follow the Playback cursor, but in case of seeking don't follow it - //pianoRoll.followPlaybackCursorIfNeeded(false); + tasWin->pianoRoll->followPlaybackCursorIfNeeded(false); } // an interface for sending Playback cursor to any frame @@ -515,7 +519,7 @@ void PLAYBACK::jump(int frame, bool forceStateReload, bool executeLua, bool foll } // follow the Playback cursor, and optionally follow pauseframe (if seeking was launched) - //pianoRoll.followPlaybackCursorIfNeeded(followPauseframe); + tasWin->pianoRoll->followPlaybackCursorIfNeeded(followPauseframe); // redraw respective Piano Roll lines if needed if (lastCursor != currFrameCounter)