Update DUMB to revision 5b53815e1f271746627bde0bfce7140109b88f14

- Made the new MOD pattern counting system optional



SVN r4106 (trunk)
This commit is contained in:
Randy Heit 2013-02-08 01:04:38 +00:00
parent a0bc90bbc8
commit b95e4b971e
2 changed files with 20 additions and 7 deletions

View file

@ -395,6 +395,8 @@ void DUMBEXPORT dumb_it_set_global_volume_zero_callback(DUMB_IT_SIGRENDERER *sig
int DUMBCALLBACK dumb_it_callback_terminate(void *data); int DUMBCALLBACK dumb_it_callback_terminate(void *data);
int DUMBCALLBACK dumb_it_callback_midi_block(void *data, int channel, unsigned char midi_byte); int DUMBCALLBACK dumb_it_callback_midi_block(void *data, int channel, unsigned char midi_byte);
/* dumb_*_mod*: restrict |= 1-Don't read 15 sample files / 2-Use old pattern counting method */
DUH *DUMBEXPORT dumb_load_it(const char *filename); DUH *DUMBEXPORT dumb_load_it(const char *filename);
DUH *DUMBEXPORT dumb_load_xm(const char *filename); DUH *DUMBEXPORT dumb_load_xm(const char *filename);
DUH *DUMBEXPORT dumb_load_s3m(const char *filename); DUH *DUMBEXPORT dumb_load_s3m(const char *filename);

View file

@ -567,7 +567,7 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int rstrict)
} }
// moo // moo
if ( rstrict && sigdata->n_samples == 15 ) if ( ( rstrict & 1 ) && sigdata->n_samples == 15 )
{ {
free(sigdata); free(sigdata);
dumbfile_close(f); dumbfile_close(f);
@ -648,6 +648,7 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int rstrict)
sigdata->n_patterns = -1; sigdata->n_patterns = -1;
if ( !( rstrict & 2 ) )
{ {
long total_sample_size; long total_sample_size;
long remain; long remain;
@ -671,11 +672,21 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int rstrict)
} }
} }
} }
else
{
sigdata->n_patterns = 0;
for (i = 0; i < sigdata->n_orders; i++)
{
if (sigdata->order[i] > sigdata->n_patterns)
sigdata->n_patterns = sigdata->order[i];
}
sigdata->n_patterns++;
}
if ( sigdata->n_patterns <= 0 ) { if ( sigdata->n_patterns <= 0 ) {
_dumb_it_unload_sigdata(sigdata); _dumb_it_unload_sigdata(sigdata);
dumbfile_close(f); dumbfile_close(f);
dumbfile_close(rem); if (rem) dumbfile_close(rem);
return NULL; return NULL;
} }
@ -689,7 +700,7 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int rstrict)
if (!sigdata->pattern) { if (!sigdata->pattern) {
_dumb_it_unload_sigdata(sigdata); _dumb_it_unload_sigdata(sigdata);
dumbfile_close(f); dumbfile_close(f);
dumbfile_close(rem); if (rem) dumbfile_close(rem);
return NULL; return NULL;
} }
for (i = 0; i < sigdata->n_patterns; i++) for (i = 0; i < sigdata->n_patterns; i++)
@ -701,7 +712,7 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int rstrict)
if (!buffer) { if (!buffer) {
_dumb_it_unload_sigdata(sigdata); _dumb_it_unload_sigdata(sigdata);
dumbfile_close(f); dumbfile_close(f);
dumbfile_close(rem); if (rem) dumbfile_close(rem);
return NULL; return NULL;
} }
for (i = 0; i < sigdata->n_patterns; i++) { for (i = 0; i < sigdata->n_patterns; i++) {
@ -709,7 +720,7 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int rstrict)
free(buffer); free(buffer);
_dumb_it_unload_sigdata(sigdata); _dumb_it_unload_sigdata(sigdata);
dumbfile_close(f); dumbfile_close(f);
dumbfile_close(rem); if (rem) dumbfile_close(rem);
return NULL; return NULL;
} }
} }
@ -721,7 +732,7 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int rstrict)
if (it_mod_read_sample_data(&sigdata->sample[i], f, fft)) { if (it_mod_read_sample_data(&sigdata->sample[i], f, fft)) {
_dumb_it_unload_sigdata(sigdata); _dumb_it_unload_sigdata(sigdata);
dumbfile_close(f); dumbfile_close(f);
dumbfile_close(rem); if (rem) dumbfile_close(rem);
return NULL; return NULL;
} }
} }
@ -745,7 +756,7 @@ static DUMB_IT_SIGDATA *it_mod_load_sigdata(DUMBFILE *f, int rstrict)
}*/ }*/
dumbfile_close(f); /* Destroy the BUFFERED_MOD DUMBFILE we were using. */ dumbfile_close(f); /* Destroy the BUFFERED_MOD DUMBFILE we were using. */
dumbfile_close(rem); /* And the BUFFERED_MOD DUMBFILE used to pre-read the signature. */ if (rem) dumbfile_close(rem); /* And the BUFFERED_MOD DUMBFILE used to pre-read the signature. */
/* The DUMBFILE originally passed to our function is intact. */ /* The DUMBFILE originally passed to our function is intact. */
/* Now let's initialise the remaining variables, and we're done! */ /* Now let's initialise the remaining variables, and we're done! */