Code and material related to PICO-8 and other products by Lexaloffle Games LLP

lexaloffle

This is a miscellaneous collection of code and material related to products by Lexaloffle Games LLP.

This collection is maintained for the benefit of the Lexaloffle community. Source code licenses are indicated below and in the corresponding files, and may differ between files.

PICO-8 file format routines

The PICO-8 fantasy game console stores game data in one of several documented file formats. The canonical file format is the P8PNG format (.p8.png), an encoding of the data stored stegonographically with a PNG image of the game's "cartridge." Game data consists of several regions for graphics, sound, music, and Lua code. In the P8PNG format, the Lua region is compressed using one of two documented proprietary methods: the legacy :c: method and the newer pxa method.

This repository contains C routines that can compress and decompress data using the two methods:

  • pxa_compress_snippets.c: the PXA method, supported by PICO-8 versions 0.2.0 and newer
  • p8_compress.c: the legacy :c: method, supported by all versions of PICO-8
    • This includes FUTURE_CODE that was injected for forwards compatibility at PICO-8 version 0.1.7. This was added to the default wrapper code in PICO-8 0.1.8 and no longer needs to be injected by the save routine.

This compression code was created and officially released by Lexaloffle Games LLP under open source licenses. See each file for the text of the respective license.

For a Python implementation of the complete P8PNG format including stegonographic decoding, see picotool. (As of this writing, picotool only supports :c: compression.)

For a prose description of the file formats and compression algorithms, see P8PNGFileFormat in the PICO-8 wiki.

Owner
Dan Sanderson
Software engineer and writer. Wrote an O'Reilly book on Google App Engine.
Dan Sanderson
Similar Resources

Node1D and other 1-dimensional node types for making 1D games in Godot.

Node1D and other 1-dimensional node types for making 1D games in Godot.

Godot 1D Node1D and other 1-dimensional node types for making 1D games in Godot. Have you ever wanted to make 1D games in Godot? ...no? You say you ha

Jul 31, 2022

Tactile-Arcade-Games - Wrote a C program comprised of four separate games that run in a loop using the PSoC 5LP board and Cypress IDE.

Tactile-Arcade-Games - Wrote a C program comprised of four separate games that run in a loop using the PSoC 5LP board and Cypress IDE. Used two potentiometers, two ADCs to convert their voltages to digital values, a PWM to drive two servos, an 8x8 RGB LED matrix, 40 digital output pins and 8 power MOSFETS to control the matrix, and a character LCD display.

Dec 24, 2021

Defold Engine integration with Yandex.Metrica to track your games on Yandex.Games.

Defold Engine integration with Yandex.Metrica to track your games on Yandex.Games.

Yandex.Metrica for Defold Yandex.Metrica is a free of charge web analytics tool for websites, that's the reason why we can use it for HTML5 games. Yan

Nov 26, 2022

CS:APP is an excellent material for learning computer systems and systems programming

CS:APP is an excellent material for learning computer systems and systems programming. However, it is inconvenient to use a virtual machine for self-learners. In this repo, I build a Docker image with most pre-requistes installed and attached all lab materials in it.

Nov 11, 2022

Educational material and examples for those interested in learning the C programming language

Learn C Educational material and examples for those interested in learning the C programming language Files: examples.c Various examples of programs w

Nov 13, 2022

WIP - Material para uma live stream que estou preparando

C para devs PHP ATENÇÃO: Este projeto ainda está em progresso. A estrutura e conteúdo aqui provavelmente ainda estão muito confusas. Eu não recomendo

Feb 24, 2022

This repository is to share the EdgeAI Lab with Microcontrollers Series material to the entire community

This repository is to share the EdgeAI Lab with Microcontrollers Series material to the entire community. We will share documents, presentations and source code of two demo applications.

Oct 23, 2021

Material para clase y entregas para la materia "Sistemas Operativos", impartida por Gunnar Wolf, en la Facultad de Ingeniería, UNAM, semestre 2022-1

sistop-2022-1 • Sistemas Operativos ¡Bienvenido! Este repositorio es el espacio de entrega de proyectos para la clase impartida por Gunnar Wolf de Sis

Jan 31, 2022

This repository provides you the material of installation the Catalana Hackintosh

VivoBook Asus X542UQ laptop Catalina 10.15.7 Hackintosh This repository provides you the material of installation the Catalana Hackintosh with Opencor

Oct 9, 2021
Comments
  • pxa: hash heap corruption

    pxa: hash heap corruption

    Hello Dan, i'm not sure if it makes sense to file an issue here because it's only example code, but I think I found a bug in the pxa compression routine:

    When one of the lists in hash_list grows to more than 32768 entries, the code in https://github.com/dansanderson/lexaloffle/blob/main/pxa_compress_snippets.c#L406 tries to reallocate it with a size of 32768 * 2 == 65536, which doesn't fit into the uint16 used to store the allocation size. So the list is effectively reallocated with a size of zero; i.e. the heap_pos is increased by only 2 for the list header.

    If any other lists are later reallocated, they will overwrite the affected list.

    Here is a cartridge where this happens: https://www.lexaloffle.com/bbs/get_cart.php?cat=7&play_src=2&lid=nerfcooking_in_vegas-2

    At input position 63072, the list for hash 3088 grows to more than 32768 entries. It is the reallocated to offset 157716 in the heap. The heap_pos is increased to 157718. Later, at input position 63433, the list for hash 3032 is reallocated to 157718, overwriting the start of the list for 3088.

    I guess this doesn't affect the correctness of the compression, since pxa_find_repeatable_block will never choose one of the corrupted blocks. But it does affect the efficiency: an implementation without this problem compresses the code in above cartridge to 7971b instead of 14348b.

    This issue also seems to be present in PICO-8 0.2.5c.

    Have a nice day!

A package to use Material side sheet into your Flutter project. Learn more about side sheet at Material.io
A package to use Material side sheet into your Flutter project. Learn more about side sheet at Material.io

Side Sheet A package to use Material side sheet into your Flutter project. Learn more about side sheet at Material.io Platform Support Android iOS Mac

Aug 25, 2022
One of my most recognised, old, products.

System48 This is one of my most well renowned products, it existed between 2016 and 2017 - with about four iterations, each better than the last, this

Nov 16, 2022
Projects related to sync'ing esphome devices with other protocols: DDP, E131, etc...

esphome sync This project is due to a desire to leverage WLED's new virtual strip (via DDP) feature or software like xLights or LEDFx to controls ESP

Oct 16, 2022
Digital rain animation gif with glow squeezed into a raspberry pi pico and pimoroni pico-display
Digital rain animation gif with glow squeezed into a raspberry pi pico and pimoroni pico-display

pico-display-matrix Digital rain animation gif with glow squeezed into a raspberry pi pico and pimoroni pico-display or how to actually use all Flash

Sep 10, 2022
Tetris on a Raspberry Pi Pico mounted on a Pimoroni Pico Explorer

PicoTetris Classic Tetris game running on a Raspberry Pi Pico microcontroller. Pico C port by Richard Birkby Original JavaScript implementation - Jake

Dec 3, 2022
Breakout game for Raspberry Pi Pico with Pimoroni Pico Display pack
Breakout game for Raspberry Pi Pico with Pimoroni Pico Display pack

breakout_rpi_pico Breakout game for Raspberry Pi Pico with Pimoroni Pico Display pack Prebuilt binary (breakout.uf2) is here. To build your own binary

Oct 15, 2022
Pico-uart-bridge - Raspberry Pi Pico UART-USB bridge

Raspberry Pi Pico USB-UART Bridge This program bridges the Raspberry Pi Pico HW UARTs to two independent USB CDC serial devices in order to behave lik

Dec 5, 2022
The pico can be used to program other devices. Raspberry pi made such an effort. However there is no board yet, that is open-source and can be used with OpenOCD as a general-purpose programmer
The pico can be used to program other devices. Raspberry pi made such an effort. However there is no board yet, that is open-source and can be used with OpenOCD as a general-purpose programmer

pico-probe-programmer The pico can be used to program other devices. Raspberry pi made such an effort. However there is no board yet, that is open-sou

Oct 15, 2022
Not related to software bugs and exploits; this repo contains snippets of code that demonstrate some interesting functionality or a handy trick.

Proof-of-Concept Not related to software bugs and exploits; this repo contains snippets of code that demonstrate some interesting functionality or a h

Nov 19, 2022
PoC tool to coerce Windows hosts to authenticate to other machines via MS-EFSRPC EfsRpcOpenFileRaw or other functions.
PoC tool to coerce Windows hosts to authenticate to other machines via MS-EFSRPC EfsRpcOpenFileRaw or other functions.

PetitPotam PoC tool to coerce Windows hosts to authenticate to other machines via MS-EFSRPC EfsRpcOpenFileRaw or other functions :) The tools use the

Dec 5, 2022