123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494 |
- #include "stdafx.h"
- #include "mod_specifications.h"
- #include "../common/misc_util.h"
- #include <algorithm>
- OPENMPT_NAMESPACE_BEGIN
- namespace ModSpecs
- {
- constexpr CModSpecifications mptm_ =
- {
-
- MOD_TYPE_MPT,
- "mptm",
- NOTE_MIN,
- NOTE_MAX,
- 4000,
- 4000,
- MAX_SEQUENCES,
- 1,
- 127,
- 32,
- 1000,
- 1,
- 255,
- 1,
- 1024,
- 25,
- 25,
- 12,
- 25,
- 12,
- 0,
- 3999,
- 255,
- MixLevels::v1_17RC3,
- SONG_LINEARSLIDES | SONG_EXFILTERRANGE | SONG_ITOLDEFFECTS | SONG_ITCOMPATGXX,
- 200,
- MAX_ENVPOINTS,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#+*?????????",
- " vpcdabuh??gfe?o",
- };
- constexpr CModSpecifications mod_ =
- {
- MOD_TYPE_MOD,
- "mod",
- 25,
- 108,
- 128,
- 128,
- 1,
- 1,
- 99,
- 32,
- 255,
- 1,
- 31,
- 64,
- 64,
- 20,
- 22,
- 0,
- 0,
- 0,
- 0,
- 31,
- 0,
- MixLevels::Compatible,
- SONG_PT_MODE | SONG_AMIGALIMITS | SONG_ISAMIGA,
- 0,
- 0,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- true,
- false,
- false,
- false,
- false,
- false,
- false,
- " 0123456789ABCD?FF?E??????????????????????????",
- " ???????????????",
- };
- constexpr CModSpecifications xm_ =
- {
- MOD_TYPE_XM,
- "xm",
- 13,
- 108,
- 256,
- 255,
- 1,
- 1,
- 32,
- 32,
- 1000,
- 1,
- 31,
- 1,
- 256,
- 20,
- 22,
- 0,
- 22,
- 0,
- 0,
- 128 * 16,
- 128,
- MixLevels::CompatibleFT2,
- SONG_LINEARSLIDES,
- 0,
- 12,
- false,
- true,
- false,
- false,
- false,
- false,
- false,
- true,
- false,
- false,
- false,
- false,
- false,
- false,
- " 0123456789ABCDRFFTE???GHK??XPL??????W????????",
- " vpcdabuhlrg????",
- };
- constexpr CModSpecifications xmEx_ =
- {
- MOD_TYPE_XM,
- "xm",
- 13,
- 108,
- 256,
- 255,
- 1,
- 1,
- 127,
- 32,
- 1000,
- 1,
- 31,
- 1,
- 1024,
- 20,
- 22,
- 0,
- 22,
- 0,
- 0,
- MAX_SAMPLES - 1,
- 255,
- MixLevels::CompatibleFT2,
- SONG_LINEARSLIDES | SONG_EXFILTERRANGE,
- 200,
- 12,
- false,
- true,
- false,
- false,
- true,
- false,
- false,
- true,
- true,
- false,
- true,
- true,
- false,
- false,
- " 0123456789ABCDRFFTE???GHK?YXPLZ\\?#??W????????",
- " vpcdabuhlrg????",
- };
- constexpr CModSpecifications s3m_ =
- {
- MOD_TYPE_S3M,
- "s3m",
- 13,
- 108,
- 100,
- 255,
- 1,
- 1,
- 32,
- 33,
- 255,
- 1,
- 255,
- 64,
- 64,
- 27,
- 27,
- 12,
- 0,
- 0,
- 0,
- 99,
- 0,
- MixLevels::Compatible,
- SONG_FASTVOLSLIDES | SONG_AMIGALIMITS | SONG_S3MOLDVIBRATO,
- 0,
- 0,
- true,
- false,
- false,
- false,
- false,
- true,
- true,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- " JFEGHLKRXODB?CQATI?SMNVW?U?????????? ????????",
- " vp?????????????",
- };
- constexpr CModSpecifications s3mEx_ =
- {
- MOD_TYPE_S3M,
- "s3m",
- 13,
- 108,
- 100,
- 255,
- 1,
- 1,
- 32,
- 33,
- 255,
- 1,
- 255,
- 64,
- 64,
- 27,
- 27,
- 12,
- 0,
- 0,
- 0,
- 99,
- 0,
- MixLevels::Compatible,
- SONG_FASTVOLSLIDES | SONG_AMIGALIMITS,
- 0,
- 0,
- true,
- false,
- false,
- false,
- false,
- true,
- true,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z????? ????????",
- " vp?????????????",
- };
- constexpr CModSpecifications it_ =
- {
- MOD_TYPE_IT,
- "it",
- 1,
- 120,
- 200,
- 256,
- 1,
- 1,
- 64,
- 32,
- 255,
- 1,
- 255,
- 1,
- 200,
- 25,
- 25,
- 12,
- 25,
- 12,
- 75,
- 99,
- 99,
- MixLevels::Compatible,
- SONG_LINEARSLIDES | SONG_ITOLDEFFECTS | SONG_ITCOMPATGXX,
- 0,
- 25,
- true,
- true,
- true,
- false,
- true,
- true,
- true,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z????? ????????",
- " vpcdab?h??gfe??",
- };
- constexpr CModSpecifications itEx_ =
- {
- MOD_TYPE_IT,
- "it",
- 1,
- 120,
- 240,
- 256,
- 1,
- 1,
- 127,
- 32,
- 512,
- 1,
- 255,
- 1,
- 1024,
- 25,
- 25,
- 12,
- 25,
- 12,
- 75,
- 3999,
- 255,
- MixLevels::Compatible,
- SONG_LINEARSLIDES | SONG_EXFILTERRANGE | SONG_ITOLDEFFECTS | SONG_ITCOMPATGXX,
- 200,
- 25,
- true,
- true,
- true,
- false,
- true,
- true,
- true,
- false,
- true,
- false,
- true,
- true,
- false,
- false,
- " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\?#?? ????????",
- " vpcdab?h??gfe??",
- };
- const std::array<const CModSpecifications *, 8> Collection = { &mptm_, &mod_, &s3m_, &s3mEx_, &xm_, &xmEx_, &it_, &itEx_ };
- const CModSpecifications &mptm = mptm_;
- const CModSpecifications &mod = mod_;
- const CModSpecifications &s3m = s3m_;
- const CModSpecifications &s3mEx = s3mEx_;
- const CModSpecifications &xm = xm_;
- const CModSpecifications &xmEx = xmEx_;
- const CModSpecifications &it = it_;
- const CModSpecifications &itEx = itEx_;
- }
- MODTYPE CModSpecifications::ExtensionToType(std::string ext)
- {
- if(ext.empty())
- {
- return MOD_TYPE_NONE;
- } else if(ext[0] == '.')
- {
- ext.erase(0, 1);
- }
- ext = mpt::ToLowerCaseAscii(ext);
- for(const auto &spec : ModSpecs::Collection)
- {
- if(ext == spec->fileExtension)
- {
- return spec->internalType;
- }
- }
- return MOD_TYPE_NONE;
- }
- bool CModSpecifications::HasNote(ModCommand::NOTE note) const
- {
- if(note >= noteMin && note <= noteMax)
- return true;
- else if(ModCommand::IsSpecialNote(note))
- {
- if(note == NOTE_NOTECUT)
- return hasNoteCut;
- else if(note == NOTE_KEYOFF)
- return hasNoteOff;
- else if(note == NOTE_FADE)
- return hasNoteFade;
- else
- return (internalType == MOD_TYPE_MPT);
- } else if(note == NOTE_NONE)
- return true;
- return false;
- }
- bool CModSpecifications::HasVolCommand(ModCommand::VOLCMD volcmd) const
- {
- if(volcmd >= MAX_VOLCMDS) return false;
- if(volcommands[volcmd] == '?') return false;
- return true;
- }
- bool CModSpecifications::HasCommand(ModCommand::COMMAND cmd) const
- {
- if(cmd >= MAX_EFFECTS) return false;
- if(commands[cmd] == '?') return false;
- return true;
- }
- char CModSpecifications::GetVolEffectLetter(ModCommand::VOLCMD volcmd) const
- {
- if(volcmd >= MAX_VOLCMDS) return '?';
- return volcommands[volcmd];
- }
- char CModSpecifications::GetEffectLetter(ModCommand::COMMAND cmd) const
- {
- if(cmd >= MAX_EFFECTS) return '?';
- return commands[cmd];
- }
- OPENMPT_NAMESPACE_END
|