Skip to content

Commit

Permalink
DIRECTOR: Check for movie file extensions on Mac
Browse files Browse the repository at this point in the history
* DIRECTOR: Check for movie file extensions on Mac

Some Mac games have file extensions for movies, but use
extensionless filenames in the code (e.g. Total Distortion).

* DIRECTOR: LINGO: Add alias for MoveMouse.XObj

Fixes Jungle Park for Mac.
  • Loading branch information
moralrecordings committed Nov 6, 2021
1 parent 8cf058a commit 08bfca4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
1 change: 1 addition & 0 deletions engines/director/lingo/xlibs/movemousexobj.cpp
Expand Up @@ -34,6 +34,7 @@ namespace Director {
const char *MoveMouseXObj::xlibName = "MoveMouse";
const char *MoveMouseXObj::fileNames[] = {
"MoveMouse",
"MoveMouse.XObj",
"MOVEWIN",
0
};
Expand Down
43 changes: 20 additions & 23 deletions engines/director/util.cpp
Expand Up @@ -510,28 +510,28 @@ Common::String pathMakeRelative(Common::String path, bool recursive, bool addext
// Let's try to translate file path into 8.3 format
Common::String addedexts;

if (g_director->getPlatform() == Common::kPlatformWindows && g_director->getVersion() < 500) {
convPath.clear();
const char *ptr = initialPath.c_str();
Common::String component;

while (*ptr) {
if (*ptr == g_director->_dirSeparator) {
if (component.equals(".")) {
convPath += component;
} else {
convPath += convertMacFilename(component.c_str());
}

component.clear();
convPath += g_director->_dirSeparator;
convPath.clear();
const char *ptr = initialPath.c_str();
Common::String component;

while (*ptr) {
if (*ptr == g_director->_dirSeparator) {
if (component.equals(".")) {
convPath += component;
} else {
component += *ptr;
convPath += convertMacFilename(component.c_str());
}

ptr++;
component.clear();
convPath += g_director->_dirSeparator;
} else {
component += *ptr;
}

ptr++;
}

if (g_director->getPlatform() == Common::kPlatformWindows) {
if (hasExtension(component)) {
Common::String nameWithoutExt = component.substr(0, component.size() - 4);
Common::String ext = component.substr(component.size() - 4);
Expand All @@ -543,14 +543,11 @@ Common::String pathMakeRelative(Common::String path, bool recursive, bool addext
if (testPath(res))
return res;
}

if (addexts)
addedexts = testExtensions(component, initialPath, convPath);
} else {
if (addexts)
addedexts = testExtensions(initialPath, initialPath, convPath);
}

if (addexts)
addedexts = testExtensions(component, initialPath, convPath);

if (!addedexts.empty()) {
return addedexts;
}
Expand Down

0 comments on commit 08bfca4

Please sign in to comment.