gosu 1.4.5.pre1 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/dependencies/SDL/include/SDL.h +1 -0
  3. data/dependencies/SDL/include/SDL_assert.h +4 -2
  4. data/dependencies/SDL/include/SDL_atomic.h +20 -0
  5. data/dependencies/SDL/include/SDL_audio.h +40 -4
  6. data/dependencies/SDL/include/SDL_blendmode.h +4 -6
  7. data/dependencies/SDL/include/SDL_clipboard.h +47 -0
  8. data/dependencies/SDL/include/SDL_config.h +71 -45
  9. data/dependencies/SDL/include/SDL_cpuinfo.h +39 -4
  10. data/dependencies/SDL/include/SDL_egl.h +59 -9
  11. data/dependencies/SDL/include/SDL_endian.h +34 -3
  12. data/dependencies/SDL/include/SDL_events.h +32 -1
  13. data/dependencies/SDL/include/SDL_filesystem.h +5 -1
  14. data/dependencies/SDL/include/SDL_gamecontroller.h +78 -5
  15. data/dependencies/SDL/include/SDL_guid.h +100 -0
  16. data/dependencies/SDL/include/SDL_hints.h +645 -43
  17. data/dependencies/SDL/include/SDL_joystick.h +127 -7
  18. data/dependencies/SDL/include/SDL_keyboard.h +38 -1
  19. data/dependencies/SDL/include/SDL_keycode.h +6 -1
  20. data/dependencies/SDL/include/SDL_log.h +2 -2
  21. data/dependencies/SDL/include/SDL_main.h +42 -2
  22. data/dependencies/SDL/include/SDL_metal.h +2 -1
  23. data/dependencies/SDL/include/SDL_mouse.h +12 -1
  24. data/dependencies/SDL/include/SDL_opengl.h +0 -51
  25. data/dependencies/SDL/include/SDL_opengl_glext.h +2260 -231
  26. data/dependencies/SDL/include/SDL_opengles2_gl2.h +374 -339
  27. data/dependencies/SDL/include/SDL_opengles2_gl2ext.h +3479 -1496
  28. data/dependencies/SDL/include/SDL_opengles2_gl2platform.h +6 -9
  29. data/dependencies/SDL/include/SDL_opengles2_khrplatform.h +43 -14
  30. data/dependencies/SDL/include/SDL_platform.h +32 -6
  31. data/dependencies/SDL/include/SDL_rect.h +154 -2
  32. data/dependencies/SDL/include/SDL_render.h +46 -17
  33. data/dependencies/SDL/include/SDL_revision.h +6 -1
  34. data/dependencies/SDL/include/SDL_rwops.h +1 -15
  35. data/dependencies/SDL/include/SDL_scancode.h +46 -21
  36. data/dependencies/SDL/include/SDL_sensor.h +24 -3
  37. data/dependencies/SDL/include/SDL_stdinc.h +119 -8
  38. data/dependencies/SDL/include/SDL_surface.h +3 -1
  39. data/dependencies/SDL/include/SDL_system.h +66 -6
  40. data/dependencies/SDL/include/SDL_syswm.h +2 -0
  41. data/dependencies/SDL/include/SDL_test_common.h +1 -0
  42. data/dependencies/SDL/include/SDL_test_font.h +90 -3
  43. data/dependencies/SDL/include/SDL_thread.h +3 -3
  44. data/dependencies/SDL/include/SDL_touch.h +8 -0
  45. data/dependencies/SDL/include/SDL_version.h +19 -3
  46. data/dependencies/SDL/include/SDL_video.h +71 -9
  47. data/dependencies/SDL/include/begin_code.h +4 -4
  48. data/dependencies/SDL/lib/x64/libSDL2.dll.a +0 -0
  49. data/dependencies/SDL/lib/x86/libSDL2.dll.a +0 -0
  50. data/dependencies/SDL_sound/SDL_sound.c +210 -71
  51. data/dependencies/SDL_sound/SDL_sound.h +1 -1
  52. data/dependencies/SDL_sound/SDL_sound_coreaudio.c +111 -168
  53. data/dependencies/SDL_sound/SDL_sound_flac.c +0 -6
  54. data/dependencies/SDL_sound/SDL_sound_internal.h +27 -5
  55. data/dependencies/SDL_sound/SDL_sound_modplug.c +20 -8
  56. data/dependencies/SDL_sound/SDL_sound_mp3.c +11 -7
  57. data/dependencies/SDL_sound/SDL_sound_raw.c +1 -1
  58. data/dependencies/SDL_sound/SDL_sound_shn.c +1 -5
  59. data/dependencies/SDL_sound/SDL_sound_voc.c +1 -1
  60. data/dependencies/SDL_sound/SDL_sound_vorbis.c +2 -4
  61. data/dependencies/SDL_sound/SDL_sound_wav.c +44 -20
  62. data/dependencies/SDL_sound/dr_flac.h +237 -95
  63. data/dependencies/SDL_sound/dr_mp3.h +46 -33
  64. data/dependencies/SDL_sound/libmodplug/fastmix.c +53 -39
  65. data/dependencies/SDL_sound/libmodplug/libmodplug.h +0 -12
  66. data/dependencies/SDL_sound/libmodplug/load_669.c +37 -32
  67. data/dependencies/SDL_sound/libmodplug/load_amf.c +57 -44
  68. data/dependencies/SDL_sound/libmodplug/load_ams.c +127 -100
  69. data/dependencies/SDL_sound/libmodplug/load_dbm.c +40 -37
  70. data/dependencies/SDL_sound/libmodplug/load_dmf.c +61 -49
  71. data/dependencies/SDL_sound/libmodplug/load_dsm.c +18 -13
  72. data/dependencies/SDL_sound/libmodplug/load_far.c +31 -24
  73. data/dependencies/SDL_sound/libmodplug/load_gdm.c +27 -21
  74. data/dependencies/SDL_sound/libmodplug/load_it.c +106 -91
  75. data/dependencies/SDL_sound/libmodplug/load_mdl.c +43 -35
  76. data/dependencies/SDL_sound/libmodplug/load_med.c +66 -52
  77. data/dependencies/SDL_sound/libmodplug/load_mod.c +30 -26
  78. data/dependencies/SDL_sound/libmodplug/load_mt2.c +61 -50
  79. data/dependencies/SDL_sound/libmodplug/load_mtm.c +23 -17
  80. data/dependencies/SDL_sound/libmodplug/load_okt.c +18 -16
  81. data/dependencies/SDL_sound/libmodplug/load_psm.c +44 -32
  82. data/dependencies/SDL_sound/libmodplug/load_ptm.c +18 -14
  83. data/dependencies/SDL_sound/libmodplug/load_s3m.c +59 -53
  84. data/dependencies/SDL_sound/libmodplug/load_stm.c +23 -18
  85. data/dependencies/SDL_sound/libmodplug/load_ult.c +33 -29
  86. data/dependencies/SDL_sound/libmodplug/load_xm.c +64 -57
  87. data/dependencies/SDL_sound/libmodplug/mmcmp.c +2 -1
  88. data/dependencies/SDL_sound/libmodplug/snd_dsp.c +30 -20
  89. data/dependencies/SDL_sound/libmodplug/snd_flt.c +6 -4
  90. data/dependencies/SDL_sound/libmodplug/snd_fx.c +91 -65
  91. data/dependencies/SDL_sound/libmodplug/sndfile.c +91 -66
  92. data/dependencies/SDL_sound/libmodplug/sndmix.c +58 -35
  93. data/dependencies/SDL_sound/stb_vorbis.h +14 -9
  94. data/dependencies/mojoAL/mojoal.c +41 -24
  95. data/dependencies/utf8proc/utf8proc.c +1 -1
  96. data/dependencies/utf8proc/utf8proc.h +1 -1
  97. data/dependencies/utf8proc/utf8proc_data.h +3366 -3184
  98. data/lib/SDL2.dll +0 -0
  99. data/lib64/SDL2.dll +0 -0
  100. data/src/Window.cpp +3 -0
  101. metadata +5 -4
@@ -200,6 +200,7 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
200
200
  const MT2DRUMSDATA *pdd;
201
201
  const MT2INSTRUMENT *InstrMap[255];
202
202
  const MT2SAMPLE *SampleMap[256];
203
+ UINT i, j;
203
204
 
204
205
  if ((!lpStream) || (dwMemLength < sizeof(MT2FILEHEADER) + 4)
205
206
  || (pfh->dwMT20 != 0x3032544D)
@@ -215,9 +216,9 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
215
216
  {
216
217
  _this->m_nDefaultTempo = 110250 / pfh->wSamplesPerTick;
217
218
  }
218
- for (UINT iOrd=0; iOrd<MAX_ORDERS; iOrd++)
219
+ for (j=0; j<MAX_ORDERS; j++)
219
220
  {
220
- _this->Order[iOrd] = (BYTE)((iOrd < pfh->nOrders) ? pfh->Orders[iOrd] : 0xFF);
221
+ _this->Order[j] = (BYTE)((j < pfh->nOrders) ? pfh->Orders[j] : 0xFF);
221
222
  }
222
223
  dwMemPos = sizeof(MT2FILEHEADER);
223
224
  if (dwMemPos+2 > dwMemLength) return TRUE;
@@ -253,21 +254,24 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
253
254
  }
254
255
  // Load Patterns
255
256
  dwMemPos = dwExtraDataPos + nExtraDataLen;
256
- for (UINT iPat=0; iPat<pfh->wPatterns; iPat++) if (dwMemPos < dwMemLength-6)
257
+ for (j=0; j<pfh->wPatterns; j++) if (dwMemPos < dwMemLength-6)
257
258
  {
258
259
  const MT2PATTERN *pmp = (MT2PATTERN *)(lpStream+dwMemPos);
259
260
  UINT wDataLen = (pmp->wDataLen + 1) & ~1;
261
+ UINT nLines;
260
262
  dwMemPos += 6;
261
263
  if (dwMemPos > dwMemLength - wDataLen || wDataLen > dwMemLength) break;
262
264
 
263
- UINT nLines = pmp->wLines;
264
- if ((iPat < MAX_PATTERNS) && (nLines > 0) && (nLines <= 256))
265
+ nLines = pmp->wLines;
266
+ if ((j < MAX_PATTERNS) && (nLines > 0) && (nLines <= 256))
265
267
  {
266
- _this->PatternSize[iPat] = nLines;
267
- _this->Patterns[iPat] = CSoundFile_AllocatePattern(nLines, _this->m_nChannels);
268
- if (!_this->Patterns[iPat]) return TRUE;
269
- MODCOMMAND *m = _this->Patterns[iPat];
270
- UINT len = wDataLen;
268
+ MODCOMMAND *m;
269
+ UINT len;
270
+ _this->PatternSize[j] = nLines;
271
+ _this->Patterns[j] = CSoundFile_AllocatePattern(nLines, _this->m_nChannels);
272
+ if (!_this->Patterns[j]) return TRUE;
273
+ m = _this->Patterns[j];
274
+ len = wDataLen;
271
275
  if (len <= 4) return TRUE;
272
276
 
273
277
  if (pfh->fulFlags & 1) // Packed Patterns
@@ -323,10 +327,11 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
323
327
  // Skip Drum Patterns
324
328
  if (pdd)
325
329
  {
326
- for (UINT iDrm=0; iDrm<pdd->wDrumPatterns; iDrm++)
330
+ for (j=0; j<pdd->wDrumPatterns; j++)
327
331
  {
332
+ UINT nLines;
328
333
  if (dwMemPos > dwMemLength-2) return TRUE;
329
- UINT nLines = *(WORD *)(lpStream+dwMemPos);
334
+ nLines = *(WORD *)(lpStream+dwMemPos);
330
335
  dwMemPos += 2 + nLines * 32;
331
336
  }
332
337
  }
@@ -337,14 +342,15 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
337
342
  if (pfh->fulFlags & 0x10) nAutoCount++; // Master Automation
338
343
  if ((pfh->fulFlags & 0x08) && (pdd)) nAutoCount += 8; // Drums Automation
339
344
  nAutoCount *= pfh->wPatterns;
340
- for (UINT iAuto=0; iAuto<nAutoCount; iAuto++)
345
+ for (j=0; j<nAutoCount; j++)
341
346
  {
347
+ const MT2AUTOMATION *pma;
342
348
  if (dwMemPos+12 >= dwMemLength) return TRUE;
343
- const MT2AUTOMATION *pma = (MT2AUTOMATION *)(lpStream+dwMemPos);
349
+ pma = (MT2AUTOMATION *)(lpStream+dwMemPos);
344
350
  dwMemPos += (pfh->wVersion <= 0x201) ? 4 : 8;
345
- for (UINT iEnv=0; iEnv<14; iEnv++)
351
+ for (i=0; i<14; i++)
346
352
  {
347
- if (pma->dwFlags & (1 << iEnv))
353
+ if (pma->dwFlags & (1 << i))
348
354
  {
349
355
  dwMemPos += 260;
350
356
  }
@@ -354,20 +360,22 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
354
360
  // Load Instruments
355
361
  SDL_memset(InstrMap, 0, sizeof(InstrMap));
356
362
  _this->m_nInstruments = (pfh->wInstruments < MAX_INSTRUMENTS) ? pfh->wInstruments : MAX_INSTRUMENTS-1;
357
- for (UINT iIns=1; iIns<=255; iIns++)
363
+ for (j=1; j<=255; j++)
358
364
  {
365
+ const MT2INSTRUMENT *pmi;
366
+ INSTRUMENTHEADER *penv;
359
367
  if (dwMemPos+36 > dwMemLength) return TRUE;
360
- const MT2INSTRUMENT *pmi = (MT2INSTRUMENT *)(lpStream+dwMemPos);
361
- INSTRUMENTHEADER *penv = NULL;
362
- if (iIns <= _this->m_nInstruments)
368
+ pmi = (MT2INSTRUMENT *)(lpStream+dwMemPos);
369
+ penv = NULL;
370
+ if (j <= _this->m_nInstruments)
363
371
  {
364
372
  penv = (INSTRUMENTHEADER *) SDL_calloc(1,sizeof(INSTRUMENTHEADER));
365
- _this->Headers[iIns] = penv;
373
+ _this->Headers[j] = penv;
366
374
  if (penv)
367
375
  {
368
376
  penv->nGlobalVol = 64;
369
377
  penv->nPan = 128;
370
- for (UINT i=0; i<NOTE_MAX; i++)
378
+ for (i=0; i<NOTE_MAX; i++)
371
379
  {
372
380
  penv->NoteMap[i] = i+1;
373
381
  }
@@ -377,15 +385,15 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
377
385
  if (pmi->dwDataLen > 0)
378
386
  {
379
387
  if (dwMemPos + sizeof(MT2INSTRUMENT) - 4 > dwMemLength) return TRUE;
380
- InstrMap[iIns-1] = pmi;
388
+ InstrMap[j-1] = pmi;
381
389
  if (penv && pmi->dwDataLen >= sizeof(MT2INSTRUMENT) - 40)
382
390
  {
391
+ MT2ENVELOPE *pehdr[4];
392
+ WORD *pedata[4];
383
393
  penv->nFadeOut = pmi->wFadeOut;
384
394
  penv->nNNA = pmi->wNNA & 3;
385
395
  penv->nDCT = (pmi->wNNA>>8) & 3;
386
396
  penv->nDNA = (pmi->wNNA>>12) & 3;
387
- MT2ENVELOPE *pehdr[4];
388
- WORD *pedata[4];
389
397
  if (pfh->wVersion <= 0x201)
390
398
  {
391
399
  DWORD dwEnvPos = dwMemPos + sizeof(MT2INSTRUMENT) - 4;
@@ -400,7 +408,7 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
400
408
  {
401
409
  DWORD dwEnvPos = dwMemPos + sizeof(MT2INSTRUMENT);
402
410
  if (dwEnvPos > dwMemLength) return TRUE;
403
- for (UINT i=0; i<4; i++)
411
+ for (i=0; i<4; i++)
404
412
  {
405
413
  if (pmi->wEnvFlags1 & (1<<i))
406
414
  {
@@ -420,12 +428,12 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
420
428
 
421
429
  }
422
430
  // Load envelopes
423
- for (UINT iEnv=0; iEnv<4; iEnv++) if (pehdr[iEnv])
431
+ for (i=0; i<4; i++) if (pehdr[i])
424
432
  {
425
- const MT2ENVELOPE *pme = pehdr[iEnv];
433
+ const MT2ENVELOPE *pme = pehdr[i];
426
434
  WORD *pEnvPoints = NULL;
427
435
  BYTE *pEnvData = NULL;
428
- switch(iEnv)
436
+ switch(i)
429
437
  {
430
438
  // Volume Envelope
431
439
  case 0:
@@ -455,7 +463,7 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
455
463
 
456
464
  // Pitch/Filter envelope
457
465
  default:
458
- if (pme->nFlags & 1) penv->dwFlags |= (iEnv==3) ? (ENV_PITCH|ENV_FILTER) : ENV_PITCH;
466
+ if (pme->nFlags & 1) penv->dwFlags |= (i==3) ? (ENV_PITCH|ENV_FILTER) : ENV_PITCH;
459
467
  if (pme->nFlags & 2) penv->dwFlags |= ENV_PITCHSUSTAIN;
460
468
  if (pme->nFlags & 4) penv->dwFlags |= ENV_PITCHLOOP;
461
469
  penv->nPitchEnv = (pme->nPoints > 16) ? 16 : pme->nPoints;
@@ -466,13 +474,14 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
466
474
  pEnvData = penv->PitchEnv;
467
475
  }
468
476
  // Envelope data
469
- if ((pEnvPoints) && (pEnvData) && (pedata[iEnv]))
477
+ if ((pEnvPoints) && (pEnvData) && (pedata[i]))
470
478
  {
471
- WORD *psrc = pedata[iEnv];
472
- for (UINT i=0; i<16; i++)
479
+ WORD *psrc = pedata[i];
480
+ UINT k = 0;
481
+ for (; k<16; k++)
473
482
  {
474
- pEnvPoints[i] = psrc[i*2];
475
- pEnvData[i] = (BYTE)psrc[i*2+1];
483
+ pEnvPoints[k] = psrc[k*2];
484
+ pEnvData[k] = (BYTE)psrc[k*2+1];
476
485
  }
477
486
  }
478
487
  }
@@ -486,17 +495,18 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
486
495
  }
487
496
  SDL_memset(SampleMap, 0, sizeof(SampleMap));
488
497
  _this->m_nSamples = (pfh->wSamples < MAX_SAMPLES) ? pfh->wSamples : MAX_SAMPLES-1;
489
- for (UINT iSmp=1; iSmp<=256; iSmp++)
498
+ for (j=1; j<=256; j++)
490
499
  {
500
+ const MT2SAMPLE *pms;
491
501
  if (dwMemPos > dwMemLength - 36) return TRUE;
492
- const MT2SAMPLE *pms = (MT2SAMPLE *)(lpStream+dwMemPos);
502
+ pms = (MT2SAMPLE *)(lpStream+dwMemPos);
493
503
  if (pms->dwDataLen > dwMemLength - (dwMemPos+36)) return TRUE;
494
504
  if (pms->dwDataLen > 0)
495
505
  {
496
- SampleMap[iSmp-1] = pms;
497
- if (iSmp < MAX_SAMPLES)
506
+ SampleMap[j-1] = pms;
507
+ if (j < MAX_SAMPLES)
498
508
  {
499
- MODINSTRUMENT *psmp = &_this->Ins[iSmp];
509
+ MODINSTRUMENT *psmp = &_this->Ins[j];
500
510
  psmp->nGlobalVol = 64;
501
511
  if (dwMemPos+sizeof(MT2SAMPLE) > dwMemLength) return TRUE;
502
512
  psmp->nVolume = (pms->wVolume >> 7);
@@ -519,22 +529,23 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
519
529
  dwMemPos += 36;
520
530
  }
521
531
  }
522
- for (UINT iMap=0; iMap<255; iMap++) if (InstrMap[iMap])
532
+ for (j=0; j<255; j++) if (InstrMap[j])
523
533
  {
524
- const MT2INSTRUMENT *pmi = InstrMap[iMap];
534
+ const MT2INSTRUMENT *pmi = InstrMap[j];
525
535
  INSTRUMENTHEADER *penv = NULL;
526
- if (iMap<_this->m_nInstruments) penv = _this->Headers[iMap+1];
527
- for (UINT iGrp=0; iGrp<pmi->wSamples; iGrp++)
536
+ if (j<_this->m_nInstruments) penv = _this->Headers[j+1];
537
+ for (i=0; i<pmi->wSamples; i++)
528
538
  {
529
539
  if (penv && dwMemPos < dwMemLength && dwMemPos < dwMemLength - 8)
530
540
  {
531
541
  const MT2GROUP *pmg = (MT2GROUP *)(lpStream+dwMemPos);
532
- for (UINT i=0; i<96; i++)
542
+ UINT k = 0;
543
+ for (; k<96; k++)
533
544
  {
534
- if (pmi->GroupsMapping[i] == iGrp)
545
+ if (pmi->GroupsMapping[k] == i)
535
546
  {
536
547
  UINT nSmp = pmg->nSmpNo+1;
537
- penv->Keyboard[i+12] = (BYTE)nSmp;
548
+ penv->Keyboard[k+12] = (BYTE)nSmp;
538
549
  if (nSmp <= _this->m_nSamples)
539
550
  {
540
551
  _this->Ins[nSmp].nVibType = pmi->bVibType;
@@ -548,10 +559,10 @@ BOOL CSoundFile_ReadMT2(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
548
559
  dwMemPos += 8;
549
560
  }
550
561
  }
551
- for (UINT iData=0; iData<256; iData++) if ((iData < _this->m_nSamples) && (SampleMap[iData]))
562
+ for (j=0; j<256; j++) if ((j < _this->m_nSamples) && (SampleMap[j]))
552
563
  {
553
- const MT2SAMPLE *pms = SampleMap[iData];
554
- MODINSTRUMENT *psmp = &_this->Ins[iData+1];
564
+ const MT2SAMPLE *pms = SampleMap[j];
565
+ MODINSTRUMENT *psmp = &_this->Ins[j+1];
555
566
  if (!(pms->nFlags & 5))
556
567
  {
557
568
  if (psmp->nLength > 0 && dwMemPos < dwMemLength)
@@ -45,7 +45,10 @@ BOOL CSoundFile_ReadMTM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
45
45
  //-----------------------------------------------------------
46
46
  {
47
47
  MTMHEADER *pmh = (MTMHEADER *)lpStream;
48
+ LPCBYTE pTracks;
49
+ LPWORD pSeq;
48
50
  DWORD dwMemPos = 66;
51
+ UINT i, j;
49
52
 
50
53
  if ((!lpStream) || (dwMemLength < 0x100)) return FALSE;
51
54
  if ((SDL_strncmp(pmh->id, "MTM", 3)) || (pmh->numchannels > 32)
@@ -60,12 +63,13 @@ BOOL CSoundFile_ReadMTM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
60
63
  _this->m_nSamples = pmh->numsamples;
61
64
  _this->m_nChannels = pmh->numchannels;
62
65
  // Reading instruments
63
- for (UINT i=1; i<=_this->m_nSamples; i++)
66
+ for (i=1; i<=_this->m_nSamples; i++)
64
67
  {
65
68
  MTMSAMPLE *pms = (MTMSAMPLE *)(lpStream + dwMemPos);
69
+ DWORD len;
66
70
  _this->Ins[i].nVolume = pms->volume << 2;
67
71
  _this->Ins[i].nGlobalVol = 64;
68
- DWORD len = pms->length;
72
+ len = pms->length;
69
73
  if ((len > 4) && (len <= MAX_SAMPLE_LENGTH))
70
74
  {
71
75
  _this->Ins[i].nLength = len;
@@ -89,32 +93,34 @@ BOOL CSoundFile_ReadMTM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
89
93
  dwMemPos += 37;
90
94
  }
91
95
  // Setting Channel Pan Position
92
- for (UINT ich=0; ich<_this->m_nChannels; ich++)
96
+ for (i=0; i<_this->m_nChannels; i++)
93
97
  {
94
- _this->ChnSettings[ich].nPan = ((pmh->panpos[ich] & 0x0F) << 4) + 8;
95
- _this->ChnSettings[ich].nVolume = 64;
98
+ _this->ChnSettings[i].nPan = ((pmh->panpos[i] & 0x0F) << 4) + 8;
99
+ _this->ChnSettings[i].nVolume = 64;
96
100
  }
97
101
  // Reading pattern order
98
102
  SDL_memcpy(_this->Order, lpStream + dwMemPos, pmh->lastorder+1);
99
103
  dwMemPos += 128;
100
104
  // Reading Patterns
101
- LPCBYTE pTracks = lpStream + dwMemPos;
105
+ pTracks = lpStream + dwMemPos;
102
106
  dwMemPos += 192 * pmh->numtracks;
103
- LPWORD pSeq = (LPWORD)(lpStream + dwMemPos);
104
- for (UINT pat=0; pat<=pmh->lastpattern; pat++)
107
+ pSeq = (LPWORD)(lpStream + dwMemPos);
108
+ for (j=0; j<=pmh->lastpattern; j++)
105
109
  {
106
- _this->PatternSize[pat] = 64;
107
- if ((_this->Patterns[pat] = CSoundFile_AllocatePattern(64, _this->m_nChannels)) == NULL) break;
108
- for (UINT n=0; n<32; n++) if ((pSeq[n]) && (pSeq[n] <= pmh->numtracks) && (n < _this->m_nChannels))
110
+ UINT n;
111
+ _this->PatternSize[j] = 64;
112
+ if ((_this->Patterns[j] = CSoundFile_AllocatePattern(64, _this->m_nChannels)) == NULL) break;
113
+ for (n=0; n<32; n++) if ((pSeq[n]) && (pSeq[n] <= pmh->numtracks) && (n < _this->m_nChannels))
109
114
  {
110
115
  LPCBYTE p = pTracks + 192 * (pSeq[n]-1);
111
- MODCOMMAND *m = _this->Patterns[pat] + n;
112
- for (UINT i=0; i<64; i++, m+=_this->m_nChannels, p+=3)
116
+ MODCOMMAND *m = _this->Patterns[j] + n;
117
+ for (i=0; i<64; i++, m+=_this->m_nChannels, p+=3)
113
118
  {
119
+ UINT cmd, param;
114
120
  if (p[0] & 0xFC) m->note = (p[0] >> 2) + 37;
115
121
  m->instr = ((p[0] & 0x03) << 4) | (p[1] >> 4);
116
- UINT cmd = p[1] & 0x0F;
117
- UINT param = p[2];
122
+ cmd = p[1] & 0x0F;
123
+ param = p[2];
118
124
  if (cmd == 0x0A)
119
125
  {
120
126
  if (param & 0xF0) param &= 0xF0; else param &= 0x0F;
@@ -129,10 +135,10 @@ BOOL CSoundFile_ReadMTM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
129
135
  dwMemPos += 64*(pmh->lastpattern+1);
130
136
  dwMemPos += pmh->commentsize;
131
137
  // Reading Samples
132
- for (UINT ismp=1; ismp<=_this->m_nSamples; ismp++)
138
+ for (i=1; i<=_this->m_nSamples; i++)
133
139
  {
134
140
  if (dwMemPos >= dwMemLength) break;
135
- dwMemPos += CSoundFile_ReadSample(_this, &_this->Ins[ismp], (_this->Ins[ismp].uFlags & CHN_16BIT) ? RS_PCM16U : RS_PCM8U,
141
+ dwMemPos += CSoundFile_ReadSample(_this, &_this->Ins[i], (_this->Ins[i].uFlags & CHN_16BIT) ? RS_PCM16U : RS_PCM8U,
136
142
  (LPSTR)(lpStream + dwMemPos), dwMemLength - dwMemPos);
137
143
  }
138
144
  _this->m_nMinPeriod = 64;
@@ -48,7 +48,8 @@ BOOL CSoundFile_ReadOKT(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
48
48
  {
49
49
  const OKTFILEHEADER *pfh = (OKTFILEHEADER *)lpStream;
50
50
  DWORD dwMemPos = sizeof(OKTFILEHEADER), dwSize;
51
- UINT nsamples = 0, norders = 0;//, npatterns = 0
51
+ UINT nsamples = 0, norders = 0, npat = 0, nsmp = 1;//, npatterns = 0
52
+ UINT i;
52
53
 
53
54
  if ((!lpStream) || (dwMemLength < 1024)) return FALSE;
54
55
  if ((bswapBE32(pfh->okta) != MAGIC('O','K','T','A'))
@@ -65,13 +66,13 @@ BOOL CSoundFile_ReadOKT(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
65
66
  _this->m_nSamples = nsamples;
66
67
  if (_this->m_nSamples >= MAX_SAMPLES) _this->m_nSamples = MAX_SAMPLES-1;
67
68
  // Reading samples
68
- for (UINT smp=1; smp <= nsamples; smp++)
69
+ for (i=1; i <= nsamples; i++)
69
70
  {
70
71
  if (dwMemPos >= dwMemLength - sizeof(OKTSAMPLE)) return TRUE;
71
- if (smp < MAX_SAMPLES)
72
+ if (i < MAX_SAMPLES)
72
73
  {
73
74
  const OKTSAMPLE *psmp = (const OKTSAMPLE *)(lpStream + dwMemPos);
74
- MODINSTRUMENT *pins = &_this->Ins[smp];
75
+ MODINSTRUMENT *pins = &_this->Ins[i];
75
76
 
76
77
  pins->uFlags = 0;
77
78
  pins->nLength = bswapBE32(psmp->length) & ~1;
@@ -121,15 +122,14 @@ BOOL CSoundFile_ReadOKT(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
121
122
  UINT orderlen = norders;
122
123
  if (orderlen >= MAX_ORDERS) orderlen = MAX_ORDERS-1;
123
124
  if (dwMemPos + 8 + orderlen > dwMemLength) return TRUE;
124
- for (UINT i=0; i<orderlen; i++) _this->Order[i] = lpStream[dwMemPos+8+i];
125
- for (UINT j=orderlen; j>1; j--) { if (_this->Order[j-1]) break; _this->Order[j-1] = 0xFF; }
125
+ for (i=0; i<orderlen; i++) _this->Order[i] = lpStream[dwMemPos+8+i];
126
+ for (i=orderlen; i>1; i--) { if (_this->Order[i-1]) break; _this->Order[i-1] = 0xFF; }
126
127
 
127
128
  dwSize = readBE32(lpStream + dwMemPos + 4);
128
129
  if (dwSize > dwMemLength - 8 || dwMemPos > dwMemLength - dwSize - 8) return TRUE;
129
130
  dwMemPos += dwSize + 8;
130
131
  }
131
132
  // PBOD
132
- UINT npat = 0;
133
133
  while ((dwMemPos < dwMemLength - 10) && (readBE32(lpStream + dwMemPos) == MAGIC('P','B','O','D')))
134
134
  {
135
135
  DWORD dwPos = dwMemPos + 10;
@@ -137,22 +137,26 @@ BOOL CSoundFile_ReadOKT(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
137
137
  if (!rows) rows = 64;
138
138
  if (npat < MAX_PATTERNS)
139
139
  {
140
+ MODCOMMAND *m;
141
+ UINT imax;
140
142
  if ((_this->Patterns[npat] = CSoundFile_AllocatePattern(rows, _this->m_nChannels)) == NULL) return TRUE;
141
- MODCOMMAND *m = _this->Patterns[npat];
143
+ m = _this->Patterns[npat];
142
144
  _this->PatternSize[npat] = rows;
143
- UINT imax = _this->m_nChannels*rows;
144
- for (UINT i=0; i<imax; i++, m++, dwPos+=4)
145
+ imax = _this->m_nChannels*rows;
146
+ for (i=0; i<imax; i++, m++, dwPos+=4)
145
147
  {
148
+ const BYTE *p;
149
+ UINT note, command, param;
146
150
  if (dwPos+4 > dwMemLength) break;
147
- const BYTE *p = lpStream+dwPos;
148
- UINT note = p[0];
151
+ p = lpStream+dwPos;
152
+ note = p[0];
149
153
  if (note)
150
154
  {
151
155
  m->note = note + 48;
152
156
  m->instr = p[1] + 1;
153
157
  }
154
- UINT command = p[2];
155
- UINT param = p[3];
158
+ command = p[2];
159
+ param = p[3];
156
160
  m->param = param;
157
161
  switch(command)
158
162
  {
@@ -208,7 +212,6 @@ BOOL CSoundFile_ReadOKT(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
208
212
  dwMemPos += dwSize + 8;
209
213
  }
210
214
  // SBOD
211
- UINT nsmp = 1;
212
215
  while ((dwMemPos < dwMemLength-10) && (readBE32(lpStream + dwMemPos) == MAGIC('S','B','O','D')))
213
216
  {
214
217
  if (nsmp < MAX_SAMPLES) CSoundFile_ReadSample(_this, &_this->Ins[nsmp], RS_PCM8S, (LPSTR)(lpStream+dwMemPos+8), dwMemLength-dwMemPos-8);
@@ -220,4 +223,3 @@ BOOL CSoundFile_ReadOKT(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
220
223
  }
221
224
  return TRUE;
222
225
  }
223
-
@@ -101,6 +101,8 @@ BOOL CSoundFile_ReadPSM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
101
101
  DWORD patptrs[MAX_PATTERNS];
102
102
  BYTE samplemap[MAX_SAMPLES];
103
103
  UINT nPatterns = 0;
104
+ const PSMSONGHDR *pSong;
105
+ UINT j;
104
106
 
105
107
  if (dwMemLength < 256) return FALSE;
106
108
 
@@ -120,20 +122,22 @@ BOOL CSoundFile_ReadPSM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
120
122
  nPatterns = 0;
121
123
  dwMemPos = 12;
122
124
  dwSongPos = 0;
123
- for (UINT iChPan=0; iChPan<16; iChPan++)
125
+ for (j=0; j<16; j++)
124
126
  {
125
- UINT pan = (((iChPan & 3) == 1) || ((iChPan&3)==2)) ? 0xC0 : 0x40;
126
- _this->ChnSettings[iChPan].nPan = pan;
127
+ UINT pan = (((j & 3) == 1) || ((j&3)==2)) ? 0xC0 : 0x40;
128
+ _this->ChnSettings[j].nPan = pan;
127
129
  }
128
130
  while (dwMemPos+8 < dwMemLength)
129
131
  {
130
132
  PSMCHUNK pchunk;
133
+ PUCHAR pdata;
134
+ ULONG len;
131
135
  SDL_memcpy(&pchunk, lpStream+dwMemPos, sizeof(PSMCHUNK));
132
136
  swap_PSMCHUNK(&pchunk);
133
137
  if ((pchunk.len >= dwMemLength - 8) || (dwMemPos + pchunk.len + 8 > dwMemLength)) break;
134
138
  dwMemPos += 8;
135
- PUCHAR pdata = (PUCHAR)(lpStream+dwMemPos);
136
- ULONG len = pchunk.len;
139
+ pdata = (PUCHAR)(lpStream+dwMemPos);
140
+ len = pchunk.len;
137
141
  if (len) switch(pchunk.id)
138
142
  {
139
143
  // "PBOD": Pattern
@@ -154,9 +158,10 @@ BOOL CSoundFile_ReadPSM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
154
158
  case IFFID_DSMP:
155
159
  if ((len >= sizeof(PSMSAMPLE)) && (_this->m_nSamples+1 < MAX_SAMPLES))
156
160
  {
157
- _this->m_nSamples++;
158
- MODINSTRUMENT *pins = &_this->Ins[_this->m_nSamples];
161
+ MODINSTRUMENT *pins;
159
162
  PSMSAMPLE psmp;
163
+ _this->m_nSamples++;
164
+ pins = &_this->Ins[_this->m_nSamples];
160
165
  SDL_memcpy(&psmp, pdata, sizeof(PSMSAMPLE));
161
166
  swap_PSMSAMPLE(&psmp);
162
167
  // smpnames[_this->m_nSamples] = psmp.smpid;
@@ -188,7 +193,7 @@ BOOL CSoundFile_ReadPSM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
188
193
  dwMemPos += pchunk.len;
189
194
  }
190
195
  // Step #1: convert song structure
191
- const PSMSONGHDR *pSong = (const PSMSONGHDR *)(lpStream+dwSongPos+8);
196
+ pSong = (const PSMSONGHDR *)(lpStream+dwSongPos+8);
192
197
  if ((!dwSongPos) || (pSong->channels < 2) || (pSong->channels > 32)) return TRUE;
193
198
  _this->m_nChannels = pSong->channels;
194
199
  // Valid song header -> convert attached chunks
@@ -198,26 +203,30 @@ BOOL CSoundFile_ReadPSM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
198
203
  while (dwMemPos + 8 < dwSongEnd)
199
204
  {
200
205
  PSMCHUNK pchunk;
206
+ PUCHAR pdata;
207
+ ULONG len;
201
208
  SDL_memcpy(&pchunk, lpStream+dwMemPos, sizeof(PSMCHUNK));
202
209
  swap_PSMCHUNK(&pchunk);
203
210
  dwMemPos += 8;
204
211
  if ((pchunk.len > dwSongEnd) || (dwMemPos + pchunk.len > dwSongEnd)) break;
205
- PUCHAR pdata = (PUCHAR)(lpStream+dwMemPos);
206
- ULONG len = pchunk.len;
212
+ pdata = (PUCHAR)(lpStream+dwMemPos);
213
+ len = pchunk.len;
207
214
  switch(pchunk.id)
208
215
  {
209
216
  case IFFID_OPLH:
210
217
  if (len >= 0x20)
211
218
  {
212
219
  UINT pos = len - 3;
220
+ UINT i = 0;
213
221
  while (pos > 5)
214
222
  {
215
223
  BOOL bFound = FALSE;
224
+ DWORD dwName;
216
225
  pos -= 5;
217
- DWORD dwName = *(DWORD *)(pdata+pos);
218
- for (UINT i=0; i<nPatterns; i++)
226
+ dwName = *(DWORD *)(pdata+pos);
227
+ for (j=0; j<nPatterns; j++)
219
228
  {
220
- DWORD dwPatName = ((const PSMPATTERN *)(lpStream+patptrs[i]+8))->name;
229
+ DWORD dwPatName = ((const PSMPATTERN *)(lpStream+patptrs[j]+8))->name;
221
230
  if (dwName == dwPatName)
222
231
  {
223
232
  bFound = TRUE;
@@ -232,16 +241,15 @@ BOOL CSoundFile_ReadPSM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
232
241
  break;
233
242
  }
234
243
  }
235
- UINT iOrd = 0;
236
- while ((pos+5<len) && (iOrd < MAX_ORDERS))
244
+ while ((pos+5<len) && (i < MAX_ORDERS))
237
245
  {
238
246
  DWORD dwName = *(DWORD *)(pdata+pos);
239
- for (UINT i=0; i<nPatterns; i++)
247
+ for (j=0; j<nPatterns; j++)
240
248
  {
241
- DWORD dwPatName = ((const PSMPATTERN *)(lpStream+patptrs[i]+8))->name;
249
+ DWORD dwPatName = ((const PSMPATTERN *)(lpStream+patptrs[j]+8))->name;
242
250
  if (dwName == dwPatName)
243
251
  {
244
- _this->Order[iOrd++] = i;
252
+ _this->Order[i++] = j;
245
253
  break;
246
254
  }
247
255
  }
@@ -255,28 +263,32 @@ BOOL CSoundFile_ReadPSM(CSoundFile *_this, LPCBYTE lpStream, DWORD dwMemLength)
255
263
  }
256
264
 
257
265
  // Step #2: convert patterns
258
- for (UINT nPat=0; nPat<nPatterns; nPat++)
266
+ for (j=0; j<nPatterns; j++)
259
267
  {
260
268
  PSMPATTERN pPsmPat;
261
269
  PSMCHUNK pchunk;
262
- SDL_memcpy(&pPsmPat, lpStream+patptrs[nPat]+8, sizeof(PSMPATTERN));
263
- swap_PSMPATTERN(&pPsmPat);
264
- SDL_memcpy(&pchunk, lpStream+patptrs[nPat], sizeof(PSMCHUNK));
265
- swap_PSMCHUNK(&pchunk);
266
-
267
- ULONG len = pchunk.len - 12;
268
- UINT nRows = pPsmPat.rows;
269
- if (len > pPsmPat.size) len = pPsmPat.size;
270
- if ((nRows < 64) || (nRows > 256)) nRows = 64;
271
- _this->PatternSize[nPat] = nRows;
272
- if ((_this->Patterns[nPat] = CSoundFile_AllocatePattern(nRows, _this->m_nChannels)) == NULL) break;
273
- MODCOMMAND *m = _this->Patterns[nPat];
274
- const BYTE *p = lpStream + patptrs[nPat] + 20;
270
+ ULONG len;
271
+ UINT nRows;
272
+ MODCOMMAND *m;
273
+ const BYTE *p;
275
274
  MODCOMMAND *sp, dummy;
276
275
  UINT pos = 0;
277
276
  UINT row = 0;
278
277
  UINT rowlim;
279
278
  UINT flags, ch;
279
+ SDL_memcpy(&pPsmPat, lpStream+patptrs[j]+8, sizeof(PSMPATTERN));
280
+ swap_PSMPATTERN(&pPsmPat);
281
+ SDL_memcpy(&pchunk, lpStream+patptrs[j], sizeof(PSMCHUNK));
282
+ swap_PSMCHUNK(&pchunk);
283
+
284
+ len = pchunk.len - 12;
285
+ nRows = pPsmPat.rows;
286
+ if (len > pPsmPat.size) len = pPsmPat.size;
287
+ if ((nRows < 64) || (nRows > 256)) nRows = 64;
288
+ _this->PatternSize[j] = nRows;
289
+ if ((_this->Patterns[j] = CSoundFile_AllocatePattern(nRows, _this->m_nChannels)) == NULL) break;
290
+ m = _this->Patterns[j];
291
+ p = lpStream + patptrs[j] + 20;
280
292
  rowlim = bswapLE16(pPsmPat.reserved1)-2;
281
293
  while ((row < nRows) && (pos+3 < len))
282
294
  {
@@ -64,11 +64,12 @@ static uint32_t BS2WORD(uint16_t w[2]) {
64
64
  BOOL CSoundFile_ReadPTM(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLength)
65
65
  //---------------------------------------------------------------
66
66
  {
67
+ PTMFILEHEADER pfh;
67
68
  DWORD dwMemPos;
68
69
  UINT nOrders;
70
+ UINT j;
69
71
 
70
72
  if ((!lpStream) || (dwMemLength < sizeof(PTMFILEHEADER))) return FALSE;
71
- PTMFILEHEADER pfh;
72
73
  SDL_memcpy(&pfh, lpStream, sizeof (pfh));
73
74
 
74
75
  pfh.norders = bswapLE16(pfh.norders);
@@ -78,7 +79,7 @@ BOOL CSoundFile_ReadPTM(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
78
79
  pfh.fileflags = bswapLE16(pfh.fileflags);
79
80
  pfh.reserved2 = bswapLE16(pfh.reserved2);
80
81
  pfh.ptmf_id = bswapLE32(pfh.ptmf_id);
81
- for (UINT j=0; j<128; j++)
82
+ for (j=0; j<128; j++)
82
83
  {
83
84
  pfh.patseg[j] = bswapLE16(pfh.patseg[j]);
84
85
  }
@@ -95,14 +96,14 @@ BOOL CSoundFile_ReadPTM(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
95
96
  dwMemPos = SIZEOF_PTMFILEHEADER;
96
97
  nOrders = (pfh.norders < MAX_ORDERS) ? pfh.norders : MAX_ORDERS-1;
97
98
  SDL_memcpy(_this->Order, pfh.orders, nOrders);
98
- for (UINT ipan=0; ipan<_this->m_nChannels; ipan++)
99
+ for (j=0; j<_this->m_nChannels; j++)
99
100
  {
100
- _this->ChnSettings[ipan].nVolume = 64;
101
- _this->ChnSettings[ipan].nPan = ((pfh.chnpan[ipan] & 0x0F) << 4) + 4;
101
+ _this->ChnSettings[j].nVolume = 64;
102
+ _this->ChnSettings[j].nPan = ((pfh.chnpan[j] & 0x0F) << 4) + 4;
102
103
  }
103
- for (UINT ismp=0; ismp<_this->m_nSamples; ismp++, dwMemPos += SIZEOF_PTMSAMPLE)
104
+ for (j=0; j<_this->m_nSamples; j++, dwMemPos += SIZEOF_PTMSAMPLE)
104
105
  {
105
- MODINSTRUMENT *pins = &_this->Ins[ismp+1];
106
+ MODINSTRUMENT *pins = &_this->Ins[j+1];
106
107
  PTMSAMPLE *psmp = (PTMSAMPLE *)(lpStream+dwMemPos);
107
108
 
108
109
  pins->nGlobalVol = 64;
@@ -113,10 +114,11 @@ BOOL CSoundFile_ReadPTM(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
113
114
  if ((psmp->sampletype & 3) == 1)
114
115
  {
115
116
  UINT smpflg = RS_PCM8D;
117
+ DWORD samplepos;
116
118
  pins->nLength = BS2WORD(psmp->length);
117
119
  pins->nLoopStart = BS2WORD(psmp->loopbeg);
118
120
  pins->nLoopEnd = BS2WORD(psmp->loopend);
119
- DWORD samplepos = BS2WORD(psmp->fileofs);
121
+ samplepos = BS2WORD(psmp->fileofs);
120
122
  if (psmp->sampletype & 4) pins->uFlags |= CHN_LOOP;
121
123
  if (psmp->sampletype & 8) pins->uFlags |= CHN_PINGPONGLOOP;
122
124
  if (psmp->sampletype & 16)
@@ -134,15 +136,17 @@ BOOL CSoundFile_ReadPTM(CSoundFile *_this, const BYTE *lpStream, DWORD dwMemLeng
134
136
  }
135
137
  }
136
138
  // Reading Patterns
137
- for (UINT ipat=0; ipat<pfh.npatterns; ipat++)
139
+ for (j=0; j<pfh.npatterns; j++)
138
140
  {
139
- dwMemPos = ((UINT)pfh.patseg[ipat]) << 4;
141
+ MODCOMMAND *m;
142
+ UINT row;
143
+ dwMemPos = ((UINT)pfh.patseg[j]) << 4;
140
144
  if ((!dwMemPos) || (dwMemPos >= dwMemLength)) continue;
141
- _this->PatternSize[ipat] = 64;
142
- if ((_this->Patterns[ipat] = CSoundFile_AllocatePattern(64, _this->m_nChannels)) == NULL) break;
145
+ _this->PatternSize[j] = 64;
146
+ if ((_this->Patterns[j] = CSoundFile_AllocatePattern(64, _this->m_nChannels)) == NULL) break;
143
147
  //
144
- MODCOMMAND *m = _this->Patterns[ipat];
145
- for (UINT row=0; ((row < 64) && (dwMemPos < dwMemLength)); )
148
+ m = _this->Patterns[j];
149
+ for (row=0; ((row < 64) && (dwMemPos < dwMemLength)); )
146
150
  {
147
151
  UINT b = lpStream[dwMemPos++];
148
152