|
|
|
|
@ -251,12 +251,13 @@ BOOL CSoundFile::ReadMT2(LPCBYTE lpStream, DWORD dwMemLength)
|
|
|
|
|
{
|
|
|
|
|
DWORD nTxtLen = dwLen;
|
|
|
|
|
if (nTxtLen > 32000) nTxtLen = 32000;
|
|
|
|
|
try {
|
|
|
|
|
m_lpszSongComments = new char[nTxtLen]; // changed from CHAR
|
|
|
|
|
if (m_lpszSongComments)
|
|
|
|
|
{
|
|
|
|
|
memcpy(m_lpszSongComments, lpStream + dwMemPos + 1, nTxtLen - 1);
|
|
|
|
|
m_lpszSongComments[nTxtLen - 1] = 0;
|
|
|
|
|
}
|
|
|
|
|
catch (std::bad_alloc& ba) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
// SUM -> author name (or "Unregistered")
|
|
|
|
|
@ -402,10 +403,9 @@ BOOL CSoundFile::ReadMT2(LPCBYTE lpStream, DWORD dwMemLength)
|
|
|
|
|
INSTRUMENTHEADER *penv = NULL;
|
|
|
|
|
if (iIns <= m_nInstruments)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
penv = new INSTRUMENTHEADER;
|
|
|
|
|
Headers[iIns] = penv;
|
|
|
|
|
if (penv)
|
|
|
|
|
{
|
|
|
|
|
memset(penv, 0, sizeof(INSTRUMENTHEADER));
|
|
|
|
|
memcpy(penv->name, pmi->szName, 32);
|
|
|
|
|
penv->nGlobalVol = 64;
|
|
|
|
|
@ -415,6 +415,8 @@ BOOL CSoundFile::ReadMT2(LPCBYTE lpStream, DWORD dwMemLength)
|
|
|
|
|
penv->NoteMap[i] = i + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (std::bad_alloc& ba) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#ifdef MT2DEBUG
|
|
|
|
|
if (iIns <= pfh->wInstruments) Log(" Instrument #%d at offset %04X: %d bytes\n", iIns, dwMemPos, pmi->dwDataLen);
|
|
|
|
|
|