[Scummvm-git-logs] scummvm master -> 0b777c23a9807d149a11d4df5ea3f4e748fb53f2
rvanlaar
roland at rolandvanlaar.nl
Mon Aug 10 16:58:48 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0b777c23a9 DIRECTOR: LINGO: normalize xlib in openXLib call
Commit: 0b777c23a9807d149a11d4df5ea3f4e748fb53f2
https://github.com/scummvm/scummvm/commit/0b777c23a9807d149a11d4df5ea3f4e748fb53f2
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2020-08-10T18:58:12+02:00
Commit Message:
DIRECTOR: LINGO: normalize xlib in openXLib call
In Director, the openXLib call loads an XLib from a file.
Resource forks on Mac, dlls on windows.
The XLib has it's own name. It looks like the filename,
most of the time.
ScummVM doesn't read these files, but reimplements them in C.
ScummVM's openXLib is a wrapper which loads the XLib in question.
A conversion is needed to go from filename to XLib.
The conversion is follows these steps:
- on mac: strip leading path, i.e. ':',
- on windows: strip '.dll' extension,
- lowercase and
- trimmed
The name in the XLibProto struct isn't normalized since that's the
variable name as it's know and found by the code.
Changed paths:
engines/director/lingo/lingo-object.cpp
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index e69ca946f1..62c1a3d9af 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -118,16 +118,27 @@ void Lingo::initXLibs() {
sym.maxArgs = 0;
sym.targetType = lib->type;
sym.u.bltin = lib->initializer;
- _xlibInitializers[lib->name] = sym;
+ Common::String xlibName = lib->name;
+ xlibName.toLowercase();
+ _xlibInitializers[xlibName] = sym;
}
}
void Lingo::openXLib(Common::String name, ObjectType type) {
- if (_vm->getPlatform() == Common::kPlatformMacintosh) {
+
+ Common::Platform platform = _vm->getPlatform();
+ if (platform == Common::kPlatformMacintosh) {
int pos = name.findLastOf(':');
name = name.substr(pos + 1, name.size());
+ } else if (platform == Common::kPlatformWindows) {
+ if (name.hasSuffixIgnoreCase(".dll"))
+ name = name.substr(0, name.size() - 4);
}
+ // normalize xlib name
+ name.toLowercase();
+ name.trim();
+
if (_xlibInitializers.contains(name)) {
Symbol sym = _xlibInitializers[name];
(*sym.u.bltin)(type);
More information about the Scummvm-git-logs
mailing list