From: <sag...@us...> - 2011-03-26 17:57:40
|
Revision: 832 http://modplug.svn.sourceforge.net/modplug/?rev=832&view=rev Author: saga-games Date: 2011-03-26 17:57:33 +0000 (Sat, 26 Mar 2011) Log Message: ----------- [New] Most MPT hacks in modules can now be found through View -> Find MPT Hacks in Song. Modified Paths: -------------- trunk/OpenMPT/mptrack/MPTHacks.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/soundlib/mod_specifications.h Modified: trunk/OpenMPT/mptrack/MPTHacks.cpp =================================================================== --- trunk/OpenMPT/mptrack/MPTHacks.cpp 2011-03-26 15:16:39 UTC (rev 831) +++ trunk/OpenMPT/mptrack/MPTHacks.cpp 2011-03-26 17:57:33 UTC (rev 832) @@ -85,8 +85,8 @@ }; // Go through the module to find out if it contains any hacks introduced by (Open)MPT -bool CModDoc::HasMPTHacks(bool autofix) -//------------------------------------- +bool CModDoc::HasMPTHacks(const bool autofix) +//------------------------------------------- { const CModSpecifications *originalSpecs = &m_SndFile.GetModSpecifications(); // retrieve original (not hacked) specs. @@ -107,6 +107,7 @@ } bool foundHacks = false, foundHere = false; + CString message; ClearLog(); // Check for plugins @@ -126,7 +127,8 @@ // Pattern count if(m_SndFile.GetNumPatterns() > originalSpecs->patternsMax) { - AddToLog("Found too many patterns\n"); + message.Format("Found too many patterns (%d allowed)\n", originalSpecs->patternsMax); + AddToLog(message); foundHacks = true; // REQUIRES (INTELLIGENT) AUTOFIX } @@ -146,7 +148,10 @@ } } if(foundHere) - AddToLog("Found incompatible pattern lengths\n"); + { + message.Format("Found incompatible pattern lengths (must be between %d and %d rows)\n", originalSpecs->patternRowsMin, originalSpecs->patternRowsMax); + AddToLog(message); + } // Check for invalid pattern commands foundHere = false; @@ -179,7 +184,8 @@ // Check for too many channels if(m_SndFile.GetNumChannels() > originalSpecs->channelsMax || m_SndFile.GetNumChannels() < originalSpecs->channelsMin) { - AddToLog("Found incompatible channel count\n"); + message.Format("Found incompatible channel count (must be between %d and %d channels)\n", originalSpecs->channelsMin, originalSpecs->channelsMax); + AddToLog(message); foundHacks = true; // REQUIRES (INTELLIGENT) AUTOFIX } @@ -203,7 +209,8 @@ // Check for too many samples if(m_SndFile.GetNumSamples() > originalSpecs->samplesMax) { - AddToLog("Found too many samples\n"); + message.Format("Found too many samples (%d allowed)\n", originalSpecs->samplesMax); + AddToLog(message); foundHacks = true; // REQUIRES (INTELLIGENT) AUTOFIX } @@ -211,7 +218,8 @@ // Check for too many instruments if(m_SndFile.GetNumInstruments() > originalSpecs->instrumentsMax) { - AddToLog("Found too many instruments\n"); + message.Format("Found too many instruments (%d allowed)\n", originalSpecs->instrumentsMax); + AddToLog(message); foundHacks = true; // REQUIRES (INTELLIGENT) AUTOFIX } @@ -253,7 +261,8 @@ // Check for too many orders if(m_SndFile.Order.GetLengthTailTrimmed() > originalSpecs->ordersMax) { - AddToLog("Found too many orders\n"); + message.Format("Found too many orders (%d allowed)\n", originalSpecs->ordersMax); + AddToLog(message); foundHacks = true; // REQUIRES (INTELLIGENT) AUTOFIX } @@ -261,7 +270,8 @@ // Check for invalid default tempo if(m_SndFile.m_nDefaultTempo > originalSpecs->tempoMax || m_SndFile.m_nDefaultTempo < originalSpecs->tempoMin) { - AddToLog("Found incompatible default tempo\n"); + message.Format("Found incompatible default tempo (must be between %d and %d)\n", originalSpecs->tempoMin, originalSpecs->tempoMax); + AddToLog(message); foundHacks = true; if(autofix) m_SndFile.m_nDefaultTempo = CLAMP(m_SndFile.m_nDefaultTempo, originalSpecs->tempoMin, originalSpecs->tempoMax); @@ -270,7 +280,8 @@ // Check for invalid default speed if(m_SndFile.m_nDefaultSpeed > originalSpecs->speedMax || m_SndFile.m_nDefaultSpeed < originalSpecs->speedMin) { - AddToLog("Found incompatible default speed\n"); + message.Format("Found incompatible default speed (must be between %d and %d)\n", originalSpecs->speedMin, originalSpecs->speedMax); + AddToLog(message); foundHacks = true; if(autofix) m_SndFile.m_nDefaultSpeed = CLAMP(m_SndFile.m_nDefaultSpeed, originalSpecs->speedMin, originalSpecs->speedMax); @@ -312,7 +323,7 @@ // Check for new tempo modes if(m_SndFile.m_nTempoMode != tempo_mode_classic) { - AddToLog("Found incompatible tempo mode\n"); + AddToLog("Found incompatible tempo mode (only classic tempo mode allowed)\n"); foundHacks = true; if(autofix) m_SndFile.m_nTempoMode = tempo_mode_classic; @@ -358,7 +369,7 @@ if(m_SndFile.m_nMixLevels != mixLevels_compatible) { - AddToLog("Found incorrect mix levels\n"); + AddToLog("Found incorrect mix levels (only compatible mix levels allowed)\n"); foundHacks = true; if(autofix) m_SndFile.m_nMixLevels = mixLevels_compatible; @@ -366,6 +377,6 @@ if(autofix && foundHacks) SetModified(); - + return foundHacks; } Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2011-03-26 15:16:39 UTC (rev 831) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2011-03-26 17:57:33 UTC (rev 832) @@ -53,6 +53,7 @@ ON_COMMAND(ID_VIEW_COMMENTS, OnEditComments) ON_COMMAND(ID_VIEW_GRAPH, OnEditGraph) //rewbs.graph ON_COMMAND(ID_VIEW_EDITHISTORY, OnViewEditHistory) + ON_COMMAND(ID_VIEW_MPTHACKS, OnViewMPTHacks) ON_COMMAND(ID_INSERT_PATTERN, OnInsertPattern) ON_COMMAND(ID_INSERT_SAMPLE, OnInsertSample) ON_COMMAND(ID_INSERT_INSTRUMENT, OnInsertInstrument) @@ -3513,6 +3514,18 @@ } +void CModDoc::OnViewMPTHacks() +//---------------------------- +{ + if(!HasMPTHacks()) + { + AddToLog("No hacks found.\n"); + } + ShowLog(); + ClearLog(); +} + + LRESULT CModDoc::OnCustomKeyMsg(WPARAM wParam, LPARAM /*lParam*/) //--------------------------------------------------------------- { Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2011-03-26 15:16:39 UTC (rev 831) +++ trunk/OpenMPT/mptrack/Moddoc.h 2011-03-26 17:57:33 UTC (rev 832) @@ -346,7 +346,7 @@ bool RestartPosToPattern(); - bool HasMPTHacks(bool autofix = false); + bool HasMPTHacks(const bool autofix = false); void FixNullStrings(); @@ -436,6 +436,7 @@ afx_msg void OnPatternPlay(); //rewbs.customKeys afx_msg void OnPatternPlayNoLoop(); //rewbs.customKeys afx_msg void OnViewEditHistory(); + afx_msg void OnViewMPTHacks(); //}}AFX_MSG DECLARE_MESSAGE_MAP() private: Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2011-03-26 15:16:39 UTC (rev 831) +++ trunk/OpenMPT/mptrack/mptrack.rc 2011-03-26 17:57:33 UTC (rev 832) @@ -2008,12 +2008,13 @@ MENUITEM "&Tree", IDD_TREEVIEW END MENUITEM SEPARATOR - MENUITEM "Set&up...", ID_VIEW_OPTIONS - MENUITEM "Add &Plugin...", ID_PLUGIN_SETUP - MENUITEM "Channel &Manager...", ID_CHANNEL_MANAGER - MENUITEM "Song Properties...", ID_VIEW_SONGPROPERTIES + MENUITEM "S&etup...", ID_VIEW_OPTIONS + MENUITEM "Pl&ugin Manager...", ID_PLUGIN_SETUP + MENUITEM "Ch&annel Manager...", ID_CHANNEL_MANAGER + MENUITEM "Song P&roperties...", ID_VIEW_SONGPROPERTIES MENUITEM "&MIDI Mapping...", ID_VIEW_MIDIMAPPING MENUITEM "Edit &History...", ID_VIEW_EDITHISTORY + MENUITEM "Find MPT Hacks in Song", ID_VIEW_MPTHACKS END POPUP "&Window" BEGIN Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2011-03-26 15:16:39 UTC (rev 831) +++ trunk/OpenMPT/mptrack/resource.h 2011-03-26 17:57:33 UTC (rev 832) @@ -1184,6 +1184,7 @@ #define ID_SAMPLE_GRID 60453 #define ID_SAMPLE_QUICKFADE 60454 #define ID_EDIT_MIXPASTE_ITSTYLE 60455 +#define ID_VIEW_MPTHACKS 60456 // Next default values for new objects // @@ -1191,7 +1192,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 529 -#define _APS_NEXT_COMMAND_VALUE 60456 +#define _APS_NEXT_COMMAND_VALUE 60457 #define _APS_NEXT_CONTROL_VALUE 2435 #define _APS_NEXT_SYMED_VALUE 901 #endif Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2011-03-26 15:16:39 UTC (rev 831) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2011-03-26 17:57:33 UTC (rev 832) @@ -193,7 +193,7 @@ false, // No notecut. true, // Has noteoff. false, // No notefade. - 255, // Pattern max. + 256, // Pattern max. 255, // Order max. 1, // Channel min 32, // Channel max @@ -233,8 +233,8 @@ false, // No notecut. true, // Has noteoff. false, // No notefade. - 255, // Pattern max. - 256, // Order max. + 256, // Pattern max. + 255, // Order max. 1, // Channel min 127, // Channel max 32, // Min tempo @@ -272,7 +272,7 @@ true, // Has notecut. false, // No noteoff. false, // No notefade. - 99, // Pattern max. + 100, // Pattern max. 255, // Order max. 1, // Channel min 32, // Channel max @@ -312,7 +312,7 @@ true, // Has notecut. false, // No noteoff. false, // No notefade. - 99, // Pattern max. + 100, // Pattern max. 255, // Order max. 1, // Channel min 32, // Channel max This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |