Browse code

Update from FSS commits 39e6fa8 and 5204c55, guards ADSR against invalid values, these may not be 100% correct but they currently work as is.

Naram Qashat authored on 2013/05/01 23:08:02
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * SSEQ Player - Common functions
3 3
  * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
- * Last modification on 2013-04-23
4
+ * Last modification on 2013-05-01
5 5
  *
6 6
  * Some code from FeOS Sound System
7 7
  * By fincs
... ...
@@ -143,11 +143,15 @@ inline int Cnv_Attack(int attk)
143 143
 		0x5C, 0x64, 0x6D, 0x74, 0x7B, 0x7F, 0x84, 0x89, 0x8F
144 144
 	};
145 145
 
146
+	if (attk & 0x80) // Supposedly invalid value...
147
+		attk = 0; // Use apparently correct default
146 148
 	return attk >= 0x6D ? lut[0x7F - attk] : 0xFF - attk;
147 149
 }
148 150
 
149 151
 inline int Cnv_Fall(int fall)
150 152
 {
153
+	if (fall & 0x80) // Supposedly invalid value...
154
+		fall = 0; // Use apparently correct default
151 155
 	if (fall == 0x7F)
152 156
 		return 0xFFFF;
153 157
 	else if (fall == 0x7E)
... ...
@@ -180,6 +184,8 @@ inline int Cnv_Sust(int sust)
180 184
 		-10, -8, -7, -6, -4, -3, -1, 0
181 185
 	};
182 186
 
187
+	if (sust & 0x80) // Supposedly invalid value...
188
+		sust = 0; // Use apparently correct default
183 189
 	return lut[sust];
184 190
 }
185 191