Important information: this site is currently scheduled to go offline indefinitely by end of the year.

PSP Mai-HiME Bakuretsu! unknown compression

Read or post about compression. And decompression. Or ask questions how to decompress your files.
Post Reply
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 94 times

PSP Mai-HiME Bakuretsu! unknown compression

Post by fatduck »

The contents of this post was deleted because of possible forum rules violation.
No more Fatduck, no more FatImporter, Byebye everyone!
GameZelda
advanced
Posts: 61
Joined: Wed Nov 14, 2007 5:56 pm
Been thanked: 29 times

Re: PSP Mai-HiME Bakuretsu! unknown compression

Post by GameZelda »

I have almost uncompressed this, but I haven't been able to figure out this completely.

(Anything is little endian).

Header
4 bytes: "Wb16" ASCII string
4 bytes: Uncompresed file size

Custom-LZSS Compressed blocks (Come immediately after the header).
4 bytes: Compression flags.
32 * 2 bytes: Compressed data.

The "compression flags" are interpreted from the LSB to the MSB (e.g. check compressionFlags & 1).

Compression flags: case 1
2 bytes: Uncompressed data.

Compression flags: case 0
2 bytes: Encoded position + length.

I believe that the encoding used is the following: 5 bits for the length and 11 bits for the position.

Code: Select all

length = ((data & 0x1F) + 2);
bufferDataPos = ((data >> 5) & 0x7FF);
The length is in groups of uint16_t's, so just multiply it by 2 to get the number of bytes.

---

I'm stuck with the position bits. I believe that they use a buffer of 0x2000 uint16_t's (0x4000 bytes) initialized to zero, like in this implementation.

http://www.programmersheaven.com/downlo ... pView.aspx

However, even if the uncompressed result is pretty good, it seems to be wrong. I've tried different buffer initial positions (variable "r" in that implementation) without success.
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 94 times

Re: PSP Mai-HiME Bakuretsu! unknown compression

Post by fatduck »

Thanks for you help GameZelda! I try to decmpress the first 2K data manually and it seems to work fine!

Strange enough the position are in +ve value!? Anyway, I'll try decompress them all to see if any special case there!
No more Fatduck, no more FatImporter, Byebye everyone!
Post Reply