dansanderson / picotool

Tools and Python libraries for manipulating Pico-8 game files. http://www.lexaloffle.com/pico-8.php
MIT License
370 stars 46 forks source link

.p8.png code compression is inefficient, does not match Pico-8 #7

Closed dansanderson closed 7 years ago

dansanderson commented 7 years ago

The current compress_code routine creates a compressed code blob that is compatible with Pico-8's decompressor (and picotool's own decompressor). However it is far less efficient than Pico-8's compressor and the results are very large, often much larger than the uncompressed original. So something is wrong.

Note that Pico-8's info command doesn't reflect this because it loads the cart successfully then runs its own compressor to determine the compressed size.

See the commented-out lines of testCompressCodeHelloExample to test the failure.

dansanderson commented 7 years ago

Fixed quickly with a port of the (slow) original Pico-8 C compression code. As time allows I'll revisit the broken implementation and try to fix it.