From: <sag...@us...> - 2014-01-15 21:00:13
|
Revision: 3578 http://sourceforge.net/p/modplug/code/3578 Author: saga-games Date: 2014-01-15 20:59:59 +0000 (Wed, 15 Jan 2014) Log Message: ----------- [Mod] MOD/S3M: If sample number next to a portamento effect differs from the previous number, the old sample is now kept (but the new default volume is being applied) (http://bugs.openmpt.org/view.php?id=474) . [Fix] Fixed potential overflow in MMCMP unpacker (fix from libmodplug) [Mod] OpenMPT: Version is now 1.22.07.14 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/soundlib/Mmcmp.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-01-15 20:43:07 UTC (rev 3577) +++ trunk/OpenMPT/common/versionNumber.h 2014-01-15 20:59:59 UTC (rev 3578) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 07 -#define VER_MINORMINOR 13 +#define VER_MINORMINOR 14 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/soundlib/Mmcmp.cpp =================================================================== --- trunk/OpenMPT/soundlib/Mmcmp.cpp 2014-01-15 20:43:07 UTC (rev 3577) +++ trunk/OpenMPT/soundlib/Mmcmp.cpp 2014-01-15 20:59:59 UTC (rev 3578) @@ -149,7 +149,9 @@ { for (UINT i=0; i<pblk->sub_blk; i++) { - if ((psubblk->unpk_pos > dwFileSize) || (psubblk->unpk_pos + psubblk->unpk_size > dwFileSize)) break; + if ((psubblk->unpk_pos >= dwFileSize) || + (psubblk->unpk_size >= dwFileSize) || + (psubblk->unpk_size > dwFileSize - psubblk->unpk_pos)) break; #ifdef MMCMP_LOG Log(" Unpacked sub-block %d: offset %d, size=%d\n", i, psubblk->unpk_pos, psubblk->unpk_size); #endif Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-01-15 20:43:07 UTC (rev 3577) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2014-01-15 20:59:59 UTC (rev 3578) @@ -688,23 +688,24 @@ bool returnAfterVolumeAdjust = false; - // IT compatibility: No sample change (also within multi-sample instruments) during portamento when using Compatible Gxx. - // Test case: PortaInsNumCompat.it, PortaSampleCompat.it - if(bPorta && pChn->pModSample != nullptr && pChn->pModSample != pSmp && IsCompatibleMode(TRK_IMPULSETRACKER) && m_SongFlags[SONG_ITCOMPATGXX]) - { - pSmp = pChn->pModSample; - } - // instrumentChanged is used for IT carry-on env option bool instrumentChanged = (pIns != pChn->pModInstrument); const bool sampleChanged = (pChn->pModSample != nullptr) && (pSmp != pChn->pModSample); - if(!instrumentChanged) + if(sampleChanged && bPorta) { - // Special XM hack - if ((bPorta) && (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2)) && (pIns) - && sampleChanged) + // IT compatibility: No sample change (also within multi-sample instruments) during portamento when using Compatible Gxx. + // Test case: PortaInsNumCompat.it, PortaSampleCompat.it + if(IsCompatibleMode(TRK_IMPULSETRACKER) && m_SongFlags[SONG_ITCOMPATGXX]) { + pSmp = pChn->pModSample; + } + + // Special XM hack (also applies to MOD / S3M) + // Test case: PortaSmpChange.mod, PortaSmpChange.s3m + if((!instrumentChanged && (GetType() & (MOD_TYPE_XM | MOD_TYPE_MT2)) && pIns) + || (GetType() & (MOD_TYPE_MOD | MOD_TYPE_S3M))) + { // FT2 doesn't change the sample in this case, // but still uses the sample info from the old one (bug?) returnAfterVolumeAdjust = true; @@ -734,11 +735,13 @@ // Update Volume if (bUpdVol) { - pChn->nVolume = 0; - if(pSmp) - pChn->nVolume = pSmp->nVolume; - else + if(!(GetType() & (MOD_TYPE_MOD | MOD_TYPE_S3M)) || pSmp->pSample != nullptr) { + pChn->nVolume = 0; + if(pSmp) + pChn->nVolume = pSmp->nVolume; + } else + { if(pIns && pIns->nMixPlug) pChn->nVolume = pChn->GetVSTVolume(); } @@ -3110,8 +3113,7 @@ pChn->nPortamentoDest = 0; pChn->m_CalculateFreq = true; } - } - else + } else { pChn->m_PortamentoFineSteps += slide; pChn->nPortamentoDest -= slide; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |