Someone on Reddit commented that they wanted a particular game on a cartridge for this system, and it got me thinking about what that would require. The game in particular is Manic Miner for the ZX Spectrum. This would require emulation, as the Pi 400 doesn't have the hardware, or an FPGA that could replicate the hardware. The first emulator that comes to mind is Retroarch, as it is modular and I could include only what is needed to run the game. It has to open the game automatically and run it in full screen, without user input. Luckily, I found a Python API for Retroarch that is very simple and would allow enough control to get this going. Below is the example usage.
RetroArchPythonAPI
A Python API for RetroArch (libretro)
Example Usage:
RETROAPI = RetroArch(retroarch_path='/usr/bin/retroarch',settings_path='settings')
RETROAPI.start("Game Path","Libretro Core Path")
RETROAPI.toggle_fullscreen()
RETROAPI.toggle_fullscreen()
RETROAPI.toggle_pause()
RETROAPI.toggle_pause()
save_state = RETROAPI.save()
RETROAPI.reset()
RETROAPI.load(save_state)
RETROAPI.stop()
It has just enough options to load a game, put it into full screen, reset, and even implement auto save and auto load. Being that I programming in Python these days, I might actually be able to modify this API to add extra features, like the two mentioned above. Inside the main python file are all the parameters of the emulator that can be specified, so you can use it to set up the emulator. I think Retroarch will be the emulator of choice for this project.
While thinking on this API, I realized that I will likely be running emulators extensively, which brought me to the idea that I may need to overclock the Pi 400 to get things like the Dolphin emulator running at full speed, assuming it can be run at all. That might have to wait until the Vulkan drivers are ready to implement. I'd love to have Super Mario Sunshine, one of my favorite games, on a cartridge for the Pi 400. That's a bigger project, but should be possible in the future. I have to make sure that whatever OS I go with can overclock the Pi, or it might miss out on some of the more resource intensive games out there. Looking at what appears to be the most viable API for the Dolphin emulator, I found it is only being developed for Debian 9. I could just strip down a Debian 9 installation with something like this script, and install the Doplhin emulator, and add whatever supporting software is needed. That stripped down image could just become the default OS for any games that require the Dolphin emulator. I'd like to hide any and all of the Dolphin interface, and have it boot straight to the game. If I can't interface with the emulator directly, for some reason, I should be able to simulate mouse clicks and keyboard presses to set up and start the game, hiding all of that behind a splash screen or loading screen of some sort. Not ideal, but could be a viable worst case scenario. There's a lot more that will go into this, and I really need to get up to speed with Linux to pull this stuff off.
After all that research, thinking, and typing, I just realized that there is a Dolphin core for Retroarch... Ignore everything above about a stripped down linux distro. I can just use the Python API for Retroarch for all emulation. Problem solved. It did lead me to find a simple way to strip down a Linux OS, which I may need anyway. Another thought on that is to just use one of the minimalist distros that is built around retroarch, and call it a day. I forgot all about the Retropie distro, and am downloading a copy of that now for testing. I should be able to strip it down, add a few things I need, and build off of that. Can't believe I forgot about it. The download is 845MB, which is pretty big for an OS that will only run one game at a time. THe bigger the OS, the bigger the flash chip needs to be, and may involve upgrading the cart to a bigger flash chip, which could cost more.
I got the image flashed and started up Retropie, but hit a few dead ends. I don't own a USB keyboard anymore. My old roommate took the USB dongle somehow when he packed up and moved out, and I can't get Retropie to connect to my bluetooth keyboard. I had to use a controller to get it set up and into the main menu. Useless without a keyboard. Stuck again. The Covid lockdown cost me my home, twice, and I ended up getting rid of many of my possesions. The extra time off work is the only reason I'm able to work on these right now, but the lack of project funding is very frustrating right now. I also managed to crack the SD card I was using in my Pi Camcorder project when I removed it with pliers, because it was too hard to get out by hand. Luckily I have my software backed up, but I have to reinstall everything, and that won't be fun. I was going to make an SD card backup, but all of my SD cards were buried somewhere, and I never got around to it. Just found them today, but broke the card before I backed it up... Off to a bad start.
Wrapping this log up and finding something else to do.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.