Guide for myself and others to get RetroArch running on the new Raspberry Pi 4 while projects like RetroPie get an image out for the rpi4.
Disclaimer: I am not an expert and this may not be the most optimal build possible, but it works.
Inspiration taken from:
- This gist showing the basic steps for building and configuring for raspberry pi 3.
I'm new to Raspberry Pi and RetroArch myself so this was super helpful and I recommend looking through it.
https://gist.github.com/AlexMax/32e5d038a66ce57253e740ea75736805 - This Reddit post showing the performanc gains over the pi 3b+
https://www.reddit.com/r/RetroPie/comments/c7j150/emulation_on_the_raspberry_pi_4_vs_rpi_3/
- I used 'Raspbian Buster with desktop' installed from NOOBS
https://www.raspberrypi.org/downloads/noobs/ - I used the OpenGL driver (Enabled by default)
sudo raspi-config
Advanced Options -> GL Driver -> G2 OpenGL desktop driver...
- Update everything and restart - skip if you know this is done already
sudo apt update
sudo apt upgrade
shutdown -r now
Install some needed packages - check the gist I linked for an explanation
sudo apt install build-essential libasound2-dev libudev-dev libgles2-mesa-dev libx11-xcb-dev libxxf86vm-dev
Download RetroArch source code - This guide will use the .tar.gz
https://github.com/libretro/RetroArch/releases
wget https://github.com/libretro/RetroArch/archive/v1.9.0.tar.gz
tar -xf v1.9.0.tar.gz
cd RetroArch-1.9.0
To fix undefined reference to XF86VidMode...
errors change this line in Makefile:
#OLD line 24
LIBS :=
#New
LIBS := -lXxf86vm -lpthread
Configure with additional options to work with rpi4
CFLAGS='-mfpu=neon -mtune=cortex-a72 -march=armv8-a' ./configure --disable-opengl1 --enable-neon --enable-opengles3 --enable-opengles --disable-videocore
If no errors, build
make
sudo make install
Launch RetroArch fullscreen
retroarch -f
Go ahead and update assets within RetroArch
Online Updater -> Update Assets
The gist for rpi 3b+ will tell you to update the retroarch.cfg file with a url, but those cores did not work for me so this guide will walk through building them.
All cores likely have multiple options to choose from but this will just go over what I've done so far.
Compiled core files end in .so
and are kept in ~/.config/retroarch/cores/
Create directory to build our cores
cd ~
mkdir cores
cd cores
This could probably use optimized CFLAGS but it works as is
git clone --depth 1 https://github.com/libretro/libretro-fceumm.git
cd libretro-fceumm
make -j4
Move fceumm_libretro.so
to cores dir
This could probably use optimized CFLAGS but it works as is
git clone --depth 1 https://github.com/libretro/snes9x2010.git
cd snes9x2010
make -j4
This core is no longer being updated so you should use mupen64plus-libretro-next, but keeping this here just in case.
git clone --depth 1 https://github.com/libretro/mupen64plus-libretro.git
cd mupen64plus-libretro
platform=rpi4 make -j4
git clone https://github.com/libretro/mupen64plus-libretro-nx.git
cd mupen64plus-libretro-nx
platform=rpi4 make -j4
git clone --depth 1 https://github.com/libretro/pcsx_rearmed.git
cd pcsx_rearmed
platform=rpi4 make -j4
Thank you for this.
Is your sound OK? On my Pi4 (4gb, 512 gpu_mem) the snes & genesis emulation only run at around 45-50 FPS (I have 60 only in retroarch's menu). And this results in distorted sound.
Sometimes (seemingly random) it will go to 60FPS and the sound is then fine.