aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2009-01-08 07:31:32 +0000
committerNicola Mettifogo2009-01-08 07:31:32 +0000
commitbeacae5efda12366b04c7c53f4e063b254253de5 (patch)
tree322e569cc3ae49e725689422381a48e28b6b6fc4 /engines
parent294c76f4c4585304d2610634dbb9f3843ab7c767 (diff)
downloadscummvm-rg350-beacae5efda12366b04c7c53f4e063b254253de5.tar.gz
scummvm-rg350-beacae5efda12366b04c7c53f4e063b254253de5.tar.bz2
scummvm-rg350-beacae5efda12366b04c7c53f4e063b254253de5.zip
Trim resource filenames to 8 characters as a last resort on BRA. Script files are unbelievably broken.
svn-id: r35784
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/disk_br.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp
index e026b908f0..1bb4023010 100644
--- a/engines/parallaction/disk_br.cpp
+++ b/engines/parallaction/disk_br.cpp
@@ -102,8 +102,26 @@ Common::SeekableReadStream *Disk_br::openFile_internal(bool errorOnNotFound, con
}
Common::SeekableReadStream *stream = _sset.openFile(lookup);
+ if (stream) {
+ return stream;
+ }
+
+ // as a very last resort, try trimming the file name to 8 chars
+ if (!ext.empty() && lookup.hasSuffix(ext.c_str())) {
+ Common::String filename = Common::lastPathComponent(lookup, '/');
+ int len = filename.size();
+ if (len > 8) {
+ debugC(9, kDebugDisk, "Disk_br::openFile: trimming filename (%s) to 8 characters", name.c_str());
+ while (len-- > 8) {
+ lookup.deleteLastChar();
+ }
+ lookup += ext;
+ stream = _sset.openFile(lookup);
+ }
+ }
+
if (!stream && errorOnNotFound) {
- errorFileNotFound(lookup);
+ errorFileNotFound(name);
}
return stream;
}