History

Tiny cleanup

Olav Sørensen committed 3 years ago

Commit 4f81f151 parent 17448352 files · +5 −12Browse files

Unified · Split

2 files
  1. src/modloaders/pt2_load_mod15.c +5 −9
  2. src/modloaders/pt2_load_mod31.c +0 −3
src/modloaders/pt2_load_mod15.c+5−9
@@ -49,7 +49,7 @@ module_t *loadMod15(uint8_t *buffer, uint32_t filesize) · 48 unmodified lines
4949 if (s->length > 9999)
5050 lateSTKVerFlag = true;
5151
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.
5353 s->volume = *p++;
5454
5555 // 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
8989 // convert UST tempo to BPM
9090 uint16_t ciaPeriod = (240 - initTempo) * 122;
9191
92− 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);
92+ const double dHz = (double)CIA_PAL_CLK / (ciaPeriod+1); // +1, CIA triggers on underflow
9493
95− m->header.initialTempo = (uint16_t)BPM;
94+ m->header.initialTempo = (uint16_t)((dHz * (125.0 / 50.0)) + 0.5);
9695 }
9796
9897 // read orders and count number of patterns
@@ -221,7 +220,7 @@ module_t *loadMod15(uint8_t *buffer, uint32_t filesize) · 122 unmodified lines
221220 s = m->samples;
222221 for (int32_t i = 0; i < 15; i++, s++)
223222 {
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.
225224 if (s->loopStart > 0 && s->loopLength < s->length)
226225 {
227226 s->length -= s->loopStart;
@@ -229,14 +228,11 @@ module_t *loadMod15(uint8_t *buffer, uint32_t filesize) · 1 unmodified line
229228 s->loopStart = 0;
230229 }
231230
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− */
235231 int32_t bytesToSkip = 0;
236232 if (realSampleLengths[i] > config.maxSampleLength)
237233 bytesToSkip = realSampleLengths[i] - config.maxSampleLength;
238234
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
240236 int32_t loopEnd = s->loopStart + s->loopLength;
241237 if (loopEnd > 2 && s->length > loopEnd)
242238 {
src/modloaders/pt2_load_mod31.c+0−3
@@ -178,9 +178,6 @@ module_t *loadMod31(uint8_t *buffer, uint32_t filesize) · 177 unmodified lines
178178 s = m->samples;
179179 for (int32_t i = 0; i < MOD_SAMPLES; i++, s++)
180180 {
181− /* We don't support loading samples bigger than 65534 bytes in our PT2 clone,
182− ** so skip overflown data in .MOD file if present.
183− */
184181 int32_t bytesToSkip = 0;
185182 if (realSampleLengths[i] > config.maxSampleLength)
186183 bytesToSkip = realSampleLengths[i] - config.maxSampleLength;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t