From: <sag...@us...> - 2015-05-25 22:02:17
|
Revision: 5186 http://sourceforge.net/p/modplug/code/5186 Author: saga-games Date: 2015-05-25 22:02:11 +0000 (Mon, 25 May 2015) Log Message: ----------- [Ref] Make hasArtistName and hasDefaultResampling members of CModSpecifications instead of distinguishing them by file format in the code. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/MPTHacks.cpp trunk/OpenMPT/soundlib/Load_it.cpp trunk/OpenMPT/soundlib/mod_specifications.cpp trunk/OpenMPT/soundlib/mod_specifications.h Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2015-05-25 21:16:02 UTC (rev 5185) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2015-05-25 22:02:11 UTC (rev 5186) @@ -271,7 +271,7 @@ const BOOL bIsNotMOD = (m_sndFile.GetType() != MOD_TYPE_MOD); const BOOL bIsNotMOD_S3M = ((bIsNotMOD) && (m_sndFile.GetType() != MOD_TYPE_S3M)); const BOOL bIsNotMOD_XM = ((bIsNotMOD) && (m_sndFile.GetType() != MOD_TYPE_XM)); - m_EditArtist.EnableWindow(bIsNotMOD_S3M); + m_EditArtist.EnableWindow(specs.hasArtistName); m_EditTempo.EnableWindow(bIsNotMOD); m_SpinTempo.EnableWindow(bIsNotMOD); GetDlgItem(IDC_BUTTON1)->EnableWindow(bIsNotMOD); @@ -660,7 +660,7 @@ if(sel >= 0) { m_sndFile.m_nResampling = static_cast<ResamplingMode>(m_CbnResampling.GetItemData(sel)); - if(m_sndFile.GetType() == MOD_TYPE_MPT) + if(m_sndFile.GetModSpecifications().hasDefaultResampling) { m_modDoc.SetModified(); } Modified: trunk/OpenMPT/mptrack/MPTHacks.cpp =================================================================== --- trunk/OpenMPT/mptrack/MPTHacks.cpp 2015-05-25 21:16:02 UTC (rev 5185) +++ trunk/OpenMPT/mptrack/MPTHacks.cpp 2015-05-25 22:02:11 UTC (rev 5186) @@ -469,7 +469,7 @@ } } - if((m_SndFile.GetType() & (MOD_TYPE_XM|MOD_TYPE_IT)) && !m_SndFile.songArtist.empty()) + if(!originalSpecs->hasArtistName && !m_SndFile.songArtist.empty()) { AddToLog("Found artist name"); foundHacks = true; Modified: trunk/OpenMPT/soundlib/Load_it.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_it.cpp 2015-05-25 21:16:02 UTC (rev 5185) +++ trunk/OpenMPT/soundlib/Load_it.cpp 2015-05-25 22:02:11 UTC (rev 5186) @@ -2080,7 +2080,7 @@ WRITEMODULAR(MAGIC4BE('R','P','.','.'), m_nRestartPos); } - if(m_nResampling != SRCMODE_DEFAULT && GetType() == MOD_TYPE_MPT) + if(m_nResampling != SRCMODE_DEFAULT && GetModSpecifications().hasDefaultResampling) { WRITEMODULAR(MAGIC4LE('R','S','M','P'), static_cast<uint32>(m_nResampling)); } Modified: trunk/OpenMPT/soundlib/mod_specifications.cpp =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.cpp 2015-05-25 21:16:02 UTC (rev 5185) +++ trunk/OpenMPT/soundlib/mod_specifications.cpp 2015-05-25 22:02:11 UTC (rev 5186) @@ -58,18 +58,20 @@ 200, // Max MIDI mapping directives 1, // Min Speed 255, // Max Speed - true, // Has song comments MAX_ENVPOINTS, // Envelope point count true, // Has envelope release node - " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#?????", // Supported Effects - " vpcdabuhlrgfe?o", // Supported Volume Column commands + true, // Has song comments true, // Has "+++" pattern true, // Has "---" pattern true, // Has restart position (order) true, // Supports plugins true, // Custom pattern time signatures true, // Pattern names + true, // Has artist name + true, // Has default resampling SongFlag(0) | SONG_LINEARSLIDES | SONG_EXFILTERRANGE | SONG_ITOLDEFFECTS | SONG_ITCOMPATGXX | SONG_EMBEDMIDICFG, // Supported song flags + " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#?????", // Supported Effects + " vpcdabuhlrgfe?o", // Supported Volume Column commands }; @@ -104,18 +106,20 @@ 0, // Max MIDI mapping directives 1, // Min Speed 32, // Max Speed - false, // No song comments 0, // No instrument envelopes false, // No envelope release node - " 0123456789ABCD?FF?E????????????????????", // Supported Effects - " ???????????????", // Supported Volume Column commands + false, // No song comments false, // Doesn't have "+++" pattern false, // Doesn't have "---" pattern true, // Has restart position (order) false, // Doesn't support plugins false, // No custom pattern time signatures false, // No pattern names + false, // Doesn't have artist name + false, // Doesn't have default resampling SongFlag(0) | SONG_PT1XMODE | SONG_AMIGALIMITS | SONG_VBLANK_TIMING, // Supported song flags + " 0123456789ABCD?FF?E????????????????????", // Supported Effects + " ???????????????", // Supported Volume Column commands }; @@ -148,18 +152,20 @@ 0, // Max MIDI mapping directives 1, // Min Speed 31, // Max Speed - false, // No song comments 12, // Envelope point count false, // No envelope release node - " 0123456789ABCDRFFTE???GHK??XPL?????????", // Supported Effects - " vpcdabuhlrg????", // Supported Volume Column commands + false, // No song comments false, // Doesn't have "+++" pattern false, // Doesn't have "---" pattern true, // Has restart position (order) false, // Doesn't support plugins false, // No custom pattern time signatures false, // No pattern names + false, // Doesn't have artist name + false, // Doesn't have default resampling SongFlag(0) | SONG_LINEARSLIDES, // Supported song flags + " 0123456789ABCDRFFTE???GHK??XPL?????????", // Supported Effects + " vpcdabuhlrg????", // Supported Volume Column commands }; // XM with MPT extensions @@ -192,18 +198,20 @@ 200, // Max MIDI mapping directives 1, // Min Speed 31, // Max Speed - true, // Has song comments 12, // Envelope point count false, // No envelope release node - " 0123456789ABCDRFFTE???GHK?YXPLZ\\?#?????", // Supported Effects - " vpcdabuhlrgfe??", // Supported Volume Column commands + true, // Has song comments false, // Doesn't have "+++" pattern false, // Doesn't have "---" pattern true, // Has restart position (order) true, // Supports plugins false, // No custom pattern time signatures true, // Pattern names + true, // Has artist name + false, // Doesn't have default resampling SongFlag(0) | SONG_LINEARSLIDES | SONG_EXFILTERRANGE | SONG_EMBEDMIDICFG, // Supported song flags + " 0123456789ABCDRFFTE???GHK?YXPLZ\\?#?????", // Supported Effects + " vpcdabuhlrgfe??", // Supported Volume Column commands }; const CModSpecifications s3m = @@ -235,18 +243,20 @@ 0, // Max MIDI mapping directives 1, // Min Speed 255, // Max Speed - false, // No song comments 0, // No instrument envelopes false, // No envelope release node - " JFEGHLKRXODB?CQATI?SMNVW?U?????????????", // Supported Effects - " vp?????????????", // Supported Volume Column commands + false, // No song comments true, // Has "+++" pattern true, // Has "---" pattern false, // Doesn't have restart position (order) false, // Doesn't support plugins false, // No custom pattern time signatures false, // No pattern names + false, // Doesn't have artist name + false, // Doesn't have default resampling SongFlag(0) | SONG_FASTVOLSLIDES | SONG_AMIGALIMITS, // Supported song flags + " JFEGHLKRXODB?CQATI?SMNVW?U?????????????", // Supported Effects + " vp?????????????", // Supported Volume Column commands }; // S3M with MPT extensions @@ -279,18 +289,20 @@ 0, // Max MIDI mapping directives 1, // Min Speed 255, // Max Speed - false, // No song comments 0, // No instrument envelopes false, // No envelope release node - " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z????????", // Supported Effects - " vp?????????????", // Supported Volume Column commands + false, // No song comments true, // Has "+++" pattern true, // Has "---" pattern false, // Doesn't have restart position (order) false, // Doesn't support plugins false, // No custom pattern time signatures false, // No pattern names + false, // Doesn't have artist name + false, // Doesn't have default resampling SongFlag(0) | SONG_FASTVOLSLIDES | SONG_AMIGALIMITS, // Supported song flags + " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z????????", // Supported Effects + " vp?????????????", // Supported Volume Column commands }; const CModSpecifications it = @@ -322,18 +334,20 @@ 0, // Max MIDI mapping directives 1, // Min Speed 255, // Max Speed - true, // Has song comments 25, // Envelope point count false, // No envelope release node - " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z????????", // Supported Effects - " vpcdab?h??gfe??", // Supported Volume Column commands + true, // Has song comments true, // Has "+++" pattern true, // Has "--" pattern false, // Doesn't have restart position (order) false, // Doesn't support plugins false, // No custom pattern time signatures false, // No pattern names + false, // Doesn't have artist name + false, // Doesn't have default resampling SongFlag(0) | SONG_LINEARSLIDES | SONG_ITOLDEFFECTS | SONG_ITCOMPATGXX | SONG_EMBEDMIDICFG, // Supported song flags + " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z????????", // Supported Effects + " vpcdab?h??gfe??", // Supported Volume Column commands }; const CModSpecifications itEx = @@ -365,18 +379,20 @@ 200, // Max MIDI mapping directives 1, // Min Speed 255, // Max Speed - true, // Has song comments 25, // Envelope point count false, // No envelope release node - " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\?#?????", // Supported Effects - " vpcdab?h??gfe??", // Supported Volume Column commands + true, // Has song comments true, // Has "+++" pattern true, // Has "---" pattern false, // Doesn't have restart position (order) true, // Supports plugins false, // No custom pattern time signatures true, // Pattern names + true, // Has artist name + false, // Doesn't have default resampling SongFlag(0) | SONG_LINEARSLIDES | SONG_EXFILTERRANGE | SONG_ITOLDEFFECTS | SONG_ITCOMPATGXX | SONG_EMBEDMIDICFG, // Supported song flags + " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\?#?????", // Supported Effects + " vpcdab?h??gfe??", // Supported Volume Column commands }; const CModSpecifications *Collection[] = { &mptm, &mod, &s3m, &s3mEx, &xm, &xmEx, &it, &itEx }; Modified: trunk/OpenMPT/soundlib/mod_specifications.h =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.h 2015-05-25 21:16:02 UTC (rev 5185) +++ trunk/OpenMPT/soundlib/mod_specifications.h 2015-05-25 22:02:11 UTC (rev 5186) @@ -39,9 +39,9 @@ MODTYPE internalType; // Internal MODTYPE value ModCommand::NOTE noteMin; // Minimum note index (index starts from 1) ModCommand::NOTE noteMax; // Maximum note index (index starts from 1) - bool hasNoteCut; // True if format has notecut. - bool hasNoteOff; // True if format has noteoff. - bool hasNoteFade; // True if format has notefade. + bool hasNoteCut : 1; // True if format has note cut (^^). + bool hasNoteOff : 1; // True if format has note off (==). + bool hasNoteFade : 1; // True if format has note fade (~~). PATTERNINDEX patternsMax; ORDERINDEX ordersMax; SEQUENCEINDEX sequencesMax; @@ -62,18 +62,20 @@ uint8 MIDIMappingDirectivesMax; // Number of MIDI Mapping directives that the format can store (0 = none) UINT speedMin; // Minimum ticks per frame UINT speedMax; // Maximum ticks per frame - bool hasComments; // True if format has a comments field uint8 envelopePointsMax; // Maximum number of points of each envelope - bool hasReleaseNode; // Envelope release node + bool hasReleaseNode : 1; // Envelope release node + bool hasComments : 1; // True if format has a comments field + bool hasIgnoreIndex : 1; // Does "+++" pattern exist? + bool hasStopIndex : 1; // Does "---" pattern exist? + bool hasRestartPos : 1; // Format has an automatic restart order position + bool supportsPlugins : 1; // Format can store plugins + bool hasPatternSignatures : 1; // Can patterns have a custom time signature? + bool hasPatternNames : 1; // Cat patterns have a name? + bool hasArtistName : 1; // Can artist name be stored in file? + bool hasDefaultResampling : 1; // Can default resampling be saved? (if not, it can still be modified in the GUI but won't set the module as modified) + FlagSet<SongFlags>::store_type songFlags; // Supported song flags NOTE: Do not use the overloaded operator | to set these flags because this results in dynamic initialization char commands[MAX_EFFECTS + 1]; // An array holding all commands this format supports; commands that are not supported are marked with "?" char volcommands[MAX_VOLCMDS + 1]; // Ditto, but for volume column - bool hasIgnoreIndex; // Does "+++" pattern exist? - bool hasStopIndex; // Does "---" pattern exist? - bool hasRestartPos; // Format has an automatic restart order position - bool supportsPlugins; // Format can store plugins - bool hasPatternSignatures; // Can patterns have a custom time signature? - bool hasPatternNames; // Cat patterns have a name? - FlagSet<SongFlags>::store_type songFlags; // Supported song flags NOTE: Do not use the overloaded operator | to set these flags because this results in dynamic initialization FlagSet<SongFlags> GetSongFlags() const { return FlagSet<SongFlags>(songFlags); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |