shithub: ft²

Download patch

ref: b8597d3238c967105640024555278aec78a5eae1
parent: 1e5706a2419f55dc66900ecf6783a9a17172ee50
author: Olav Sørensen <[email protected]>
date: Mon Jun 15 18:38:41 EDT 2020

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

These speed settings are only obtainable by hex-editing XMs

--- a/src/ft2_replayer.c
+++ b/src/ft2_replayer.c
@@ -1727,7 +1727,15 @@
 	// 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;
--- 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
--- 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];