This commit is contained in:
tildearrow 2022-01-25 15:51:53 -05:00
parent 61a1932bce
commit 503a79c904
1 changed files with 11 additions and 2 deletions

View File

@ -2134,6 +2134,9 @@ SafeWriter* DivEngine::saveVGM() {
int hasC352=0; int hasC352=0;
int hasGA20=0; int hasGA20=0;
int loopPos=-1;
int loopTick=-1;
SafeWriter* w=new SafeWriter; SafeWriter* w=new SafeWriter;
w->init(); w->init();
@ -2533,6 +2536,12 @@ SafeWriter* DivEngine::saveVGM() {
playSub(false); playSub(false);
size_t tickCount=0; size_t tickCount=0;
while (!done) { while (!done) {
if (loopPos==-1) {
if (loopOrder==curOrder && loopRow==curRow) {
loopPos=w->tell();
loopTick=tickCount;
}
}
if (nextTick()) done=true; if (nextTick()) done=true;
// get register dumps // get register dumps
for (int i=0; i<song.systemLen; i++) { for (int i=0; i<song.systemLen; i++) {
@ -2616,8 +2625,8 @@ SafeWriter* DivEngine::saveVGM() {
w->seek(0x18,SEEK_SET); w->seek(0x18,SEEK_SET);
w->writeI(tickCount); w->writeI(tickCount);
// loop not handled for now // loop not handled for now
w->writeI(0); w->writeI(loopPos-0x1c);
w->writeI(0); w->writeI(tickCount-loopTick);
remainingLoops=-1; remainingLoops=-1;
playing=false; playing=false;