mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-07-27 17:41:49 +03:00
Remove nuisance Vorbis errors on blank music slots
When vvvvvvmusic.vvv files contain blank slots before the last valid song, the following error message would be output for all of them: [ERROR] Unable to create Vorbis handle, error 30 Now, this is very common: many levels, for example, ship a music file where songs start at slot 16, or alternatively they used slots 0-15 but didn't need every slot. Or IDs are skipped so that certain songs are on their own page in the music editor. Either way, I've seen bursts of this message appear in my console a lot when loading levels lol, so it became time this was silenced by not bothering to load a <=1 byte song, and giving a (silenced by default) debug message in that case instead. (It checks for <= 1 byte, because in all these cases, the empty slots have a single null byte in them. I looked up why that is again, and it is because, in 2019, "Rumor goes that 0-byte tracks actually mess things up in VVVVVV". We could probably verify if that's the case now, but music files have been made this way for ages, and it's pretty clear a 1-byte song is not usable.)
This commit is contained in:
@@ -381,6 +381,12 @@ public:
|
|||||||
MusicTrack(SDL_RWops *rw, const char* _id, bool _loose_extra)
|
MusicTrack(SDL_RWops *rw, const char* _id, bool _loose_extra)
|
||||||
{
|
{
|
||||||
SDL_zerop(this);
|
SDL_zerop(this);
|
||||||
|
if (rw->size(rw) <= 1)
|
||||||
|
{
|
||||||
|
// Don't bother
|
||||||
|
vlog_debug("Skipping empty music track");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
read_buf = (Uint8*) SDL_malloc(rw->size(rw));
|
read_buf = (Uint8*) SDL_malloc(rw->size(rw));
|
||||||
SDL_RWread(rw, read_buf, rw->size(rw), 1);
|
SDL_RWread(rw, read_buf, rw->size(rw), 1);
|
||||||
int err;
|
int err;
|
||||||
|
|||||||
Reference in New Issue
Block a user