Log In  

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.

P#96936 2021-09-06 05:24 ( Edited 2021-09-06 16:06)

1

This is the coolest thing ever. AMAZING!

P#96952 2021-09-06 14:07

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.

https://www.thingiverse.com/thing:4950864

P#96960 2021-09-06 16:12 ( Edited 2021-09-06 17:12)

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.

P#97015 2021-09-07 18:35 ( Edited 2021-09-07 18:37)

This is a grand idea! I made a pico8 arcade too and i think this would be a perfect fit. Thank you for taking the time! Finally a use for my 3d printer :D

P#97346 2021-09-15 15:05

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-09-22 01:37:19 | 0.008s | Q:12