| @@ -49,7 +49,7 @@ module_t *loadMod15(uint8_t *buffer, uint32_t filesize) · 48 unmodified lines |
| 49 | if (s->length > 9999) | 49 | if (s->length > 9999) |
| 50 | lateSTKVerFlag = true; | 50 | lateSTKVerFlag = true; |
| 51 | | 51 | |
| 52 | p++; // Hi-byte of volume, no finetune in STK/UST modules. Skip it. | 52 | p++; // hi-byte of volume, no finetune in STK/UST modules. Skip it. |
| 53 | s->volume = *p++; | 53 | s->volume = *p++; |
| 54 | | 54 | |
| 55 | // in The Ultimate SoundTracker, sample loop start is in bytes, not words | 55 | // in The Ultimate SoundTracker, sample loop start is in bytes, not words |
| @@ -89,10 +89,9 @@ module_t *loadMod15(uint8_t *buffer, uint32_t filesize) · 33 unmodified lines |
| 89 | // convert UST tempo to BPM | 89 | // convert UST tempo to BPM |
| 90 | uint16_t ciaPeriod = (240 - initTempo) * 122; | 90 | uint16_t ciaPeriod = (240 - initTempo) * 122; |
| 91 | | 91 | |
| 92 | double dHz = (double)CIA_PAL_CLK / (ciaPeriod+1); // +1, CIA triggers on underflow | 92 | const double dHz = (double)CIA_PAL_CLK / (ciaPeriod+1); // +1, CIA triggers on underflow |
| 93 | int32_t BPM = (int32_t)((dHz * (125.0 / 50.0)) + 0.5); | | |
| 94 | | 93 | |
| 95 | m->header.initialTempo = (uint16_t)BPM; | 94 | m->header.initialTempo = (uint16_t)((dHz * (125.0 / 50.0)) + 0.5); |
| 96 | } | 95 | } |
| 97 | | 96 | |
| 98 | // read orders and count number of patterns | 97 | // read orders and count number of patterns |
| @@ -221,7 +220,7 @@ module_t *loadMod15(uint8_t *buffer, uint32_t filesize) · 122 unmodified lines |
| 221 | s = m->samples; | 220 | s = m->samples; |
| 222 | for (int32_t i = 0; i < 15; i++, s++) | 221 | for (int32_t i = 0; i < 15; i++, s++) |
| 223 | { | 222 | { |
| 224 | // For Ultimate SoundTracker modules, only the loop area of a looped sample is played. | 223 | // for Ultimate SoundTracker modules, only the loop area of a looped sample is played. |
| 225 | if (s->loopStart > 0 && s->loopLength < s->length) | 224 | if (s->loopStart > 0 && s->loopLength < s->length) |
| 226 | { | 225 | { |
| 227 | s->length -= s->loopStart; | 226 | s->length -= s->loopStart; |
| @@ -229,14 +228,11 @@ module_t *loadMod15(uint8_t *buffer, uint32_t filesize) · 1 unmodified line |
| 229 | s->loopStart = 0; | 228 | s->loopStart = 0; |
| 230 | } | 229 | } |
| 231 | | 230 | |
| 232 | /* We don't support loading samples bigger than 65534 bytes in our PT2 clone, | | |
| 233 | ** so skip overflown data in .MOD file if present. | | |
| 234 | */ | | |
| 235 | int32_t bytesToSkip = 0; | 231 | int32_t bytesToSkip = 0; |
| 236 | if (realSampleLengths[i] > config.maxSampleLength) | 232 | if (realSampleLengths[i] > config.maxSampleLength) |
| 237 | bytesToSkip = realSampleLengths[i] - config.maxSampleLength; | 233 | bytesToSkip = realSampleLengths[i] - config.maxSampleLength; |
| 238 | | 234 | |
| 239 | // For Ultimate SoundTracker modules, don't load sample data after loop end | 235 | // for Ultimate SoundTracker modules, don't load sample data after loop end |
| 240 | int32_t loopEnd = s->loopStart + s->loopLength; | 236 | int32_t loopEnd = s->loopStart + s->loopLength; |
| 241 | if (loopEnd > 2 && s->length > loopEnd) | 237 | if (loopEnd > 2 && s->length > loopEnd) |
| 242 | { | 238 | { |