mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
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
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user