From: <sag...@us...> - 2011-10-12 19:10:48
|
Revision: 1103 http://modplug.svn.sourceforge.net/modplug/?rev=1103&view=rev Author: saga-games Date: 2011-10-12 19:10:41 +0000 (Wed, 12 Oct 2011) Log Message: ----------- [Fix] S3M Loader: MIDI Macros are now cleared when loading S3M files saved with Impulse Tracker 2.13 or older (fixes BABYLON.S3M by Necros) [Fix] Note Properties: When showing the note properties of a #xx effect, negative values could have been shown. [Mod] Pitch/Tempo lock cannot be used in IT files anymore. Files that make use of this setting still work, but it cannot be used for new files. [Mod] Main window is now always used as a parent window for message boxes if parent window is specified, to avoid "lost" message boxes (keyboard handler would be disabled as long as lost message boxes are still active). [Mod] OpenMPT: Version is now 1.20.00.42 Modified Paths: -------------- trunk/OpenMPT/common/Reporting.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/ModConvert.cpp trunk/OpenMPT/mptrack/ModConvert.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Load_s3m.cpp Modified: trunk/OpenMPT/common/Reporting.cpp =================================================================== --- trunk/OpenMPT/common/Reporting.cpp 2011-10-10 22:13:51 UTC (rev 1102) +++ trunk/OpenMPT/common/Reporting.cpp 2011-10-12 19:10:41 UTC (rev 1103) @@ -23,6 +23,10 @@ pMainFrm->GetInputHandler()->Bypass(true); } + if(parent == nullptr) + { + parent = pMainFrm; + } UINT result = ::MessageBox((parent ? parent->m_hWnd : NULL), text, caption, flags); if(pMainFrm != nullptr && pMainFrm->GetInputHandler() != nullptr) Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-10-10 22:13:51 UTC (rev 1102) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2011-10-12 19:10:41 UTC (rev 1103) @@ -1164,6 +1164,9 @@ if (((dwHintMask >> HINT_SHIFT_INS) != m_nInstrument) && (dwHintMask & (HINT_INSTRUMENT|HINT_ENVELOPE)) && (!(dwHintMask & HINT_MODTYPE))) return; LockControls(); if (!m_bInitialized) dwHintMask |= HINT_MODTYPE; + + MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument]; + if (dwHintMask & HINT_MODTYPE) { const CModSpecifications *specs = &m_pSndFile->GetModSpecifications(); @@ -1172,10 +1175,10 @@ m_EditName.SetLimitText(specs->instrNameLengthMax); m_EditFileName.SetLimitText(specs->instrFilenameLengthMax); - const BOOL bITandMPT = ((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE; + const BOOL bITandMPT = ((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT)) && (m_pSndFile->GetNumInstruments())) ? TRUE : FALSE; //rewbs.instroVSTi - const BOOL bITandXM = ((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM)) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE; - const BOOL bMPTOnly = ((m_pSndFile->m_nType == MOD_TYPE_MPT) && (m_pSndFile->m_nInstruments)) ? TRUE : FALSE; + const BOOL bITandXM = ((m_pSndFile->m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_XM)) && (m_pSndFile->GetNumInstruments())) ? TRUE : FALSE; + const BOOL bMPTOnly = ((m_pSndFile->m_nType == MOD_TYPE_MPT) && (m_pSndFile->GetNumInstruments())) ? TRUE : FALSE; ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT10), bITandXM); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT11), bITandXM); ::EnableWindow(::GetDlgItem(m_hWnd, IDC_EDIT7), bITandXM); @@ -1223,13 +1226,12 @@ m_SpinInstrument.SetRange(1, m_pSndFile->m_nInstruments); m_SpinInstrument.EnableWindow((m_pSndFile->m_nInstruments) ? TRUE : FALSE); m_ComboTuning.EnableWindow(bMPTOnly); - m_EditPitchTempoLock.EnableWindow(bITandMPT); - m_CheckPitchTempoLock.EnableWindow(bITandMPT); + m_EditPitchTempoLock.EnableWindow(bMPTOnly); + m_CheckPitchTempoLock.EnableWindow(bMPTOnly); } if (dwHintMask & (HINT_INSTRUMENT|HINT_MODTYPE)) { CHAR s[128]; - MODINSTRUMENT *pIns = m_pSndFile->Instruments[m_nInstrument]; if (pIns) { memcpy(s, pIns->name, 32); @@ -1260,28 +1262,36 @@ //if (pIns->nMidiChannel & 0x80) m_CbnMidiCh.SetCurSel((pIns->nMidiChannel&0x7f)+16); else // m_CbnMidiCh.SetCurSel(0); //now: - if (pIns->nMidiChannel < 17) { + if (pIns->nMidiChannel < 17) + { m_CbnMidiCh.SetCurSel(pIns->nMidiChannel); - } else { + } else + { m_CbnMidiCh.SetCurSel(0); } - if (pIns->nMixPlug <= MAX_MIXPLUGINS) { + if (pIns->nMixPlug <= MAX_MIXPLUGINS) + { m_CbnMixPlug.SetCurSel(pIns->nMixPlug); - } else { + } else + { m_CbnMixPlug.SetCurSel(0); } OnMixPlugChanged(); //end rewbs.instroVSTi - for(int nRes = 0; nRes<m_CbnResampling.GetCount(); nRes++) { + for(int nRes = 0; nRes<m_CbnResampling.GetCount(); nRes++) + { DWORD v = m_CbnResampling.GetItemData(nRes); - if (pIns->nResampling == v) { + if (pIns->nResampling == v) + { m_CbnResampling.SetCurSel(nRes); break; } } - for(int nFltMode = 0; nFltMode<m_CbnFilterMode.GetCount(); nFltMode++) { + for(int nFltMode = 0; nFltMode<m_CbnFilterMode.GetCount(); nFltMode++) + { DWORD v = m_CbnFilterMode.GetItemData(nFltMode); - if (pIns->nFilterMode == v) { + if (pIns->nFilterMode == v) + { m_CbnFilterMode.SetCurSel(nFltMode); break; } @@ -1317,11 +1327,12 @@ // -! NEW_FEATURE#0027 UpdateTuningComboBox(); - if(pIns->wPitchToTempoLock > 0) //Current instrument uses pitchTempoLock. - CheckDlgButton(IDC_CHECK_PITCHTEMPOLOCK, MF_CHECKED); - else - CheckDlgButton(IDC_CHECK_PITCHTEMPOLOCK, MF_UNCHECKED); - + + // Only enable Pitch/Tempo Lock for MPTM files or legacy files that have this property enabled. + m_EditPitchTempoLock.EnableWindow((m_pSndFile->GetType() == MOD_TYPE_MPT || pIns->wPitchToTempoLock > 0) ? TRUE : FALSE); + m_CheckPitchTempoLock.EnableWindow(m_EditPitchTempoLock.IsWindowEnabled()); + CheckDlgButton(IDC_CHECK_PITCHTEMPOLOCK, (pIns->wPitchToTempoLock > 0 ? MF_CHECKED : MF_UNCHECKED)); + OnBnClickedCheckPitchtempolock(); if(m_pSndFile->GetType() & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) Modified: trunk/OpenMPT/mptrack/ModConvert.cpp =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.cpp 2011-10-10 22:13:51 UTC (rev 1102) +++ trunk/OpenMPT/mptrack/ModConvert.cpp 2011-10-12 19:10:41 UTC (rev 1103) @@ -351,58 +351,64 @@ for(INSTRUMENTINDEX nIns = 1; nIns <= m_SndFile.GetNumInstruments(); nIns++) { + MODINSTRUMENT *pIns = m_SndFile.Instruments[nIns]; + if(pIns == nullptr) + { + continue; + } + // Convert IT/MPT to XM (fix instruments) if(oldTypeIsIT_MPT && newTypeIsXM) { - MODINSTRUMENT *pIns = m_SndFile.Instruments[nIns]; - if (pIns) + for (UINT k = 0; k < NOTE_MAX; k++) { - for (UINT k = 0; k < NOTE_MAX; k++) + if ((pIns->NoteMap[k]) && (pIns->NoteMap[k] != (BYTE)(k+1))) { - if ((pIns->NoteMap[k]) && (pIns->NoteMap[k] != (BYTE)(k+1))) - { - CHANGEMODTYPE_WARNING(wBrokenNoteMap); - break; - } + CHANGEMODTYPE_WARNING(wBrokenNoteMap); + break; } - // Convert sustain loops to sustain "points" - if(pIns->VolEnv.nSustainStart != pIns->VolEnv.nSustainEnd) - { - CHANGEMODTYPE_WARNING(wInstrumentSustainLoops); - pIns->VolEnv.nSustainEnd = pIns->VolEnv.nSustainStart; - } - if(pIns->PanEnv.nSustainStart != pIns->PanEnv.nSustainEnd) - { - CHANGEMODTYPE_WARNING(wInstrumentSustainLoops); - pIns->PanEnv.nSustainEnd = pIns->PanEnv.nSustainStart; - } - pIns->VolEnv.dwFlags &= ~ENV_CARRY; - pIns->PanEnv.dwFlags &= ~ENV_CARRY; - pIns->PitchEnv.dwFlags &= ~(ENV_CARRY|ENV_ENABLED|ENV_FILTER); - pIns->dwFlags &= ~INS_SETPANNING; - pIns->nIFC &= 0x7F; - pIns->nIFR &= 0x7F; - pIns->nFilterMode = FLTMODE_UNCHANGED; + } + // Convert sustain loops to sustain "points" + if(pIns->VolEnv.nSustainStart != pIns->VolEnv.nSustainEnd) + { + CHANGEMODTYPE_WARNING(wInstrumentSustainLoops); + pIns->VolEnv.nSustainEnd = pIns->VolEnv.nSustainStart; + } + if(pIns->PanEnv.nSustainStart != pIns->PanEnv.nSustainEnd) + { + CHANGEMODTYPE_WARNING(wInstrumentSustainLoops); + pIns->PanEnv.nSustainEnd = pIns->PanEnv.nSustainStart; + } + pIns->VolEnv.dwFlags &= ~ENV_CARRY; + pIns->PanEnv.dwFlags &= ~ENV_CARRY; + pIns->PitchEnv.dwFlags &= ~(ENV_CARRY|ENV_ENABLED|ENV_FILTER); + pIns->dwFlags &= ~INS_SETPANNING; + pIns->nIFC &= 0x7F; + pIns->nIFR &= 0x7F; + pIns->nFilterMode = FLTMODE_UNCHANGED; - pIns->nCutSwing = pIns->nPanSwing = pIns->nResSwing = pIns->nVolSwing = 0; + pIns->nCutSwing = pIns->nPanSwing = pIns->nResSwing = pIns->nVolSwing = 0; - pIns->wPitchToTempoLock = 0; + pIns->nPPC = NOTE_MIDDLEC - 1; + pIns->nPPS = 0; - pIns->nPPC = NOTE_MIDDLEC - 1; - pIns->nPPS = 0; - - pIns->nGlobalVol = 64; - pIns->nPan = 128; - } + pIns->nGlobalVol = 64; + pIns->nPan = 128; } - // Convert MPT to anything - remove instrument tunings + // Convert MPT to anything - remove instrument tunings, Pitch/Tempo Lock if(oldTypeIsMPT) { - if(m_SndFile.Instruments[nIns] != nullptr && m_SndFile.Instruments[nIns]->pTuning != nullptr) + if(pIns->pTuning != nullptr) { - m_SndFile.Instruments[nIns]->SetTuning(nullptr); + pIns->SetTuning(nullptr); CHANGEMODTYPE_WARNING(wInstrumentTuning); } + + if(pIns->wPitchToTempoLock != 0) + { + pIns->wPitchToTempoLock = 0; + CHANGEMODTYPE_WARNING(wPitchToTempoLock); + } } } @@ -523,26 +529,34 @@ ConvertSamplesToInstruments(); } + // Pattern warnings CHAR s[64]; - CHANGEMODTYPE_CHECK(wInstrumentsToSamples, "All instruments have been converted to samples.\n"); wsprintf(s, "%d patterns have been resized to 64 rows\n", nResizedPatterns); CHANGEMODTYPE_CHECK(wResizedPatterns, s); + CHANGEMODTYPE_CHECK(wRestartPos, "Restart position is not supported by the new format.\n"); + CHANGEMODTYPE_CHECK(wPatternSignatures, "Pattern-specific time signatures are not supported by the new format.\n"); + CHANGEMODTYPE_CHECK(wChannelVolSurround, "Channel volume and surround are not supported by the new format.\n"); + CHANGEMODTYPE_CHECK(wChannelPanning, "Channel panning is not supported by the new format.\n"); + + // Sample warnings CHANGEMODTYPE_CHECK(wSampleBidiLoops, "Sample bidi loops are not supported by the new format.\n"); CHANGEMODTYPE_CHECK(wSampleSustainLoops, "New format doesn't support sample sustain loops.\n"); CHANGEMODTYPE_CHECK(wSampleAutoVibrato, "New format doesn't support sample autovibrato.\n"); CHANGEMODTYPE_CHECK(wMODSampleFrequency, "Sample C-5 frequencies will be lost.\n"); - CHANGEMODTYPE_CHECK(wBrokenNoteMap, "Note Mapping will be lost when saving as XM.\n"); + CHANGEMODTYPE_CHECK(wMOD31Samples, "Samples above 31 will be lost when saving as MOD. Consider rearranging samples if there are unused slots available.\n"); + + // Instrument warnings + CHANGEMODTYPE_CHECK(wInstrumentsToSamples, "All instruments have been converted to samples.\n"); + CHANGEMODTYPE_CHECK(wTrimmedEnvelopes, "Instrument envelopes have been shortened.\n"); CHANGEMODTYPE_CHECK(wInstrumentSustainLoops, "Sustain loops were converted to sustain points.\n"); CHANGEMODTYPE_CHECK(wInstrumentTuning, "Instrument tunings will be lost.\n"); + CHANGEMODTYPE_CHECK(wPitchToTempoLock, "Pitch / Tempo Lock instrument property is not supported by the new format.\n"); + CHANGEMODTYPE_CHECK(wBrokenNoteMap, "Note Mapping will be lost when saving as XM.\n"); + CHANGEMODTYPE_CHECK(wReleaseNode, "Instrument envelope release nodes are not supported by the new format.\n"); + + // General warnings CHANGEMODTYPE_CHECK(wMODGlobalVars, "Default speed, tempo and global volume will be lost.\n"); - CHANGEMODTYPE_CHECK(wMOD31Samples, "Samples above 31 will be lost when saving as MOD. Consider rearranging samples if there are unused slots available.\n"); - CHANGEMODTYPE_CHECK(wRestartPos, "Restart position is not supported by the new format.\n"); - CHANGEMODTYPE_CHECK(wChannelVolSurround, "Channel volume and surround are not supported by the new format.\n"); - CHANGEMODTYPE_CHECK(wChannelPanning, "Channel panning is not supported by the new format.\n"); - CHANGEMODTYPE_CHECK(wPatternSignatures, "Pattern-specific time signatures are not supported by the new format.\n"); CHANGEMODTYPE_CHECK(wLinearSlides, "Linear Frequency Slides not supported by the new format.\n"); - CHANGEMODTYPE_CHECK(wTrimmedEnvelopes, "Instrument envelopes have been shortened.\n"); - CHANGEMODTYPE_CHECK(wReleaseNode, "Instrument envelope release nodes are not supported by the new format.\n"); CHANGEMODTYPE_CHECK(wEditHistory, "Edit history will not be saved in the new format.\n"); CHANGEMODTYPE_CHECK(wMixmode, "Consider setting the mix levels to \"Compatible\" in the song properties when working with legacy formats.\n"); CHANGEMODTYPE_CHECK(wCompatibilityMode, "Consider enabling the \"compatible playback\" option in the song properties to increase compatiblity with other players.\n"); Modified: trunk/OpenMPT/mptrack/ModConvert.h =================================================================== --- trunk/OpenMPT/mptrack/ModConvert.h 2011-10-10 22:13:51 UTC (rev 1102) +++ trunk/OpenMPT/mptrack/ModConvert.h 2011-10-12 19:10:41 UTC (rev 1103) @@ -35,6 +35,7 @@ wEditHistory, wMixmode, wCompatibilityMode, + wPitchToTempoLock, wNumWarnings }; Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-10 22:13:51 UTC (rev 1102) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-10-12 19:10:41 UTC (rev 1103) @@ -3055,7 +3055,7 @@ } else { - wsprintf(s, "%d", param); + wsprintf(s, "%u", param); } } strcat(pszName, s); Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2011-10-10 22:13:51 UTC (rev 1102) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2011-10-12 19:10:41 UTC (rev 1103) @@ -547,7 +547,7 @@ {PATTERN_FLATBUTTONS, "Flat Buttons", "Use flat buttons in toolbars"}, {PATTERN_SINGLEEXPAND, "Single click to expand tree", "Single-clicking in the left tree view will expand a branch"}, {PATTERN_MUTECHNMODE, "Ignored muted channels", "Notes will not be played on muted channels (unmuting will only start on a new note)."}, - {PATTERN_NOEXTRALOUD, "No loud samples", "Disable loud playback of samples in the sample/instrument editor. Sample volume depends on the sample volume slider on the general tab when activated (if activated, a sample volume of 256 is used)."}, + {PATTERN_NOEXTRALOUD, "No loud sample preview", "Disable loud playback of samples in the sample/instrument editor. Sample volume depends on the sample volume slider on the general tab when activated (if disabled, a sample volume of 256 is used)."}, {PATTERN_SHOWPREVIOUS, "Show Prev/Next patterns", "Displays grayed-out version of the previous/next patterns in the pattern editor. Does not work if \"always center active row\" is disabled."}, {PATTERN_CONTSCROLL, "Continuous scroll", "Jumps to the next pattern when moving past the end of a pattern"}, {PATTERN_KBDNOTEOFF, "Record note off", "Record note off when a key is released on the PC keyboard (Only works in instrument mode)."}, Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-10-10 22:13:51 UTC (rev 1102) +++ trunk/OpenMPT/mptrack/version.h 2011-10-12 19:10:41 UTC (rev 1103) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 41 +#define VER_MINORMINOR 42 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/soundlib/Load_s3m.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_s3m.cpp 2011-10-10 22:13:51 UTC (rev 1102) +++ trunk/OpenMPT/soundlib/Load_s3m.cpp 2011-10-12 19:10:41 UTC (rev 1103) @@ -253,13 +253,18 @@ { // MPT 1.16 and older versions of OpenMPT m_dwLastSavedWithVersion = MAKE_VERSION_NUMERIC(1, 16, 00, 00); - bKeepMidiMacros = true; // simply load Zxx commands + // Simply keep default (filter) MIDI macros + bKeepMidiMacros = true; } if((psfh.cwtv & 0xF000) >= 0x2000) { // 2xyy - Orpheus, 3xyy - IT, 4xyy - Schism, 5xyy - OpenMPT - bKeepMidiMacros = true; // simply load Zxx commands + if((psfh.cwtv & 0xF000) != 0x3000 || psfh.cwtv >= 0x3214) + { + // Keep MIDI macros if this is not an old IT version (BABYLON.S3M by Necros has Zxx commands and was saved with IT 2.05) + bKeepMidiMacros = true; + } } if(!bKeepMidiMacros) // Remove macros so they don't interfere with tunes made in trackers that don't support Zxx This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |