Opened 13 years ago

Closed 13 years ago

#30858 closed enhancement (fixed)

starfighter: add app icon

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.0.1
Keywords: Cc:
Port: starfighter

Description

starfighter should have a proper app icon in the Finder. The game sets the icon once it's running, but in an unusual way: it uses the icon "gfx/alienDevice.png" (see init.cpp), but it's not a standalone file in the distfile; rather, it's embedded inside a Quake I- or II-style .pak file starfighter.pak along with all the other graphics and sounds. So we need to extract this so that we can make an .icns from it. Either we do it manually and store it in the files directory, or we do it programmatically at build time.

To do it manually, I've tried using PakExplorer 1.2, but it has an out of memory error trying to read the .pak. Maybe it's not a standard Quake I/II .pak file, or maybe PakExplorer is broken.

To do it programmatically, we could try to build an executable that uses unpack() (see unpack.cpp).

Change History (1)

comment:1 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: newclosed

The icon is only a couple hundred bytes so it is not awful to have it in the files directory. I extracted it from the .pak manually by reading unpack() and using HexEdit. I found the string "gfx/alienDevice.png" and skipped ahead 56 bytes from the start of that string (the .pak uses 56-byte fixed length filenames). The next 4 bytes are the length int (0x129); I copied the next 0x129 bytes into a new file and saved it.

The image is supposed to appear with a transparent background, but appears with a black background. To fix this I used ImageMagick. Then I used pngcrush to make it as small as possible.

convert alienDevice.png -transparent '#000000' alienDevice.tmp.png
pngcrush alienDevice.tmp.png alienDevice.png
rm -f alienDevice.tmp.png

Icon added to port in r82693.

Note: See TracTickets for help on using tickets.