fuzziqersoftware / resource_dasm

Classic Mac OS resource fork and application disassembler, with reverse-engineering tools for specific applications
MIT License
114 stars 13 forks source link

Maelstrom icns converted to PNG/BMP are just mask #70

Closed erichelgeson closed 1 year ago

erichelgeson commented 1 year ago

Using Maelstrom_1.4.3_f.zip https://macintoshgarden.org/games/maelstrom-13-original

Screenshot 2023-04-03 at 9 24 23 AM

The image behind is the .icns file showing the color image and the mask. The foreground img is the converted bmp (or png) - which is just the mask.

Using resource_dasm --image-format=bmp --icon-family-format=image,icns --filename-format="%f:%T:%i" archive/Maelstrom_1.4.3_f/ Maelstrom_1.4.3_f/rsrc/

fuzziqersoftware commented 1 year ago

This is correct behavior, though it's admittedly a bit confusing. Each icon family (set of ICN#, icl8, ics8, and ics# resources with the same ID) is being packaged up into each .icns file, but each .bmp file contains only one resource. In Maelstrom 1.4.3, all the ICN# and ics# resources are indeed white masks, which the .bmp files reflect - the .icns files represent what happens when those masks are combined with the icl8 and ics8 resources.

erichelgeson commented 1 year ago

Why is the result of combining the actual icon and the mask, a mask? Shouldn't it be the icon with a transparency?

Is there a way to work around this and dump the non-mask icons to a png/bmp?

I don't fully grasp how all these resources work yet, I appreciate your help.

fuzziqersoftware commented 1 year ago

Here's how icons worked in classic Mac OS:

resource_dasm does the same thing as classic Mac OS - for ICN# resources, it renders the monochrome image from the ICN# and applies the transparency mask from the ICN#. For Maelstrom, this results in a white silhouette of the sprite because that's what the ICN# actually contains. For icl8 resources, resource_dasm renders the 8-bit image, then looks up the ICN# with the same ID (if it exists) and applies the mask from that resource. If you want to extract all the sprite images with correct transparency, it should suffice to export only the icl8 resources. (It looks like Ambrosia never intended to support monochrome graphics in Maelstrom, and only added ICN# resources because it was the easiest way to draw icons from icl8 resources with transparency.)

erichelgeson commented 1 year ago

Thanks for the detailed answer and work around - worked great!