Mercurial > hg > dmlib
comparison minijss/jloadjss.c @ 1311:f1c4b9b074ad
Fixes to jssmod loader.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 20 Aug 2017 01:01:40 +0300 |
parents | dce4730372c7 |
children | 4eb394c9e682 |
comparison
equal
deleted
inserted
replaced
1310:dce4730372c7 | 1311:f1c4b9b074ad |
---|---|
412 if (tmp != 0xffff && tmp > jssH.npatterns) | 412 if (tmp != 0xffff && tmp > jssH.npatterns) |
413 JSSERROR(DMERR_INVALID_DATA, DMERR_INVALID_DATA, | 413 JSSERROR(DMERR_INVALID_DATA, DMERR_INVALID_DATA, |
414 "Invalid orders list entry #%d value %d > %d.\n", | 414 "Invalid orders list entry #%d value %d > %d.\n", |
415 index, tmp, jssH.npatterns); | 415 index, tmp, jssH.npatterns); |
416 | 416 |
417 module->orderList[index] = (tmp == 0xffff) ? jsetNotSet : tmp; | |
417 } | 418 } |
418 | 419 |
419 // Parse the patterns | 420 // Parse the patterns |
420 for (index = 0; index < module->npatterns; index++) | 421 for (index = 0; index < module->npatterns; index++) |
421 { | 422 { |
507 "Failed to read ext.instrument #%d header.\n", | 508 "Failed to read ext.instrument #%d header.\n", |
508 index); | 509 index); |
509 } | 510 } |
510 | 511 |
511 // Allocate instrument | 512 // Allocate instrument |
512 if ((einst = jssAllocateExtInstrument()) == NULL) | 513 einst = module->extInstruments[index] = jssAllocateExtInstrument(); |
514 if (einst == NULL) | |
513 { | 515 { |
514 JSSERROR(DMERR_MALLOC, DMERR_MALLOC, | 516 JSSERROR(DMERR_MALLOC, DMERR_MALLOC, |
515 "Could not allocate extended instrument structure #%d\n", index); | 517 "Could not allocate extended instrument structure #%d\n", index); |
516 } | 518 } |
517 | |
518 module->extInstruments[index] = einst; | |
519 | 519 |
520 einst->nsamples = jssE.nsamples; | 520 einst->nsamples = jssE.nsamples; |
521 einst->vibratoType = jssE.vibratoType; | 521 einst->vibratoType = jssE.vibratoType; |
522 einst->vibratoSweep = jssE.vibratoSweep; | 522 einst->vibratoSweep = jssE.vibratoSweep; |
523 einst->vibratoDepth = jssE.vibratoDepth; | 523 einst->vibratoDepth = jssE.vibratoDepth; |
578 } | 578 } |
579 | 579 |
580 // Validate what we can | 580 // Validate what we can |
581 if (jssI.loopS > jssI.size || | 581 if (jssI.loopS > jssI.size || |
582 jssI.loopE > jssI.size || | 582 jssI.loopE > jssI.size || |
583 jssI.loopE > jssI.loopS) | 583 jssI.loopS > jssI.loopE) |
584 { | 584 { |
585 JSSERROR(DMERR_INVALID_DATA, DMERR_INVALID_DATA, | 585 JSSERROR(DMERR_INVALID_DATA, DMERR_INVALID_DATA, |
586 "Invalid or corrupted sample instrument #%d.\n", | 586 "Invalid or corrupted sample instrument #%d.\n", |
587 index); | 587 index); |
588 } | 588 } |
589 | 589 |
590 // Allocate instrument | 590 // Allocate instrument |
591 inst = module->instruments[index] = jssAllocateInstrument(); | |
592 if (inst == NULL) | |
593 { | |
594 JSSERROR(DMERR_MALLOC, DMERR_MALLOC, | |
595 "Could not allocate sample instrument structure #%d\n", | |
596 index); | |
597 } | |
591 | 598 |
592 // Copy data | 599 // Copy data |
593 inst->size = jssI.size; | 600 inst->size = jssI.size; |
594 inst->loopS = jssI.loopS; | 601 inst->loopS = jssI.loopS; |
595 inst->loopE = jssI.loopE; | 602 inst->loopE = jssI.loopE; |