From 741271e1536261039f66683c6bd296b1a955df86 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Thu, 20 Mar 2014 22:37:11 -0700 Subject: [PATCH] Worked around two issues in DUMB's XM reader; Fixes dark lighthouse.xm --- Frameworks/Dumb/dumb/src/it/readxm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Frameworks/Dumb/dumb/src/it/readxm.c b/Frameworks/Dumb/dumb/src/it/readxm.c index 03a73e6b0..44fc9bdb5 100644 --- a/Frameworks/Dumb/dumb/src/it/readxm.c +++ b/Frameworks/Dumb/dumb/src/it/readxm.c @@ -897,6 +897,16 @@ static DUMB_IT_SIGDATA *it_xm_load_sigdata(DUMBFILE *f, int * version) 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 */