diff options
-rw-r--r-- | engines/sherlock/music.cpp | 27 | ||||
-rw-r--r-- | engines/sherlock/resources.cpp | 8 | ||||
-rw-r--r-- | engines/sherlock/resources.h | 6 |
3 files changed, 39 insertions, 2 deletions
diff --git a/engines/sherlock/music.cpp b/engines/sherlock/music.cpp index 10796e47ea..7802bf5eeb 100644 --- a/engines/sherlock/music.cpp +++ b/engines/sherlock/music.cpp @@ -583,8 +583,31 @@ void Music::setMusicVolume(int volume) { void Music::getSongNames(Common::StringArray &songs) { songs.clear(); if (IS_SERRATED_SCALPEL) { - for (int i = 0; i < ARRAYSIZE(SONG_NAMES); i++) { - songs.push_back(SONG_NAMES[i]); + if (IS_3DO) { + Common::FSDirectory gameDirectory(ConfMan.get("path")); + Common::FSDirectory *musicDirectory = gameDirectory.getSubDirectory("music"); + Common::ArchiveMemberList files; + + musicDirectory->listMatchingMembers(files, "*_mw22.aifc"); + + for (Common::ArchiveMemberList::iterator i = files.begin(); i != files.end(); ++i) { + Common::String name = (*i)->getName(); + name.erase(name.size() - 10); + songs.push_back(name); + } + } else { + for (int i = 0; i < ARRAYSIZE(SONG_NAMES); i++) { + songs.push_back(SONG_NAMES[i]); + } + } + } else { + Common::StringArray fileList; + _vm->_res->getResourceNames("music.lib", fileList); + for (Common::StringArray::iterator i = fileList.begin(); i != fileList.end(); ++i) { + if ((*i).matchString("*.XMI", true)) { + (*i).erase((*i).size() - 4); + songs.push_back(*i); + } } } Common::sort(songs.begin(), songs.end()); diff --git a/engines/sherlock/resources.cpp b/engines/sherlock/resources.cpp index 8432c071ba..c4093048bd 100644 --- a/engines/sherlock/resources.cpp +++ b/engines/sherlock/resources.cpp @@ -314,6 +314,14 @@ int Resources::resourceIndex() const { return _resourceIndex; } +void Resources::getResourceNames(const Common::String &libraryFile, Common::StringArray &names) { + addToCache(libraryFile); + LibraryIndex &libIndex = _indexes[libraryFile]; + for (LibraryIndex::iterator i = libIndex.begin(); i != libIndex.end(); ++i) { + names.push_back(i->_key); + } +} + Common::SeekableReadStream *Resources::decompress(Common::SeekableReadStream &source) { // This variation can't be used by Rose Tattoo, since compressed resources include the input size, // not the output size. Which means their decompression has to be done via passed buffers diff --git a/engines/sherlock/resources.h b/engines/sherlock/resources.h index 8275703491..99d58a51b1 100644 --- a/engines/sherlock/resources.h +++ b/engines/sherlock/resources.h @@ -29,6 +29,7 @@ #include "common/hash-str.h" #include "common/rect.h" #include "common/str.h" +#include "common/str-array.h" #include "common/stream.h" #include "graphics/surface.h" @@ -140,6 +141,11 @@ public: int resourceIndex() const; /** + * Produces a list of all resource names within a file. Used by the debugger. + */ + void getResourceNames(const Common::String &libraryFile, Common::StringArray &names); + + /** * Decompresses LZW compressed data */ Common::SeekableReadStream *decompress(Common::SeekableReadStream &source); |