PDA

View Full Version : Comic Party Unpacker Tool


EsperKnight
2009-01-14, 14:01
Hello all,
I've been reading the forums for a while trying to learn what I can about reverse engineering file formats and finally took the plunge and went for it. I present to you the fruits of my labor, a tool to unpack the .pak files of Comic Party. I've been wanting to see this translated and saw that no one has really looked at it, I figured I'd give it a shot.

From what I've sample it appears to extract everything fine, except it doesn't turn the .msk files or font files into BMPs just yet. I'm still learning the BMP format and haven't looked to see what the palette is for these (I'll update it later when I find them if they do use it as a BMP, why they may not).

I've also included my code with this (which is hopefully pretty straight forward in showing how there decompression scheme works). I haven't coded a compression scheme to go the reverse though since it appears we'd need a key to do it (it uses a key that's AND'd against to find out if it show do a run and other bytes to set up counts, reset the buffer, etc. etc). The good thing is though, I don't believe we'd need a compression routine to reinsert them since as long as you set the 0th byte to FF and every 9th byte after that to FF it won't trigger a run, instead it'll just build it normally.

If anyone looks at this let me know if you find any bugs or not please. Also later on I'm going to possibly post a walkthrough/tutorial on how I reversed it so it could possibly help anyone else looking at learning this (more of a guide of what to look for possibly).

Also, if anyone would like to help in translating please let me know! Thanks!

EsperKnight

zalas
2009-01-15, 22:47
In case you haven't realized, it's using a pretty standard implementation of LZSS and the "key" you describe is simply a set of flags (one for each bit in the byte) telling the decompressor what types of token follow, whether they be verbatim byte-copy tokens or window backwards-lookup tokens. That being said, yes you can simply create a byte-stream that's all 'verbatim-copy' tokens, but if you want to learn how to write a real compressor for it, look up LZSS.

EsperKnight
2009-01-16, 08:54
I hadn't realize it (and yet, sadly, I was reading up on the LZ compression schemes not to long ago and didn't make the connection) but I'll definitely look into it. Thanks!

kouryuu
2009-01-26, 08:52
O.o I have no clue about the comp scripting side of things, but if you get this up and running, and working completely (as well as maybe figure out how to re-pack after un-packing) ...let me know. You might just give me a looot of motivation to finish up the Tl project I've been working on sooner rather than later.

Spitze
2009-02-05, 20:51
[This post was converted into something useful by the power of a magical hammer.]

るぅぅぅぅ!\o/