The VG Resource

Full Version: Marble Saga: Kororinpa Data Compression
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have been trying to decode and encode data for Marble Saga: Kororinpa, but it seems to use a proprietary compression format. (See the Wikipedia page for some important info about it.) I have tried using ntcompress, and using the -lex flag gives a result similar to what is seen with the game's files, but it's not quite right. I believe I have three known input-output pairs, but am unsure if I am legally allowed to post content from the game's files. (If anyone is interested, A19S006.bin is Hudson 07, A19S008.bin is Hudson 08, and A19S010 is Hudson 09.) I have also found that for level files, using the header sequence 00 00 00 01 00 00 00 08 XX XX XX XX 00 00 00 01, where XX XX XX XX is the uncompressed size, written in big endian, and then copying the contents with an FF byte before each grouping of 8 bytes within the file.
After over a year, I've finally figured out how the system works. It uses a 1KiB rolling buffer, with flag bytes read right-to-left, with 1 being a literal and 0 being a reference. It's a 10 byte offset (with the top 2 bytes stored in the second byte of the reference), and a 6 byte length parameter stored as the actual length minus 3. The most unusual aspect is that writes start at offset 0x3BE. I've implemented an encoding and decoding algorithm in the koro Python library.