Opened 5 years ago

Closed 5 years ago

Last modified 7 months ago

#6678 closed defect (fixed)

SCUMM: LOOM Mac - Steam version exits immediately with error()

Reported by: SF/janischulze Owned by: criezy
Priority: normal Component: Port: Mac OS X
Keywords: Cc:
Game: Loom

Description

Steps to reproduce:
1) Purchase and install Loom in Steam if not done already.
2) Once installed right click the Loom entry in your Library and select "Properties". Select "Local Files" and from there "Browse Local Files". In Finder notice the location of the single application bundle called "Loom".
3) Start ScummVM and select "Add Game...". Navigate to folder you saw in the previous step.
4) Notice that if you select the application bundle it will not get recognized by ScummVM.
5) Go back to Finder and right click the Loom application bundle. Select "Show Contents". Copy the "Contents" folder somewhere on your hard drive.
6) Select "Add Game..." again in ScummVM and navigate to the folder where you copied the "Contents" folder.
7) The game gets correctly detected as: ID = loom-steam-mac, Name = Loom (Steam/Machintosh/English), Language = English, Platform = Macintosh.
8) Try to launch the game in ScummVM.
9) Game will not launch, instead error message is displayed: "Cannot find file:'000.lfl'"

Details:
ScummVM version:
ScummVM 1.8.0git49-g24595ed (Jul 9 2014 08:11:42)
Features compiled in: TAINTED Vorbis FLAC MP3 SEQ TiMidity RGB zLib MPEG2 Theora FreeType2 JPEG PNG
Mac OSX 10.9.4. 2.3 GHz Intel Core i5, 8 Gt 1333Mhz DDR 3 Memory, Intel HD3000 integrated graphics

Notes: I am not sure how Steam/Mac versions should be added to ScummVM that is why I included rather elaborate steps to reproduce in case it is an user error.

Ticket imported from: bugs/6678.

Change History (14)

comment:1 Changed 5 years ago by bluegr

That is very odd. Can you please provide the name, file size and MD5 hash of your Loom main executable?

Mine is located in Contents/MacOS/Loom
Size: 393,572 bytes
MD5 hash: B4A677BF27C010A747975705108FF1E6

comment:2 Changed 5 years ago by criezy

If I follow the steps described here I get the same issue. I am also on MacOS 10.9 and I am using a version compiled from the current branch-1-7 head (aa31d1f).

File Contents/MacOS/Loom
Size:393 572 bytes
MD5: b4a677bf27c010a747975705108ff1e6
So this is exactly the same ones posted by Filippos.

comment:3 Changed 5 years ago by digitall

Summary: Loom Mac Steam version gets detected but gives error when trying to play itSCUMM: LOOM Mac - Steam version exits immediately with error()

comment:4 Changed 5 years ago by bluegr

Could you try with the Windows version, too? You can download it via the Windows Steam client.

Under Windows, both the Windows and the Mac versions work fine. Reading through the code, I can't find any reason why the game executable isn't accessed properly (which is what this error means). Quite odd.

comment:5 Changed 5 years ago by digitall

That particular error() is only emitted from ScummEngine::askForDisk():
https://github.com/scummvm/scummvm/blob/master/engines/scumm/resource.cpp#L213

In turn, this is only called from ScummEngine::openRoom():
https://github.com/scummvm/scummvm/blob/master/engines/scumm/resource.cpp#L65

Probably this particular call:
https://github.com/scummvm/scummvm/blob/master/engines/scumm/resource.cpp#L143

comment:6 Changed 5 years ago by digitall

Since either call uses ScummEngine::openResourceFile() to actually get the datafile i.e. 000.lfl:
https://github.com/scummvm/scummvm/blob/master/engines/scumm/resource.cpp#L203

Then the issue is whether ScummEngine::openFile() is finding that file:
https://github.com/scummvm/scummvm/blob/master/engines/scumm/resource.cpp#L184

comment:7 Changed 5 years ago by digitall

My guess here is that this may be because ScummSteamFile implements the open() method, but not the openSubFile() method which is used in one case:
https://github.com/scummvm/scummvm/blob/master/engines/scumm/file.h#L135
https://github.com/scummvm/scummvm/blob/master/engines/scumm/resource.cpp#L192

This does not cause an error as the base class, ScummFile implements it in the "normal" way, but will of course not find this if it is inside the Steam container...

comment:8 Changed 5 years ago by bluegr

digitall: no, only specific versions are packed in container files. In such cases, ALL of the game data files are in the container. Such versions are distinguished via the kGenUnchanged file generation method.

In the Mac Steam version of Loom, only the main index file (000.lfl) is packed inside the main executable, whereas the rest of the datafiles are not packed. These are distinguished by the kGenDiskNumSteam/kGenRoomNumSteam file generation methods. Thus, there will never be a global container file set in these versions, so the code blocks you pointed at should never be reached in this case.

comment:9 Changed 5 years ago by criezy

This fails when calling ScummFile::open("Loom") from ScummSteamFile::openWithSubRange.

But I got it working. The issue is that you need to have all the files in the same directory, for example copy the Loom executable from MacOS into Resources and then select that directory when adding the game. With the instructions from the original poster, for some reasons selecting the Content directory does detect the game correctly, despite the executable being in a MacOS sub-directory, but then that executable is not found when starting the game.

comment:10 Changed 5 years ago by bluegr

@Thierry Crozat: Thanks!

That means that lines 1052-1055 in scumm.cpp are not working as they should in MacOS:
SearchMan.addSubDirectoryMatching(gameDataDir, "Contents");
SearchMan.addSubDirectoryMatching(gameDataDir, "Contents/MacOS");
SearchMan.addSubDirectoryMatching(gameDataDir, "Contents/Resources");
SearchMan.addSubDirectoryMatching(gameDataDir, "Contents/Resources/video");

Does the game work if you copy these out of the if block ("Extra directories needed for the Steam versions") together with the other lines above the if blok?

comment:11 Changed 5 years ago by criezy

@Filippos: Those lines work as expected. The issue is that Loom.app does not appear as a directory but appears as an application file on Mac. So you cannot select it when adding a game. Which is why the original bug reporter copied the Contents directory outside of the Loom.app bundle and selected Contents when adding the game. And then there is no "Contents/MacOS" subdirectory in there. Adding the following lines make it work correctly in this configuration:
SearchMan.addSubDirectoryMatching(gameDataDir, "MacOS");
SearchMan.addSubDirectoryMatching(gameDataDir, "Resources");
SearchMan.addSubDirectoryMatching(gameDataDir, "Resources/video");

An alternative to copying Contents outside the application bundle is to rename the application bundle. If you remove the ".app" from "Loom.app", then it appears as a folder and you can select it when adding the game. And then everything work well with the current code.

comment:12 Changed 5 years ago by criezy

Owner: set to criezy
Resolution: fixed
Status: newclosed

comment:13 Changed 5 years ago by criezy

I pushed a commit to treat bundles as directories in the OS X file browser. So now we can select Loom.app when adding a game and it all works as expected afterward. So I will close this as fixed.

comment:14 Changed 7 months ago by digitall

Component: Port: Mac OS X
Game: Loom
Note: See TracTickets for help on using tickets.