Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
803 stars 62 forks source link

Support for MacOS resources/assets #304

Open a-hurst opened 5 years ago

a-hurst commented 5 years ago

As mentioned in #28, this source port currently only works with the assets from the DOS CD and GOG "Enhanced" versions of the game. However, the original Mac OS version of SS1 had higher-resolution resources and a slightly different layout, giving it a unique feel and aesthetic:

DOS Version:

SS1DOS

Mac Version:

SS1

Given that this source port is based on the original Mac source code for SS1, is there any chance that Shockolate could support the Mac version of the resources as well? Or would that complicate things too much on the back end? I'd love to be able to play the original Mac version on modern hardware.

Interrupt commented 5 years ago

The Mac version of the game packages their resources in some period Mac specific resource files for some crazy reason, whereas the DOS version uses Looking Glass' own resource format. Life would be much easier if they used the same resource format, right now loading those assets would only be possible if they were re-packaged.

angstsmurf commented 4 years ago

For a Mac programmer at the time, packaging things in resource forks would have been the clean and proper way to do it. See https://en.wikipedia.org/wiki/Resource_fork

The (legal) solution for Shockolate would be to provide a user guide on how to extract the Mac resource forks using HFSExplorer (documentation here), similar to this guide for ScummVM: https://wiki.scummvm.org/index.php?title=HOWTO-Extract_Pegasus_Prime

Then we would just have to implement reading the extracted resources, which might not be as hard as it sounds, as we already have the original Mac code, and the format is pretty much the same as the DOS assets but big endian. See https://www.systemshock.org/index.php?topic=8054.msg91812#msg91812

Interrupt commented 4 years ago

Supporting two different resource formats seems like more complexity than is needed, a resource converter tool that can convert the files extracted from the Mac resource forks back to the DOS counterparts might be the way to go ahead with this.

I remember seeing a bunch of code in the original Mac code that would take the DOS versions of files and switch their endian-ness and write them back out, maybe we could leverage that as the base of a tool to switch them back!

Another portion of the work here is to get the game code to intelligently scale images based on a target size, right now everything is hard coded to render properly. A big part of getting things rendering properly again in this project was undoing the changes made to draw the higher res Mac UI elements.

angstsmurf commented 4 years ago

I just noticed that the GOG System Shock Enhanced Edition actually uses Mac assets now. I haven't checked whether they are endian swapped. I think the old DOS assets are still included, though.

Kristine1975 commented 2 years ago

Supporting two different resource formats seems like more complexity than is needed, a resource converter tool that can convert the files extracted from the Mac resource forks back to the DOS counterparts might be the way to go ahead with this.

FWIW the format of Mac resource forks is officially documented: https://developer.apple.com/library/archive/documentation/mac/pdf/MoreMacintoshToolbox.pdf#page=151

Reading the files wouldn't be too difficult, as on macOS they can be accessed as <file>/..namedfork/rsrc (see macro _PATH_RSRCFORKSPEC in <sys/paths.h>).

Other than that, a tool like e.g. resource_dasm could be used to extract the resources of a Mac resource fork into separate files. But I'm not sure if it's end-user friendly enough.

I remember seeing a bunch of code in the original Mac code that would take the DOS versions of files and switch their endian-ness and write them back out, maybe we could leverage that as the base of a tool to switch them back!

That was probably necessary because the old Macs (68k, PPC) used big endian. That has changed since x86, now it's little-endian (both macOS and iOS). So that would no longer be required.

eisnerguy1 commented 1 year ago

I was wondering if any headway has been made on this? I'd love to not have to user SheepShaver to play the mac version 😄