aboutsummaryrefslogtreecommitdiff
path: root/scumm/resource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scumm/resource.cpp')
-rw-r--r--scumm/resource.cpp23
1 files changed, 16 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();