Things that happen when my brain gets full

I recently was linked to CCG Workshop which is a site where you can play collectable card games (CCGs) online. It’s interesting because they have this gatlingEngine software, which apparently runs the game for you using a set of rules in a gatlingML file.

I thought this would be a wonderful chance to document the rules for the Love Hina CCG, which I never finished translating as you can see, but the gatlingDevKit and all the developer documentation requires that you sign an NDA and suchlike.

Discussions on the forum (the developers talk openly on the public forum, so I have an idea what’s not under NDA ^_^) indicated the gatlingML files were XML, but when I got one while trying to play a game, it was quite clearly binary.

The first four bytes are !HZL which I thought looked really familiar, but it took a fair while before I clicked that that was “LZH!” backwards, LZH being the compression algorithm used in the LHA family of archivers. Of course, research indicated that none of the LHA family of archivers actually wrote a file with !HZL at the front.

Poking about some more, I noticed that the gatlingEngine is written in Delphi (and is legacy code anyway) and went looking for Delphi compression libraries. Thankfully, the vast majority do PKZIP-compatible compression, and the first one I tried that supported LZH compression was Tlzrw1. (Apologies for the quality of the link, the 1998 link in the read file is dead, and the Wayback machine record for it indicates that the author’s page didn’t mention the library anyway) So I note that the library in question attributes its LZH code to LZHUF.C which Google duly turns up for me. I change the code a bit to stop assuming a 16-bit word, handle the header at the front, and suddenly I have a utility which can encode and decode files compressed with the LZH mode of Tlzrw1. (Which has been ported to C# and Delphi.NET, Google tells me.)

Now of course someone needs the interest, gumption and skills needed to produce an open-source program that can process gatlingML files and run games from them. ^_^

Oh, and a cool thing: progress bar for cp, courtesy of Chris Lamb via Planet Debian.

Edit: Missing quote put a whole whack of text inside an <a>-tag.


7 thoughts on “Things that happen when my brain gets full

  1. Yeah, somewhere. I dunno what I did with the source, but it’s pretty easy. Just find lzhuf.c, get it compiling, and skip the four byte header at the front. If needed, I could try and find the source, and post it.

  2. Hey! I used to play too!!
    I started before the xml files started geting compressed so I have some of the older versions of the xmls. But I also have the compressed xml version, I saved them because I knew tis day would come, when I would be able to decompress them!
    This is pet proyect of mine, the all the xml files are done, and the idea is realtively simple, have each card have a script and the engine just runs the script.
    If you could find and post the code, that would be great.

  3. I can’t seem to find my modified code any more, but the original lzhuf.c I used appears to have come in a file called which Google just offered me several links for.

    I don’t think it’d take long for a C programmer to follow my directions above, but we are looking at three and a half years ago, so I don’t remember any useful details beyond that. >_<

  4. Jorge says:

    Finally!!! after a year of devoting free time to this, I’ve finally found LZHUF.c, modified it and can now decompress gEngine xml.cmp files!!!
    Thanks for your help!
    I’ll let you know what I do with this here.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s