From f435576f1dd317be535fd80f6ea883611a3af127 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 16 Dec 2008 00:59:20 +0000 Subject: [PATCH] - Increased maximum number of per-pattern rows for the XM loader from 256 to 1024 to deal with a module that otherwise would not load. - Removed the artificial restriction on not supporting Vorbis-compressed samples in XMs if they are stereo, since it turns out that OggMod does support them. SVN r1316 (trunk) --- docs/rh-log.txt | 7 +++++++ dumb/src/it/readxm.c | 12 ++++++------ src/sound/fmodsound.cpp | 1 - 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 563737a0c3..8bdec42248 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,10 @@ +December 15, 2008 +- Increased maximum number of per-pattern rows for the XM loader from + 256 to 1024 to deal with a module that otherwise would not load. +- Removed the artificial restriction on not supporting Vorbis-compressed + samples in XMs if they are stereo, since it turns out that OggMod does + support them. + December 12, 2008 (Changes by Graf Zahl) - Added a SECF_NORESPAWN flag for sectors that prevents players from being respawned in such a sector. As a workaround for current map formats a new actor diff --git a/dumb/src/it/readxm.c b/dumb/src/it/readxm.c index e0711567f5..347c37feae 100644 --- a/dumb/src/it/readxm.c +++ b/dumb/src/it/readxm.c @@ -27,6 +27,7 @@ #include #include +#define MAX_COLUMN_MEMORY (1024*5) extern short *DUMBCALLBACK dumb_decode_vorbis(int outlen, const void *oggstream, int sizebytes); @@ -211,8 +212,8 @@ static int it_xm_read_pattern(IT_PATTERN *pattern, DUMBFILE *f, int n_channels, if (size == 0) return 0; - if (size > 1280 * n_channels) { - TRACE("XM error: pattern data size > %d bytes\n", 1280 * n_channels); + if (size > MAX_COLUMN_MEMORY * n_channels) { + TRACE("XM error: pattern data size > %d bytes\n", MAX_COLUMN_MEMORY * n_channels); return -1; } @@ -636,8 +637,7 @@ static int it_xm_read_sample_data(IT_SAMPLE *sample, unsigned char roguebytes, D return -1; /* FMOD extension: Samples compressed with Ogg Vorbis */ - if (!(sample->flags & IT_SAMPLE_STEREO) && - !memcmp((char *)sample->data + 4, "OggS", 4) && + if (!memcmp((char *)sample->data + 4, "OggS", 4) && !memcmp((char *)sample->data + 33, "vorbis", 7)) { int32 outlen = ((unsigned char *)(sample->data))[0] | @@ -859,7 +859,7 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f, int * version) sigdata->pattern[i].entry = NULL; { - unsigned char *buffer = malloc(1280 * n_channels); /* 256 rows * 5 bytes */ + unsigned char *buffer = malloc(MAX_COLUMN_MEMORY * n_channels); /* 256 rows * 5 bytes */ if (!buffer) { _dumb_it_unload_sigdata(sigdata); return NULL; @@ -1054,7 +1054,7 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f, int * version) sigdata->pattern[i].entry = NULL; { - unsigned char *buffer = malloc(1280 * n_channels); /* 256 rows * 5 bytes */ + unsigned char *buffer = malloc(MAX_COLUMN_MEMORY * n_channels); /* 256 rows * 5 bytes */ if (!buffer) { free(roguebytes); _dumb_it_unload_sigdata(sigdata); diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index 994753ae5b..5c339b114a 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -2397,7 +2397,6 @@ short *FMODSoundRenderer::DecodeSample(int outlen, const void *coded, int sizeby } result = sound->getFormat(NULL, &format, &channels, NULL); // TODO: Handle more formats if it proves necessary. - // Does OggMod work with stereo samples? if (result != FMOD_OK || format != FMOD_SOUND_FORMAT_PCM16 || channels != 1) { sound->release();