PICO-8: Retroarch lr-retro8 core installation script
-
UPDATE:
PICO-8 has now been officially added to the RetroPie Setup script. Update your RetroPie Setup script and you'll now find it as an installable system in the Experimental section.
I've been experimenting with the Retroarch core for the PICO-8 virtual system.
Libretro has a core called lr-retro8 for it, but there isn't yet any install script for RetroPie.
@JimmyFromTheBay had written an older post on getting this system going but he used the stand alone emulator you have to purchase.
I wanted to test out the Retroarch core though to see if it would work or not.
Here is an install script for the libretro core. You have to install from source, but I didn't have any errors doing so.
Leaving the game files zipped, I've been able to play several of them.
1 - create new file for installation
/home/pi/RetroPie-Setup/scriptmodules/libretrocores
create a new file in that directory called:
Here are the contents of the file:
#!/usr/bin/env bash # This file is part of The RetroPie Project # # The RetroPie Project is the legal property of its developers, whose names are # too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. # # See the LICENSE.md file at the top-level directory of this distribution and # at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md # rp_module_id="lr-retro8" rp_module_desc="PICO-8 emulator port for libretro" rp_module_help="ROM Extensions: .zip .ZIP .png .PNG\n\nCopy your roms to $romdir/pico8" rp_module_licence="GPL2 https://raw.githubusercontent.com/libretro/retro8/master/COPYING" rp_module_repo="git https://github.com/libretro/retro8.git master" rp_module_section="exp" function sources_lr-retro8() { gitPullOrClone } function build_lr-retro8() { make md_ret_require="$md_build/retro8_libretro.so" } function install_lr-retro8() { md_ret_files=( 'retro8_libretro.so' 'README.md' ) } function configure_lr-retro8() { mkRomDir "pico8" ensureSystemretroconfig "pico8" addEmulator 1 "$md_id" "pico8" "$md_inst/retro8_libretro.so" addSystem "pico8" "PICO-8" ".png .zip" }
2 - Install from source
Once the script is there, in Emulation Station, run the RetroPie Setup script and navigate to the emulator installation menu and go into the Experimental section.
You should see the new lr-retro8 as an emulator to install.
Click on it and then choose Install from source.
That should then compile the core and create all of the needed backend changes (es_systems.cfg and roms directory are also updated and created).
3 - Copy over some games
As mentioned in the older post above, PICO-8 games have a .png file extension but I had issues running them as *.png files. Once I zipped them into *.zip files, they worked.
Copy them into the /home/pi/RetroPie/roms/pico8 folder.
Launch Emulation Station and you should see PICO-8 on the main menu and you can then launch and test some games.
Hopefully others will enjoy this unique system.
-
@dmmarti you should submit a pull request on GitHub for this.
-
Like you asked, I tried the script.
It installs ok, I think.For now I can't seem to play any games.
With one game it starts a picture but I can't do anything.
When I zip, It boots just black.Are the games embedded withing a picture .png ?
Or do I have try something else ? -
Yea...PICO-8 games have a *.png extension (which is kinda wierd).
I didn't have much success with using them that way. Instead, I zipped them up on my Windows PC (just using normal Windows "send to zip" method).
For example, this game I downloaded from the PICO-8 website:
picotetris-5.p8.png
Didn't run.
I zipped it and it then had this name:
picotetris-5.p8.zip
and then it worked for me.
I'll do some more testing though and see if I can figure out anything.
-
Ok, tried that game and it worked.
Earlier I tried these, but I can't get them working :
2048.png
fruitdrop_extreme-0.p8.png
noyjejza-0.p8.png
total_collapse_2-1.p8.pngWill try some other files.
Ok,
More games are working now (zipped):
instant3dplus-0.p8.png
fcv5-0.p8.pngIt seems not all games are working though.
When loading the .png's it seems I can only scroll trough all the game pictures I have in the rom directory.What is your experience ?
-
I experimented with the png's
I made a theme for https://github.com/DTEAM-1/cygnus-blue-flames.
The png's are multipurpose and can also be used in a gamelist.xml for displaying the cart in emulationstation.
Here some pictures :
We should find out how SPLORE (the cartridge browser) inside the emulator works. I think we see this browser if we load a png instead of a zip.
If we can't figure out how this works then perhaps it's best to remove the .png extension from the module-script, agreed ?Btw.
It is possible to scrape the pico-8 website.
( wget -c -r https://.................................... -A p8.png )
It has already done 6000 files. (It will take more that 5 hours though)
(edit : finished, got 6226 files in 6h 33m 43s)Perhaps not perfect yet, but here are some examples of zipping all files one by one :
#if games are in the same directory (outputs zip files in the same directory) cd /home/pi/RetroPie/roms/pico8 for i in *.png;do zip $(basename $i .png).zip $i;done
#if games are in the multiple subdirectories (outputs zip files in one directory) cd /home/pi/RetroPie/roms/pico8 find -name "*.p8.png"|while read i;do zip $(basename $i .png).zip $i;done
#if games are in the multiple subdirectories (outputs zip files in the same directory as the .p8.png) cd /home/pi/RetroPie/roms/pico8 find -name "*.p8.png"|while read i;do zip $(echo $i|sed 's/\.png/\.zip/g') $i;done
-
@folly Woah! Nice!! 6000 .. .wow!
Theme looks great too.
Ah, I didn't think about using the *.png files as cart art too - clever idea.
Yea, it sounds like we should just use *.zip files for the actual rom file extension then and drop *.png. That would probably make life alot easier for everyone.
I'd not experimented with a lot of games - only ran a handful to test the system out.
Thanks for building up this system. I hope some folks find it enjoyable for a casual game or two.
-
Ok, I will add it to my repository, but without the .png extension.
We can add it later if we find out how we can run .p8.png's directly.
(edit : added here : https://github.com/FollyMaddy/RetroPie-Share/tree/main/00-scriptmodules-00/libretrocores ).
Edit :
I will ask DTEAM for adding the system theme in :
https://github.com/DTEAM-1/cygnus-blue-flames
I will do the same with lowres-nx.
(have a look at the readme, I made a nice animated gif for this theme.
.We should see if we can build up a nice gamelist.xml .
Basically If I only do the picture then it is fairly easy to create.
Not sure yet, but we could try to make that too. -
@folly when do you plan to submit a pull request for this?
-
Buzz is planning on adding the module-script, by him self, into the original RetroPie-Setup.
Have a look here :
https://retropie.org.uk/forum/topic/30974/lowres-nx-retroarch-core-installation-instructions/9
So we just have to wait a little while before it's added.I did a pull request for the themes I made.
You can see my pulls here :
https://github.com/DTEAM-1/cygnus-blue-flames/pulls?q=is%3Apr+is%3AclosedThis theme is added now to the original RetroPie-Setup.
-
@folly @dmmarti I think the issue with reading the .p8.png files has to do with the way Retroarch works. I've used Retroarch on mobile and computer to load Pico-8 games, and I find that I have to specifically select the core (retro8) before opening a file in order for the game to launch instead of the image viewer. Perhaps that core selection phase will need to be programmed in somehow in order for the launch to work properly? I'm still pretty new to Retropie so I don't know how that'd work, just trying to find some hints!
Also, when I zip my .p8.png files and the emulator tries to open them, my load freezes up. I can type with a keyboard to enter the retroarch emulator (where I can quit properly with hotkeys), but all I get is a black screen. I may have some issues because I installed the Pico-8 core first using this forum thread, but I don't know what would cause the total freeze. Right now, I have two cores listed, lr-retro8 and pico8_dyn. Would love to use the libretro emulator so I can save progress (if that feature works!)
-
@ln_rc said in PICO-8: Retroarch lr-retro8 core installation script:
@folly @dmmarti I think the issue with reading the .p8.png files has to do with the way Retroarch works. I've used Retroarch on mobile and computer to load Pico-8 games, and I find that I have to specifically select the core (retro8) before opening a file in order for the game to launch instead of the image viewer. Perhaps that core selection phase will need to be programmed in somehow in order for the launch to work properly?
Basically the core is loaded when a selected rom is loaded.
You can see the "command" in /opt/retropie/configs/pico8/emulators.cfg
So I think it's something else.
We can try and remove the .png extension part and see how RetroArch will react on that.I'm still pretty new to Retropie so I don't know how that'd work, just trying to find some hints!
Thank you for giving the hints and indeed perhaps we can find some useful leads ;-)
Also, when I zip my .p8.png files and the emulator tries to open them, my load freezes up. I can type with a keyboard to enter the retroarch emulator (where I can quit properly with hotkeys), but all I get is a black screen. I may have some issues because I installed the Pico-8 core first using this forum thread, but I don't know what would cause the total freeze. Right now, I have two cores listed, lr-retro8 and pico8_dyn. Would love to use the libretro emulator so I can save progress (if that feature works!)
Some games will not work.
I had that issue too in the beginning.
Have you tried more games ? -
@folly I think I see what you mean, though I don't totally understand the code. Let me try to explain better what I see on Windows Retroarch, because the Retroarch also launches the console, but the games launch differently based on how you open them.
Run Method 1:
- Open RetroArch
- Drag .p8.png file straight into RetroArch
- File loads with retro8 engine, but only shows the png file
Run Method 2:
- Open Retroarch
- Click "Load Core"
- Click "Retro8"
- Drag .p8.png file straight into RetroArch
- Game loads properly with retro8 engine
The process looks basically the same since the retro8 engine is set to run in both cases, but for some reason, the manual selection makes the games work while the automatic selection does not.
As with the games, yes I see that some work and some do not. I was able to make some simpler games function such as Tiny Parkour and Picoban. However, many other games don't open. Celeste opened but the music and graphics are very glitchy.
When I try these games in PC RetroArch, the issue is the same, so it seems like the lr-retro8 engine is not fully developed. There's not much we can do about that I don't think. Too bad, I was hoping to play Islander and save my progress with RetroArch. Maybe one day!
-
To follow up here, I figured out a way to use lr-retro8 and pico8_dyn (the official raspberry pi Pico-8 emulator) interchangeably.
This is how my config file looks
default = "pico8_dyn" pico8_dyn = "/home/pi/RetroPie/roms/pico8/pico8_dyn -run %ROM%" lr-retro8 = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-retro8/retro8_libretro.so --config /opt/retropie/configs/pico8/retroarch.cfg %ROM%"
In the roms/pico8/ folder, I put all of the core data files to run the emulator. These include:
- pico8
- pico8.dat
- pico-8.txt
- pico8_dyn
- pico8_gpio
(I did not need lexaloffle-pico8.png)
However, pico8_dyn does not open .zip files, only .p8.png. Now I've got .p8.png AND .zip files in my roms folder, one for pico_dyn and one for lr-retro8. It's a bit of a mess in there, but I figure this is a temporary fix until either lr-retro8 can run more games or the lr-retro8 emulator can open .p8.png files directly.
-
Good posts, explaining from your side.
For now, I can't put my finger on it why it doesn't work the way we think it should.
In time I will look at it once more to see if I get the AHA.Just renamed a file from .p8.png to .p8
This works on my end.
So it seems the core or retroarch is reacting on the .png part.
Basically we did already know this.To be continued.......
-
@folly Excellent! I can confirm that the .p8 files without the .png end can be opened with both the libretro engine and the pico8_dyn engine. Now I have freedom of choice. Huzzah!
-
Nice to hear.
So .p8 should be added to the module-script.
I will add it when I can. -
-
@folly this module looks good btw minus maybe a couple of tweaks but please feel free to submit it as a PR. Thanks.
-
you can disable the retroarch image viewer in order to allow retroarch to load the .p8.png files
in retropie, this looks like a retroarch.cfg like this
# Settings made here will only override settings in the global retroarch.cfg if placed above the #include line builtin_imageviewer_enable = "false" #include "/opt/retropie/configs/all/retroarch.cfg"
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.