ref: 5b53815e1f271746627bde0bfce7140109b88f14
parent: 30b178af5674b8604306885a693c2a8aa422472f
author: Chris Moeller <kode54@gmail.com>
date: Sat Dec 15 17:47:19 EST 2012
Made the new MOD pattern counting system optional
--- a/dumb/include/dumb.h
+++ b/dumb/include/dumb.h
@@ -379,6 +379,8 @@
int dumb_it_callback_terminate(void *data);
int 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 *dumb_load_it(const char *filename);
DUH *dumb_load_xm(const char *filename);
DUH *dumb_load_s3m(const char *filename);
--- a/dumb/src/it/readmod.c
+++ b/dumb/src/it/readmod.c
@@ -567,7 +567,7 @@
}
// moo
- if ( restrict && sigdata->n_samples == 15 )
+ if ( ( restrict & 1 ) && sigdata->n_samples == 15 )
{
free(sigdata);
dumbfile_close(f);
@@ -648,6 +648,7 @@
sigdata->n_patterns = -1;
+ if ( !( restrict & 2 ) )
{
long total_sample_size;
long remain;
@@ -671,11 +672,21 @@
}
}
}
+ 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 ) {
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
- dumbfile_close(rem);
+ if (rem) dumbfile_close(rem);
return NULL;
}
@@ -689,7 +700,7 @@
if (!sigdata->pattern) {
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
- dumbfile_close(rem);
+ if (rem) dumbfile_close(rem);
return NULL;
}
for (i = 0; i < sigdata->n_patterns; i++)
@@ -701,7 +712,7 @@
if (!buffer) {
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
- dumbfile_close(rem);
+ if (rem) dumbfile_close(rem);
return NULL;
}
for (i = 0; i < sigdata->n_patterns; i++) {
@@ -709,7 +720,7 @@
free(buffer);
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
- dumbfile_close(rem);
+ if (rem) dumbfile_close(rem);
return NULL;
}
}
@@ -721,7 +732,7 @@
if (it_mod_read_sample_data(&sigdata->sample[i], f, fft)) {
_dumb_it_unload_sigdata(sigdata);
dumbfile_close(f);
- dumbfile_close(rem);
+ if (rem) dumbfile_close(rem);
return NULL;
}
}
@@ -745,7 +756,7 @@
}*/
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. */
/* Now let's initialise the remaining variables, and we're done! */