1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-05 02:39:41 +01:00

Ignore comments of tracks with a negative loop comment

If a music track has a loop comment with a negative value, ignore all
comments of the track. This is just to prevent any weirdness from
happening as it's safer to just let the track loop improperly. Also log
to the console to let users know.

This is the same thing that SDL_mixer does now:
libsdl-org/SDL_mixer@e819489459

This commit happened as a result of discussion on the VVVVVV Discord
server about SDL_mixer 2.0.4 behavior with weird loop comment values
(e.g. octal input with leading zeroes). This is simply updating the code
to be in line with what newer versions of SDL_mixer do.
This commit is contained in:
Misa 2022-11-13 19:47:37 -08:00
parent fb13e652fa
commit 876362365b

View file

@ -526,6 +526,19 @@ end:
loopend = _Mix_ParseTime(value, t->format.nSamplesPerSec);
}
if (t->loopbegin < 0 || t->looplength < 0 || loopend < 0)
{
vlog_warn(
"A track loop comment had a negative value. "
"Ignoring all comments for the track."
);
t->loopbegin = 0;
t->looplength = 0;
loopend = 0;
SDL_free(param);
break;
}
SDL_free(param);
}
if (loopend != 0)