[Core/CD] fixed track index when decoding CUE file MegaSD specific loop commands

This commit is contained in:
ekeeke 2021-09-17 10:08:40 +02:00
parent 543e17f818
commit 0c63be93f7

View File

@ -623,6 +623,7 @@ int cdd_load(char *filename, char *header)
if (fd) if (fd)
{ {
int mm, ss, bb, pregap = 0; int mm, ss, bb, pregap = 0;
int index = 0;
/* DATA track already loaded ? */ /* DATA track already loaded ? */
if (cdd.toc.last) if (cdd.toc.last)
@ -795,27 +796,30 @@ int cdd_load(char *filename, char *header)
cdd.toc.tracks[cdd.toc.last - 1].end = 0; cdd.toc.tracks[cdd.toc.last - 1].end = 0;
} }
} }
/* save current track index */
index = cdd.toc.last;
} }
/* decode REM LOOP xxx command (MegaSD specific command) */ /* decode REM LOOP xxx command (MegaSD specific command) */
else if (sscanf(lptr, "REM LOOP %d", &bb) == 1) else if (sscanf(lptr, "REM LOOP %d", &bb) == 1)
{ {
cdd.toc.tracks[cdd.toc.last].loopEnabled = 1; cdd.toc.tracks[index].loopEnabled = 1;
cdd.toc.tracks[cdd.toc.last].loopOffset = bb; cdd.toc.tracks[index].loopOffset = bb;
isMSDfile = 1; isMSDfile = 1;
} }
/* decode REM LOOP command (MegaSD specific command) */ /* decode REM LOOP command (MegaSD specific command) */
else if (strstr(lptr,"REM LOOP")) else if (strstr(lptr,"REM LOOP"))
{ {
cdd.toc.tracks[cdd.toc.last].loopEnabled = 1; cdd.toc.tracks[index].loopEnabled = 1;
isMSDfile = 1; isMSDfile = 1;
} }
/* decode REM NOLOOP command (MegaSD specific command) */ /* decode REM NOLOOP command (MegaSD specific command) */
else if (strstr(lptr,"REM NOLOOP")) else if (strstr(lptr,"REM NOLOOP"))
{ {
cdd.toc.tracks[cdd.toc.last].loopEnabled = -1; cdd.toc.tracks[index].loopEnabled = -1;
isMSDfile = 1; isMSDfile = 1;
} }