Dolphin requires moving to a 64-bit kernel. This means your system will be prone to camera and video decode have problems, and improperly written wrapper scripts that depend on uname -m (e.g. Wolfram, Kodi) will run into problems. For this reason it's highly recommended to use a new SD card separate from your primary system.
Start with a standard Raspbian Buster desktop installation for your Pi 4B. Do not attempt this on a Pi 3B+ or older because those devices do not support GLES 3.0 in hardware.
(Updated) The Raspbian maintainers now publish a 64-bit kernel. Download it with:
Code: Select all
sudo rpi-update
Code: Select all
arm_64bit=1
Code: Select all
reboot
Code: Select all
uname -m
Create a 64-bit chroot with all the Dolphin runtime dependencies:
Code: Select all
sudo apt-get install -y debootstrap schroot
cat << EOF | sudo tee /etc/schroot/chroot.d/pi64 >/dev/null
[pi64]
description=Debian Buster arm64
type=directory
directory=/srv/chroot/pi64
users=pi
root-groups=root
profile=desktop
personality=linux
preserve-environment=true
EOF
sudo debootstrap --arch=arm64 buster /srv/chroot/pi64
sudo schroot -c pi64 -- apt-get install -y sudo curl mesa-utils xz-utils libqt5widgets5 libevdev2 libudev1 libasound2 libbluetooth3 libopengl0 libglu1-mesa
Code: Select all
schroot -c pi64
Code: Select all
(pi64)pi@raspberrypi:~ $
Our next roadblock is that because this is a Debian (not Raspbian) chroot, it's using Mesa 19.0 which won't be sufficient. Download and unpack this custom build of 64-bit Mesa 19.3 like so:
Code: Select all
(pi64)pi@raspberrypi:~ $ sudo echo
(pi64)pi@raspberrypi:~ $ curl -Lo- https://www.dropbox.com/s/yjpez224cotk3tj/mesa-v3d_19.3-EXT_buffer_storage_arm64.tar.xz?dl=0 | sudo tar -xJf- -C /
Next, check if this fixed GLES 3.0 hardware acceleration by running the command:
Code: Select all
(pi64)pi@raspberrypi:~ $ glxinfo | egrep 'Vendor|Device|GLES\[23\]'
Code: Select all
Vendor: Broadcom (0x14e4)
Device: V3D 4.2 (0xffffffff)
Max GLES[23] profile version: 3.0
Let's get Dolphin. Normally it takes more than 30 minutes to build natively, so I've provided a precompiled binary:
Code: Select all
(pi64)pi@raspberrypi:~ $ curl -L -O https://www.dropbox.com/s/evw12h6q4j0dw7w/dolphin-emu_5.0-10886-230ff47c0a_arm64.tar.xz
...
(pi64)pi@raspberrypi:~ $ sudo tar xvf dolphin-emu_5.0-10886-230ff47c0a_arm64.tar.xz -C /
Code: Select all
(pi64)pi@raspberrypi:~ $ dolphin-emu
This should create the appropriate configuration files. Find ~/.config/dolphin-emu/GFX.ini and edit it. You'll need to add the following line:
Code: Select all
PreferGLES = True
Dolphin is now almost ready to run, but if you try opening a ROM it'll immediately hit an error saying "MemoryMap_Setup: Failed finding a memory base." This is due to a shortcoming in debootstrap or schroot that by default shared memory is not available. You can hack around this like so:
Code: Select all
(pi64)pi@raspberrypi:~ $ sudo chmod a+w /dev/shm
Code: Select all
(pi64)pi@raspberrypi:~ $ dolphin-emu
There, you made it!
Note: If this works the first time but after a reboot it runs into a memory error, that is typically because the /dev/shm and overwriting of Mesa /usr/lib files is not sticky. You'll have to rerun those particular commands to get the chroot back into its ready mode, so if you plan on going back into the emulator often consider putting together a helper script.
Note this whole thing is at the proof-of-concept stage. Turning on antialiasing immediately causes a crash and Wii games are unplayable. I'm sharing this mainly so that all Pi 4 owners can jump in figure out ways to move this forward.
To minimize dependencies, the pre-built binary I provided had minimal add-ons such as ALSA and Bluetooth controller support. I opted not to include AVI recording or PulseAudio. If you'd like to reconfigure your build or hack on the code, here's a rundown of what to do inside your 64-bit chroot:
Code: Select all
uname -m # i.e. double-check that you're inside the chroot. This should output aarch64
sudo apt install -y build-essential git cmake ninja-build ccache qtbase5-dev qtbase5-private-dev libxi-dev libxrandr-dev libudev-dev libevdev-dev libbluetooth-dev libasound2-dev
sudo update-ccache-symlinks
git clone https://github.com/dolphin-emu/dolphin.git
cd dolphin
mkdir build; cd build
PATH=/usr/lib/ccache:$PATH \
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_C_FLAGS"-mtune=cortex-a72" -DCMAKE_CXX_FLAGS="-mtune=cortex-a72" ..
ninja -j3 all
sudo ninja install
The -j3 option is there to avoid running out of memory or thrashing to swap on a 2 GB Pi 4. Ninja knows the number of cores but doesn't deal with RAM limitations. If you have a 4 GB model then you should be fine letting Ninja take all the cores.