I was working on a new project that involved learning how rom cartridges worked, so I asked around for help and someone suggested that I use SD cards. I ended up liking the idea and decided to use that in my current Pico 8 fanmade handheld project as well. What I did was created a shell that goes around a SD card to give it a cartridge look and feel. A USB SD card reader will read the 'cartridges'. I also wrote a bash script that will search for a p8.png file in your SD card directory and have Pico 8 run that file or run splore instead if no SD card cartridge was connected. Firstly, when you plug in a SD card to your card reader, you should type in
sudo fdisk -l
. This should list your SD card. Mine was listed as /dev/sda1
I then mounted the SD card and made sure Pico 8 could run the file. While in my Pico 8 directory, I typed in
./pico8 -run /media/usb0/run.p8.png
and Pico 8 ran the file, but use whatever directory you mount your SD card in. Why did I call the cartridge run.p8.png? I tried just using
./pico8 -run /media/usb0/*p8.png
, but I thought, if I had multiple cartridges on the same SD card, it would pick one out of random, and I didn't want that, especially for multicart games. Maybe there is a better way at doing this. If there is, please let me know. I made it where the first cartridge can be called run.p8.png, but other cartridges can be called whatever you want. I modified /etc/rc.local and added a line before the screen driver where it would mount the SD card. For me, I put in
sudo mount /dev/sda1 /media/usb0
I then created a bash script that would either load a game from a SD card cartridge or run splore if there was no cartridge connected.
Here is the bash script below: I named it autorunpico8.sh, but you can call it whatever you want.
#!/bin/bash if [ -f "/media/usb0/run.p8.png" ] then exec /home/pi/pico-8/pico8 -run /media/usb0/run.p8.png & else exec /home/pi/pico-8/pico8 -splore & fi exit 0
Once you create the file, you will want to make it executable by typing in
chmod +x yourscripthere.sh
Test out the script and see if it works. If it does, put the script in /etc/rc.local above exit 0 at the bottom of the file.
When you turn on your Raspberry Pi, Pico 8 will load the cartridge.
When there is no 'cartridge' connected to your SD card reader it boots into splore, but if you really want to, you can make a 100% offline system and make it only look for cartridges.
I will upload the cartridge shells on my Thingiverse page soon enough. The front of the cartridge shell allows you to use custom artwork and you can modify the top text to be anything you want. You slide in a SD card and if it isn't a snug fit, hot glue gun might help keep it in place. The back plate of the cartridge can be removed so you can remove the SD card if it stops working. I hope this tutorial is useful and these cartridges can be used in your Pico 8 projects. Have a wonderful day.
Thanks. Also, I changed the bash script where you do not need to be root.
Edit: I also made a test label. I do not know if this will be the correct dimensions, but Paint.net claims it is. It should fit over the front of the cartridge with a glue stick or another adhesive.
The 3D printable models are available on my Thingiverse page so feel free to use them if you want. They are a work in progress as I want to make the shells as perfect as I can, but the models are open source so you can use them however you like.
I 3D printed a new shell and back plate that allows cartridges to slot in from the top, but I came across a huge issue. The sd card reader I used sits right near the powerboost 1000c and if I put in a cartridge, it pushes against the lithium-ion battery cable.
I will create a new back plate that will have walls to keep the cartridges away from the wires. Also the back plate will have a opening so you can see the cartridge artwork and I will make the cartridges slighly smaller to fit inside the new walls.
I have finished version 3.0 of my handheld project and made a revision to my cartridge shells. If you want to 3D print your own cartridges, they will be available on my Thingiverse page: https://www.thingiverse.com/thing:5136457
Also, if you want to make a label, they need to be 128x106px to fit
Here is a test label I made that is the correct size.
That’s really cool! I love the idea of having a “console” that also displays a “cart” for pico 8. I’m currently using a pi zero w as my pico 8 console (with hdmi out and a wired controller). It has a little square screen on it (240*240px). I’m trying to get the pi to scrape the cartridge being played and display it on the little screen but I’m bad at programming. If I ever do finish I’ll share specs. There is Something about a physical representation of a card is just so cool!
[Please log in to post a comment]