Porting Mupen64Plus to aarch64

August 21, 2018 - 3 minutes

Mupen64Plus now has aarch64 support

I have had my aarch64 based desktop for almost a year now, and the time of the year came around for my yearly tradition of 100%‘ing Super Mario 64 by getting all 120 stars. My only issue was none of my 32 bit ARM machines were powerful enough to emulate the Nintendo 64. I have a cubox which is capable, but I haven’t been able to get a graphical desktop set up on it. Whenever you would try to compile Mupen64Plus on the Macchiatobin, it would fail with an error because their Makefile didn’t include support for aarch64. So naturally with my abilities in C and C++ I got to work.

What I did

I had to read through the settings for their Makefile for all of the different CPU architectures. Which normally things such as CPU architecture can largely be ignored in a C based project such as mupen64plus. However, mupen64plus dynamically recompiles ROMs, which they use some assembly for. And the only dynarec that supported ARM was the new_dynarec, and it was 32 bit assembly, but thankfully all ARM assembly code is 32 bit, so this assembly runs on aarch64 without issue. So I added some settings in several of the Makefiles in the mupen64plus project so that aarch64 would build and link correctly. A couple hours of toying with Makefiles and I finally get this!

mario start screen

This was quite a happy sight to see. I got yet another application working on aarch64. While I was hacking on the project I also came along and wrote a CMake build for the mupen64plus-input-sdl project, along with adding Markdown syntax to it’s README. I would like to eventually go through the project and add a Markdown README and a CMake build for the other modules in the project. At the time of this writing though all of my current contributions to mupen64plus have been accepted into their respective master branches. So now anyone running aarch64 can play their favorite Nintendo games!

A word about running aarch64

Some people would consider running a lesser known architecture like aarch64 a waste of time, or of no benefit. But I’d argue that the problems you face running it give you an education about things that you wouldn’t otherwise gain, it’s almost a knowledge that will be exclusive to you. So through all of the inconvenience that came with porting all of my home network to run ARM instead of x86, in the end I gained a low power consuming, modern home network that runs only free software. It’s been a lot of working getting to this point, but now I can truly call myself a proud CPU hipster!