Wednesday, May 27, 2009

KQlives on the Mac

I've been out of the programming loop for a while.  Two kids can do that to you.

I wanted to download and play with KQlives on my iMac.  The download from Sourceforge provided an outdated version, but which ran.  The CVS version gave me all the current updates, but wouldn't run (and compile).

My iMac isn't configured for programming: it's got XCode, a few programming projects I've worked on, DarwinPorts (very nice, by the way), and a few libraries to run Allegro-built games.

When I started, I was informed that my 'autoreconf' was out-of-date.  I upgraded to the most recent version via DarwinPorts, then got a bunch of warnings stating that a bunch of stuff was deprecated.  Lovely.

I don't remember how, but after hammering away at it for a good day or two, I finally got it to create a Makefile for me.

I ran that, and found that I didn't have the Allegro4, Lua, or DuMB libraries installed.  I grabbed them from DarwinPorts, but to my chagrin, it didn't give me any header files or sources: just the precompiled binaries.

I went off and downloaded the library sources, installed, and then was able to compile KQ (yay!).

Trying to RUN kq gave me problems.  It created a blank window, then complained that it was missing "misc.pcx".  I saw a few other reports like this on Google from a few years ago, but no resolution.  I found the answer, so I wanted to create this blog in case someone else happens across it.

I found out what was happening by adding a line of code that told me where, exactly, the datafile was trying to be found (the "mpcx.dat" datafile specifically).  Instead of being under the current directory (or even under ./data/mpcx.dat like I expected), it was looking for it under "./Contents/Resources/data/mpcx.dat"  So I simply created that directory, copied everything from ./data into that directory, and ran it.  It gave me the opening credits!  Of course, it died shortly after, complaining about some scripts and whatnot, but it's the same situation: it needs "./Contents/Resources/scripts/" and all of the other "important" subdirectories (like music, etc.) to be moved/copied under that.

If I get this up and working, I may even be able to work on some more code and see if I can't resurrect a few things for the kqlives project.  Kids- and time-willing, of course.