fix song stop screwing everything up

This commit is contained in:
tildearrow 2022-09-29 00:27:40 -05:00
parent 9f2cb1450f
commit 6ed50d717c
3 changed files with 20 additions and 9 deletions

View file

@ -401,6 +401,7 @@ void writePackedCommandValues(SafeWriter* w, const DivCommand& c) {
SafeWriter* DivEngine::saveCommand(bool binary) {
stop();
repeatPattern=false;
shallStop=false;
setOrder(0);
BUSY_BEGIN_SOFT;
// determine loop point
@ -1873,6 +1874,7 @@ void DivEngine::play() {
sPreview.wave=-1;
sPreview.pos=0;
sPreview.dir=false;
shallStop=false;
if (stepPlay==0) {
freelance=false;
playSub(false);
@ -2031,6 +2033,7 @@ void DivEngine::reset() {
speed1=curSubSong->speed1;
speed2=curSubSong->speed2;
firstTick=false;
shallStop=false;
nextSpeed=speed1;
divider=60;
if (curSubSong->customTempo) {

View file

@ -327,6 +327,7 @@ class DivEngine {
bool lowQuality;
bool playing;
bool freelance;
bool shallStop;
bool speedAB;
bool endOfSong;
bool consoleMode;
@ -998,6 +999,7 @@ class DivEngine {
lowQuality(false),
playing(false),
freelance(false),
shallStop(false),
speedAB(false),
endOfSong(false),
consoleMode(false),

View file

@ -844,15 +844,7 @@ void DivEngine::processRow(int i, bool afterDelay) {
break;
case 0xff: // stop song
freelance=false;
playing=false;
extValuePresent=false;
stepPlay=0;
remainingLoops=-1;
sPreview.sample=-1;
sPreview.wave=-1;
sPreview.pos=0;
sPreview.dir=false;
shallStop=true;
break;
}
}
@ -1285,6 +1277,20 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
firstTick=false;
if (shallStop) {
freelance=false;
playing=false;
extValuePresent=false;
stepPlay=0;
remainingLoops=-1;
sPreview.sample=-1;
sPreview.wave=-1;
sPreview.pos=0;
sPreview.dir=false;
ret=true;
return ret;
}
// system tick
for (int i=0; i<song.systemLen; i++) disCont[i].dispatch->tick(subticks==tickMult);