Guide: Super Mario 64 Port on Retro Handhelds

Last updated: 23JUN2022 (see Changelog for details)

Great news – the method used to bring the awesome Super Mario 64 port for RG350 devices is now available for the RG351P and similar retro handheld devices. This port is unique in that it features a 60fps (frames per second) patch, making the game look and feel twice as smooth as it originally did. It’s worth checking out this port for this feature alone. Moreover, it’s available for both the 351ELEC and ArkOS firmwares, which is very handy!

This guide is relatively simple, but before we get started, a word about copyright: The game file for Super Mario 64 (or for any game, unless explicitly offered by the owner) is considered copyrighted media, just like a film or song is considered copyrighted media. While it’s never been tested in court, distributing game files over the internet is considered illegal. This guide will show you how to create your own port of SM64 using your own copy of the game, for your own personal use. Sharing the location of a copy of SM64 is not permitted on this site, nor is distributing a copy of the completed port we’re about to create. If you’re interested in reading more about the legality surrounding game emulation, check out my article here.

Note that the video below is quite dated, but the process is relatively the same. For the most current information, follow the written guides below.

Table of Contents:
Build the Super Mario 64 port
Remap the controls
RG351V instructions
RG351MP instructions
Updated instructions for RG351V, RG351MP, RGB20S, RG552, RG503, and RG353P
PowKiddy RGB10 instructions
RetroOZ (ODROID Go Super and PowKiddy RGB10 Max) instructions
Notes

Changelog

To start, you will need your personal copy of the Super Mario 64 Nintendo 64 ROM. Make sure that you’re using a ROM with the file extension of .z64 to ensure widest compatibility. You need to use a US version of the ROM. The file needs to be renamed as follows:

baserom.us.z64 for NTSC/US version of Super Mario 64

Build the Super Mario 64 port

I found this to be the most fun part of the whole process. The developer of this port created an online builder tool specifically for this port. All you have to do is visit a webpage, follow a few notes, and voilà, the builder will decompile and build a zip file from your SM64 game file.

  • Head to this page to find the SM64 port builder.
  • In the first “cell” (piece of code) on the page, you’ll find a “play” button on the top-left side of the code. This will download the toolchain and create the necessary file structure.
  • On the left menu, you’ll see an icon of a folder (click the refresh button if you don’t see it). Click that folder icon, then the “sm64-351elec-port” folder. Take your renamed “baserom.us.z64” file and drag it into the sm64-351elec-port folder.
  • In the next cell (code) you will see a bunch of lines that are annotated with a “#” comment symbol. It will look like this:
# VERY EXPERIMENTAL : Uncomment the following line to apply puppycam patch
#!cd sm64-351elec-port && patch -p1 < ./enhancements/puppycam.patch

# Uncomment the following line to apply 60fps patch
#!cd sm64-351elec-port && git apply ./enhancements/60fps.patch --ignore-whitespace --reject

# Uncomment the following line to build for 351ELEC
#!cd sm64-351elec-port && ./build_351_elec.sh && ./build_package_elec.sh

# Uncomment the following line to build for ArkOS
#!cd sm64-351elec-port && ./build_351_ark.sh && ./build_package_ark.sh
  • The first section is for a “puppycam” patch, which gives you a full 360 camera on the right stick (something not originally available on the game). This section is still experimental, so it’s up to you if you want to try it or stick with the original camera. To try the puppycam patch, simply delete the “#” before the “!cd” line, which will enable the patch. Fair warning, the patch is fairly buggy, and I prefer not to use it.
  • Similarly, you want to delete the “#” from the first “!cd” line to apply the 60fps patch, and then delete the “#” from the “!cd” line that applies to whatever firmware you’re using — 351ELEC or ArkOS.
  • After that, just click the “play” button for this cell, and it will create the .zip file port for you. If you get an error, there’s probably something wrong with your Super Mario 64 ROM. Use a different one.
  • If all goes well, you will have a file named sm64-351ELEC.zip (or sm64-ArkOS.zip if you built the ArkOS version) in the main root directory on the left menu. Download this file, then unzip it to reveal a sm64.sh file and a folder named sm64. Note that in ArkOS, the name of the .sh file is what will appear on your menu, so if you’d like, rename it to something easier to identify, like “Super Mario 64.sh”. To change the name of the game in 351ELEC, use the gamelist.xml entry found in the Notes section below.
  • Insert your RG351P microSD card into your computer using a USB SD card reader, then navigate to GAMES (or EASYROMS for ArkOS) / ports folder. Place the sm64.sh and sm64 folder into the ports folder. Note that it will take a while to move over, because there are lots of little files in the sm64 folder.

After that, just eject the SD card and re-insert it into your device. You should now find the Super Mario 64 game in your Ports section.

Remap the controls

By default, here are the controls:

A button: jump
B button: punch/roll
L1 button: Z button
R1 button: R button
Right analog stick: C buttons
START: pause/in-game menu
START + SELECT: close game

There are two methods to remap the controls. If you built your SM64 port before 30DEC2020, you will need to do Method #2. If you compiled your port on 30DEC2020 or later, you can do either method.

Method #1: sm64config.txt files

To start, you have to boot up the game at least once to create the necessary files. Eject the SD card and put it in your computer. In the ports/sm64/configuration folder on your SD card, you’ll find a file named “sm64config.txt”. In this file, you can set the parameters “button_a”, “button_b”, etc, with the buttons you want to use (be sure to use uppercase). It will look like this:

button_a A
button_b B
button_start START
button_r R1
button_z L1

For me, I changed button_a to B and button_b to Y.

Method #2: gamecontrollerdb.txt file

You can also go into the ports/sm64/controller folder on your SD card, and open the gamecontrollerdb.txt file. Find the text string that starts with “03000000091200000031000011010000,OpenSimHardware OSH PB Controller”, and make the following changes to the face button configuration in that string:

a:b1,b:b3,y:b2,x:b0

This will map the jump button to the B button, and the punch/roll button to Y, which feels the most natural to me.

RG351V instructions

The RG351V has a single analog stick, which makes using the C buttons a bit tricky. Luckily this process will map them to the d-pad instead, giving you a simple workaround. Thanks to Reddit user daedalia2 for the controller file!

  • Build the SM64 port using the build guide above, following instructions for either the ArkOS or 351ELEC version. Also be sure to uncomment the 60fps patch, and you can also select the puppycam patch to make navigation a bit easier in later levels. If you’ve already built it once before, you can use that same file again.
  • Place the sm64.sh file and the sm64 folder in the “ports” folder (you can rename sm64.sh file to something a bit nicer, like Super Mario 64.sh). Next, download this file, unzip it, and place the gamecontrollerdb.txt file in the ports/sm64/controller folder (replace the one that’s already in there).
  • If using ArkOS with a two-card setup, place everything in the SD2 card instead, but also place the downloaded gamecontrollerdb.txt file in the EASYROMS/ports/sm64/controller folder of the SD1 card too. You will have to create the sm64/controller folders first.

Press START + SELECT to exit the game at any time.

RG351MP instructions

Thanks to Reddit user daedalia2 and jetup for cracking the code on this one.

  • Build the SM64 port using the build guide above, following instructions for either the ArkOS or 351ELEC version. Also be sure to uncomment the 60fps patch, and you can also select the puppycam patch to make navigation a bit easier in later levels. If you’ve already built it once before, you can use that same file again.
  • Place the sm64.sh file and the sm64 folder in the “ports” folder (you can rename sm64.sh file to something a bit nicer, like Super Mario 64.sh). Next, download this file, unzip it, and place the gamecontrollerdb.txt file in the ports/sm64/controller folder (replace the one that’s already in there).
  • If using ArkOS with a two-card setup, place everything in the SD2 card instead, but also place the downloaded gamecontrollerdb.txt file in the EASYROMS/ports/sm64/controller folder of the SD1 card too. You will have to create the sm64/controller folders first.

Press START + SELECT to exit the game at any time.

Updated instructions for RG351V, RG351MP, RGB20S, RG552, RG503, and RG353P

These instructions will work with any retro handheld that has dual SD cards and is capable of running PortMaster. This will include the RG351V, RG351MP, RG552, RG503, and RG353P. This process will take a couple extra steps from those above, but will utilize universal controller profiles already set up in PortMaster. You will need to have PortMaster installed and updated on your device before starting, here is my guide on how to get this set up. Thanks to romadu for the fixes!

  • Download this package and extract the contents onto our computer.
  • Build the SM64 port using the build guide above, following instructions to create either the 351ELEC or ArkOS version. Also be sure to uncomment the 60fps patch, and you can also select the puppycam patch to make navigation a bit easier in later levels. Before pressing the “Play” button on Step 2, go into the file browser on the left column and navigate to sm64-351elec-port > src > pc > controller and delete the controller_sdl.c file found there. Then, drag and drop the controller_sdl.c file we downloaded from the package in Step 1 into that same folder, to replace it. Proceed with the rest of the build as intructed above.
  • Once you have built the sm64-ArkOS.zip or sm64-351ELEC.zip file, save it to your computer, then unzip the file to reveal the data files inside. Within there, replace the sm64.sh file with the sm64.sh file we downloaded from the package in Step 1.
  • Place the sm64.sh file and the sm64 folder in the PORTS folder in your SD card (you can rename the sm64.sh file to something a bit nicer, like Super Mario 64.sh).

PowKiddy RGB10 instructions

Setting up Super Mario 64 on the RGB10 is almost the same as the RG351 devices, but with a special button configuration for the device. You will need to be running the ArkOS firmware for this to work.

  • Build the SM64 port using the build guide above, following instructions to create the ArkOS version. Also be sure to uncomment the 60fps patch, and you can also select the puppycam patch to make navigation a bit easier in later levels.
  • Once you have built the sm64-ArkOS.zip file, save it to your computer, then unzip that file to reveal all of the data files inside.
  • Place the sm64.sh file and the sm64 folder in the EASYROMS/ports folder (you can rename the sm64.sh file to something a bit nicer, like Super Mario 64.sh). Next, download this file, unzip it, and place the gamecontrollerdb.txt file in the EASYROMS/ports/sm64/controller folder (replace the one that’s already in there).

Press START + SELECT to exit the game at any time.

RetroOZ (ODROID Go Super and PowKiddy RGB10 Max) instructions

Setting up Super Mario 64 on the ODROID Go Super and RGB10 Max is fairly simple, but it does have some distinguishing installation requirements from the Anbernic devices:

  • Build the SM64 port using the build guide above, following instructions to create the ArkOS version. Also be sure to uncomment the 60fps patch, too. You can also select the puppycam patch, although I find it to be inferior to the standard SM64 camera when using dual analog sticks.
  • Once you have built the sm64-ArkOS.zip file, save it to your computer, then unzip that file to reveal all of the data files inside.
  • Move everything within the unzipped “sm64” folder into the ROMS/ports/sm64 folder on your RetroOZ sd card, minus the “configuration” and “controller” folders. Don’t worry about the .sh file that is in the root directory of your unzipped folder, RetroOZ already has a pre-built .sh file in the ports folder for you.
  • If using the RGB10 Max, be sure to go into the OPTIONS section in the main RetroOZ menu, then select DEVICES > and whatever RGB10 Max control scheme you prefer (I like having my START/SELECT buttons on top, for example).
  • If using the RGB10 Max 2, download this file, unzip it, and place the gamecontrollerdb.txt file in the ports/sm64/controller folder (replace the once that’s already in there).

Press START + SELECT to exit the game at any time.

Notes

Note that there are no save states, you will have to use the in-game saves just like on the original console.


Changelog

23JUN2022
– updated instructions to include RG351V, RG351MP, RGB20S, RG552, RG503, and RG353P
– removed boxart instructions since you can now just scrape the game within the menu

07NOV2021
– added instructions for the RGB10 Max 2

06NOV2021
– added RG351MP instructions

29AUG2021
– added RG351V, RGB10, and RetroOZ instructions

01AUG2021
– fixed broken link

29DEC2020
– added gamelist.xml instructions for 351ELEC
– added button remapping section

28DEC2020
– published guide

92 thoughts on “Guide: Super Mario 64 Port on Retro Handhelds

  1. Hello, I was wondering I’m able to use this port and play it on a home brew switch?
    There are guides to run a port of sm64 in android on home brew but there’s nothing searchable or no guides out

    Like

  2. I figured out why controls were broken on my R36S. The executable would throw ‘SDL mapping error: Invalid RWops’ which seems to cryptically mean that the gamecontrollerdb.txt wasn’t found. The Github code that Google Colab is using doesn’t support Mario 64 running from a second SDcard (/roms2).

    To fix, prior to clicking the first Run/Play button in Colab, you’ll need to change one line. Find the “!git clone..” line and change AdrienLombard to ncflagg
    If you get build errors, try deleting the sm64-351elec-port folder if it exists.

    I incorporated some of the controller_sdl.c code inside the sm64update2022.zip archive (from this guide) as well as a fix for the Back button being mapped to Start. I also included a small movement hack which prevents Mario running around in small circles at low walking speeds to avoid falling off ledges for no good reason.
    Once the sm64-ArkOS.zip is built, follow the rest of this guide.

    Like

  3. I tried the method ncflagg described here for my R36S but the start button still wouldn’t work. The thing that finally did it was to download the PortMaster.zip file from their website and then put the included gamecontrollerdb.txt file in ports/sm64/controller. Seems like the default controller definition is wrong for this port.

    Like

  4. Oh and you definitely need Portmaster installed (and updated) for this to work even though the port itself doesn’t show up in Portmaster.

    Like

  5. Actually, turns out the whole problem burns down to the sm64.sh from the sm64update2022.zip being wrong for Portmaster on ArkOS. It looks for the Portmaster files in /roms(2)/ports/Portmaster but if you installed according to their instructions it should be in /roms(2)/ports/tools/Portmaster (notice the ‘tools’ folder). So the game never starts because it can’t find the controller definition.

    If you just use the start script from the build process instead, you never load the environment variable that should contain where the controller definition is and the game won’t start either.

    The game files with the updated instructions above work fine but you need to adjust the start script.

    Sorry for the SPAM. Hope it at least helps someone else with R36S on ArkOS 2.0 to avoid the same stuff that I went through.

    Like

Leave a comment