From: <sag...@us...> - 2014-06-14 17:20:35
|
Revision: 4112 http://sourceforge.net/p/modplug/code/4112 Author: saga-games Date: 2014-06-14 17:20:24 +0000 (Sat, 14 Jun 2014) Log Message: ----------- [Fix] Pattern Editor: Don't crash when the module doesn't have any patterns. [Mod] Revert icon loading code to avoid black icons over RDP sessions (http://bugs.openmpt.org/view.php?id=530 vs http://bugs.openmpt.org/view.php?id=520) [Fix] Plugin Bridge: Unknown vendor-specific opcodes that send pointers are now rejected, as they cannot work over the bridge. [Fix] S3M Loader: Some files created with ST3 were detected as being made with Velvet Studio. [Fix] XM Loader: More intelligent handling of MIDI program loading for files that were not made with ModPlug. [Fix] IMF loader: Ignore note cut with a zero parameter. [Mod] Installer: Rename "Launch OpenMPT" start menu shortcut to just OpenMPT (per Windows design guidelines) [Ref] Various small cleanup changes [Fix] Adapt manual generator to MediaWiki 1.23 [Doc] Updated release note documents. [Mod] OpenMPT: Version is now 1.23.04.00 Modified Paths: -------------- trunk/OpenMPT/common/StringFixer.h trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/installer/install.iss trunk/OpenMPT/mptrack/CImageListEx.cpp trunk/OpenMPT/mptrack/CTreeCtrl.h trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/PNG.cpp trunk/OpenMPT/mptrack/PNG.h trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/manual_generator/run.cmd trunk/OpenMPT/mptrack/manual_generator/source/help.css trunk/OpenMPT/mptrack/manual_generator/wiki.py trunk/OpenMPT/packageTemplate/History.txt trunk/OpenMPT/pluginBridge/Bridge.cpp trunk/OpenMPT/soundlib/Load_ams.cpp trunk/OpenMPT/soundlib/Load_imf.cpp trunk/OpenMPT/soundlib/Load_s3m.cpp trunk/OpenMPT/soundlib/XMTools.cpp Modified: trunk/OpenMPT/common/StringFixer.h =================================================================== --- trunk/OpenMPT/common/StringFixer.h 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/common/StringFixer.h 2014-06-14 17:20:24 UTC (rev 4112) @@ -371,7 +371,7 @@ void CopyN(char (&destBuffer)[destSize], const char *srcBuffer, const size_t srcSize = SIZE_MAX) //---------------------------------------------------------------------------------------------- { - const size_t copySize = MIN(destSize - 1, srcSize); + const size_t copySize = std::min(destSize - 1u, srcSize); std::strncpy(destBuffer, srcBuffer, copySize); destBuffer[copySize] = '\0'; } Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/common/versionNumber.h 2014-06-14 17:20:24 UTC (rev 4112) @@ -18,8 +18,8 @@ //Version definitions. The only thing that needs to be changed when changing version number. #define VER_MAJORMAJOR 1 #define VER_MAJOR 23 -#define VER_MINOR 03 -#define VER_MINORMINOR 02 +#define VER_MINOR 04 +#define VER_MINORMINOR 00 //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/installer/install.iss =================================================================== --- trunk/OpenMPT/installer/install.iss 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/installer/install.iss 2014-06-14 17:20:24 UTC (rev 4112) @@ -102,7 +102,7 @@ [Icons] ; start menu -Name: {group}\{cm:LaunchProgram,OpenMPT}; Filename: {app}\mptrack.exe +Name: {group}\OpenMPT; Filename: {app}\mptrack.exe Name: {group}\{cm:UninstallProgram,OpenMPT}; Filename: {uninstallexe} Name: {group}\ModPlug Central; Filename: {app}\ModPlug Central.url Modified: trunk/OpenMPT/mptrack/CImageListEx.cpp =================================================================== --- trunk/OpenMPT/mptrack/CImageListEx.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/CImageListEx.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -80,8 +80,8 @@ } CBitmap dib, dibMask; - bitmap->ToDIB(dib); - bitmapMask.ToDIB(dibMask); + bitmap->ToDIB(dib, dc); + bitmapMask.ToDIB(dibMask, dc); result = CImageList::Create(cx, cy, ILC_COLOR24 | ILC_MASK, nInitial, nGrow) && CImageList::Add(&dib, &dibMask); @@ -89,7 +89,7 @@ { // 32-bit image on modern system CBitmap dib; - bitmap->ToDIB(dib); + bitmap->ToDIB(dib, dc); result = CImageList::Create(cx, cy, ILC_COLOR32, nInitial, nGrow) && CImageList::Add(&dib, RGB(0, 0, 0)); } Modified: trunk/OpenMPT/mptrack/CTreeCtrl.h =================================================================== --- trunk/OpenMPT/mptrack/CTreeCtrl.h 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/CTreeCtrl.h 2014-06-14 17:20:24 UTC (rev 4112) @@ -21,12 +21,12 @@ #ifndef UNICODE BOOL GetItem(TVITEMW *pItem) const { - return ::SendMessage(m_hWnd, TVM_GETITEMW, 0, (LPARAM)pItem) ? TRUE : FALSE; + return ::SendMessage(m_hWnd, TVM_GETITEMW, 0, (LPARAM)pItem); } BOOL SetItem(TVITEMW *pItem) { - return ::SendMessage(m_hWnd, TVM_SETITEMW, 0, (LPARAM)pItem) ? TRUE : FALSE; + return ::SendMessage(m_hWnd, TVM_SETITEMW, 0, (LPARAM)pItem); } BOOL SetItem(HTREEITEM hItem, UINT nMask, const WCHAR *lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) { @@ -107,7 +107,7 @@ tvi.mask = TVIF_TEXT; CStringW str; int nLen = 128; - int nRes; + size_t nRes; do { nLen *= 2; @@ -115,7 +115,7 @@ tvi.cchTextMax = nLen; ::SendMessage(m_hWnd, TVM_GETITEMW, 0, (LPARAM)&tvi); nRes = wcslen(tvi.pszText); - } while (nRes >= nLen - 1); + } while (nRes >= size_t(nLen - 1)); str.ReleaseBuffer(); return str; #endif // UNICODE Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -20,13 +20,7 @@ #include "math.h" #include "../common/misc_util.h" -// -> CODE#0015 -// -> DESC="channels management dlg" -#include "Ctrl_pat.h" -#include "ctrl_gen.h" -// -! NEW_FEATURE#0015 - OPENMPT_NAMESPACE_BEGIN @@ -193,13 +187,14 @@ } if(delay) { - CModSpecifications specs = m_sndFile.GetModSpecifications(); uint32 newTempo = 60000 * numSamples; if(m_sndFile.m_nTempoMode != tempo_mode_modern) { newTempo = (newTempo * m_sndFile.m_nDefaultSpeed * m_sndFile.m_nDefaultRowsPerBeat) / 24; } newTempo /= delay; + + const CModSpecifications specs = m_sndFile.GetModSpecifications(); Limit(newTempo, specs.tempoMin, specs.tempoMax); SetDlgItemInt(IDC_EDIT_TEMPO, newTempo, FALSE); } Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -347,8 +347,11 @@ nPat = (PATTERNINDEX)(dwHintMask >> HINT_SHIFT_PAT); else nPat = (PATTERNINDEX)SendViewMessage(VIEWMSG_GETCURRENTPATTERN); - m_sndFile.Patterns[nPat].GetName(s); - m_EditPatName.SetWindowText(s); + if(m_sndFile.Patterns.IsValidIndex(nPat)) + { + m_sndFile.Patterns[nPat].GetName(s); + m_EditPatName.SetWindowText(s); + } BOOL bXMIT = (m_sndFile.GetType() & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) ? TRUE : FALSE; m_ToolBar.EnableButton(ID_PATTERN_MIDIMACRO, bXMIT); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -46,13 +46,13 @@ #define FLOAT_ERROR 1.0e-20f // Float point comparison -bool EqualTof(const float a, const float b) +static bool EqualTof(const float a, const float b) { return (fabs(a - b) <= FLOAT_ERROR); } // Round floating point value to "digit" number of digits -float Round(const float value, const int digit) +static float Round(const float value, const int digit) { float v = 0.1f * (value * powf(10.0f, (float)(digit + 1)) + (value < 0.0f ? -5.0f : 5.0f)); modff(v, &v); @@ -60,7 +60,7 @@ } template<int v> -int PowerOf2Exponent() +static int PowerOf2Exponent() { if(v <= 1) return 0; @@ -1564,9 +1564,8 @@ void CCtrlSamples::OnDownsample() //------------------------------- { - DWORD dwStart, dwEnd, dwRemove, dwNewLen; - UINT smplsize; - PVOID pOriginal, pNewSample; + SmpLength dwStart, dwEnd, dwRemove, dwNewLen; + SmpLength smplsize; if((!m_sndFile.GetSample(m_nSample).pSample)) return; BeginWaitCursor(); @@ -1583,11 +1582,10 @@ dwEnd = sample.nLength; } smplsize = sample.GetBytesPerSample(); - pOriginal = sample.pSample; + void *pOriginal = sample.pSample, *pNewSample = nullptr; dwRemove = (dwEnd-dwStart+1)>>1; dwNewLen = sample.nLength - dwRemove; dwEnd = dwStart+dwRemove*2; - pNewSample = NULL; if ((dwNewLen >= 4) && (dwRemove)) pNewSample = ModSample::AllocateSample(dwNewLen, smplsize); if (pNewSample) { @@ -1808,7 +1806,7 @@ break; case 3 : _tcscpy(str, _T("Not enough memory...")); break; - case 6 : _tcscpy(str, _T("Too short sample")); + case 6 : _tcscpy(str, _T("Sample too short")); break; default: _tcscpy(str, _T("Unknown Error...")); break; @@ -2688,7 +2686,6 @@ sample.uFlags.set(CHN_SUSTAINLOOP, n > 0); sample.uFlags.set(CHN_PINGPONGSUSTAIN, n == 2); - // set sustain loop points if theren't any if(wasDisabled && sample.uFlags[CHN_SUSTAINLOOP] && sample.nSustainStart == sample.nSustainEnd) { Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -484,12 +484,10 @@ pfnt->nNumX, pfnt->nNumY+((val / 10)%10)*COLUMN_HEIGHT); m_Dib.TextBlt(x+pfnt->nVolCmdWidth+pfnt->nVolHiWidth, y, pfnt->nEltWidths[2]-(pfnt->nVolCmdWidth+pfnt->nVolHiWidth), COLUMN_HEIGHT, pfnt->nNumX, pfnt->nNumY+(val % 10)*COLUMN_HEIGHT); - } - else + } else { - static_assert(MAX_VOLCMDS <= 16, "Pattern draw code assumes <= 16 volume commands"); - ModCommand::VOLCMD volcmd = (mc.volcmd & 0x0F); - int vol = (mc.vol & 0x7F); + ModCommand::VOLCMD volcmd = std::min<ModCommand::VOLCMD>(mc.volcmd, MAX_VOLCMDS - 1); + int vol = (mc.vol & 0x7F); if(drawDefaultVolume) { @@ -541,25 +539,23 @@ HGDIOBJ oldpen; CRect rcClient, rect, rc; const CModDoc *pModDoc; - const CSoundFile *pSndFile; HDC hdc; CHANNELINDEX xofs; ROWINDEX yofs; - UINT nColumnWidth, ncols, nrows, ncolhdr; + UINT nColumnWidth, ncols, ncolhdr; int xpaint, ypaint, mixPlug; ASSERT(pDC); UpdateSizes(); - if ((pModDoc = GetDocument()) == NULL) return; + if ((pModDoc = GetDocument()) == nullptr) return; GetClientRect(&rcClient); hdc = pDC->m_hDC; oldpen = ::SelectObject(hdc, CMainFrame::penDarkGray); xofs = static_cast<CHANNELINDEX>(GetXScrollPos()); yofs = static_cast<ROWINDEX>(GetYScrollPos()); - pSndFile = pModDoc->GetSoundFile(); + const CSoundFile &sndFile = pModDoc->GetrSoundFile(); nColumnWidth = m_szCell.cx; - nrows = (pSndFile->Patterns[m_nPattern]) ? pSndFile->Patterns[m_nPattern].GetNumRows() : 0; - ncols = pSndFile->GetNumChannels(); + ncols = sndFile.GetNumChannels(); xpaint = m_szHeader.cx; ypaint = rcClient.top; ncolhdr = xofs; @@ -577,24 +573,14 @@ rect.SetRect(xpaint, ypaint, xpaint+nColumnWidth, ypaint + m_szHeader.cy); if (ncolhdr < ncols) { -// -> CODE#0012 -// -> DESC="midi keyboard split" - const char *pszfmt = pSndFile->m_bChannelMuteTogglePending[ncolhdr]? "[Channel %d]" : "Channel %d"; -// const char *pszfmt = pModDoc->IsChannelRecord(ncolhdr) ? "Channel %d " : "Channel %d"; -// -! NEW_FEATURE#0012 - if ((pSndFile->GetType() & (MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT)) && ((BYTE)pSndFile->ChnSettings[ncolhdr].szName[0] >= ' ')) - pszfmt = pSndFile->m_bChannelMuteTogglePending[ncolhdr] ? "%d: [%s]" : "%d: %s"; - else if (m_nDetailLevel < PatternCursor::volumeColumn) pszfmt = pSndFile->m_bChannelMuteTogglePending[ncolhdr] ? "[Ch%d]" : "Ch%d"; - else if (m_nDetailLevel < PatternCursor::effectColumn) pszfmt = pSndFile->m_bChannelMuteTogglePending[ncolhdr] ? "[Chn %d]" : "Chn %d"; - wsprintf(s, pszfmt, ncolhdr + 1, pSndFile->ChnSettings[ncolhdr].szName); -// -> CODE#0012 -// -> DESC="midi keyboard split" -// DrawButtonRect(hdc, &rect, s, -// (pSndFile->ChnSettings[ncolhdr].dwFlags & CHN_MUTE) ? TRUE : FALSE, -// ((m_bInItemRect) && ((m_nDragItem & DRAGITEM_MASK) == DRAGITEM_CHNHEADER) && ((m_nDragItem & DRAGITEM_VALUEMASK) == ncolhdr)) ? TRUE : FALSE, DT_CENTER); -// rect.bottom = rect.top + COLHDR_HEIGHT; + const char *pszfmt = sndFile.m_bChannelMuteTogglePending[ncolhdr]? "[Channel %d]" : "Channel %d"; + if ((sndFile.GetType() & (MOD_TYPE_XM | MOD_TYPE_IT | MOD_TYPE_MPT)) && sndFile.ChnSettings[ncolhdr].szName[0] != 0) + pszfmt = sndFile.m_bChannelMuteTogglePending[ncolhdr] ? "%d: [%s]" : "%d: %s"; + else if (m_nDetailLevel < PatternCursor::volumeColumn) pszfmt = sndFile.m_bChannelMuteTogglePending[ncolhdr] ? "[Ch%d]" : "Ch%d"; + else if (m_nDetailLevel < PatternCursor::effectColumn) pszfmt = sndFile.m_bChannelMuteTogglePending[ncolhdr] ? "[Chn %d]" : "Chn %d"; + wsprintf(s, pszfmt, ncolhdr + 1, sndFile.ChnSettings[ncolhdr].szName); DrawButtonRect(hdc, &rect, s, - pSndFile->ChnSettings[ncolhdr].dwFlags[CHN_MUTE] ? TRUE : FALSE, + sndFile.ChnSettings[ncolhdr].dwFlags[CHN_MUTE] ? TRUE : FALSE, ((m_bInItemRect) && ((m_nDragItem & DRAGITEM_MASK) == DRAGITEM_CHNHEADER) && ((m_nDragItem & DRAGITEM_VALUEMASK) == ncolhdr)) ? TRUE : FALSE, pModDoc->IsChannelRecord(static_cast<CHANNELINDEX>(ncolhdr)) ? DT_RIGHT : DT_CENTER); @@ -617,20 +603,15 @@ CRect insRect; insRect.SetRect(xpaint, ypaint, xpaint+nColumnWidth / 8 + 3, ypaint + 16); -// if (MultiRecordMask[ncolhdr>>3] & (1 << (ncolhdr&7))) if (pModDoc->IsChannelRecord1(static_cast<CHANNELINDEX>(ncolhdr))) { -// rect.DeflateRect(1, 1); -// InvertRect(hdc, &rect); -// rect.InflateRect(1, 1); FrameRect(hdc,&rect,CMainFrame::brushGray); InvertRect(hdc, &rect); s[0] = '1'; s[1] = '\0'; DrawButtonRect(hdc, &insRect, s, FALSE, FALSE, DT_CENTER); FrameRect(hdc,&insRect,CMainFrame::brushBlack); - } - else if (pModDoc->IsChannelRecord2(static_cast<CHANNELINDEX>(ncolhdr))) + } else if (pModDoc->IsChannelRecord2(static_cast<CHANNELINDEX>(ncolhdr))) { FrameRect(hdc,&rect,CMainFrame::brushGray); InvertRect(hdc, &rect); @@ -639,7 +620,6 @@ DrawButtonRect(hdc, &insRect, s, FALSE, FALSE, DT_CENTER); FrameRect(hdc,&insRect,CMainFrame::brushBlack); } -// -! NEW_FEATURE#0012 if(m_Status[psShowVUMeters]) { @@ -652,12 +632,11 @@ { rect.top+=PLUGNAME_HEIGHT; rect.bottom+=PLUGNAME_HEIGHT; - mixPlug=pSndFile->ChnSettings[ncolhdr].nMixPlugin; - if (mixPlug) { - wsprintf(s, "%d: %s", mixPlug, (pSndFile->m_MixPlugins[mixPlug - 1]).pMixPlugin ? (pSndFile->m_MixPlugins[mixPlug - 1]).GetName() : "[empty]"); - } else { + mixPlug = sndFile.ChnSettings[ncolhdr].nMixPlugin; + if (mixPlug) + wsprintf(s, "%d: %s", mixPlug, (sndFile.m_MixPlugins[mixPlug - 1]).pMixPlugin ? (sndFile.m_MixPlugins[mixPlug - 1]).GetName() : "[empty]"); + else wsprintf(s, "---"); - } DrawButtonRect(hdc, &rect, s, FALSE, ((m_bInItemRect) && ((m_nDragItem & DRAGITEM_MASK) == DRAGITEM_PLUGNAME) && ((m_nDragItem & DRAGITEM_VALUEMASK) == ncolhdr)) ? TRUE : FALSE, DT_CENTER); } @@ -668,6 +647,7 @@ } } ypaint += m_szHeader.cy; + if (m_nMidRow) { if (yofs >= m_nMidRow) @@ -684,24 +664,24 @@ const ORDERINDEX startOrder = static_cast<ORDERINDEX>(SendCtrlMessage(CTRLMSG_GETCURRENTORDER)); if(startOrder > 0) { - ORDERINDEX prevOrder = pSndFile->Order.GetPreviousOrderIgnoringSkips(startOrder); + ORDERINDEX prevOrder = sndFile.Order.GetPreviousOrderIgnoringSkips(startOrder); //Skip +++ items - if(startOrder < pSndFile->Order.size() && pSndFile->Order[startOrder] == m_nPattern) + if(startOrder < sndFile.Order.size() && sndFile.Order[startOrder] == m_nPattern) { - nPrevPat = pSndFile->Order[prevOrder]; + nPrevPat = sndFile.Order[prevOrder]; } } } - if(pSndFile->Patterns.IsValidPat(nPrevPat)) + if(sndFile.Patterns.IsValidPat(nPrevPat)) { - ROWINDEX nPrevRows = pSndFile->Patterns[nPrevPat].GetNumRows(); - ROWINDEX n = MIN(static_cast<ROWINDEX>(nSkip), nPrevRows); + ROWINDEX nPrevRows = sndFile.Patterns[nPrevPat].GetNumRows(); + ROWINDEX n = std::min(static_cast<ROWINDEX>(nSkip), nPrevRows); ypaint += (nSkip - n) * m_szCell.cy; rect.SetRect(0, m_szHeader.cy, nColumnWidth * ncols + m_szHeader.cx, ypaint - 1); m_Dib.SetBlendMode(0x80); - DrawPatternData(hdc, pSndFile, nPrevPat, false, false, + DrawPatternData(hdc, nPrevPat, false, false, nPrevRows - n, nPrevRows, xofs, rcClient, &ypaint); m_Dib.SetBlendMode(0); } else @@ -718,8 +698,10 @@ yofs = 0; } } + + UINT nrows = sndFile.Patterns.IsValidPat(m_nPattern) ? sndFile.Patterns[m_nPattern].GetNumRows() : 0; int ypatternend = ypaint + (nrows-yofs)*m_szCell.cy; - DrawPatternData(hdc, pSndFile, m_nPattern, TRUE, (pMainFrm->GetModPlaying() == pModDoc), + DrawPatternData(hdc, m_nPattern, TRUE, (pMainFrm->GetModPlaying() == pModDoc), yofs, nrows, xofs, rcClient, &ypaint); // Display next pattern if ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_SHOWPREVIOUS) && (ypaint < rcClient.bottom) && (ypaint == ypatternend)) @@ -730,22 +712,22 @@ PATTERNINDEX nNextPat = PATTERNINDEX_INVALID; const ORDERINDEX startOrder= static_cast<ORDERINDEX>(SendCtrlMessage(CTRLMSG_GETCURRENTORDER)); - ORDERINDEX nNextOrder = pSndFile->Order.GetNextOrderIgnoringSkips(startOrder); + ORDERINDEX nNextOrder = sndFile.Order.GetNextOrderIgnoringSkips(startOrder); if(nNextOrder == startOrder) nNextOrder = ORDERINDEX_INVALID; //Ignore skip items(+++) from sequence. - const ORDERINDEX ordCount = pSndFile->Order.GetLength(); + const ORDERINDEX ordCount = sndFile.Order.GetLength(); - if(nNextOrder < ordCount && pSndFile->Order[startOrder] == m_nPattern) + if(nNextOrder < ordCount && sndFile.Order[startOrder] == m_nPattern) { - nNextPat = pSndFile->Order[nNextOrder]; + nNextPat = sndFile.Order[nNextOrder]; } - if(pSndFile->Patterns.IsValidPat(nNextPat)) + if(sndFile.Patterns.IsValidPat(nNextPat)) { - ROWINDEX nNextRows = pSndFile->Patterns[nNextPat].GetNumRows(); - ROWINDEX n = MIN(static_cast<ROWINDEX>(nVisRows), nNextRows); + ROWINDEX nNextRows = sndFile.Patterns[nNextPat].GetNumRows(); + ROWINDEX n = std::min(static_cast<ROWINDEX>(nVisRows), nNextRows); m_Dib.SetBlendMode(0x80); - DrawPatternData(hdc, pSndFile, nNextPat, false, false, + DrawPatternData(hdc, nNextPat, false, false, 0, n, xofs, rcClient, &ypaint); m_Dib.SetBlendMode(0); } @@ -788,23 +770,29 @@ } -void CViewPattern::DrawPatternData(HDC hdc, const CSoundFile *pSndFile, PATTERNINDEX nPattern, bool selEnable, +void CViewPattern::DrawPatternData(HDC hdc, PATTERNINDEX nPattern, bool selEnable, bool isPlaying, ROWINDEX startRow, ROWINDEX numRows, CHANNELINDEX startChan, CRect &rcClient, int *pypaint) //------------------------------------------------------------------------------------------------------------- { uint8 selectedCols[MAX_BASECHANNELS]; // Bit mask of selected channel components static_assert(PatternCursor::lastColumn <= 7, "Columns are used as bitmasks here."); + const CSoundFile &sndFile = GetDocument()->GetrSoundFile(); + if(!sndFile.Patterns.IsValidPat(nPattern)) + { + return; + } + PCPATTERNFONT pfnt = GetCurrentPatternFont(); const ModCommand m0 = ModCommand::Empty(); - const ModCommand *pPattern = pSndFile->Patterns[nPattern]; + const ModCommand *pPattern = sndFile.Patterns[nPattern]; CHAR s[256]; CRect rect; int xpaint, ypaint = *pypaint; int row_col, row_bkcol; UINT bSpeedUp, nColumnWidth; - CHANNELINDEX ncols = pSndFile->GetNumChannels(); + CHANNELINDEX ncols = sndFile.GetNumChannels(); nColumnWidth = m_szCell.cx; rect.SetRect(m_szHeader.cx, rcClient.top, m_szHeader.cx+nColumnWidth, rcClient.bottom); for(CHANNELINDEX cmk = startChan; cmk < ncols; cmk++) @@ -819,7 +807,7 @@ while ((maxcol > startChan) && (selectedCols[maxcol-1] & COLUMN_BITS_INVISIBLE)) maxcol--; // Init bitmap border { - UINT maxndx = pSndFile->GetNumChannels() * m_szCell.cx; + UINT maxndx = sndFile.GetNumChannels() * m_szCell.cx; UINT ibmp = 0; if (maxndx > FASTBMP_MAXWIDTH) maxndx = FASTBMP_MAXWIDTH; do @@ -859,15 +847,15 @@ row_bkcol = MODCOLOR_BACKNORMAL; // time signature highlighting - ROWINDEX nBeat = pSndFile->m_nDefaultRowsPerBeat, nMeasure = pSndFile->m_nDefaultRowsPerMeasure; - if(pSndFile->Patterns[nPattern].GetOverrideSignature()) + ROWINDEX nBeat = sndFile.m_nDefaultRowsPerBeat, nMeasure = sndFile.m_nDefaultRowsPerMeasure; + if(sndFile.Patterns[nPattern].GetOverrideSignature()) { - nBeat = pSndFile->Patterns[nPattern].GetRowsPerBeat(); - nMeasure = pSndFile->Patterns[nPattern].GetRowsPerMeasure(); + nBeat = sndFile.Patterns[nPattern].GetRowsPerBeat(); + nMeasure = sndFile.Patterns[nPattern].GetRowsPerMeasure(); } // secondary highlight (beats) if ((TrackerSettings::Instance().m_dwPatternSetup & PATTERN_2NDHIGHLIGHT) - && (nBeat) && (nBeat < numRows)) + && (nBeat) && (nBeat < numRows)) { if(!(compRow % nBeat)) { @@ -975,14 +963,14 @@ { tx_col = MODCOLOR_NOTE; - if(pSndFile->m_SongFlags[SONG_PT1XMODE] && (m->note < NOTE_MIDDLEC - 12 || m->note >= NOTE_MIDDLEC + 2 * 12)) + if(sndFile.m_SongFlags[SONG_PT1XMODE] && (m->note < NOTE_MIDDLEC - 12 || m->note >= NOTE_MIDDLEC + 2 * 12)) { // MOD "ProTracker 1.x" flag: Highlight notes that are not supported by Amiga trackers. tx_col = MODCOLOR_DODGY_COMMANDS; - } else if(pSndFile->m_SongFlags[SONG_AMIGALIMITS] && m->instr != 0 && m->instr <= pSndFile->GetNumSamples()) + } else if(sndFile.m_SongFlags[SONG_AMIGALIMITS] && m->instr != 0 && m->instr <= sndFile.GetNumSamples()) { // S3M "Force Amiga Limits": Highlight notes that exceed the Amiga's frequency range. - UINT period = pSndFile->GetPeriodFromNote(m->note, 0, pSndFile->GetSample(m->instr).nC5Speed); + UINT period = sndFile.GetPeriodFromNote(m->note, 0, sndFile.GetSample(m->instr).nC5Speed); if(period < 113 * 4 || period > 856 * 4) { tx_col = MODCOLOR_DODGY_COMMANDS; @@ -996,8 +984,8 @@ } // Drawing note m_Dib.SetTextColor(tx_col, bk_col); - if(pSndFile->m_nType == MOD_TYPE_MPT && m->instr < MAX_INSTRUMENTS && pSndFile->Instruments[m->instr]) - DrawNote(xbmp+x, 0, m->note, pSndFile->Instruments[m->instr]->pTuning); + if(sndFile.GetType() == MOD_TYPE_MPT && m->instr < MAX_INSTRUMENTS && sndFile.Instruments[m->instr]) + DrawNote(xbmp+x, 0, m->note, sndFile.Instruments[m->instr]->pTuning); else //Original DrawNote(xbmp+x, 0, m->note); } @@ -1083,7 +1071,7 @@ { if(m->command != CMD_NONE) { - char n = pSndFile->GetModSpecifications().GetEffectLetter(m->command); + char n = sndFile.GetModSpecifications().GetEffectLetter(m->command); ASSERT(n > ' '); DrawLetter(xbmp+x, 0, n, pfnt->nEltWidths[3], pfnt->nCmdOfs); } else @@ -1187,7 +1175,7 @@ int x1, y1, x2, y2; int nChannels, nRows; - if(pSndFile == nullptr) return; + if(pSndFile == nullptr || !pSndFile->Patterns.IsValidPat(m_nPattern)) return; // Compute relative movement int dx = (int)m_DragPos.GetChannel() - (int)m_StartSel.GetChannel(); @@ -1307,7 +1295,7 @@ //----------------------------------- { const CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile) + if(pSndFile && pSndFile->Patterns.IsValidIndex(m_nPattern)) { CRect rect; SIZE sizeTotal, sizePage, sizeLine; @@ -1491,7 +1479,7 @@ // Get new selection area m_Selection = PatternRect(beginSel, endSel); const CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile != nullptr) + if(pSndFile != nullptr && pSndFile->Patterns.IsValidIndex(m_nPattern)) { m_Selection.Sanitize(pSndFile->Patterns[m_nPattern].GetNumRows(), pSndFile->GetNumChannels()); } @@ -1542,7 +1530,7 @@ //------------------------------------------ { const CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile) + if(pSndFile && pSndFile->Patterns.IsValidIndex(m_nPattern)) { int yofs = GetYScrollPos() - m_nMidRow; if (n == ROWINDEX_INVALID) n = GetCurrentRow(); @@ -1611,8 +1599,8 @@ nChn = m_Cursor.GetChannel(); s[0] = 0; if(!m_Status[psKeyboardDragSelect] - && (m_Selection.GetUpperLeft() == m_Selection.GetLowerRight()) && (pSndFile->Patterns[m_nPattern]) - && (GetCurrentRow() < pSndFile->Patterns[m_nPattern].GetNumRows()) && (nChn < pSndFile->m_nChannels)) + && (m_Selection.GetUpperLeft() == m_Selection.GetLowerRight()) && pSndFile->Patterns.IsValidIndex(m_nPattern) + && (GetCurrentRow() < pSndFile->Patterns[m_nPattern].GetNumRows()) && (nChn < pSndFile->GetNumChannels())) { const ModCommand *m = pSndFile->Patterns[m_nPattern].GetpModCommand(GetCurrentRow(), nChn); @@ -1715,7 +1703,7 @@ const CSoundFile *pSndFile = GetSoundFile(); CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if(pMainFrm != nullptr && pSndFile != nullptr) + if(pMainFrm != nullptr && pSndFile != nullptr && pSndFile->Patterns.IsValidIndex(m_nPattern)) { //xtraInfo.Format("Chan: %d; macro: %X; cutoff: %X; reso: %X; pan: %X", xtraInfo.Format("Chn:%d; Vol:%X; Mac:%X; Cut:%X%s; Res:%X; Pan:%X%s", @@ -1756,7 +1744,7 @@ bPlaying = (pMainFrm->GetFollowSong(pModDoc) == m_hWnd) ? TRUE : FALSE; x = m_szHeader.cx; nChn = xofs; - while ((nChn < pSndFile->m_nChannels) && (x < rcClient.right)) + while ((nChn < pSndFile->GetNumChannels()) && (x < rcClient.right)) { ChnVUMeters[nChn] = (WORD)pnotify->pos[nChn]; if ((!bPlaying) || pnotify->type[Notification::Stop]) ChnVUMeters[nChn] = 0; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -1083,7 +1083,7 @@ //OnPlayerPause(); // pause song - pausing VSTis is too slow // All notes off - for (UINT i=0; i<MAX_CHANNELS; i++) + for(CHANNELINDEX i = 0; i < MAX_CHANNELS; i++) { if ((i < GetNumChannels()) || (m_SndFile.m_PlayState.Chn[i].nMasterChn)) { @@ -2357,11 +2357,11 @@ ord = 0; pat = m_SndFile.Order[ord]; } - if(pat >= m_SndFile.Patterns.Size()) + if(!m_SndFile.Patterns.IsValidPat(pat)) { pat = 0; - } - if(row >= m_SndFile.Patterns[pat].GetNumRows()) + row = 0; + } else if(row >= m_SndFile.Patterns[pat].GetNumRows()) { row = 0; } Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -1284,7 +1284,7 @@ BOOL CSplashScreen::OnInitDialog() //-------------------------------- { - bitmap->ToDIB(m_Bitmap); + bitmap->ToDIB(m_Bitmap, GetDC()); CRect rect; int cx, cy, newcx, newcy; Modified: trunk/OpenMPT/mptrack/PNG.cpp =================================================================== --- trunk/OpenMPT/mptrack/PNG.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/PNG.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -182,4 +182,23 @@ } +// Create a DIB for the current device from our PNG. +bool PNG::Bitmap::ToDIB(CBitmap &bitmap, CDC *dc) const +//----------------------------------------------------- +{ + BITMAPINFOHEADER bi; + MemsetZero(bi); + bi.biSize = sizeof(BITMAPINFOHEADER); + bi.biWidth = width; + bi.biHeight = -(int32_t)height; + bi.biPlanes = 1; + bi.biBitCount = 32; + bi.biCompression = BI_RGB; + bi.biSizeImage = width * height * 4; + + if(dc == nullptr) dc = CDC::FromHandle(GetDC(NULL)); + return bitmap.CreateCompatibleBitmap(dc, width, height) + && SetDIBits(dc->GetSafeHdc(), bitmap, 0, height, GetPixels(), reinterpret_cast<BITMAPINFO *>(&bi), DIB_RGB_COLORS); +} + OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/mptrack/PNG.h =================================================================== --- trunk/OpenMPT/mptrack/PNG.h 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/PNG.h 2014-06-14 17:20:24 UTC (rev 4112) @@ -35,7 +35,7 @@ uint32_t GetNumPixels() const { return width * height; } // Create a DIB from our PNG. - bool ToDIB(CBitmap &bitmap) const { return bitmap.CreateBitmap(width, height, 1, 32, GetPixels()) != FALSE; } + bool ToDIB(CBitmap &bitmap, CDC *dc) const; }; Bitmap *ReadPNG(FileReader &file); Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -458,8 +458,6 @@ m_chkShare.EnableWindow(m_chkBridge.GetCheck() != BST_UNCHECKED); showBoxes = SW_SHOW; - } else - { } } else { Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -267,7 +267,7 @@ //--------------------------------------------------------------------------------------- { const CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile == nullptr) + if(pSndFile == nullptr || !pSndFile->Patterns.IsValidIndex(m_nPattern)) return false; if(wrap && pSndFile->Patterns[m_nPattern].GetNumRows()) @@ -545,7 +545,7 @@ //---------------------------------------------------------------------------------------------------------------- { const CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile == nullptr) + if(pSndFile == nullptr || !pSndFile->Patterns.IsValidPat(m_nPattern)) { return false; } @@ -792,7 +792,7 @@ //---------------------------------- { CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile == nullptr) + if(pSndFile == nullptr || !pSndFile->Patterns.IsValidPat(m_nPattern)) { return; } @@ -876,7 +876,7 @@ //----------------------------------- { CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile == nullptr) + if(pSndFile == nullptr || !pSndFile->Patterns.IsValidPat(m_nPattern)) { return; } @@ -1560,16 +1560,18 @@ // Double-clicked a pattern cell to select whole channel. // Continue dragging to select more channels. const CSoundFile *pSndFile = GetSoundFile(); - const ROWINDEX lastRow = pSndFile->Patterns[m_nPattern].GetNumRows() - 1; + if(pSndFile->Patterns.IsValidPat(m_nPattern)) + { + const ROWINDEX lastRow = pSndFile->Patterns[m_nPattern].GetNumRows() - 1; - CHANNELINDEX startChannel = m_Cursor.GetChannel(); - CHANNELINDEX endChannel = GetPositionFromPoint(point).GetChannel(); - - m_StartSel = PatternCursor(0, startChannel, (startChannel <= endChannel ? PatternCursor::firstColumn : PatternCursor::lastColumn)); - PatternCursor endSel = PatternCursor(lastRow, endChannel, (startChannel <= endChannel ? PatternCursor::lastColumn : PatternCursor::firstColumn)); + CHANNELINDEX startChannel = m_Cursor.GetChannel(); + CHANNELINDEX endChannel = GetPositionFromPoint(point).GetChannel(); - DragToSel(endSel, true, false, false); + m_StartSel = PatternCursor(0, startChannel, (startChannel <= endChannel ? PatternCursor::firstColumn : PatternCursor::lastColumn)); + PatternCursor endSel = PatternCursor(lastRow, endChannel, (startChannel <= endChannel ? PatternCursor::lastColumn : PatternCursor::firstColumn)); + DragToSel(endSel, true, false, false); + } } else if(m_Status[psRowSelection] && point.y > m_szHeader.cy) { // Mark row number => mark whole row (continue) @@ -1627,7 +1629,7 @@ //---------------------------------- { const CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile != nullptr) + if(pSndFile != nullptr && pSndFile->Patterns.IsValidPat(m_nPattern)) { SetCurSel(PatternCursor(0), PatternCursor(pSndFile->Patterns[m_nPattern].GetNumRows() - 1, pSndFile->GetNumChannels() - 1, PatternCursor::lastColumn)); } @@ -1638,7 +1640,7 @@ //------------------------------------- { const CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile != nullptr) + if(pSndFile != nullptr && pSndFile->Patterns.IsValidPat(m_nPattern)) { SetCurSel(PatternCursor(0, m_MenuCursor.GetChannel()), PatternCursor(pSndFile->Patterns[m_nPattern].GetNumRows() - 1, m_MenuCursor.GetChannel(), PatternCursor::lastColumn)); } @@ -1649,7 +1651,7 @@ //---------------------------------------- { const CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile != nullptr) + if(pSndFile != nullptr && pSndFile->Patterns.IsValidPat(m_nPattern)) { PatternCursor beginSel(0, GetCurrentChannel()); PatternCursor endSel(pSndFile->Patterns[m_nPattern].GetNumRows() - 1, GetCurrentChannel(), PatternCursor::lastColumn); @@ -2609,7 +2611,7 @@ //--------------------------------------------------------- { CSoundFile *sndFile = GetSoundFile(); - if(sndFile == nullptr) + if(sndFile == nullptr || !sndFile->Patterns.IsValidPat(m_nPattern)) { return; } @@ -4143,7 +4145,7 @@ case VIEWMSG_COPYPATTERN: { const CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile != nullptr) + if(pSndFile != nullptr && pSndFile->Patterns.IsValidPat(m_nPattern)) { CopyPattern(m_nPattern, PatternRect(PatternCursor(0, 0), PatternCursor(pSndFile->Patterns[m_nPattern].GetNumRows() - 1, pSndFile->GetNumChannels() - 1, PatternCursor::lastColumn))); } @@ -5402,6 +5404,10 @@ return; } CSoundFile &sndFile = pModDoc->GetrSoundFile(); + if(!sndFile.Patterns.IsValidPat(m_nPattern)) + { + return; + } const CHANNELINDEX chn = GetCurrentChannel(); const PatternRow rowBase = sndFile.Patterns[m_nPattern].GetRow(GetCurrentRow()); @@ -5907,7 +5913,7 @@ //---------------------------------------------- { CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile == nullptr) + if(pSndFile == nullptr || !pSndFile->Patterns.IsValidPat(m_nPattern)) { return; } @@ -6457,7 +6463,7 @@ //------------------------------------------------------------------------------------------------------------------------------------- { const CSoundFile *sndFile = GetSoundFile(); - if(startRow == endRow || sndFile == nullptr) + if(startRow == endRow || sndFile == nullptr || !sndFile->Patterns.IsValidPat(m_nPattern)) return false; bool result = false; @@ -6695,7 +6701,7 @@ //------------------------------------------- { const CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile == nullptr) + if(pSndFile == nullptr || !pSndFile->Patterns.IsValidPat(m_nPattern)) return 0; if(!pSndFile->Patterns[m_nPattern].GetOverrideSignature()) return pSndFile->m_nDefaultRowsPerBeat; @@ -6709,7 +6715,7 @@ //---------------------------------------------- { const CSoundFile *pSndFile = GetSoundFile(); - if(pSndFile == nullptr) + if(pSndFile == nullptr || !pSndFile->Patterns.IsValidPat(m_nPattern)) return 0; if(!pSndFile->Patterns[m_nPattern].GetOverrideSignature()) return pSndFile->m_nDefaultRowsPerMeasure; Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/View_pat.h 2014-06-14 17:20:24 UTC (rev 4112) @@ -20,8 +20,6 @@ class CEditCommand; class CEffectVis; //rewbs.fxvis class CPatternGotoDialog; -class CPatternRandomizer; -class COpenGLEditor; // Drag & Drop info #define DRAGITEM_VALUEMASK 0x00FFFFFF @@ -291,7 +289,7 @@ void ProcessChar(UINT nChar, UINT nFlags); public: - void DrawPatternData(HDC hdc, const CSoundFile *pSndFile, PATTERNINDEX nPattern, bool selEnable, bool isPlaying, ROWINDEX startRow, ROWINDEX numRows, CHANNELINDEX startChan, CRect &rcClient, int *pypaint); + void DrawPatternData(HDC hdc, PATTERNINDEX nPattern, bool selEnable, bool isPlaying, ROWINDEX startRow, ROWINDEX numRows, CHANNELINDEX startChan, CRect &rcClient, int *pypaint); void DrawLetter(int x, int y, char letter, int sizex=10, int ofsx=0); void DrawNote(int x, int y, UINT note, CTuning* pTuning = NULL); void DrawInstrument(int x, int y, UINT instr); Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -163,7 +163,7 @@ // Time signature. numerator = rows per beats / rows pear measure (should sound somewhat logical to you). // the denominator is a bit more tricky, since it cannot be set explicitely. so we just assume quarters for now. - timeInfo.timeSigNumerator = sndFile.m_PlayState.m_nCurrentRowsPerMeasure / MAX(sndFile.m_PlayState.m_nCurrentRowsPerBeat, 1); + timeInfo.timeSigNumerator = sndFile.m_PlayState.m_nCurrentRowsPerMeasure / std::max(sndFile.m_PlayState.m_nCurrentRowsPerBeat, ROWINDEX(1)); timeInfo.timeSigDenominator = 4; //gcd(pSndFile->m_nCurrentRowsPerMeasure, pSndFile->m_nCurrentRowsPerBeat); } } @@ -546,10 +546,10 @@ // Multiple paths const FileDialog::PathList &files = dlg.GetFilenames(); fileSel->nbReturnPath = files.size(); - fileSel->returnMultiplePaths = new char *[fileSel->nbReturnPath]; + fileSel->returnMultiplePaths = new (std::nothrow) char *[fileSel->nbReturnPath]; for(size_t i = 0; i < files.size(); i++) { - char *fname = new char[files[i].ToLocale().length() + 1]; + char *fname = new (std::nothrow) char[files[i].ToLocale().length() + 1]; strcpy(fname, files[i].ToLocale().c_str()); fileSel->returnMultiplePaths[i] = fname; } @@ -569,7 +569,7 @@ // Provide some memory for the return path. fileSel->sizeReturnPath = dlg.GetFirstFile().ToLocale().length() + 1; - fileSel->returnPath = new char[fileSel->sizeReturnPath]; + fileSel->returnPath = new (std::nothrow) char[fileSel->sizeReturnPath]; if(fileSel->returnPath == nullptr) { return 0; Modified: trunk/OpenMPT/mptrack/manual_generator/run.cmd =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/run.cmd 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/manual_generator/run.cmd 2014-06-14 17:20:24 UTC (rev 4112) @@ -2,6 +2,9 @@ REM mkdir html REM wiki.py copy source\*.* html\ +"%ProgramFiles%\7-zip\7z" x html.tgz +"%ProgramFiles%\7-zip\7z" x -y html.tar +del html.tar htmlhelp\hhc.exe "html\OpenMPT Manual.hhp" copy "html\OpenMPT Manual.chm" "..\..\packageTemplate\" @pause \ No newline at end of file Modified: trunk/OpenMPT/mptrack/manual_generator/source/help.css =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/source/help.css 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/manual_generator/source/help.css 2014-06-14 17:20:24 UTC (rev 4112) @@ -7,12 +7,22 @@ color: #000; } +img +{ + border: 0; +} + h1 { background-color: #DFEFFF; padding: 0.25em; } +h1, h2 +{ + border-bottom: 1px solid #aaa; +} + #content { margin: 0 !important; Modified: trunk/OpenMPT/mptrack/manual_generator/wiki.py =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/wiki.py 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/mptrack/manual_generator/wiki.py 2014-06-14 17:20:24 UTC (rev 4112) @@ -12,7 +12,7 @@ base_url = 'http://wiki.openmpt.org' -style = urlopen(base_url + '/load.php?debug=false&lang=en&modules=mediawiki.legacy.common%2Cshared|skins.vector&only=styles&*').read() +style = urlopen(base_url + '/load.php?debug=false&lang=en&modules=mediawiki.legacy.common%2Cshared|mediawiki.ui.button|skins.vector.styles&only=styles&skin=vector&*').read() # Remove a few unused CSS classes style = re.sub(r'\}(\w+)?[\.#]vector([\w >]+)\{.+?\}', '}', style) style_file = open('html/style.css', 'w') Modified: trunk/OpenMPT/packageTemplate/History.txt =================================================================== --- trunk/OpenMPT/packageTemplate/History.txt 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/packageTemplate/History.txt 2014-06-14 17:20:24 UTC (rev 4112) @@ -25,6 +25,56 @@ <ks> coda / Ken Snyder +v1.23.04.00 (14 June 2014, revision 4096) +----------------------------------------- +Pattern tab + [New] <js> Added possibility to interpolate the instrument column. + [Imp] <js> Stay at current order / pattern when removing something from the order list (http://bugs.openmpt.org/view.php?id=511). + [Fix] <js> With overflow paste, marking the pasted pattern area was not working when the paste ended exactly in the last pattern row (broke in OpenMPT 1.23.02.00). + [Fix] <js> Select / Copy Select keys should no longer interfere with mouse dragging (tx coda). + [Fix] <js> Don't crash when the module doesn't have any patterns. + [Fix] <jh> Fix flickering of current-row highlight in pattern view on Wine (http://bugs.openmpt.org/view.php?id=522). + +Sample tab + [Fix] <js> Setting sustain loop points by typing the values in didn't update the waveform display. + [Fix] <js> When removing DC offset from a sample, the wrong volume variable on channels currently playing the modified sample was modified. + +Tree view + [Fix] <js> It was not possible to drag and drop drums from sound banks (http://bugs.openmpt.org/view.php?id=536, x64 only). + +VST / DMO Plugins + [Imp] <js> Improve preset menu creation in the plugin editor for plugins with less than 128 presets, so that the menu is only created when needed (speeds up e.g. bridged VOPM). + [Imp] <js> When trying to load a plugin where both the 32-bit and 64-bit version are registered in OpenMPT, prefer the native version. + [Fix] <js> When trying to play notes in a VST GUI with no instrument assigned yet, prevent notes from being stuck after closing the instrument creation confirmation (tx coda). + +VST::Plugin Bridge + [Fix] <js> Don't crash when a plugin sends an opcode that isn't expected to have a data pointer set (http://bugs.openmpt.org/view.php?id=519). + [Fix] <js> Unknown vendor-specific opcodes that send pointers are now rejected, as they cannot work over the bridge. + +XM + [Fix] <js> More intelligent extraction of the selected MIDI program for files that were not made with ModPlug. + [Fix] <js> Loading ADPCM-compressed samples broke in OpenMPT 1.23 (http://bugs.openmpt.org/view.php?id=538). + +S3M + [Fix] <js> Some files created with Scream Tracker were detected as being made with Velvet Studio. + +MOD + [Fix] <js> Loading ADPCM-compressed samples was broken ever since OpenMPT 1.22.06.00. + +Other formats + [Fix] <js> IMF: Ignore note cut with a zero parameter. + +Audio I/O + [Mod] <jh> Default to 16-bit output on Wine, since some Wine versions apparently have problems with sample formats > 16bit. + [Fix] <jh> DirectSound: Emulated drivers do not support primary buffer access. Actually test whether the device is emulated or not and do not advertise primary buffer support if it is. + [Fix] <jh> Fix clamping / rounding of WaveOut and DirectSound buffer sizes for 24bit samples (http://bugs.openmpt.org/view.php?id=540). + +Misc + [Imp] <js> When loading plugins during startup, the error message that was potentially shown didn't appear in the task bar, making it easy to forget about such a half-initialized OpenMPT instance. + [Fix] <js> Potential fix for a crash when loading modules through the command-line (tx coda). + [Fix] <js> "Find MPT Hacks" erroneously identified FT2 pan law mix mode as a hack (http://bugs.openmpt.org/view.php?id=531). + + v1.23.03.00 (4 May 2014, revision 4039) --------------------------------------- VST / DMO Plugins @@ -40,7 +90,7 @@ [Fix] <js> Moving plugins unintentionally broke the plugin chain in many cases (http://bugs.openmpt.org/view.php?id=514). Pattern tab - [Imp] <js> Don't require shift key to be pressed when entering numeric effect letters on French keyboards (https://forum.openmpt.org/index.php?topic=5279.0). + [Imp] <js> Don't require shift key to be pressed when entering numeric effect letters on French keyboards (http://forum.openmpt.org/index.php?topic=5279.0). [Imp] <js> Channel mute / channel mute on pattern transition shortcuts got extended to cover all channels covered by the selection instead of just the channel where the cursor is. [Mod] <js> After pasting pattern data, the pasted area is automatically selected (http://bugs.openmpt.org/view.php?id=498). [Fix] <js> When "loop pattern" was enabled, jumping between patterns could trigger sample syncing while playback was paused. @@ -78,13 +128,13 @@ [Fix] <js> Rearranging samples broke in the previous version (http://bugs.openmpt.org/view.php?id=497). Audio I/O - [Fix] <js> With new installations (and probably also upgraded ones), it was possible that OpenMPT was internally rendering at a different sample rate than the sound device was outputting (https://forum.openmpt.org/index.php?topic=5265.0). + [Fix] <js> With new installations (and probably also upgraded ones), it was possible that OpenMPT was internally rendering at a different sample rate than the sound device was outputting (http://forum.openmpt.org/index.php?topic=5265.0). Misc [Imp] <js> All parts of the Song Properties dialog are now updated instantly when switching between formats. [Imp] <js> Made S3M amiga frequency limits option editable from the Song Properties dialog. [Mod] <js> Changed manual format from PDF to CHM. When opening help from certain dialogs, the relevant manual page is automatically opened. - [Fix] <js> SF2 sample frequency conversion was broken in 64-bit builds (https://bugs.openmpt.org/view.php?id=508). + [Fix] <js> SF2 sample frequency conversion was broken in 64-bit builds (http://bugs.openmpt.org/view.php?id=508). [Fix] <js> Modifying patterns, samples, etc. should now always update other views of the same type of the same module properly. [Fix] <js> DefaultTemplate option was looking for the template file in the wrong paths. Modified: trunk/OpenMPT/pluginBridge/Bridge.cpp =================================================================== --- trunk/OpenMPT/pluginBridge/Bridge.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/pluginBridge/Bridge.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -892,6 +892,11 @@ case audioMasterVendorSpecific: if(index != kVendorOpenMPT || value != kUpdateProcessingBuffer) { + if(ptr != 0) + { + // Cannot translate this. + return 0; + } break; } MPT_FALLTHROUGH; @@ -963,6 +968,12 @@ case audioMasterCanDo: // Name in [ptr] + if(!strcmp(ptrC, "openFileSelector") + || !strcmp(ptrC, "closeFileSelector")) + { + // Not supported through the bridge yet. + return -1; + } ptrOut = strlen(ptrC) + 1; dispatchData.insert(dispatchData.end(), ptrC, ptrC + ptrOut); break; Modified: trunk/OpenMPT/soundlib/Load_ams.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ams.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/soundlib/Load_ams.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -99,7 +99,7 @@ CMD_GLOBALVOLUME, // Global volume (0... 127) }; - static ModCommand dummy; + ModCommand dummy; for(ROWINDEX row = 0; row < pattern.GetNumRows(); row++) { Modified: trunk/OpenMPT/soundlib/Load_imf.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_imf.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/soundlib/Load_imf.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -364,7 +364,9 @@ break; case 0xC: // note cut case 0xD: // note delay - // no change + // Apparently, Imago Orpheus doesn't cut samples on tick 0. + if(!m.param) + m.command = CMD_NONE; break; case 0xE: // ignore envelope /* predicament: we can only disable one envelope at a time. Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -214,7 +214,7 @@ m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 16, 00, 00); madeWithTracker = "ModPlug Tracker / OpenMPT"; keepMidiMacros = true; - } else if(fileHeader.special == 0 && fileHeader.ultraClicks == 0 && fileHeader.flags == 0 && fileHeader.usePanningTable == 0) + } else if(fileHeader.cwtv == S3MFileHeader::trkST3_20 && fileHeader.special == 0 && fileHeader.ultraClicks == 0 && fileHeader.flags == 0 && fileHeader.usePanningTable == 0) { madeWithTracker = "Velvet Studio"; } else Modified: trunk/OpenMPT/soundlib/XMTools.cpp =================================================================== --- trunk/OpenMPT/soundlib/XMTools.cpp 2014-06-11 19:18:15 UTC (rev 4111) +++ trunk/OpenMPT/soundlib/XMTools.cpp 2014-06-14 17:20:24 UTC (rev 4112) @@ -233,8 +233,8 @@ { mptIns.nMidiChannel = midiChannel + MidiFirstChannel; Limit(mptIns.nMidiChannel, uint8(MidiFirstChannel), uint8(MidiLastChannel)); + mptIns.nMidiProgram = static_cast<uint8>(std::min(midiProgram, uint16(127)) + 1); } - //mptIns.nMidiProgram = midiProgram + 1; mptIns.midiPWD = static_cast<int8>(pitchWheelRange); } @@ -288,6 +288,7 @@ sampleHeaderSize = sizeof(XMSample); } else { + // TODO: FT2 completely ignores MIDI settings (and also the less important stuff) if not at least one (empty) sample is assigned to this instrument! size -= sizeof(XMInstrument); sampleHeaderSize = 0; } @@ -301,7 +302,7 @@ numSamples = instrument.ConvertToXM(mptIns, compatibilityExport); mpt::String::Write<mpt::String::spacePadded>(name, mptIns.name); - type = mptIns.nMidiProgram; // If FT2 writes crap here, we can do so, too! (we probably shouldn't, though.) + type = mptIns.nMidiProgram; // If FT2 writes crap here, we can do so, too! (we probably shouldn't, though. This is just for backwards compatibility with old MPT versions.) } @@ -325,7 +326,11 @@ mpt::String::Read<mpt::String::spacePadded>(mptIns.name, name); - mptIns.nMidiProgram = type; + // Old MPT backwards compatibility + if(!instrument.midiEnabled) + { + mptIns.nMidiProgram = type; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |