From beacae5efda12366b04c7c53f4e063b254253de5 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Thu, 8 Jan 2009 07:31:32 +0000 Subject: Trim resource filenames to 8 characters as a last resort on BRA. Script files are unbelievably broken. svn-id: r35784 --- engines/parallaction/disk_br.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'engines') 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; } -- cgit v1.2.3