MT32: Sync with the latest changes in munt

This syncs the code with munt commit fa8b4f899d, avoiding usage of a
global constructor
This commit is contained in:
Filippos Karapetis 2014-07-13 17:12:04 +03:00
parent fd40cb2224
commit f953e3a435
3 changed files with 22 additions and 28 deletions

View File

@ -33,14 +33,6 @@ static const Bit8u PartialMixStruct[13] = {
1, 3, 3, 2, 2, 2, 2
};
static const float floatKeyfollow[17] = {
-1.0f, -1.0f / 2.0f, -1.0f / 4.0f, 0.0f,
1.0f / 8.0f, 1.0f / 4.0f, 3.0f / 8.0f, 1.0f / 2.0f, 5.0f / 8.0f, 3.0f / 4.0f, 7.0f / 8.0f, 1.0f,
5.0f / 4.0f, 3.0f / 2.0f, 2.0f,
1.0009765625f, 1.0048828125f
};
RhythmPart::RhythmPart(Synth *useSynth, unsigned int usePartNum): Part(useSynth, usePartNum) {
strcpy(name, "Rhythm");
rhythmTemp = &synth->mt32ram.rhythmTemp[0];

View File

@ -20,6 +20,7 @@
namespace MT32Emu {
static const ROMInfo *getKnownROMInfoFromList(unsigned int index) {
static const ControlROMFeatureSet MT32_COMPATIBLE(true);
static const ControlROMFeatureSet CM32L_COMPATIBLE(false);
@ -48,13 +49,16 @@ static const ROMInfo * const ROM_INFOS[] = {
&PCM_CM32L,
NULL};
return ROM_INFOS[index];
}
const ROMInfo* ROMInfo::getROMInfo(Common::File *file) {
size_t fileSize = file->size();
// We haven't added the SHA1 checksum code in ScummVM, as the file size
// suffices for our needs for now.
//const char *fileDigest = file->getSHA1();
for (int i = 0; ROM_INFOS[i] != NULL; i++) {
const ROMInfo *romInfo = ROM_INFOS[i];
for (int i = 0; getKnownROMInfoFromList(i) != NULL; i++) {
const ROMInfo *romInfo = getKnownROMInfoFromList(i);
if (fileSize == romInfo->fileSize /*&& !strcmp(fileDigest, romInfo->sha1Digest)*/) {
return romInfo;
}
@ -68,7 +72,7 @@ void ROMInfo::freeROMInfo(const ROMInfo *romInfo) {
static int getROMCount() {
int count;
for(count = 0; ROM_INFOS[count] != NULL; count++) {
for(count = 0; getKnownROMInfoFromList(count) != NULL; count++) {
}
return count;
}
@ -76,8 +80,8 @@ static int getROMCount() {
const ROMInfo** ROMInfo::getROMInfoList(unsigned int types, unsigned int pairTypes) {
const ROMInfo **romInfoList = new const ROMInfo*[getROMCount() + 1];
const ROMInfo **currentROMInList = romInfoList;
for(int i = 0; ROM_INFOS[i] != NULL; i++) {
const ROMInfo *romInfo = ROM_INFOS[i];
for(int i = 0; getKnownROMInfoFromList(i) != NULL; i++) {
const ROMInfo *romInfo = getKnownROMInfoFromList(i);
if ((types & (1 << romInfo->type)) && (pairTypes & (1 << romInfo->pairType))) {
*currentROMInList++ = romInfo;
}

View File

@ -246,7 +246,6 @@ bool Synth::isReversedStereoEnabled() {
}
bool Synth::loadControlROM(const ROMImage &controlROMImage) {
if (&controlROMImage == NULL) return false;
Common::File *file = controlROMImage.getFile();
const ROMInfo *controlROMInfo = controlROMImage.getROMInfo();
if ((controlROMInfo == NULL)
@ -282,7 +281,6 @@ bool Synth::loadControlROM(const ROMImage &controlROMImage) {
}
bool Synth::loadPCMROM(const ROMImage &pcmROMImage) {
if (&pcmROMImage == NULL) return false;
Common::File *file = pcmROMImage.getFile();
const ROMInfo *pcmROMInfo = pcmROMImage.getROMInfo();
if ((pcmROMInfo == NULL)