aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/resource.cpp23
-rw-r--r--scumm/sound.cpp19
2 files changed, 35 insertions, 7 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index cf20931e8c..8b9087c35b 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -848,6 +848,7 @@ int Scumm::readSoundResource(int type, int idx) {
// Specifies a seperate file to be used for music from what I gather.
int tmpsize;
int i = 0;
+ File dmuFile;
char buffer[128];
debug(1, "Found base tag FMUS in sound %d, size %d", idx, total_size);
debug(1, "It was at position %d", _fileHandle.pos());
@@ -861,15 +862,23 @@ int Scumm::readSoundResource(int type, int idx) {
tmpsize = _fileHandle.readUint32BE();
// SDAT contains name of file we want
- do {
+ for (i = 0; (buffer[i] != ' ') && (i < tmpsize - 8) ; i++) {
buffer[i] = _fileHandle.readByte();
- i++;
- } while (i < tmpsize && i < 128 && buffer[i] != ' ');
- buffer[i] = '\0';
+ }
+ buffer[tmpsize - 11] = '\0';
debug(1, "FMUS file %s", buffer);
-
- res.roomoffs[type][idx] = 0xFFFFFFFF;
- return 0;
+ if (dmuFile.open(buffer, getGameDataPath()) == false) {
+ warning("Can't open music file %s*", buffer);
+ res.roomoffs[type][idx] = 0xFFFFFFFF;
+ return 0;
+ }
+ dmuFile.seek(4, SEEK_SET);
+ total_size = dmuFile.readUint32BE();
+ debug(1, "dmu file size %d", total_size);
+ dmuFile.seek(-8, SEEK_CUR);
+ dmuFile.read(createResource(type, idx, total_size), total_size);
+ dmuFile.close();
+ return 1;
} else if (basetag == MKID('Crea')) {
_fileHandle.seek(-12, SEEK_CUR);
total_size = _fileHandle.readUint32BE();
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index a610d8acf5..c70f8e8f2d 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -239,6 +239,24 @@ void Sound::playSound(int soundID) {
_scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
return;
}
+ else if (READ_UINT32(ptr) == MKID('MRAW')) {
+ // pcm music in 3DO humongous games
+ // TODO play via imuse so isSoundRunning can properly report music value?
+ ptr += 8 + READ_BE_UINT32(ptr+12);
+ if (READ_UINT32(ptr) != MKID('SDAT'))
+ return;
+
+ size = READ_BE_UINT32(ptr+4) - 8;
+ rate = 22050;
+ flags = SoundMixer::FLAG_AUTOFREE;
+
+ // Allocate a sound buffer, copy the data into it, and play
+ sound = (char *)malloc(size);
+ memcpy(sound, ptr + 8, size);
+ _scumm->_mixer->playRaw(NULL, sound, size, rate, flags, soundID);
+
+ return;
+ }
// XMIDI
else if ((READ_UINT32(ptr) == MKID('MIDI')) && (_scumm->_features & GF_HUMONGOUS)) {
// Pass XMIDI on to IMuse unprocessed.
@@ -658,6 +676,7 @@ int Sound::isSoundRunning(int sound) const {
} else if (sound == -1) {
// getSoundStatus(), with a -1, will return the
// ID number of the first active music it finds.
+ // TODO handle MRAW (pcm music) in humongous games
return _scumm->_imuse->getSoundStatus(sound);
}
}