diff options
author | Eugene Sandulenko | 2017-02-23 19:06:10 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-02-23 19:06:10 +0100 |
commit | 6047e35bfdc568beecc25ff6adffe77e1543cc1a (patch) | |
tree | b4d730abe28a1a83ca9b425daacf8d400e21e220 /engines/director/lingo/lingo-funcs.cpp | |
parent | 70eddbcdb0f0f3720897b069955f4a007fe5ebfe (diff) | |
download | scummvm-rg350-6047e35bfdc568beecc25ff6adffe77e1543cc1a.tar.gz scummvm-rg350-6047e35bfdc568beecc25ff6adffe77e1543cc1a.tar.bz2 scummvm-rg350-6047e35bfdc568beecc25ff6adffe77e1543cc1a.zip |
DIRECTOR: Lingo: Clean file name of 8-bit character before loading
Mac has had possibility to have 8-bit characters in their filenames.
In the modern world it goes with either codepages or UTF-8, which
makes it much less compatible. Trying to mitigate that
Diffstat (limited to 'engines/director/lingo/lingo-funcs.cpp')
-rw-r--r-- | engines/director/lingo/lingo-funcs.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp index ddc51f4149..f8a17f3bdb 100644 --- a/engines/director/lingo/lingo-funcs.cpp +++ b/engines/director/lingo/lingo-funcs.cpp @@ -180,17 +180,29 @@ void Lingo::func_goto(Datum &frame, Datum &movie) { if (movie.type != VOID) { movie.toString(); + Common::String cleanedFilename; + + for (const char *p = movie.u.s->c_str(); *p; p++) + if (*p >= 0x20 && *p <= 0x7f) + cleanedFilename += *p; + bool fileExists = false; if (_vm->getPlatform() == Common::kPlatformMacintosh) { Common::MacResManager resMan; if (resMan.open(*movie.u.s)) { fileExists = true; + cleanedFilename = *movie.u.s; + } else if (resMan.open(cleanedFilename)) { + fileExists = true; } } else { Common::File file; if (file.open(*movie.u.s)) { fileExists = true; + cleanedFilename = *movie.u.s; + } else if (file.open(cleanedFilename)) { + fileExists = true; } } @@ -199,7 +211,7 @@ void Lingo::func_goto(Datum &frame, Datum &movie) { return; } - _vm->_nextMovie = *movie.u.s; + _vm->_nextMovie = cleanedFilename; _vm->getCurrentScore()->_stopPlay = true; _vm->_nextMovieFrameS.clear(); |