From 5a0a9db9c3a830aa172d43de8e74bc800622a030 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 6 Jun 2022 01:05:06 -0500 Subject: [PATCH] highlight cur row instead of next one on playback --- src/engine/engine.cpp | 15 +++++++++++++-- src/engine/engine.h | 4 +++- src/engine/playback.cpp | 3 +++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 07e74922c..093f6d942 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -780,6 +780,8 @@ void DivEngine::changeSong(size_t songIndex) { curSubSongIndex=songIndex; curOrder=0; curRow=0; + prevOrder=0; + prevRow=0; } void DivEngine::swapChannelsP(int src, int dest) { @@ -871,6 +873,7 @@ void DivEngine::clearSubSongs() { song.clearSongData(); changeSong(0); curOrder=0; + prevOrder=0; saveLock.unlock(); BUSY_END; } @@ -1113,6 +1116,8 @@ void DivEngine::playSub(bool preserveDrift, int goalRow) { int goal=curOrder; curOrder=0; curRow=0; + prevOrder=0; + prevRow=0; stepPlay=0; int prevDrift; prevDrift=clockDrift; @@ -1162,6 +1167,8 @@ void DivEngine::playSub(bool preserveDrift, int goalRow) { if (!preserveDrift) { ticks=1; subticks=1; + prevOrder=curOrder; + prevRow=curRow; } skipping=false; cmdStream.clear(); @@ -1288,6 +1295,7 @@ unsigned int DivEngine::convertPanLinearToSplit(int val, unsigned char bits, int void DivEngine::play() { BUSY_BEGIN_SOFT; + curOrder=prevOrder; sPreview.sample=-1; sPreview.wave=-1; sPreview.pos=0; @@ -1583,11 +1591,11 @@ int DivEngine::getMaxVolumeChan(int ch) { } unsigned char DivEngine::getOrder() { - return curOrder; + return prevOrder; } int DivEngine::getRow() { - return curRow; + return prevRow; } size_t DivEngine::getCurrentSubSong() { @@ -2564,6 +2572,7 @@ void DivEngine::setOrder(unsigned char order) { BUSY_BEGIN_SOFT; curOrder=order; if (order>=curSubSong->ordersLen) curOrder=0; + prevOrder=curOrder; if (playing && !freelance) { playSub(false); } @@ -2757,6 +2766,8 @@ void DivEngine::quitDispatch() { tempoAccum=0; curRow=0; curOrder=0; + prevRow=0; + prevOrder=0; nextSpeed=3; changeOrd=-1; changePos=0; diff --git a/src/engine/engine.h b/src/engine/engine.h index 3bd4fc28e..ec48e187a 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -303,7 +303,7 @@ class DivEngine { bool systemsRegistered; bool hasLoadedSomething; int softLockCount; - int subticks, ticks, curRow, curOrder, remainingLoops, nextSpeed; + int subticks, ticks, curRow, curOrder, prevRow, prevOrder, remainingLoops, nextSpeed; size_t curSubSongIndex; double divider; int cycles; @@ -935,6 +935,8 @@ class DivEngine { ticks(0), curRow(0), curOrder(0), + prevRow(0), + prevOrder(0), remainingLoops(-1), nextSpeed(3), curSubSongIndex(0), diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 0297a56b4..f7c1646f9 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -798,6 +798,9 @@ void DivEngine::nextRow() { printf("| %.2x:%s | \x1b[1;33m%3d%s\x1b[m\n",curOrder,pb1,curRow,pb3); } + prevOrder=curOrder; + prevRow=curRow; + for (int i=0; i