From 7edd64243b1a9e092b04b001d55b9f4c44b558e7 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 8 Feb 2013 01:25:00 +0000 Subject: [PATCH] Update DUMB to revision ac46a8b6056cf12bff464407bc1582301051c1f1 - Fixed STM speed handling SVN r4112 (trunk) --- dumb/include/internal/it.h | 2 ++ dumb/src/it/itrender.c | 29 ++++++++++++++++++++++++----- dumb/src/it/readstm.c | 19 ++++++++++--------- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/dumb/include/internal/it.h b/dumb/include/internal/it.h index 74a08d5671..1ab5d3b272 100644 --- a/dumb/include/internal/it.h +++ b/dumb/include/internal/it.h @@ -412,6 +412,8 @@ struct IT_PATTERN #define IT_WAS_AN_OKT 2048 +#define IT_WAS_AN_STM 4096 + #define IT_ORDER_END 255 #define IT_ORDER_SKIP 254 diff --git a/dumb/src/it/itrender.c b/dumb/src/it/itrender.c index e93ea9df6a..ecdf9e78c0 100644 --- a/dumb/src/it/itrender.c +++ b/dumb/src/it/itrender.c @@ -2075,7 +2075,18 @@ Yxy This uses a table 4 times larger (hence 4 times slower) than /*if (entry->effectvalue == 255) if (sigrenderer->callbacks->xm_speed_zero && (*sigrenderer->callbacks->xm_speed_zero)(sigrenderer->callbacks->xm_speed_zero_data)) return 1;*/ - sigrenderer->tick = sigrenderer->speed = entry->effectvalue; + if (sigdata->flags & IT_WAS_AN_STM) + { + int n = entry->effectvalue; + if (n >= 32) + { + sigrenderer->tick = sigrenderer->speed = n; + } + } + else + { + sigrenderer->tick = sigrenderer->speed = entry->effectvalue; + } } else if ((sigdata->flags & (IT_WAS_AN_XM|IT_WAS_A_MOD)) == IT_WAS_AN_XM) { #ifdef BIT_ARRAY_BULLSHIT @@ -4323,9 +4334,12 @@ static int process_tick(DUMB_IT_SIGRENDERER *sigrenderer) update_effects(sigrenderer); } } else { - speed0: - update_effects(sigrenderer); - update_tick_counts(sigrenderer); + if ( !(sigdata->flags & IT_WAS_AN_STM) || !(sigrenderer->tick & 15)) + { + speed0: + update_effects(sigrenderer); + update_tick_counts(sigrenderer); + } } if (sigrenderer->globalvolume == 0) { @@ -4348,7 +4362,12 @@ static int process_tick(DUMB_IT_SIGRENDERER *sigrenderer) process_all_playing(sigrenderer); { - LONG_LONG t = sigrenderer->sub_time_left + ((LONG_LONG)TICK_TIME_DIVIDEND << 16) / sigrenderer->tempo; + LONG_LONG t = ((LONG_LONG)TICK_TIME_DIVIDEND << 16) / sigrenderer->tempo; + if ( sigrenderer->sigdata->flags & IT_WAS_AN_STM ) + { + t /= 16; + } + t += sigrenderer->sub_time_left; sigrenderer->time_left += (int)(t >> 16); sigrenderer->sub_time_left = (int)t & 65535; } diff --git a/dumb/src/it/readstm.c b/dumb/src/it/readstm.c index a4b00f79b2..89237d6e74 100644 --- a/dumb/src/it/readstm.c +++ b/dumb/src/it/readstm.c @@ -142,9 +142,9 @@ static int it_stm_read_pattern( IT_PATTERN *pattern, DUMBFILE *f, unsigned char entry->mask |= IT_ENTRY_VOLPAN; entry->mask |= IT_ENTRY_EFFECT; switch ( entry->effect ) { - case IT_SET_SPEED: - entry->effectvalue >>= 4; - break; + case IT_SET_SPEED: + /* taken care of in the renderer */ + break; case IT_BREAK_TO_ROW: entry->effectvalue -= (entry->effectvalue >> 4) * 6; @@ -236,16 +236,17 @@ static DUMB_IT_SIGDATA *it_stm_load_sigdata(DUMBFILE *f, int * version) sigdata->n_samples = 31; sigdata->n_pchannels = 4; - sigdata->tempo = 125; - sigdata->mixing_volume = 48; + sigdata->tempo = 125; + sigdata->mixing_volume = 48; sigdata->pan_separation = 128; /** WARNING: which ones? */ - sigdata->flags = IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_WAS_AN_S3M | IT_STEREO; + sigdata->flags = IT_OLD_EFFECTS | IT_COMPATIBLE_GXX | IT_WAS_AN_S3M | IT_WAS_AN_STM | IT_STEREO; - sigdata->speed = dumbfile_getc(f) >> 4; - if ( sigdata->speed < 1 ) sigdata->speed = 1; - sigdata->n_patterns = dumbfile_getc(f); + n = dumbfile_getc(f); + if ( n < 32 ) n = 32; + sigdata->speed = n; + sigdata->n_patterns = dumbfile_getc(f); sigdata->global_volume = dumbfile_getc(f) << 1; if ( sigdata->global_volume > 128 ) sigdata->global_volume = 128;