From: <sag...@us...> - 2010-05-14 15:27:29
|
Revision: 595 http://modplug.svn.sourceforge.net/modplug/?rev=595&view=rev Author: saga-games Date: 2010-05-14 15:27:19 +0000 (Fri, 14 May 2010) Log Message: ----------- [Reg] Removed AutodetectITplaystyle option, since the tracker detection works reliably enough now. Tracker detection can not be ignored anymore now. [Mod] Changes some error messages to be more verbose. [Mod] More error messages are now added to the log instead of showing messageboxes. [Mod] Updated internet links (ModPlug Central Forums link is now a permalink) [Ref] Removed unfinished, possibly confusing code from CMainFrame. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/soundlib/IT_DEFS.H trunk/OpenMPT/soundlib/Load_it.cpp Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2010-05-13 21:06:48 UTC (rev 594) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2010-05-14 15:27:19 UTC (rev 595) @@ -1825,13 +1825,6 @@ } -UINT CMainFrame::GetCurrentInstrument() -//------------------------------------- -{ - return 0; -} - - void CMainFrame::SetPreAmp(UINT n) //-------------------------------- { @@ -2245,7 +2238,7 @@ BOOL CMainFrame::SetupDirectories(LPCTSTR szModDir, LPCTSTR szSampleDir, LPCTSTR szInstrDir, LPCTSTR szVstDir, LPCTSTR szPresetDir) -//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------------------------------------------------------------- { // will also set working directory SetDefaultDirectory(szModDir, DIR_MODS); @@ -2760,8 +2753,8 @@ // case ID_NETLINK_OSMUSIC: pszURL = "http://www.osmusic.net/"; break; // case ID_NETLINK_HANDBOOK: pszURL = "http://www.modplug.com/mods/handbook/handbook.htm"; break; case ID_NETLINK_MPTFR: pszURL = "http://mpt.new.fr/"; break; - case ID_NETLINK_FORUMS: pszURL = "http://www.lpchip.com/modplug"; break; - case ID_NETLINK_PLUGINS: pszURL = "http://www.kvraudio.com"; break; + case ID_NETLINK_FORUMS: pszURL = "http://openmpt.com/forum/"; break; + case ID_NETLINK_PLUGINS: pszURL = "http://www.kvraudio.com/"; break; case ID_NETLINK_MODARCHIVE: pszURL = "http://modarchive.org/"; break; case ID_NETLINK_OPENMPTWIKI_GERMAN: pszURL = "http://sagamusix.de/openmpt/Hauptseite"; break; } Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2010-05-13 21:06:48 UTC (rev 594) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2010-05-14 15:27:19 UTC (rev 595) @@ -562,7 +562,6 @@ VOID SetXInfoText(LPCSTR lpszText); //rewbs.xinfo VOID SetHelpText(LPCSTR lpszText); UINT GetBaseOctave(); - UINT GetCurrentInstrument(); CModDoc *GetActiveDoc(); CView *GetActiveView(); //rewbs.customKeys CImageList *GetImageList() { return &m_ImageList; } Modified: trunk/OpenMPT/soundlib/IT_DEFS.H =================================================================== --- trunk/OpenMPT/soundlib/IT_DEFS.H 2010-05-13 21:06:48 UTC (rev 594) +++ trunk/OpenMPT/soundlib/IT_DEFS.H 2010-05-14 15:27:19 UTC (rev 595) @@ -143,8 +143,10 @@ #define ITP_VERSION 0x00000102 // v1.02 #define ITP_FILE_ID 0x2e697470 // .itp ASCII -enum IT_ReaderBitMasks { +#define IT_CHBI 0x49424843 // "CHBI" magic bytes in the IT header to identify ChibiTracker +enum IT_ReaderBitMasks +{ // pattern row parsing, the channel data is read to obtain // number of channels active in the pattern. These bit masks are // to blank out sections of the byte of data being read. Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2010-05-13 21:06:48 UTC (rev 594) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2010-05-14 15:27:19 UTC (rev 595) @@ -196,10 +196,14 @@ if(iter == notFoundTunings.end()) { notFoundTunings.push_back(str); - string erm = string("Tuning ") + str + string(" used by the module was not found."); - MessageBox(0, erm.c_str(), 0, MB_ICONINFORMATION); - if(csf.GetpModDoc()) //The tuning is changed so the modified flag is set. - csf.GetpModDoc()->SetModified(); +#ifdef MODPLUG_TRACKER + if(csf.GetpModDoc() != nullptr) + { + string erm = string("Tuning ") + str + string(" used by the module was not found."); + csf.GetpModDoc()->AddToLog(erm.c_str()); + csf.GetpModDoc()->SetModified(); //The tuning is changed so the modified flag is set. + } +#endif // MODPLUG_TRACKER } csf.Instruments[i]->pTuning = csf.Instruments[i]->s_DefaultTuning; @@ -767,7 +771,8 @@ if(streamPos >= dwMemLength || len > dwMemLength - streamPos) return false; // Copy sample struct data - if(pis.id == 0x53504D49){ + if(pis.id == 0x53504D49) + { MODSAMPLE *pSmp = &Samples[nsmp]; memcpy(pSmp->filename, pis.filename, 12); pSmp->uFlags = 0; @@ -873,7 +878,8 @@ //HACK: if we fail on i <= m_nInstruments above, arrive here without having set fcode as appropriate, // hence the code duplication. - if ( (uintptr_t)(ptr - lpStream) <= dwMemLength - 4 ) { + if ( (uintptr_t)(ptr - lpStream) <= dwMemLength - 4 ) + { fcode = (*((__int32 *)ptr)); } @@ -1031,7 +1037,7 @@ memcpy(m_lpszSongComments, lpStream+pifh->msgoffset, pifh->msglength); m_lpszSongComments[pifh->msglength] = 0; // ChibiTracker uses \n instead of \r. - if(pifh->cwtv == 0x0214 && pifh->cmwt == 0x0214 && LittleEndian(pifh->reserved) == 0x49424843) + if(pifh->cwtv == 0x0214 && pifh->cmwt == 0x0214 && LittleEndian(pifh->reserved) == IT_CHBI) { for(size_t i = 0; i < pifh->msglength; i++) { @@ -1053,9 +1059,11 @@ { if(nordsize > GetModSpecifications().ordersMax) { +#ifdef MODPLUG_TRACKER CString str; str.Format(str_SequenceTruncationNote, nordsize, GetModSpecifications().ordersMax); - CMainFrame::GetMainFrame()->MessageBox(str, 0, MB_ICONWARNING); + if(GetpModDoc() != nullptr) GetpModDoc()->AddToLog(str); +#endif // MODPLUG_TRACKER nordsize = GetModSpecifications().ordersMax; } @@ -1090,9 +1098,14 @@ if(patpossize > GetModSpecifications().patternsMax) { // Hack: Note user here if file contains more patterns than what can be read. - CString str; - str.Format(str_PatternSetTruncationNote, patpossize, GetModSpecifications().patternsMax); - CMainFrame::GetMainFrame()->MessageBox(str, 0, MB_ICONWARNING); +#ifdef MODPLUG_TRACKER + if(GetpModDoc() != nullptr) + { + CString str; + str.Format(str_PatternSetTruncationNote, patpossize, GetModSpecifications().patternsMax); + GetpModDoc()->AddToLog(str); + } +#endif // MODPLUG_TRACKER patpossize = GetModSpecifications().patternsMax; } @@ -1357,8 +1370,8 @@ #ifdef MODPLUG_TRACKER CString s; s.Format(TEXT("Allocating patterns failed starting from pattern %u"), npat); - if(m_pModDoc != nullptr) m_pModDoc->AddToLog(s); -#endif + if(GetpModDoc() != nullptr) GetpModDoc()->AddToLog(s); +#endif // MODPLUG_TRACKER break; } continue; @@ -1473,7 +1486,7 @@ // 203-212: Vibrato depth if ((vol >= 203) && (vol <= 212)) { m[ch].volcmd = VOLCMD_VIBRATODEPTH; m[ch].vol = vol - 203; - // Old versions of ModPlug seemed to save this as vibrato speed instead so let's fix that + // Old versions of ModPlug saved this as vibrato speed instead, so let's fix that if(m_dwLastSavedWithVersion <= MAKE_VERSION_NUMERIC(1, 17, 02, 54) && interpretModplugmade) m[ch].volcmd = VOLCMD_VIBRATOSPEED; } else @@ -1511,24 +1524,15 @@ SetModFlag(MSF_OLDVOLSWING, true); } - static char autodetectITplaymode = -1; if(GetType() == MOD_TYPE_IT) { -#ifdef MODPLUG_TRACKER - if(autodetectITplaymode == -1) - autodetectITplaymode = CMainFrame::GetPrivateProfileLong("Misc", "AutodetectITplaystyle", 1, theApp.GetConfigFileName()); -#endif - - if(autodetectITplaymode) + // Set appropriate mod flags if the file was not made with MPT. + if(!interpretModplugmade) { - if(!interpretModplugmade) - { - SetModFlag(MSF_MIDICC_BUGEMULATION, false); - SetModFlag(MSF_OLDVOLSWING, false); - SetModFlag(MSF_COMPATIBLE_PLAY, true); - } + SetModFlag(MSF_MIDICC_BUGEMULATION, false); + SetModFlag(MSF_OLDVOLSWING, false); + SetModFlag(MSF_COMPATIBLE_PLAY, true); } - return true; } else { @@ -1551,14 +1555,24 @@ ssb.ReadItem(Order, FileIdSequences, strlen(FileIdSequences), &ReadModSequences); if (ssb.m_Status & srlztn::SNT_FAILURE) - AfxMessageBox("Unknown error occured.", MB_ICONERROR); + { +#ifdef MODPLUG_TRACKER + if(GetpModDoc() != nullptr) GetpModDoc()->AddToLog(_T("Unknown error occured while deserializing file.")); +#endif // MODPLUG_TRACKER + } } else //Loading for older files. { if(GetTuneSpecificTunings().Deserialize(iStrm)) - MessageBox(0, "Error occured - loading failed while trying to load tune specific tunings.", "", MB_ICONERROR); + { +#ifdef MODPLUG_TRACKER + if(GetpModDoc() != nullptr) GetpModDoc()->AddToLog(_T("Error occured - loading failed while trying to load tune specific tunings.")); +#endif // MODPLUG_TRACKER + } else + { ReadTuningMap(iStrm, *this); + } } } //version condition(MPT) } @@ -2422,7 +2436,7 @@ ssb.FinishWrite(); if (ssb.m_Status & srlztn::SNT_FAILURE) - AfxMessageBox("Error occured in writing.", MB_ICONERROR); + AfxMessageBox("Error occured in writing MPTM extensions.", MB_ICONERROR); //Last 4 bytes should tell where the hack mpt things begin. if(!fout.good()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |