diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-08-08 21:56:15 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-08-11 03:29:12 +0000 |
commit | b4e70422a3455e327433a7471c929ef100ef3b10 (patch) | |
tree | e96c5431a1b22af1fcbc628322b79fb8c3162427 /apps/plugins/mikmod/load_mod.c | |
parent | 8c7780bafc9eabac6b92cfe5a5a00831c3d5fd9d (diff) | |
download | rockbox-b4e70422a3455e327433a7471c929ef100ef3b10.tar.gz rockbox-b4e70422a3455e327433a7471c929ef100ef3b10.zip |
mikmod: Upgrade mikmod core from v3.2.0 to v3.3.11
* Get rid of the non-functional GT2 loader
* Add the UMX loader
* Add HQ mixer routines (and make it configurable)
* Allow samplerate to be configured at run/playtime
* Support >64KHz mixing/playback
* Correctly restore non-boost status
(The diff to upstream is much smaller now too!)
Change-Id: Iaa4ac901ba9cd4123bb225656976e78271353a72
Diffstat (limited to 'apps/plugins/mikmod/load_mod.c')
-rw-r--r-- | apps/plugins/mikmod/load_mod.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/apps/plugins/mikmod/load_mod.c b/apps/plugins/mikmod/load_mod.c index 6075e9c7e1..0fe0dcd595 100644 --- a/apps/plugins/mikmod/load_mod.c +++ b/apps/plugins/mikmod/load_mod.c | |||
@@ -6,12 +6,12 @@ | |||
6 | it under the terms of the GNU Library General Public License as | 6 | it under the terms of the GNU Library General Public License as |
7 | published by the Free Software Foundation; either version 2 of | 7 | published by the Free Software Foundation; either version 2 of |
8 | the License, or (at your option) any later version. | 8 | the License, or (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU Library General Public License for more details. | 13 | GNU Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public | 15 | You should have received a copy of the GNU Library General Public |
16 | License along with this library; if not, write to the Free Software | 16 | License along with this library; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | /*============================================================================== | 21 | /*============================================================================== |
22 | 22 | ||
23 | $Id: load_mod.c,v 1.3 2005/04/07 19:57:38 realtech Exp $ | 23 | $Id$ |
24 | 24 | ||
25 | Generic MOD loader (Protracker, StarTracker, FastTracker, etc) | 25 | Generic MOD loader (Protracker, StarTracker, FastTracker, etc) |
26 | 26 | ||
@@ -108,7 +108,7 @@ static int MOD_CheckType(UBYTE *id, UBYTE *numchn, CHAR **descr) | |||
108 | *numchn = 4; | 108 | *numchn = 4; |
109 | return 1; | 109 | return 1; |
110 | } | 110 | } |
111 | 111 | ||
112 | /* Star Tracker */ | 112 | /* Star Tracker */ |
113 | if (((!memcmp(id, "FLT", 3)) || (!memcmp(id, "EXO", 3))) && | 113 | if (((!memcmp(id, "FLT", 3)) || (!memcmp(id, "EXO", 3))) && |
114 | (isdigit(id[3]))) { | 114 | (isdigit(id[3]))) { |
@@ -190,6 +190,8 @@ static void MOD_Cleanup(void) | |||
190 | { | 190 | { |
191 | MikMod_free(mh); | 191 | MikMod_free(mh); |
192 | MikMod_free(patbuf); | 192 | MikMod_free(patbuf); |
193 | mh=NULL; | ||
194 | patbuf=NULL; | ||
193 | } | 195 | } |
194 | 196 | ||
195 | /* | 197 | /* |
@@ -277,7 +279,7 @@ static UBYTE ConvertNote(MODNOTE *n, UBYTE lasteffect) | |||
277 | /* Handle ``heavy'' volumes correctly */ | 279 | /* Handle ``heavy'' volumes correctly */ |
278 | if ((effect == 0xc) && (effdat > 0x40)) | 280 | if ((effect == 0xc) && (effdat > 0x40)) |
279 | effdat = 0x40; | 281 | effdat = 0x40; |
280 | 282 | ||
281 | /* An isolated 100, 200 or 300 effect should be ignored (no | 283 | /* An isolated 100, 200 or 300 effect should be ignored (no |
282 | "standalone" porta memory in mod files). However, a sequence such | 284 | "standalone" porta memory in mod files). However, a sequence such |
283 | as 1XX, 100, 100, 100 is fine. */ | 285 | as 1XX, 100, 100, 100 is fine. */ |
@@ -288,7 +290,7 @@ static UBYTE ConvertNote(MODNOTE *n, UBYTE lasteffect) | |||
288 | UniPTEffect(effect, effdat); | 290 | UniPTEffect(effect, effdat); |
289 | if (effect == 8) | 291 | if (effect == 8) |
290 | of.flags |= UF_PANNING; | 292 | of.flags |= UF_PANNING; |
291 | 293 | ||
292 | return effect; | 294 | return effect; |
293 | } | 295 | } |
294 | 296 | ||
@@ -309,14 +311,13 @@ static UBYTE *ConvertTrack(MODNOTE *n, int numchn) | |||
309 | /* Loads all patterns of a modfile and converts them into the 3 byte format. */ | 311 | /* Loads all patterns of a modfile and converts them into the 3 byte format. */ |
310 | static int ML_LoadPatterns(void) | 312 | static int ML_LoadPatterns(void) |
311 | { | 313 | { |
312 | int t, tracks = 0; | 314 | unsigned int t, s, tracks = 0; |
313 | unsigned int s; | ||
314 | 315 | ||
315 | if (!AllocPatterns()) | 316 | if (!AllocPatterns()) |
316 | return 0; | 317 | return 0; |
317 | if (!AllocTracks()) | 318 | if (!AllocTracks()) |
318 | return 0; | 319 | return 0; |
319 | 320 | ||
320 | /* Allocate temporary buffer for loading and converting the patterns */ | 321 | /* Allocate temporary buffer for loading and converting the patterns */ |
321 | if (!(patbuf = (MODNOTE *)MikMod_calloc(64U * of.numchn, sizeof(MODNOTE)))) | 322 | if (!(patbuf = (MODNOTE *)MikMod_calloc(64U * of.numchn, sizeof(MODNOTE)))) |
322 | return 0; | 323 | return 0; |
@@ -385,10 +386,10 @@ static int MOD_Load(int curious) | |||
385 | 386 | ||
386 | mh->songlength = _mm_read_UBYTE(modreader); | 387 | mh->songlength = _mm_read_UBYTE(modreader); |
387 | 388 | ||
388 | /* this fixes mods which declare more than 128 positions. | 389 | /* this fixes mods which declare more than 128 positions. |
389 | * eg: beatwave.mod */ | 390 | * eg: beatwave.mod */ |
390 | if (mh->songlength > 128) { mh->songlength = 128; } | 391 | if (mh->songlength > 128) { mh->songlength = 128; } |
391 | 392 | ||
392 | mh->magic1 = _mm_read_UBYTE(modreader); | 393 | mh->magic1 = _mm_read_UBYTE(modreader); |
393 | _mm_read_UBYTES(mh->positions, 128, modreader); | 394 | _mm_read_UBYTES(mh->positions, 128, modreader); |
394 | _mm_read_UBYTES(mh->magic2, 4, modreader); | 395 | _mm_read_UBYTES(mh->magic2, 4, modreader); |
@@ -477,11 +478,11 @@ static int MOD_Load(int curious) | |||
477 | q++; | 478 | q++; |
478 | } | 479 | } |
479 | 480 | ||
480 | of.modtype = StrDup(descr); | 481 | of.modtype = MikMod_strdup(descr); |
481 | 482 | ||
482 | if (!ML_LoadPatterns()) | 483 | if (!ML_LoadPatterns()) |
483 | return 0; | 484 | return 0; |
484 | 485 | ||
485 | return 1; | 486 | return 1; |
486 | } | 487 | } |
487 | 488 | ||