From: <rel...@us...> - 2008-12-21 13:30:11
|
Revision: 239 http://modplug.svn.sourceforge.net/modplug/?rev=239&view=rev Author: relabsoluness Date: 2008-12-21 13:30:05 +0000 (Sun, 21 Dec 2008) Log Message: ----------- . Plugins: When playing with MIDI keyboard, plugins got a constant note velocity, not the actual velocity (bug 2754) . File opening: Added a couple of return value checks to reduce the change of crash when opening lots of files (bug 2546) . Pattern cleanup: Sequence wasn't in some cases cleaned properly for mptm. / Pattern cleanup: Clearing sequence after first '---' item is now optional. . S3M saving: Sequence of length 241-255 should now be cut to length 240 instead of ~16. / S3M saving: Saved sequence is no longer cut on first '---' item. / Sequence: Sequence scrolling behavior for S3M is now the same as for XM/IT/MPTM. / Song properties: Minor rephrasing in flag descriptions. Modified Paths: -------------- trunk/OpenMPT/mptrack/Childfrm.cpp trunk/OpenMPT/mptrack/Ctrl_seq.cpp trunk/OpenMPT/mptrack/Globals.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/soundlib/Load_s3m.cpp Modified: trunk/OpenMPT/mptrack/Childfrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.cpp 2008-12-11 19:53:02 UTC (rev 238) +++ trunk/OpenMPT/mptrack/Childfrm.cpp 2008-12-21 13:30:05 UTC (rev 239) @@ -110,10 +110,10 @@ pModView->SetMDIParentFrame(m_hWnd); } - ChangeViewClass(RUNTIME_CLASS(CViewGlobals), pContext); + const BOOL bStatus = ChangeViewClass(RUNTIME_CLASS(CViewGlobals), pContext); - // it all worked, we now have a splitter window which contain two different views - return TRUE; + // If it all worked, we now have a splitter window which contain two different views + return bStatus; } //rewbs.varWindowSize Modified: trunk/OpenMPT/mptrack/Ctrl_seq.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2008-12-11 19:53:02 UTC (rev 238) +++ trunk/OpenMPT/mptrack/Ctrl_seq.cpp 2008-12-21 13:30:05 UTC (rev 239) @@ -116,13 +116,13 @@ UINT nPage; int nMax = 0; - if(pSndFile->TypeIsIT_MPT_XM()) - { // For IT/MPT/XM, show sequence until the last used item... - nMax = pSndFile->Order.GetLengthTailTrimmed(); + if(pSndFile->GetType() == MOD_TYPE_MOD) + { // With MOD, cut shown sequence to first '---' item... + nMax = pSndFile->Order.GetLengthFirstEmpty(); } else - { // ...and for MOD/S3M, cut shown sequence to first '---' item. - nMax = pSndFile->Order.GetLengthFirstEmpty(); + { // ...for S3M/IT/MPT/XM, show sequence until the last used item. + nMax = pSndFile->Order.GetLengthTailTrimmed(); } GetScrollInfo(SB_HORZ, &info, SIF_PAGE|SIF_RANGE); @@ -179,7 +179,10 @@ if(m_cxFont > 0) return static_cast<BYTE>(rcClient.right / m_cxFont); else - return static_cast<BYTE>(rcClient.right / GetFontWidth()); + { + const int nFontWidth = GetFontWidth(); + return (nFontWidth > 0) ? static_cast<BYTE>(rcClient.right / nFontWidth) : 0; + } } Modified: trunk/OpenMPT/mptrack/Globals.cpp =================================================================== --- trunk/OpenMPT/mptrack/Globals.cpp 2008-12-11 19:53:02 UTC (rev 238) +++ trunk/OpenMPT/mptrack/Globals.cpp 2008-12-21 13:30:05 UTC (rev 239) @@ -375,11 +375,16 @@ return FALSE; } if (!pDlg) return FALSE; + pDlg->SetDocument(GetDocument(), this); + pDlg->SetViewWnd(m_hWndView); + BOOL bStatus = pDlg->Create(nID, this); + if(bStatus == 0) // Creation failed. + { + delete pDlg; + return FALSE; + } m_nActiveDlg = nIndex; m_Pages[nIndex] = pDlg; - pDlg->SetDocument(GetDocument(), this); - pDlg->SetViewWnd(m_hWndView); - pDlg->Create(nID, this); } RecalcLayout(); pMainFrm->SetUserText(""); @@ -735,4 +740,4 @@ return HID_BASE_COMMAND + tbbn.idCommand; } return 0; -} \ No newline at end of file +} Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2008-12-11 19:53:02 UTC (rev 238) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2008-12-21 13:30:05 UTC (rev 239) @@ -882,8 +882,8 @@ if ((nPlugin) && (nPlugin <= MAX_MIXPLUGINS)) { IMixPlugin *pPlugin = m_SndFile.m_MixPlugins[nPlugin-1].pMixPlugin; - //if (pPlugin) pPlugin->MidiCommand(penv->nMidiChannel, penv->nMidiProgram, penv->wMidiBank, note, pChn->nVolume, MAX_BASECHANNELS); - if (pPlugin) pPlugin->MidiCommand(penv->nMidiChannel, penv->nMidiProgram, penv->wMidiBank, note, pChn->GetVSTVolume(), MAX_BASECHANNELS); + if (pPlugin) pPlugin->MidiCommand(penv->nMidiChannel, penv->nMidiProgram, penv->wMidiBank, note, pChn->nVolume, MAX_BASECHANNELS); + //if (pPlugin) pPlugin->MidiCommand(penv->nMidiChannel, penv->nMidiProgram, penv->wMidiBank, note, pChn->GetVSTVolume(), MAX_BASECHANNELS); } } } Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2008-12-11 19:53:02 UTC (rev 238) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2008-12-21 13:30:05 UTC (rev 239) @@ -509,6 +509,21 @@ vector<UINT> nPatRows(maxPatIndex, 0); vector<MODCOMMAND*> pPatterns(maxPatIndex, NULL); vector<BOOL> bPatUsed(maxPatIndex, false); + + const ORDERINDEX nLengthSub0 = m_SndFile.Order.GetLengthFirstEmpty(); + const ORDERINDEX nLengthUsed = m_SndFile.Order.GetLengthTailTrimmed(); + + // Flag to tell whether keeping sequence items which are after the first empty('---') order. + bool bKeepSubSequences = false; + + if(nLengthUsed != nLengthSub0) + { // There are used sequence items after first '---'; ask user whether to remove those. + if (CMainFrame::GetMainFrame()->MessageBox( + _TEXT("Do you want to remove sequence items which are after the first '---' item?"), + _TEXT("Sequence Cleanup"), MB_YESNO) != IDYES + ) + bKeepSubSequences = true; + } CHAR s[512]; BOOL bEnd = FALSE, bReordered = FALSE; @@ -522,7 +537,7 @@ if (n < maxPatIndex) { if (n >= maxpat) maxpat = n+1; - if (!bEnd) bPatUsed[n] = TRUE; + if (!bEnd || bKeepSubSequences) bPatUsed[n] = TRUE; } else if (n == m_SndFile.Order.GetInvalidPatIndex()) bEnd = TRUE; } nMinToRemove = 0; @@ -571,7 +586,7 @@ { if (nPatMap[n] > maxPatIndex) nPatMap[n] = nPats++; m_SndFile.Order[imap] = nPatMap[n]; - } else if (n == 0xFF) break; + } else if (n == m_SndFile.Order.GetInvalidPatIndex() && (bKeepSubSequences == false)) break; } // Add unused patterns at the end if ((!bRemove) || (!bWaste)) Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2008-12-11 19:53:02 UTC (rev 238) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2008-12-21 13:30:05 UTC (rev 239) @@ -277,10 +277,10 @@ { p->ShowWindow(XMorITorMPT); if(ITorMPT) - p->SetWindowText("0: Various playback changes for IT compatibility\n" - "1: Old instrument random variation behavior\n" - "2: Plugin volume command bug emulation"); - else if(XM) p->SetWindowText("0: Unused\n1: Unused\n2: Plugin volume command bug emulation"); + p->SetWindowText("1. Enable more IT compatible playback.\n" + "2. Use old random variation behavior for instruments.\n" + "3. Enable plugin volume command bug emulation."); + else if(XM) p->SetWindowText("1. Unused\n2. Unused\n3. Plugin volume command bug emulation"); } p = GetDlgItem(IDC_FLAGEDITTITLE); if(p) p->ShowWindow(XMorITorMPT); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2008-12-11 19:53:02 UTC (rev 238) +++ trunk/OpenMPT/mptrack/mptrack.rc 2008-12-21 13:30:05 UTC (rev 239) @@ -975,9 +975,9 @@ WS_EX_STATICEDGE EDITTEXT IDC_EDIT5,7,209,58,13,ES_AUTOHSCROLL | ES_READONLY EDITTEXT IDC_EDIT6,7,225,58,13,ES_AUTOHSCROLL | ES_READONLY - LTEXT "Miscellaneous flags",IDC_FLAGEDITTITLE,9,150,65,12, - SS_CENTERIMAGE - EDITTEXT IDC_EDIT_FLAGS,80,150,70,12,ES_AUTOHSCROLL + LTEXT "Miscellaneous flags(0/1):",IDC_FLAGEDITTITLE,9,150,81, + 12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_FLAGS,93,150,70,12,ES_AUTOHSCROLL LTEXT "",IDC_FLAG_EXPLANATIONS,9,164,217,26 END Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2008-12-11 19:53:02 UTC (rev 238) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2008-12-21 13:30:05 UTC (rev 239) @@ -493,7 +493,15 @@ header[0x1B] = 0; header[0x1C] = 0x1A; header[0x1D] = 0x10; - nbo = (GetNumPatterns() + 15) & 0xF0; + // Changes to 1.17.02.53: + // -Try to save whole sequence instead of stopping on first empty order. + // -With more than 0xF0 orders, limit sequence to 0xF0 instead of just masking with 0xF0. + //TODO: Check whether the 0xF0 mask is correct. + // (there are two bytes reserved from the header, so why 0xF0 mask?). + //nbo = (GetNumPatterns() + 15) & 0xF0; + nbo = Order.GetLengthTailTrimmed() + 15; + if(nbo > 0xF0) nbo = 0xF0; + nbo = nbo & 0xF0; if (!nbo) nbo = 16; header[0x20] = nbo & 0xFF; header[0x21] = nbo >> 8; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |