Guide: Super Mario 64 Port on RG351P

Last updated: 29DEC2020 (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. 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 RG351P 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.

Table of Contents:
Build the Super Mario 64 port
Remap the controls
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. This process also supports the EU and JP versions of the ROM, but are untested at this time. If possible, 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
baserom.eu.z64 for European version of Super Mario 64
baserom.jp.z64 for Japan 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.

Notes

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

If you want to add boxart and videos to your menu, download and unzip this file.

In ArkOS, place the sm64-image.png file in the ports/images folder, and the sm64-video.mp4 file in the ports/videos folder. Note that if you change the name of your .sh file from sm64.sh to something else, you need to change the image and video file names as well, so that they match.

If you are using 351ELEC, you will need to alter the gamelist.xml file in your ports folder, using a text editor. Add the following entry (thanks to seajay for the code) to add box art and change the displayed name to “Super Mario 64”:

<game>
    <path>./sm64.sh</path>
    <name>Super Mario 64</name>
    <desc>A native port of Super Mario 64, built specifically for the RG351P.</desc>
    <image>./images/sm64-image.png</image>
    <video>./videos/sm64-video.mp4</video>
    <thumbnail>./images/sm64-image.png</thumbnail>
    <rating>1.0</rating>
    <releasedate>19960624T000000</releasedate>
    <genre>Platform</genre>
    <developer>Nintendo</developer>
    <publisher>Nintendo</publisher>
</game>

Finally, place the sm64-image.png file in the ports/images folder, and the sm64-video.mp4 file in the ports/videos folder.


Changelog

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

28DEC2020
– published guide

38 thoughts on “Guide: Super Mario 64 Port on RG351P

    1. Seems there is a Permissions issue with the Jupyter notebook–he is aware and is looking into it (per the pinned comment on his youTube video).

      Like

  1. I just built it and got it installed on my device but for some reason the game won’t work. Its throwing some kind of an error that says “Software Failure: Check log files for more info.” I really don’t know what the problem is, I followed the tutorial step for step.

    Like

    1. What version of ArkOS are you using? To echo Gingerone, could be you need to redump the ROM (or otherwise source a different one), but I also wonder if this maybe only works with ArkOS 1.5 so far.

      Like

  2. This is somehow very specific and mostly the game is running perfect on the device. Thanks a lot for the guide.
    Not sure if this is somehow related to the port…but I think there are small problems in the game… e.g. in world “Whomp’s Fortress” –> “Blast Away the Wall” the star is missing and not revealed when Mario is crashing into the wall.

    Do you know about more problems like this?

    Like

  3. For folks having issues with the preview image and video, I figured it out! There wasn’t anything in the gamelist file pointing to it. Just copied the formatting for some of the other games and made this for sm64, which is working beautifully.

    Make sure your ../roms/ports/gamelist.xml file has this entry:

    ./sm64.sh
    sm64
    A native port of Super Mario 64, built specifically for the RG351P.
    ./images/sm64-image.png
    ./videos/sm64-video.mp4
    ./images/sm64-image.png
    1.0
    19960624T000000
    Nintendo
    Nintendo

    Like

    1. Ah shoot – it stripped the formatting and everything, and I can’t edit the comment. The relevant text to paste in is here though!

      <game>
      <path>./sm64.sh</path>
      <name>sm64</name>
      <desc>A native port of Super Mario 64, built specifically for the RG351P.</desc>
      <image>./images/sm64-image.png</image>
      <video>./videos/sm64-video.mp4</video>
      <thumbnail>./images/sm64-image.png</thumbnail>
      <rating>1.0</rating>
      <releasedate>19960624T000000</releasedate>
      <genre>Platform</genre>
      <developer>Nintendo</developer>
      <publisher>Nintendo</publisher>
      </game>

      view raw
      sm64example.xml
      hosted with ❤ by GitHub

      Liked by 1 person

  4. The puppycam patch seems to be really wonky on 351Elec. The sensitivity is completely off (might be tuned through settings), and I did not find a way to reset the camera. I’m going to rebuild a version without this patch.

    Like

  5. does anyone else have a problem with the controls not working at all? I’ve recompiled this thing like 4 times and each time it will boot, but controls don’t work so I can’t get past the title screen. Was working just fine on ArkOS, but newest 351 elec is giving me problems as of now.

    Like

  6. Hi Guys. Thanks this is awsome. At least, I think it is. First rom i tried, didn work, wrong hash. Second worked and everything worked flawless.
    So I copied the folder an the sh file to the roms/ports Folder of 351Elec.
    But it did not show up in the ports section. Since there was no gameslist.xml in the ports folder i made an empty one, copied the conted for the video and image into it and made a videos and a images folder and copied the image and the video into them. But still, in the ports section all the other (empty) ports appeyr, but not SM64. Does anyone have an idea what could be wrong?

    Liked by 1 person

  7. o man, come on… I just did everything from scratch again. new file, US Version again, correct sha1 Checksum, did every step again without errors. And still the same. Sothing appears in the ports section of Emulation Station. 😦

    Liked by 1 person

    1. “ScummVM, Ports, and MS-DOS are hidden by default in the collections menu. To enable press Start at the main menu screen. Scroll to Game Collection Settings, and press A. Select Systems Displayed, and press A. Scroll to the system you wish to enable and press A. Press B repeatedly to back out to the main menu and EmulationStation will restart automatically.” From the 351elec Wiki

      Liked by 1 person

  8. Hi b1ttercup,

    thank you. Yes I knew that, I allready turned the porst section on to see it.
    I found the problem, as often it was sitting in front of the pc. I wasn´t aware I was still on 351Elec 1.0. After reflashing the OS now the 1.08. version, SM64 works.

    So Russ, thanks this port is awesome, I´ve never seen SM64 this great.

    Liked by 1 person

  9. The content you provide is so awesome. Can’t thank you enough! Really hope to see some more amazing port guides soon. Love your channel and web content on Retro handhelds, easily the best out there in my opinion!

    Like

  10. I keep getting this error. Really new to this so it could be something small I’m missing!

    Makefile:839: recipe for target ‘build/us_pc/src/engine/math_util.o’ failed
    make: *** [build/us_pc/src/engine/math_util.o] Error 1
    make: *** Waiting for unfinished jobs….

    Like

  11. Damn it… this was working for me perfectly for hours. Over the past week I got 70 stars and went to fight the final Bowser, beat him, and then reset the RG351M once the credits got to the “The End” screen. Now it doesn’t work! When I start the game the audio and controls seem to be working flawlessly, like I can load the game and hear everything happening, but there’s no video. Just a black screen and a blinking yellow underscore in the top left side of the screen. In fact, I just check my Doom port (brutal doom) which was working fine and it’s doing the same thing. Emulated games seem to work fine.

    Anyone else experience this?

    Like

  12. Hi, first of all, great port, but there are some problems with the puppycam patch which makes the game barely playable:

    Most of the time, I can’t move the camera to the left and directly to the right. I need to move it up or down between left and right, otherwise it won’t move. The same goes for up to down. I need to go either left or right between those.
    There is no problem if I keep rotating the joystick. But if I release it to center position, I must do this weird manipulation to unlock the camera movement.

    Does anyone have the same problem?

    Like

  13. So regarding the video not playing in the menu. You have to follow the same instructions as 351 Elec. You need to edit the gamelist.xml file to point to the actual video file.

    Like

  14. Hi all,

    Got this running perfectly however, I can’t seem to make Mario double or triple jump? When I press the mapped button as mario lands, nothing happens… any one else experience this problem with the RG351M ?

    Thanks!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s