diff options
author | Eugene Sandulenko | 2016-12-17 12:46:25 +0100 |
---|---|---|
committer | GitHub | 2016-12-17 12:46:25 +0100 |
commit | 2f90d7ba2286db79e28e9d4d59f3b082ca0becd7 (patch) | |
tree | 4024bd5ec26093efb2687fac9fc963e4371a81c6 /audio/softsynth/mt32/ROMInfo.cpp | |
parent | c8a2a6a89e98a5c5932094ebba913208f24e6e82 (diff) | |
parent | 1e23c91914cde7e9b9c47c9e727818d958e57e3f (diff) | |
download | scummvm-rg350-2f90d7ba2286db79e28e9d4d59f3b082ca0becd7.tar.gz scummvm-rg350-2f90d7ba2286db79e28e9d4d59f3b082ca0becd7.tar.bz2 scummvm-rg350-2f90d7ba2286db79e28e9d4d59f3b082ca0becd7.zip |
Merge pull request #863 from csnover/munt-2.0.0
MT32: Update Munt to 2.0.0
Diffstat (limited to 'audio/softsynth/mt32/ROMInfo.cpp')
-rwxr-xr-x[-rw-r--r--] | audio/softsynth/mt32/ROMInfo.cpp | 90 |
1 files changed, 34 insertions, 56 deletions
diff --git a/audio/softsynth/mt32/ROMInfo.cpp b/audio/softsynth/mt32/ROMInfo.cpp index f6817c1a4d..ce78e693aa 100644..100755 --- a/audio/softsynth/mt32/ROMInfo.cpp +++ b/audio/softsynth/mt32/ROMInfo.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher - * Copyright (C) 2011, 2012, 2013, 2014 Dean Beeler, Jerome Fisher, Sergey V. Mikayev + * Copyright (C) 2011-2016 Dean Beeler, Jerome Fisher, Sergey V. Mikayev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,27 +15,27 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -//#include <cstring> +#include <cstring> + +#include "internals.h" + #include "ROMInfo.h" namespace MT32Emu { -static const ROMInfo *getKnownROMInfoFromList(unsigned int index) { - static const ControlROMFeatureSet MT32_COMPATIBLE(true, true); - static const ControlROMFeatureSet CM32L_COMPATIBLE(false, false); - +static const ROMInfo *getKnownROMInfoFromList(Bit32u index) { // Known ROMs - static const ROMInfo CTRL_MT32_V1_04 = {65536, "5a5cb5a77d7d55ee69657c2f870416daed52dea7", ROMInfo::Control, "ctrl_mt32_1_04", "MT-32 Control v1.04", ROMInfo::Full, NULL, &MT32_COMPATIBLE}; - static const ROMInfo CTRL_MT32_V1_05 = {65536, "e17a3a6d265bf1fa150312061134293d2b58288c", ROMInfo::Control, "ctrl_mt32_1_05", "MT-32 Control v1.05", ROMInfo::Full, NULL, &MT32_COMPATIBLE}; - static const ROMInfo CTRL_MT32_V1_06 = {65536, "a553481f4e2794c10cfe597fef154eef0d8257de", ROMInfo::Control, "ctrl_mt32_1_06", "MT-32 Control v1.06", ROMInfo::Full, NULL, &MT32_COMPATIBLE}; - static const ROMInfo CTRL_MT32_V1_07 = {65536, "b083518fffb7f66b03c23b7eb4f868e62dc5a987", ROMInfo::Control, "ctrl_mt32_1_07", "MT-32 Control v1.07", ROMInfo::Full, NULL, &MT32_COMPATIBLE}; - static const ROMInfo CTRL_MT32_BLUER = {65536, "7b8c2a5ddb42fd0732e2f22b3340dcf5360edf92", ROMInfo::Control, "ctrl_mt32_bluer", "MT-32 Control BlueRidge", ROMInfo::Full, NULL, &MT32_COMPATIBLE}; + static const ROMInfo CTRL_MT32_V1_04 = {65536, "5a5cb5a77d7d55ee69657c2f870416daed52dea7", ROMInfo::Control, "ctrl_mt32_1_04", "MT-32 Control v1.04", ROMInfo::Full, NULL}; + static const ROMInfo CTRL_MT32_V1_05 = {65536, "e17a3a6d265bf1fa150312061134293d2b58288c", ROMInfo::Control, "ctrl_mt32_1_05", "MT-32 Control v1.05", ROMInfo::Full, NULL}; + static const ROMInfo CTRL_MT32_V1_06 = {65536, "a553481f4e2794c10cfe597fef154eef0d8257de", ROMInfo::Control, "ctrl_mt32_1_06", "MT-32 Control v1.06", ROMInfo::Full, NULL}; + static const ROMInfo CTRL_MT32_V1_07 = {65536, "b083518fffb7f66b03c23b7eb4f868e62dc5a987", ROMInfo::Control, "ctrl_mt32_1_07", "MT-32 Control v1.07", ROMInfo::Full, NULL}; + static const ROMInfo CTRL_MT32_BLUER = {65536, "7b8c2a5ddb42fd0732e2f22b3340dcf5360edf92", ROMInfo::Control, "ctrl_mt32_bluer", "MT-32 Control BlueRidge", ROMInfo::Full, NULL}; - static const ROMInfo CTRL_CM32L_V1_00 = {65536, "73683d585cd6948cc19547942ca0e14a0319456d", ROMInfo::Control, "ctrl_cm32l_1_00", "CM-32L/LAPC-I Control v1.00", ROMInfo::Full, NULL, &CM32L_COMPATIBLE}; - static const ROMInfo CTRL_CM32L_V1_02 = {65536, "a439fbb390da38cada95a7cbb1d6ca199cd66ef8", ROMInfo::Control, "ctrl_cm32l_1_02", "CM-32L/LAPC-I Control v1.02", ROMInfo::Full, NULL, &CM32L_COMPATIBLE}; + static const ROMInfo CTRL_CM32L_V1_00 = {65536, "73683d585cd6948cc19547942ca0e14a0319456d", ROMInfo::Control, "ctrl_cm32l_1_00", "CM-32L/LAPC-I Control v1.00", ROMInfo::Full, NULL}; + static const ROMInfo CTRL_CM32L_V1_02 = {65536, "a439fbb390da38cada95a7cbb1d6ca199cd66ef8", ROMInfo::Control, "ctrl_cm32l_1_02", "CM-32L/LAPC-I Control v1.02", ROMInfo::Full, NULL}; - static const ROMInfo PCM_MT32 = {524288, "f6b1eebc4b2d200ec6d3d21d51325d5b48c60252", ROMInfo::PCM, "pcm_mt32", "MT-32 PCM ROM", ROMInfo::Full, NULL, NULL}; - static const ROMInfo PCM_CM32L = {1048576, "289cc298ad532b702461bfc738009d9ebe8025ea", ROMInfo::PCM, "pcm_cm32l", "CM-32L/CM-64/LAPC-I PCM ROM", ROMInfo::Full, NULL, NULL}; + static const ROMInfo PCM_MT32 = {524288, "f6b1eebc4b2d200ec6d3d21d51325d5b48c60252", ROMInfo::PCM, "pcm_mt32", "MT-32 PCM ROM", ROMInfo::Full, NULL}; + static const ROMInfo PCM_CM32L = {1048576, "289cc298ad532b702461bfc738009d9ebe8025ea", ROMInfo::PCM, "pcm_cm32l", "CM-32L/CM-64/LAPC-I PCM ROM", ROMInfo::Full, NULL}; static const ROMInfo * const ROM_INFOS[] = { &CTRL_MT32_V1_04, @@ -52,23 +52,11 @@ static const ROMInfo *getKnownROMInfoFromList(unsigned int index) { return ROM_INFOS[index]; } -const ROMInfo* ROMInfo::getROMInfo(Common::File *file) { - size_t fileSize = file->size(); - Common::String fileName = file->getName(); - fileName.toUppercase(); - bool isCM32LROM = fileName.hasPrefix("CM32L_"); - // We haven't added the SHA1 checksum code in ScummVM, as the file size - // and ROM name suffices for our needs for now. - //const char *fileDigest = file->getSHA1(); - for (int i = 0; getKnownROMInfoFromList(i) != NULL; i++) { +const ROMInfo* ROMInfo::getROMInfo(File *file) { + size_t fileSize = file->getSize(); + for (Bit32u i = 0; getKnownROMInfoFromList(i) != NULL; i++) { const ROMInfo *romInfo = getKnownROMInfoFromList(i); - if (fileSize == romInfo->fileSize /*&& !strcmp(fileDigest, romInfo->sha1Digest)*/) { - if (fileSize == 65536) { - // If we are looking for a CM-32L ROM, make sure we return the first matching - // CM-32L ROM from the list, instead of the first matching MT-32 ROM - if (isCM32LROM && romInfo->controlROMFeatures->isDefaultReverbMT32Compatible()) - continue; - } + if (fileSize == romInfo->fileSize && !strcmp(file->getSHA1(), romInfo->sha1Digest)) { return romInfo; } } @@ -79,17 +67,17 @@ void ROMInfo::freeROMInfo(const ROMInfo *romInfo) { (void) romInfo; } -static int getROMCount() { - int count; +static Bit32u getROMCount() { + Bit32u count; for(count = 0; getKnownROMInfoFromList(count) != NULL; count++) { } return count; } -const ROMInfo** ROMInfo::getROMInfoList(unsigned int types, unsigned int pairTypes) { +const ROMInfo** ROMInfo::getROMInfoList(Bit32u types, Bit32u pairTypes) { const ROMInfo **romInfoList = new const ROMInfo*[getROMCount() + 1]; const ROMInfo **currentROMInList = romInfoList; - for(int i = 0; getKnownROMInfoFromList(i) != NULL; i++) { + for (Bit32u i = 0; getKnownROMInfoFromList(i) != NULL; i++) { const ROMInfo *romInfo = getKnownROMInfoFromList(i); if ((types & (1 << romInfo->type)) && (pairTypes & (1 << romInfo->pairType))) { *currentROMInList++ = romInfo; @@ -103,19 +91,22 @@ void ROMInfo::freeROMInfoList(const ROMInfo **romInfoList) { delete[] romInfoList; } -const ROMImage* ROMImage::makeROMImage(Common::File *file) { - ROMImage *romImage = new ROMImage; - romImage->file = file; - romImage->romInfo = ROMInfo::getROMInfo(romImage->file); - return romImage; +ROMImage::ROMImage(File *useFile) : file(useFile), romInfo(ROMInfo::getROMInfo(file)) +{} + +ROMImage::~ROMImage() { + ROMInfo::freeROMInfo(romInfo); +} + +const ROMImage* ROMImage::makeROMImage(File *file) { + return new ROMImage(file); } void ROMImage::freeROMImage(const ROMImage *romImage) { - ROMInfo::freeROMInfo(romImage->romInfo); delete romImage; } -Common::File* ROMImage::getFile() const { +File* ROMImage::getFile() const { return file; } @@ -123,17 +114,4 @@ const ROMInfo* ROMImage::getROMInfo() const { return romInfo; } -ControlROMFeatureSet::ControlROMFeatureSet(bool useDefaultReverbMT32Compatible, bool useOldMT32AnalogLPF) : - defaultReverbMT32Compatible(useDefaultReverbMT32Compatible), - oldMT32AnalogLPF(useOldMT32AnalogLPF) -{} - -bool ControlROMFeatureSet::isDefaultReverbMT32Compatible() const { - return defaultReverbMT32Compatible; -} - -bool ControlROMFeatureSet::isOldMT32AnalogLPF() const { - return oldMT32AnalogLPF; -} - -} +} // namespace MT32Emu |