The VG Resource
Marble Saga: Kororinpa Data Compression - Printable Version

+- The VG Resource (https://www.vg-resource.com)
+-- Forum: The Resources (https://www.vg-resource.com/forum-109.html)
+--- Forum: General Ripping (https://www.vg-resource.com/forum-145.html)
+--- Thread: Marble Saga: Kororinpa Data Compression (/thread-40739.html)



Marble Saga: Kororinpa Data Compression - DigitalDetective47 - 06-14-2022

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.


A solution - DigitalDetective47 - 09-16-2023

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.