ft2-clone

Fasttracker 2 clone
Log | Files | Refs | README | LICENSE

commit b8597d3238c967105640024555278aec78a5eae1
parent 1e5706a2419f55dc66900ecf6783a9a17172ee50
Author: Olav Sørensen <olav.sorensen@live.no>
Date:   Mon, 15 Jun 2020 22:38:14 +0200

Arpeggio is now 100% correct for ticks 31..99

These speed settings are only obtainable by hex-editing XMs

Diffstat:
Msrc/ft2_replayer.c | 10+++++++++-
Msrc/ft2_tables.c | 17+++++++++++++----
Msrc/ft2_tables.h | 2+-
3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/ft2_replayer.c b/src/ft2_replayer.c @@ -1727,7 +1727,15 @@ static void doEffects(stmTyp *ch) // 0xy - Arpeggio if (ch->effTyp == 0) { - tick = arpTab[song.timer & 0x1F]; // 8bitbubsy: AND it for security + int16_t timer = song.timer; + + /* Non-FT2 protection for our extended 100-byte arp table. + ** (this shouldn't happen, but just in case) + */ + if (timer > 99) + timer = 99; + + tick = arpTab[timer]; if (tick == 0) { ch->outPeriod = ch->realPeriod; diff --git a/src/ft2_tables.c b/src/ft2_tables.c @@ -10,12 +10,21 @@ /* REPLAYER TABLES */ /* ----------------------------------------------------------------------- */ -const uint8_t arpTab[32] = +const uint8_t arpTab[100] = { 0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0, - // the following are overflown values from vibTab in the FT2 replayer code - 0,24,49,74,97,120,141,161,180, - 197,212,224,235,244,250,253 + + /* The following are overflown bytes from FT2's binary. + ** (confirmed to be the same on FT2.08 and FT2.09) + */ + 0x00, 0x18, 0x31, 0x4A, 0x61, 0x78, 0x8D, 0xA1, 0xB4, 0xC5, 0xD4, + 0xE0, 0xEB, 0xF4, 0xFA, 0xFD, 0xFF, 0xFD, 0xFA, 0xF4, 0xEB, 0xE0, + 0xD4, 0xC5, 0xB4, 0xA1, 0x8D, 0x78, 0x61, 0x4A, 0x31, 0x18, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x02, + 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x06, 0x00, 0x00, 0x07, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x03, 0x04, 0x05, 0x00, 0x00, 0x0B, 0x00, + 0x0A, 0x02, 0x01, 0x03, 0x04, 0x07, 0x00, 0x05, 0x06, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 }; const int8_t vibSineTab[256] = // for auto-vibrato diff --git a/src/ft2_tables.h b/src/ft2_tables.h @@ -10,7 +10,7 @@ #define KEY2EFX_ENTRIES (signed)(sizeof (key2EfxTab) / sizeof (SDL_Keycode)) #define KEY2HEX_ENTRIES (signed)(sizeof (key2HexTab) / sizeof (SDL_Keycode)) -extern const uint8_t arpTab[32]; +extern const uint8_t arpTab[100]; extern const int8_t vibSineTab[256]; // for auto-vibrato extern const uint8_t vibTab[32]; extern const uint16_t amigaPeriod[12 * 8];