From: <sag...@us...> - 2009-08-10 16:08:36
|
Revision: 319 http://modplug.svn.sourceforge.net/modplug/?rev=319&view=rev Author: saga-games Date: 2009-08-10 16:08:26 +0000 (Mon, 10 Aug 2009) Log Message: ----------- [Fix] IT Compatiblity Export doesn't screw up patterns anymore if the module has more than 64 channels [Fix] S3M Loading: Don't read S3M "saved with" version before the file is actually verified to be a S3M file [Imp] XM Compatibility Export cuts off channels > 32 [Imp] XM Saving: When channel count is odd, the empty channel is now always the last one [Imp] IT Loading: Reading our custom tracker version now as well. [Imp] Got rid of the string lameness in the ID3 tagger Modified Paths: -------------- trunk/OpenMPT/mptrack/tagging.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/Load_xm.cpp Modified: trunk/OpenMPT/mptrack/tagging.cpp =================================================================== --- trunk/OpenMPT/mptrack/tagging.cpp 2009-08-09 23:07:50 UTC (rev 318) +++ trunk/OpenMPT/mptrack/tagging.cpp 2009-08-10 16:08:26 UTC (rev 319) @@ -87,11 +87,8 @@ if(!strcmp(cFrameID, "COMM")) { // English language for comments - no description following (hence the text ending nullchar(s)) - // HALP this is really lame, how is it done properly so the nullchar is not lost? - string sInfo; - sInfo = "eng"; // See http://en.wikipedia.org/wiki/ISO-639-2 - sInfo += ID3v2_TEXTENDING; - sFramecontent = sInfo + sFramecontent; + // For language IDs, see http://en.wikipedia.org/wiki/ISO-639-2 + sFramecontent = "eng" + (ID3v2_TEXTENDING + sFramecontent); } sFramecontent = ID3v2_CHARSET + sFramecontent; Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2009-08-09 23:07:50 UTC (rev 318) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2009-08-10 16:08:26 UTC (rev 319) @@ -984,6 +984,12 @@ } } + if((pifh->cwtv & 0xF000) == 0x5000) // OpenMPT Version number (Major.Minor) + { + m_dwLastSavedWithVersion = (pifh->cwtv & 0x0FFF) << 16; + interpretModplugmade = true; + } + if (pifh->flags & 0x08) m_dwSongFlags |= SONG_LINEARSLIDES; if (pifh->flags & 0x10) m_dwSongFlags |= SONG_ITOLDEFFECTS; if (pifh->flags & 0x20) m_dwSongFlags |= SONG_ITCOMPATMODE; @@ -2854,8 +2860,9 @@ for (UINT row=0; row<PatternSize[npat]; row++) { len = 0; - for (UINT ch=0; ch<nChannels; ch++, m++) + for (UINT ch = 0; ch < m_nChannels; ch++, m++) { + if(ch >= nChannels) continue; BYTE b = 0; UINT command = m->command; UINT param = m->param; Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-08-09 23:07:50 UTC (rev 318) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2009-08-10 16:08:26 UTC (rev 319) @@ -273,11 +273,12 @@ psfh.scrm = LittleEndian(psfh.scrm); psfh.special = LittleEndianW(psfh.special); + if ((!lpStream) || (dwMemLength <= sizeof(S3MFILEHEADER)+sizeof(S3MSAMPLESTRUCT)+64)) return false; + if (psfh.scrm != 0x4D524353) return false; + if((psfh.cwtv & 0xF000) == 0x5000) // OpenMPT Version number (Major.Minor) m_dwLastSavedWithVersion = (psfh.cwtv & 0x0FFF) << 16; - if ((!lpStream) || (dwMemLength <= sizeof(S3MFILEHEADER)+sizeof(S3MSAMPLESTRUCT)+64)) return false; - if (psfh.scrm != 0x4D524353) return false; dwMemPos = 0x60; m_nType = MOD_TYPE_S3M; memset(m_szNames,0,sizeof(m_szNames)); Modified: trunk/OpenMPT/soundlib/Load_xm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_xm.cpp 2009-08-09 23:07:50 UTC (rev 318) +++ trunk/OpenMPT/soundlib/Load_xm.cpp 2009-08-10 16:08:26 UTC (rev 319) @@ -694,8 +694,11 @@ header.size = sizeof(XMFILEHEADER); header.norder = 0; header.restartpos = m_nRestartPos; + header.channels = (m_nChannels + 1) & 0xFFFE; // avoid odd channel count for FT2 compatibility if(m_nChannels & 1) bAddChannel = true; + if(bCompatibilityExport && header.channels > 32) + header.channels = 32; header.patterns = 0; /*for (i=0; i<MAX_ORDERS; i++) { @@ -740,14 +743,17 @@ xmph[0] = 9; xmph[5] = (BYTE)(PatternSize[i] & 0xFF); xmph[6] = (BYTE)(PatternSize[i] >> 8); - for (UINT j=m_nChannels*PatternSize[i]; j; j--,p++) + for (UINT j = m_nChannels * PatternSize[i]; j > 0; j--, p++) { + // Don't write more than 32 channels + if(bCompatibilityExport && m_nChannels - ((j - 1) % m_nChannels) > 32) continue; + UINT note = p->note; UINT param = ModSaveCommand(p, true, bCompatibilityExport); UINT command = param >> 8; param &= 0xFF; if (note >= 0xFE) note = 97; else - if ((note <= 12) || (note > 96+12)) note = NOTE_NONE; else + if ((note <= 12) || (note > 96+12)) note = 0; else note -= 12; UINT vol = 0; if (p->volcmd) @@ -791,13 +797,14 @@ if (b & 16) s[len++] = param; } - if(bAddChannel && !(j % m_nChannels)) + if(bAddChannel && (j % m_nChannels == 1 || m_nChannels == 1)) { ASSERT_CAN_WRITE(1); s[len++] = 0x80; } ASSERT_CAN_WRITE(5); + } xmph[7] = (BYTE)(len & 0xFF); xmph[8] = (BYTE)(len >> 8); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |