You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have stumbled over a strange thing affecting .p8.png files created by older versions of PICO-8 (file version 8 and lower). It appears that the memory image a modern version of PICO-8 (tested 0.2.4c, 0.2.5c) reads from those files differs from what it should be according to the encoding scheme described in https://pico-8.fandom.com/wiki/P8PNGFileFormat and implemented in picotool.
When I read that PNG and look at the pixel data, the bytes starting at 0xc400 look like this:
0c400 fc f0 e9 fc fc f0 ea fc
Decoding them according to the usual scheme gives
fc f0 e9 fc fc f0 ea fc
extract lowest 2 bits (& 3):
00 00 01 00 00 00 02 00
merge (alpha << 6 + red << 4 + green << 2 + blue) :
01 02
Since 0xc400 / 4 == 0x3100, these are the first bytes of the music section. So the first music pattern should have SFX 1 in the first channel and SFX 2 in the second channel. But when I open the file with PICO-8, I instead get SFX 2 in the first channel and SFX 1 in the second channel:
This is confirmed when I re-export the file using PICO-8, i.e. pico8 -export test.p8.png 13010.png. When I look at the pixels of the re-exported file at the same offset, I see
0c400 fc f0 ea fc fc f0 e9 fc
extract lowest 2 bits (& 3):
00 00 02 00 00 00 01 00
merge (alpha << 6 + red << 4 + green << 2 + blue) :
02 01
Those are not the only differences between the original and the re-exported version. There are also changes in the SFX section:
Hello Dan,
I have stumbled over a strange thing affecting
.p8.png
files created by older versions of PICO-8 (file version 8 and lower). It appears that the memory image a modern version of PICO-8 (tested 0.2.4c, 0.2.5c) reads from those files differs from what it should be according to the encoding scheme described in https://pico-8.fandom.com/wiki/P8PNGFileFormat and implemented in picotool.Example: https://www.lexaloffle.com/bbs/get_cart.php?cat=7&play_src=2&lid=13010
When I read that PNG and look at the pixel data, the bytes starting at 0xc400 look like this:
Decoding them according to the usual scheme gives
Since
0xc400 / 4 == 0x3100
, these are the first bytes of the music section. So the first music pattern should have SFX 1 in the first channel and SFX 2 in the second channel. But when I open the file with PICO-8, I instead get SFX 2 in the first channel and SFX 1 in the second channel:This is confirmed when I re-export the file using PICO-8, i.e.
pico8 -export test.p8.png 13010.png
. When I look at the pixels of the re-exported file at the same offset, I seeThose are not the only differences between the original and the re-exported version. There are also changes in the SFX section:
In all the carts I tested, this seems to affect only the SFX and music sections.
Do you have any idea what PICO-8 is doing here?
Have a nice day!
The text was updated successfully, but these errors were encountered: