Opened 14 years ago

Closed 14 years ago

Last modified 5 years ago

#9112 closed patch

HE: Resource Forks on Mac OS X

Reported by: SF/mthreepwood Owned by: sev-
Priority: normal Component: Port: Mac OS X
Version: Keywords:
Cc: Game:

Description

This patch adds support for opening the resource fork directly on Mac OS X. Previously, the games that required the resource fork could not be used on Mac OS X without mangling the files. It's slightly hackish in that I'm calling StdioStream directly (though in a #ifdef MACOSX block), but it was the cleanest way I could think of. I tested this with Let's Explore the Jungle with Buzzy (Macintosh, obviously) on Mac OS X 10.5.8 x86.

Ticket imported from: #2901515. Ticket imported from: patches/1217.

Attachments (4)

scumm_mac_resfork.diff (1.3 KB ) - added by SF/mthreepwood 14 years ago.
Patch against HEAD
resfork_macosx.diff (12.3 KB ) - added by SF/mthreepwood 14 years ago.
Patch against r47406
resfork_macosx_alt.diff (12.5 KB ) - added by SF/mthreepwood 14 years ago.
Patch with dumped forks on OSX too (r47618)
mac_resfork_4-7-2010.diff (17.4 KB ) - added by SF/mthreepwood 14 years ago.
Patch against r48579

Download all attachments as: .zip

Change History (21)

by SF/mthreepwood, 14 years ago

Attachment: scumm_mac_resfork.diff added

Patch against HEAD

comment:1 by sev-, 14 years ago

Max, could you take a look at this?

Matthew, I wonder why are you removing the reopening file code at lines 1184 and 1185?

comment:2 by sev-, 14 years ago

Owner: set to fingolfin

comment:3 by SF/mthreepwood, 14 years ago

There's two reasons why I removed that: a) It wouldn't be calling the same StdioStream::makeFromPath function as before, and more importantly b) It's not necessary to have in the first place ;)

comment:4 by sev-, 14 years ago

I moved Mac Resource manager to separate class in Common. What I see now is that your code on Macs will work only with files with resource fork, and will stop working with extracted forks.

Can you modify your code so this will be as a fallback? And of course, move it to common/mancresman.cpp. I could do it, but I completely unable to test it.

comment:5 by sev-, 14 years ago

Owner: changed from fingolfin to SF/mthreepwood

comment:6 by SF/mthreepwood, 14 years ago

I purposely made the code not work with the extracted forks. I don't think users who legally use the game will be using the MacBinary format for their game. I don't see any benefit in letting Mac OS X use the MacBinary code here.

I will add an updated patch soon.

comment:7 by SF/mthreepwood, 14 years ago

I'm adding an updated patch which does the following: - Make MacResManager API more sensible by adding a open/close functions and returning a Common::SeekableReadStream pointer from getResource() instead of a byte pointer (and an int pointer parameter). - Rename convertCursor() to convertCrsrCursor() because there are many types of cursors that can be found in resource forks - Use a uint32 tagID instead of a const char* as the tagID - Move the checks for the filename to MacResManager (.bin, .rsrc, etc.) - Added the Mac OS X specific code into MacResManager

However, I left my games at home that would use this code and I am unable to test until, by the earliest, Friday night.

by SF/mthreepwood, 14 years ago

Attachment: resfork_macosx.diff added

Patch against r47406

comment:8 by SF/mthreepwood, 14 years ago

Owner: changed from SF/mthreepwood to sev-

comment:9 by SF/mthreepwood, 14 years ago

Just tested this patch and it works fine. Assigning back to sev to have a look at it.

by SF/mthreepwood, 14 years ago

Attachment: resfork_macosx_alt.diff added

Patch with dumped forks on OSX too (r47618)

comment:10 by SF/mthreepwood, 14 years ago

One last update: Here's a version that still allows for dumped forks to still be used on OS X.

by SF/mthreepwood, 14 years ago

Attachment: mac_resfork_4-7-2010.diff added

Patch against r48579

comment:11 by SF/mthreepwood, 14 years ago

Updating again:

1) Refactor out some of the code to separate raw/MacBinary, etc. 2) Add support for reading the data fork portion of MacBinary files 3) For files without the data fork embedded, getDataFork() will return a pointer to the regular file 4) Add hasDataFork() and hasResFork() functions 5) Add (untested) support for the AppleDouble format used when copying on OS X from a HFS(+) to non-HFS(+) file system to maintain the data fork

comment:12 by SF/mthreepwood, 14 years ago

Would be nice if there were an edit function on these tickets...

In regards to #5, it can be removed if the rest of the patch is acceptable and you don't want to commit the untested code.

comment:13 by sev-, 14 years ago

The patch looks pretty good now. The only thing that it does not apply anymore to trunk. Could you please update it, so I test for regressions?

comment:14 by sev-, 14 years ago

My bad. On new OS patch utility requires -p parameter to understand the patches.

I tested for regressions and committed as is. Still I did not tested in on MacOS, but judging by the code it should work.

comment:15 by sev-, 14 years ago

Status: newclosed

comment:16 by SF/mthreepwood, 14 years ago

Yup, still works on Mac OS X.

comment:17 by digitall, 5 years ago

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