Updated DUMB to version 2.0.2.

CQTexperiment
Christopher Snowhill 2017-10-08 18:48:02 -07:00
parent 34357351c8
commit 20d1ce09e5
46 changed files with 112 additions and 60 deletions

View File

@ -40,8 +40,8 @@ extern "C" {
*/
#define DUMB_MAJOR_VERSION 2
#define DUMB_MINOR_VERSION 0
#define DUMB_REVISION_VERSION 0
#define DUMB_VERSION_STR "2.0.0"
#define DUMB_REVISION_VERSION 2
#define DUMB_VERSION_STR "2.0.2"
#define DUMB_VERSION \
(DUMB_MAJOR_VERSION * 10000 + DUMB_MINOR_VERSION * 100 + \

View File

@ -40,6 +40,10 @@ int _dumb_it_fix_invalid_orders(DUMB_IT_SIGDATA *sigdata) {
sigdata->order[i] <= last_invalid) {
sigdata->order[i] = sigdata->n_patterns;
found_some = 1;
} else if (sigdata->order[i] < first_invalid) {
IT_PATTERN *pattern = sigdata->pattern + sigdata->order[i];
if (!pattern->n_rows || (pattern->n_entries && !pattern->entry))
return -1;
}
}

View File

@ -1042,6 +1042,7 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f) {
// XXX sample count
if (dumbfile_error(f) || sigdata->n_orders <= 0 ||
sigdata->n_orders > 1024 || // Whoa, nelly.
sigdata->n_instruments > 256 || sigdata->n_samples > 4000 ||
sigdata->n_patterns > 256) {
_dumb_it_unload_sigdata(sigdata);
@ -1437,7 +1438,10 @@ static sigdata_t *it_load_sigdata(DUMBFILE *f) {
free(buffer);
free(component);
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;
}

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you, and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* opening and closing it for you. | < / \_
* | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -13,7 +13,7 @@
* do an initial run-through. | \/ /\ /
* \_ / > /
* | \ / /
* By Chris Moeller. | ' /
* By Christopher Snowhill. | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* module formats supported by DUMB, | < / \_
* opening and closing the file for you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -13,7 +13,7 @@
* opening and closing the file for | \/ /\ /
* you, and do an initial run-through. \_ / > /
* | \ / /
* by Chris Moeller. | ' /
* by Christopher Snowhill. | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* module file, opening and closing it | < / \_
* for you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -13,7 +13,7 @@
* for you, and do an initial run- | \/ /\ /
* through. \_ / > /
* | \ / /
* By Chris Moeller. | ' /
* By Christopher Snowhill. | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you, and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -13,7 +13,7 @@
* it for you, and do an initial run- | \/ /\ /
* through. \_ / > /
* | \ / /
* By Chris Moeller. | ' /
* By Christopher Snowhill. | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -13,7 +13,7 @@
* you, and do an initial run- | \/ /\ /
* through. \_ / > /
* | \ / /
* By Chris Moeller. | ' /
* By Christopher Snowhill. | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you, and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you, and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* opening and closing it for you. | < / \_
* | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* opening and closing it for you, | < / \_
* and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -12,7 +12,7 @@
* file, opening and closing it for | < / \_
* you, and do an initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -11,7 +11,7 @@
* ptmeffect.c - Code for converting PTM / / \ \
* effects to IT effects. | < / \_
* | \/ /\ /
* By Chris Moeller. Based on xmeffect.c \_ / > /
* By Christopher Snowhill. Based on xmeffect.c \_ / > /
* by Julien Cugniere. | \ / /
* | ' /
* \__/

View File

@ -11,7 +11,7 @@
* read669.c - Code to read a 669 Composer module / / \ \
* from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/
@ -423,7 +423,10 @@ static DUMB_IT_SIGDATA *it_669_load_sigdata(DUMBFILE *f, int *ext) {
sigdata->channel_pan[i + 1] = 32 - sep;
}
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;
}

View File

@ -11,7 +11,7 @@
* read6692.c - Code to read a 669 Composer module / / \ \
* from an open file, and do an initial | < / \_
* run-through. | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/

View File

@ -11,7 +11,7 @@
* readam.c - Code to read a RIFF AM module / / \ \
* from a parsed RIFF structure. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/
@ -463,7 +463,10 @@ static DUMB_IT_SIGDATA *it_riff_amff_load_sigdata(DUMBFILE *f,
}
}
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;

View File

@ -11,7 +11,7 @@
* readamf.c - Code to read a DSMI AMF module from / / \ \
* an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/
@ -536,8 +536,6 @@ static DUMB_IT_SIGDATA *it_amf_load_sigdata(DUMBFILE *f, int *version) {
sigdata->mixing_volume = 48;
sigdata->pan_separation = 128;
_dumb_it_fix_invalid_orders(sigdata);
for (i = 0; i < realntracks; i++) {
if (track[i]) {
free(track[i]);
@ -547,6 +545,11 @@ static DUMB_IT_SIGDATA *it_amf_load_sigdata(DUMBFILE *f, int *version) {
free(trackmap);
free(orderstotracks);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;
error_all:

View File

@ -11,7 +11,7 @@
* readany.c - Code to detect and read any of the / / \ \
* module formats supported by DUMB. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/

View File

@ -13,7 +13,7 @@
* from an open file and do an initial | \/ /\ /
* run-through. \_ / > /
* | \ / /
* by Chris Moeller. | ' /
* by Christopher Snowhill. | ' /
* \__/
*/

View File

@ -11,7 +11,7 @@
* readasy.c - Code to read an ASYLUM Music Format / / \ \
* module from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/
@ -314,7 +314,10 @@ static DUMB_IT_SIGDATA *it_asy_load_sigdata(DUMBFILE *f) {
sigdata->channel_pan[i + 3] = 32 - sep;
}
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;
}

View File

@ -11,7 +11,7 @@
* readam.c - Code to read a RIFF DSMF module / / \ \
* from a parsed RIFF structure. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/
@ -293,6 +293,8 @@ static DUMB_IT_SIGDATA *it_riff_dsmf_load_sigdata(DUMBFILE *f,
sigdata->flags = IT_STEREO | IT_OLD_EFFECTS | IT_COMPATIBLE_GXX;
dumbfile_skip(f, 36 - 28);
sigdata->n_orders = dumbfile_igetw(f);
if (sigdata->n_orders > 1024) // Whoa, nelly.
goto error_usd;
// sigdata->n_samples = ptr[ 38 ] | ( ptr[ 39 ] << 8 ); // whatever
// sigdata->n_patterns = ptr[ 40 ] | ( ptr[ 41 ] << 8 );
dumbfile_skip(f, 42 - 38);
@ -355,7 +357,10 @@ static DUMB_IT_SIGDATA *it_riff_dsmf_load_sigdata(DUMBFILE *f,
}
}
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;

View File

@ -621,7 +621,10 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int restrict_) {
sigdata->channel_pan[i + 3] = 32 - sep;
}
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;
}

View File

@ -11,7 +11,7 @@
* readmtm.c - Code to read a MultiTracker Module / / \ \
* from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/
@ -389,12 +389,15 @@ static DUMB_IT_SIGDATA *it_mtm_load_sigdata(DUMBFILE *f, int *version) {
goto error_fs;
}
_dumb_it_fix_invalid_orders(sigdata);
free(sequence);
free(track);
free(skip_bytes);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;
error_fc:

View File

@ -11,7 +11,7 @@
* readokt.c - Code to read an Oktalyzer module / / \ \
* from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/
@ -577,7 +577,10 @@ static DUMB_IT_SIGDATA *it_okt_load_sigdata(DUMBFILE *f) {
memset(sigdata->channel_pan + n_channels, 32,
DUMB_IT_N_CHANNELS - n_channels);
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;
}

View File

@ -13,7 +13,7 @@
* an initial run-through. | \/ /\ /
* \_ / > /
* | \ / /
* By Chris Moeller. | ' /
* By Christopher Snowhill. | ' /
* \__/
*/

View File

@ -11,7 +11,7 @@
* readpsm.c - Code to read an old Protracker / / \ \
* Studio module from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/
@ -111,7 +111,7 @@ static int it_old_psm_read_samples(IT_SAMPLE **sample, DUMBFILE *f, int *num) {
} else
smp.finetune = 0;
smp.flags |= IT_SAMPLE_EXISTS;
smp.flags = IT_SAMPLE_EXISTS;
if (flags & 0x41)
continue;
if (flags & 0x20)
@ -705,7 +705,8 @@ static DUMB_IT_SIGDATA *it_old_psm_load_sigdata(DUMBFILE *f) {
}
}
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0)
goto error_fc;
free(component);

View File

@ -11,7 +11,7 @@
* readpsm.c - Code to read a Protracker Studio / / \ \
* module from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/
@ -1062,7 +1062,10 @@ static DUMB_IT_SIGDATA *it_psm_load_sigdata(DUMBFILE *f, int *ver,
free(songchunk);
free_chunks(chunk, n_chunks);
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
dumb_it_optimize_orders(sigdata);

View File

@ -11,7 +11,7 @@
* readptm.c - Code to read a Poly Tracker v2.03 / / \ \
* module from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. Based on reads3m.c \_ / > /
* By Christopher Snowhill. Based on reads3m.c \_ / > /
* by entheh. | \ / /
* | ' /
* \__/
@ -352,6 +352,7 @@ static DUMB_IT_SIGDATA *it_ptm_load_sigdata(DUMBFILE *f) {
sigdata->n_patterns = dumbfile_igetw(f);
if (dumbfile_error(f) || sigdata->n_orders <= 0 ||
sigdata->n_orders > 1024 || // Whoa, nelly.
sigdata->n_samples > 255 || sigdata->n_patterns > 128) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
@ -534,7 +535,10 @@ static DUMB_IT_SIGDATA *it_ptm_load_sigdata(DUMBFILE *f) {
free(buffer);
free(component);
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;
}

View File

@ -12,7 +12,7 @@
* from memory. | < / \_
* | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -480,6 +480,7 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f, int *cwtv) {
sigdata->n_patterns = dumbfile_igetw(f);
if (dumbfile_error(f) || sigdata->n_orders <= 0 ||
sigdata->n_orders > 1024 || // Whoa, nelly.
sigdata->n_samples > 256 || sigdata->n_patterns > 256) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
@ -733,7 +734,10 @@ static DUMB_IT_SIGDATA *it_s3m_load_sigdata(DUMBFILE *f, int *cwtv) {
free(buffer);
free(component);
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;
}

View File

@ -11,7 +11,7 @@
* readstm.c - Code to read a ScreamTracker 2 / / \ \
* module from an open file. | < / \_
* | \/ /\ /
* By Chris Moeller. \_ / > /
* By Christopher Snowhill. \_ / > /
* | \ / /
* | ' /
* \__/
@ -355,7 +355,10 @@ static DUMB_IT_SIGDATA *it_stm_load_sigdata(DUMBFILE *f, int *version) {
}
}
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;
}

View File

@ -12,7 +12,7 @@
* module from an open file and do an | < / \_
* initial run-through. | \/ /\ /
* \_ / > /
* By Chris Moeller. | \ / /
* By Christopher Snowhill. | \ / /
* | ' /
* \__/
*/

View File

@ -1252,7 +1252,10 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f, int *version) {
memset(sigdata->channel_volume, 64, DUMB_IT_N_CHANNELS);
memset(sigdata->channel_pan, 32, DUMB_IT_N_CHANNELS);
_dumb_it_fix_invalid_orders(sigdata);
if (_dumb_it_fix_invalid_orders(sigdata) < 0) {
_dumb_it_unload_sigdata(sigdata);
return NULL;
}
return sigdata;
}