aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/sound/zork_raw.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2015-01-07 23:45:43 +0200
committerFilippos Karapetis2015-01-07 23:49:12 +0200
commit07ad10babe6eed96ac1d3ff8e9fc9580ec21b7bd (patch)
tree261bc0f12735a974245b7d775b3f13c62f0923fa /engines/zvision/sound/zork_raw.cpp
parent5e1702d60e4e6b6e618be36a64dc4ef563c80e47 (diff)
downloadscummvm-rg350-07ad10babe6eed96ac1d3ff8e9fc9580ec21b7bd.tar.gz
scummvm-rg350-07ad10babe6eed96ac1d3ff8e9fc9580ec21b7bd.tar.bz2
scummvm-rg350-07ad10babe6eed96ac1d3ff8e9fc9580ec21b7bd.zip
ZVISION: Handle sound patches (.src files) dynamically
Diffstat (limited to 'engines/zvision/sound/zork_raw.cpp')
-rw-r--r--engines/zvision/sound/zork_raw.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/engines/zvision/sound/zork_raw.cpp b/engines/zvision/sound/zork_raw.cpp
index 6d1980b1af..0ef5de2f55 100644
--- a/engines/zvision/sound/zork_raw.cpp
+++ b/engines/zvision/sound/zork_raw.cpp
@@ -242,11 +242,27 @@ Audio::RewindableAudioStream *makeRawZorkStream(Common::SeekableReadStream *stre
Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, ZVision *engine) {
Common::File *file = new Common::File();
- if (!engine->getSearchManager()->openFile(*file, filePath))
- error("File not found: %s", filePath.c_str());
+ Common::String actualName = filePath;
+ bool found = engine->getSearchManager()->openFile(*file, actualName);
+ bool isRaw = actualName.hasSuffix(".raw");
+
+ if ((!found && isRaw) || (found && isRaw && file->size() < 10)) {
+ if (found)
+ file->close();
+
+ // Check for an audio patch (.src)
+ actualName.setChar('s', actualName.size() - 3);
+ actualName.setChar('r', actualName.size() - 2);
+ actualName.setChar('c', actualName.size() - 1);
+
+ if (!engine->getSearchManager()->openFile(*file, actualName))
+ error("File not found: %s", actualName.c_str());
+ } else if (!found && !isRaw) {
+ error("File not found: %s", actualName.c_str());
+ }
// Get the file name
- Common::StringTokenizer tokenizer(filePath, "/\\");
+ Common::StringTokenizer tokenizer(actualName, "/\\");
Common::String fileName;
while (!tokenizer.empty()) {
fileName = tokenizer.nextToken();