ref: 02b855c989a02ddf757cf87110857cf376b879e4
parent: b661a11b09185a8e8b8a2c4a5c64021cc928ef12
author: Chris Moeller <kode54@gmail.com>
date: Thu Mar 20 18:26:06 EDT 2014
Work around two possible issues in XM reader; Fixes dark_lighthouse.xm.
--- a/dumb/src/it/readxm.c
+++ b/dumb/src/it/readxm.c
@@ -897,6 +897,16 @@
if (sigdata->speed == 0) sigdata->speed = 6; // Should we? What about tempo?
sigdata->tempo = dumbfile_igetw(f);
+ // FT2 always clips restart position against the song length
+ if (sigdata->restart_position > sigdata->n_orders)
+ sigdata->restart_position = sigdata->n_orders;
+ // And FT2 starts playback on order 0, regardless of length,
+ // and only checks if the next order is greater than or equal
+ // to this, not the current pattern. Work around this with
+ // DUMB's playback core by overriding a zero length with one.
+ if (sigdata->n_orders == 0)
+ sigdata->n_orders = 1;
+
/* sanity checks */
// XXX
i = header_size - 4 - 2 * 8; /* Maximum number of orders expected */