Mercurial > hg > dmlib
diff xm2jss.c @ 338:cd57ba1130eb
Fixes and improvements in the JMOD saving and loading.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 15 Oct 2012 16:19:57 +0300 |
parents | b420025e5cd2 |
children |
line wrap: on
line diff
--- a/xm2jss.c Mon Oct 15 15:57:30 2012 +0300 +++ b/xm2jss.c Mon Oct 15 16:19:57 2012 +0300 @@ -386,7 +386,8 @@ JSFOREACHNOTE2; JSFOREACHNOTE1; - JSCONVPUT(note->param, "Param"); + tmp = (note->param != jsetNotSet) ? note->param : 0; + JSPUTBYTE(tmp); JSFOREACHNOTE2; return DMERR_OK; @@ -704,7 +705,7 @@ { if (n->instrument != jsetNotSet) { - if (n->instrument >= 0 && n->instrument < m->nextInstruments) + if (optStripExtInstr || (n->instrument >= 0 && n->instrument < m->nextInstruments)) usedExtInstruments[n->instrument] = TRUE; else dmMsg(2, "Pattern 0x%x, row=0x%x, chn=%d has invalid instrument 0x%x\n", @@ -781,7 +782,7 @@ for (n8 = n16 = i = 0; i <= jsetMaxInstruments; i++) if (m->instruments[i] != NULL) { - if (!usedInstruments[i]) + if (!usedInstruments[i] && !optStripInstr) { dmPrint(2, "0x%x, ", i); } @@ -810,7 +811,7 @@ for (i = 0; i < jsetMaxInstruments; i++) if (usedExtInstruments[i]) { - if (i >= m->nextInstruments) + if (i >= m->nextInstruments && !optStripExtInstr) { dmError("Ext.instrument 0x%x >= 0x%x, but used!\n", i, m->nextInstruments); @@ -874,12 +875,15 @@ { char effect; - if (n->instrument >= 0 && n->instrument <= jsetMaxInstruments) - n->instrument = mapExtInstruments[n->instrument]; + if (!optStripExtInstr) + { + if (n->instrument >= 0 && n->instrument <= jsetMaxInstruments) + n->instrument = mapExtInstruments[n->instrument]; - if (n->instrument != jsetNotSet && r->extInstruments[n->instrument] == NULL) - dmError("Non-existing instrument used #%d.\n", n->instrument); - + if (n->instrument != jsetNotSet && r->extInstruments[n->instrument] == NULL) + dmError("Non-existing instrument used #%d.\n", n->instrument); + } + JMPGETEFFECT(effect, n->effect); switch (effect)