quadra-game / quadra

An addictive action puzzle game with single player and multiplayer capabilities (Internet or LAN).
GNU Lesser General Public License v2.1
28 stars 18 forks source link

Quadra endianness and Mac Universal Binary #59

Open pphaneuf opened 10 years ago

pphaneuf commented 10 years ago

This is just a reminder-issue: will Quadra run correctly on Intel Mac if built by a PPC mac and/or vice-versa? Do we have Universal Binary compilation enabled? Are the config file and 'res' file endian-compatible between platforms?

pphaneuf commented 10 years ago

That is an excellent question, actually. Didn't think of it. :-)

A PPC binary should run correctly on Intel, maybe a little bit slow (under Rosetta), but it ran okay on my old 486, so that shouldn't be too much of a problem. If built on Intel, it should be an "universal binary" (ah, good old fat binaries returns!), and I'm not entirely sure of how to make one with gcc/ld, but it should be a checkbox somewhere in Xcode. If it's only an Intel binary, it won't run at all on PPC.

For the config file, it shouldn't be too much of a problem, even if it's written backward, it'll be read backward too on the same machine.

The resource file, though, is another thing. I doubt it'll work correctly... The resources themselves should be fine, but there are few other things in the resource file. Let's have a look...

Oh! dgryski rules the day! The thing is peppered with INTELWORD()s. Ironically, it looks like it's just missing the one for the signature. Heh.

pphaneuf commented 10 years ago

And the signature is kept as a character array, so it looks okay. For testing, I took the quadra.res generated on my Linux/Intel machine, and used it on my Mac OS X/PPC machine.

pphaneuf commented 10 years ago

For future reference, you can pass "-arch ppc -arch i386" to Apple's gcc (the one provided with Xcode) while compiling and linking, and it will produce "fat" object files and binaries.

I don't remember if I tested with a PPC binary on my Intel Mac, that should work fine, but should check...