diff src/modplug/load_stm.cxx @ 2216:3673c7ec4ea2

Sync with schism's modplug engine. Suggested by G?rkan Seng?n.
author William Pitcock <nenolod@atheme.org>
date Fri, 07 Dec 2007 12:08:47 -0600
parents 6b5a52635b3b
children 6907fc39b53f
line wrap: on
line diff
--- a/src/modplug/load_stm.cxx	Thu Nov 29 04:17:51 2007 +0300
+++ b/src/modplug/load_stm.cxx	Fri Dec 07 12:08:47 2007 -0600
@@ -94,14 +94,14 @@
 		STMSAMPLE *pStm = &phdr->sample[nIns];  // STM sample data
 		memcpy(pIns->name, pStm->filename, 13);
 		memcpy(m_szNames[nIns+1], pStm->filename, 12);
-		pIns->nC4Speed = bswapLE16(pStm->c2spd);
+		pIns->nC4Speed = pStm->c2spd;
 		pIns->nGlobalVol = 64;
 		pIns->nVolume = pStm->volume << 2;
 		if (pIns->nVolume > 256) pIns->nVolume = 256;
-		pIns->nLength = bswapLE16(pStm->length);
-		if ((pIns->nLength < 4) || (!pIns->nVolume)) pIns->nLength = 0;
-		pIns->nLoopStart = bswapLE16(pStm->loopbeg);
-		pIns->nLoopEnd = bswapLE16(pStm->loopend);
+		pIns->nLength = pStm->length;
+		if ((pIns->nLength < 2) || (!pIns->nVolume)) pIns->nLength = 0;
+		pIns->nLoopStart = pStm->loopbeg;
+		pIns->nLoopEnd = pStm->loopend;
 		if ((pIns->nLoopEnd > pIns->nLoopStart) && (pIns->nLoopEnd != 0xFFFF)) pIns->uFlags |= CHN_LOOP;
 	}
 	dwMemPos = sizeof(STMHEADER);
@@ -111,6 +111,7 @@
 	{
 		if (dwMemPos + 64*4*4 > dwMemLength) return TRUE;
 		PatternSize[nPat] = 64;
+		PatternAllocSize[nPat] = 64;
 		if ((Patterns[nPat] = AllocatePattern(64, m_nChannels)) == NULL) return TRUE;
 		MODCOMMAND *m = Patterns[nPat];
 		STMNOTE *p = (STMNOTE *)(lpStream + dwMemPos);