# HG changeset patch # User Matti Hamalainen # Date 1503180100 -10800 # Node ID f1c4b9b074ada9f920c55d991e500e0699a78843 # Parent dce4730372c76c0e30915e960d05924f08e723de Fixes to jssmod loader. diff -r dce4730372c7 -r f1c4b9b074ad minijss/jloadjss.c --- a/minijss/jloadjss.c Sun Aug 20 01:01:12 2017 +0300 +++ b/minijss/jloadjss.c Sun Aug 20 01:01:40 2017 +0300 @@ -414,6 +414,7 @@ "Invalid orders list entry #%d value %d > %d.\n", index, tmp, jssH.npatterns); + module->orderList[index] = (tmp == 0xffff) ? jsetNotSet : tmp; } // Parse the patterns @@ -509,14 +510,13 @@ } // Allocate instrument - if ((einst = jssAllocateExtInstrument()) == NULL) + einst = module->extInstruments[index] = jssAllocateExtInstrument(); + if (einst == NULL) { JSSERROR(DMERR_MALLOC, DMERR_MALLOC, "Could not allocate extended instrument structure #%d\n", index); } - module->extInstruments[index] = einst; - einst->nsamples = jssE.nsamples; einst->vibratoType = jssE.vibratoType; einst->vibratoSweep = jssE.vibratoSweep; @@ -580,7 +580,7 @@ // Validate what we can if (jssI.loopS > jssI.size || jssI.loopE > jssI.size || - jssI.loopE > jssI.loopS) + jssI.loopS > jssI.loopE) { JSSERROR(DMERR_INVALID_DATA, DMERR_INVALID_DATA, "Invalid or corrupted sample instrument #%d.\n", @@ -588,6 +588,13 @@ } // Allocate instrument + inst = module->instruments[index] = jssAllocateInstrument(); + if (inst == NULL) + { + JSSERROR(DMERR_MALLOC, DMERR_MALLOC, + "Could not allocate sample instrument structure #%d\n", + index); + } // Copy data inst->size = jssI.size;