User avatar
boomonster
Posts: 77
Joined: Fri May 11, 2018 11:18 pm

I managed to get Dolphin running on a Pi 2?!? (VERY SLOWLY)

Thu Aug 15, 2019 10:41 pm

I've seen a lot of posts on trying to get Dolphin running on the Pi, and whether or not it will run.
After fiddling around with the CMakeLists.txt file for a bit, I managed to successfully configure
and compile Dolphin - Please note that this version of Dolphin did not come from the Dolphin
website or GitHub. After installing dolphin, I tried testing it... When I ran the GUI, everything
seemed intact and working - except for the fact that I was unable to use any video outputs but
"Software Renderer" (I think that's SDL). Because of this, all games were unplayably slow, and
I only had the patience to wait for the Nintendo logo to show up and fade out in GameCube
emulation. So yes, I got Dolphin running, but unusably all the same. I never got any video output
from Wii emulation, even though I don't think I got any errors - please forgive me for being so
vague as I am a "noob" and this stuff often goes in one ear and out the other...

The source code I used can be found here: https://code.launchpad.net/~dolphin-emu ... emu/stable
However, I am pretty sure you have to use Bazaar (bzr) to download the code:
sudo apt-get install bzr && bzr branch lp:~dolphin-emu/dolphin-emu/stable

I did use the official documentation for installing Dolphin 5.0 from source on Linux, except that I
changed a few things (mostly leaving out certain packages): https://wiki.dolphin-emu.org/index.php? ... n_on_Linux
#1 Do not install polarssl-dev, as I get some errors having to do with lines of code like "x509_cert cacert;".
Instead, Dolphin will build its own version from Externals which fixes the error.
#2 Do not install libavcodec-dev, as again I get a ton of errors when trying to build the one of the AVI recording
objects.
#3 Make sure Full KMS GL is disabled because this seemed to make Dolphin think that GLU was not
installed and that aborted the configuring. If it persists, reflash Raspbian, or try uninstalling and reinstalling
the libglu-mesa-whateveritis driver (find the package name in the official Dolphin website on compiling from source).
#4 I had to edit the CMakeLists.txt file a bit, because it was not detecting that I had both X11 and Wayland
installed for rendering. Here's the changes I made in the code (I only copied the section that I changed):

Code: Select all

option(ANDROID "Enables a build for Android" OFF)
option(USE_EGL "Enables EGL OpenGL Interface" OFF)
option(USE_X11 "Enables X11 Support" ON)
option(USE_WAYLAND "Enables Wayland Support" OFF)
option(USE_GLES "Enables GLES2 And EGL, disables OGL" OFF)
option(USE_GLES3 "Enables GLES3 and EGL" OFF)
option(USE_UPNP "Enables UPnP port mapping support" ON)
option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF)

option(FASTLOG "Enable all logs" OFF)
option(OPROFILING "Enable profiling" OFF)
option(OPENMP "Enable OpenMP parallelization" ON)
#I changed ENCODE_FRAMEDUMPS to OFF because there were errors in the AVI dumping code.
option(ENCODE_FRAMEDUMPS "Encode framedumps in AVI format" OFF)
Here's the second place I had to change CMakeLists.txt:

Code: Select all

include(CheckLib)
include(CheckCXXSourceRuns)
if(NOT ANDROID)
	#Here is the FindOpenGL command which supposedly checks if X11 is available as well.
	#However, that part of FindOpenGL is deprecated (I think) and I modified the code later on to
	#compensate for this.
	include(FindOpenGL)
	include_directories(${OPENGL_INCLUDE_DIR})
	if(NOT OPENGL_GLU_FOUND)
		message(FATAL_ERROR "GLU is required but not found")
	endif()

	if(OPENMP)
		include(FindOpenMP OPTIONAL)
		if(OPENMP_FOUND)
			message("OpenMP parallelization enabled")
			add_definitions("${OpenMP_CXX_FLAGS}")
			set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}")
		endif()
	endif()
	if(NOT OPENMP_FOUND)
		add_definitions(-Wno-unknown-pragmas)
		message("OpenMP parallelization disabled")
	endif()

	include(FindALSA OPTIONAL)
	if(ALSA_FOUND)
		add_definitions(-DHAVE_ALSA=1)
		message("ALSA found, enabling ALSA sound backend")
	else()
		add_definitions(-DHAVE_ALSA=0)
		message("ALSA NOT found, disabling ALSA sound backend")
	endif(ALSA_FOUND)

	check_lib(AO ao QUIET)
	if(AO_FOUND)
		add_definitions(-DHAVE_AO=1)
		message("ao found, enabling ao sound backend")
	else()
		add_definitions(-DHAVE_AO=0)
		message("ao NOT found, disabling ao sound backend")
	endif(AO_FOUND)

	check_lib(BLUEZ bluez QUIET)
	if(BLUEZ_FOUND)
		add_definitions(-DHAVE_BLUEZ=1)
		message("bluez found, enabling bluetooth support")
	else()
		add_definitions(-DHAVE_BLUEZ=0)
		message("bluez NOT found, disabling bluetooth support")
	endif(BLUEZ_FOUND)

	check_lib(PULSEAUDIO libpulse-simple QUIET)
	if(PULSEAUDIO_FOUND)
		add_definitions(-DHAVE_PULSEAUDIO=1)
		message("PulseAudio found, enabling PulseAudio sound backend")
	else()
		add_definitions(-DHAVE_PULSEAUDIO=0)
		message("PulseAudio NOT found, disabling PulseAudio sound backend")
	endif(PULSEAUDIO_FOUND)

	include(FindOpenAL OPTIONAL)
	if(OPENAL_FOUND)
		add_definitions(-DHAVE_OPENAL=1)
		include_directories(${OPENAL_INCLUDE_DIR})
		message("OpenAL found, enabling OpenAL sound backend")
	else()
		add_definitions(-DHAVE_OPENAL=0)
		message("OpenAL NOT found, disabling OpenAL sound backend")
	endif(OPENAL_FOUND)

	if(UNIX AND NOT APPLE)
		# Note: The convention is to check USE_X11 or USE_WAYLAND where needed.
		# This is where we detect platforms and set the variables accordingly.
		pkg_check_modules(WAYLAND wayland-egl wayland-client wayland-cursor)
		if(USE_WAYLAND AND WAYLAND_FOUND)
			pkg_check_modules(XKBCOMMON xkbcommon)
			if(XKBCOMMON_FOUND)
				set(USE_WAYLAND 1)
				add_definitions(-DHAVE_WAYLAND)
				include_directories(${WAYLAND_INCLUDE_DIR})
				message("Wayland support enabled")
			endif(XKBCOMMON_FOUND)
		else()
			set(USE_WAYLAND 0)
			message("Wayland support disabled")
			add_definitions(-DHAVE_WAYLAND=0)
		endif(USE_WAYLAND AND WAYLAND_FOUND)

		# Note: We do not need to explicitly check for X11 as it is done in the cmake
		# FindOpenGL module on Linux OR SO THEY SAY...
		#Here is where I have to change the code again (Look at the next line...).
		include(FindX11)
		if(USE_X11 AND X11_FOUND)
			set(USE_X11 1)
			add_definitions(-DHAVE_X11=1)
			include_directories(${X11_INCLUDE_DIR})
			message("X11 support enabled")
		else()
			set(USE_X11 0)
			SET(X11_FOUND "")
			message("X11 support disabled")
			add_definitions(-DHAVE_X11=0)
		endif(USE_X11 AND X11_FOUND)

		if (NOT USE_WAYLAND AND NOT USE_X11)
			message(FATAL_ERROR "\n"
				"No suitable display platform found\n"
				"Requires wayland or x11 to run")
		endif()
	endif()

I hope this answers some questions!
If you want to try getting GL or Direct 3D
rendering working I would greatly appreciate
that as I am a fan of New Super Mario Bros. Wii.

If I forgot anything, or you are having problems
duplicating what I did, please tell me - I will frequent
the Forums about once a week.

Cheers
Boomonster :)

jdonald
Posts: 261
Joined: Fri Nov 03, 2017 4:36 pm

Re: I managed to get Dolphin running on a Pi 2?!? (VERY SLOWLY)

Fri Aug 16, 2019 4:12 am

Hey thanks so much for sharing this. I had no idea about the fork on bazaar because it doesn't match any of the branches on GitHub.

On a Pi 2 v1.2, 3, 3B+, or 4 it's possible to run dolphin-emu from the Debian APT repository if you install a 64-bit kernel. I posted instructions for doing that on Raspbian in one of the 64-bit debate threads.

sakaki released an updated kernel yesterday that fixes GPU acceleration so I tested this out today. Unfortunately it turns out the V3D driver doesn't support OpenGL 3.0 and above so I had to fall back to Mesa llvmpipe. Note this is still different from the Software backend in Dolphin, as you basically select OpenGL and the software rendering happens internal to Mesa.

I played New Super Mario Bros Wii at about 7 fps and confirmed I got make it through the cutscenes and at least get started in world 1-1, but overall it's unplayable. The fps goes up to 30 when the screen fades to black, so that shows potential that the main bottleneck is in the renderer and not CPU, sound, or other parts.

The particular branch you've shared stands out because:
* Unlike mainline, it supports JIT for ARM 32-bit
* It has options like USE_GLES and USE_GLES3
* However, it seems to be forked from something really old.

I wonder why mainline doesn't have the USE_GLES3 option. This would give us accelerated graphics on a Pi 4, and I figure most of the plumbing has already been done for Android.

User avatar
boomonster
Posts: 77
Joined: Fri May 11, 2018 11:18 pm

Re: I managed to get Dolphin running on a Pi 2?!? (VERY SLOWLY)

Fri Aug 16, 2019 6:08 pm

One of the things I was wondering
about is if you know of any way to route
the graphics rendering to anything but
Software Renderer as that is the slowest
rendering available and yet this fork does
not want to give me any other options
such as GL or Direct 3D...

Boomonster

jdonald
Posts: 261
Joined: Fri Nov 03, 2017 4:36 pm

Re: I managed to get Dolphin running on a Pi 2?!? (VERY SLOWLY)

Fri Aug 16, 2019 6:18 pm

What happened when you tried compiling with USE_GLES=ON? I attempted that and it didn't change the listed video options, but I could have easily missed something given all the precarious steps.

You would need a Pi 4 to test USE_GLES3=ON, but can probably hold off on that until someone gets USE_GLES [2.0] working.

User avatar
boomonster
Posts: 77
Joined: Fri May 11, 2018 11:18 pm

Re: I managed to get Dolphin running on a Pi 2?!? (VERY SLOWLY)

Fri Aug 16, 2019 11:58 pm

So... I tried with USE_GLES as well, and it didn't
change the video outputs available. :x

If you try running Dolphin in
a terminal, you will see that it is using GLES, but
it seems as if GLES just calculates the graphics
and passes it on to SDL to render or something wierd
like that - forgive me! This stuff is really confusing.

Then, I tried disabling EGL and GLES, and ported
the video to GLX, although the video output seemed
to stay the same in Dolphin. Unfortunately, though
I was hoping it would be faster, Dolphin suddenly
crashed, despite me enabling the error box thing
so Dolphin would tell me if an error occured and
what it is...

Oh, and F-Zero GX for GameCube does not work
at all as it gave me some funny memory error problem
before crashing.

If you know of any ways that could possibly help,
please tell me!

Boomonster

Return to “Gaming”