dansanderson / picotool

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

Support new truncated .p8 format #35

Closed dansanderson closed 6 years ago

dansanderson commented 6 years ago

As of Pico-8 0.1.11e, the .p8 file format has changed (version "15") such that tailing rows of each section are truncated if they match the default state. If entire sections match the default state, they are elided from the file. An empty cart (saved after reboot) is the two-line header, the __lua__ section header, and a blank line.

Game.from_p8_file() needs updating to expect entire sections to be missing from the raw data. Each section type's from_lines() class method needs testing and possible updating, though at first glance it looks like it coincidentally does the right thing for truncated sections in most cases.

Nice to have would be to update each section's to_lines() to write this format, as well as game.to_p8_file() (with an updated "version" header).

dansanderson commented 6 years ago

I ran a few simple tests and I think this is (coincidentally?) a non-issue. New-style .p8 carts seem to load just fine. p8tool build will even preserve truncated sections, apparently? How does my code work?

Resolving until an actual problem is found.