Interfacing to Super Mario 64

Introduction

Even to this day Super Mario 64 for the N64 has remained popular and there has been a great number of advancements in Gameshark codes and utilities to change levels and objects. This page deals with new with ways of interfacing to SM64 in an electronic way such as to output HUD values to an electronic display or to use sensors to change values in the game.

You can email me at james.boshikoopa@gmail.com

To return to the main Interfacing page please click here.

New: Update: Use Amiibo with Super Mario 64 (27/03/18)

Collect a red coin and get sweets in Super Mario 64 (16/11/16)

Use Amiibo with Super Mario 64 (14/06/16)

Super Mario 64 Real HUD

Please go to Super Mario 64 Real HUD

Use Amiibo with Super Mario 64

Introduction

The classic N64 game Super Mario 64 used standard controller input but by using the emulated version on Project64 and a program I wrote, support for Amiibo can be added. It is based on my real electronic HUD project I did for SM64 but rather than output HUD values from SM64 to a number of displays it makes use of Amiibo to input (modify) SM64. If you place Silver Mario on the NFC reader Mario becomes Metal Mario and Yoshi increases Mario's lives.

It would be a good idea to read up on my SM64 HUD to help understand how this project works:

https://sites.google.com/site/jamesskingdom/Home/electronics-by-james-s/interfacing/sm64-real-hud

For information about the NFC reader please see:

https://sites.google.com/site/jamesskingdom/Home/electronics-by-james-s/interfacing#TOC-ACR122U-NFC-reader

The project can be extended to support other Amiibo and do more advanced things that just simple changes.

You can view a video I did about the project:

Software

The Visual Studio project is attached to the bottom of this page and is called 'Amiibo_to_process_writer.zip' It was created using Visual Studio 2010 and has two main files which are 'Amiibo_to_process_writer.cpp' and 'Form1.h'. Note that both files have commented out lines of code to show how the project has changed or to disable certain things.

When the program starts up an init() function is called which looks for an NFC reader and reports if one was found. The function also looks for Project64 running Super Mario 64. If all is good a timer checks every second for an NFC character on the NFC reader by calling the connectToReader() function. If it finds an Amiibo it reads its Unique identifier (UID) and compares it with the values in userInformation so that it can perform an action by writing to Project64's memory. You may find terms such as 'user' that I've used in my code a bit odd but that's because the program is based on another of mine which was an NFC reader test that detected users associated with smart cards.

Update: I now know that the UID read in by this project is unique for every Amiibo and therefore does not identify the type of Amiibo (e.g. Silver Mario); the ID for the Amiibo type is stored in pages 21-22. This means you will need to obtain the UID from your Amiibo figures and put them into userInformation. Or feel free to adapt the code to read the actual Amiibo UID to determine the character type.

Silver Mario enables Metal Mario which requires that Mario's cap modifier and timer values are changed. Yarn Yoshi however increases Mario's lives so that the current lives value is read in, increased by one and put back. It would not be too difficult to write other values to Project64 based on what Amiibo are used.

Testing

Plug in your NFC reader (I'm using the ACR122U reader), open Project64 and load up the Super Mario 64 ROM. Then, in Visual Studio, build and run the project; you should get a message saying that the reader has been detected. In the program window select the PAL/NTSC option as appropriate for your ROM. When you place Silver Mario or Yarn Yoshi on the NFC reader it should react and should get the before mentioned response. Of course you can change the values in userInformation to support other Amiibo but you will need a way to get the UID (I used ACR122UTool which came with the NFC reader).

Collect a red coin and get sweets in Super Mario 64

Introduction

It's one thing to play for virtual rewards but how about getting real sweets every time you collect a red coin in Super Mario 64? Well now you can through the use of the Shindou version of SM64, a cheat code and a simple circuit that acts as the interface between the N64 and a sweet dispenser. Yes, unlike my previous SM64 interfacing projects which used an emulator running on a PC this project works on a real N64.

In the Shindou edition of SM64 the rumble goes off when Mario performs certain actions such as when he ground pounds or hits a wall, but by extending the length of the rumble when Mario collects a red coin we can use a circuit to detect the long rumble and thus the action. Here is the code:

8125049E 0050

The code extends the red coin collection rumble to about 1.4 seconds, which is a bit long but can be shortened by changing the code and making appropriate changes to the circuit. You'll need a cheat code cartridge of which I used an Equalizer which oddly displays its menu in black and white when used on a Japanese N64 so that may have something to do with the Equalizer being UK made.

Circuit

This is the circuit:

The way we measure the length of the rumble is by ANDing a clock pulse generated by one half of the 556 (IC1) at a frequency of ~3Hz with the incoming rumble signal; the AND is performed by two NAND gates (IC3). This has the effect of creating a clock pulse that lasts the length of the rumble and coupled with the decade counter (IC2), the length of the rumble pulse is counted. If enough pulses are counted that IC2's output 4 (O4) turns on, the signal will be inverted by a NAND gate (IC3) and trigger a monostable as part of the other half of the 556 (IC1). The monostable output (OUT B) controls the sweet dispenser motor driver and will turn it on for a time controlled by PR1 (roughly controlling the number of sweets given out) with a maximum of around 1 second. To filter out short or repetitive quick rumbles the 4017 (IC2) is reset whenever the rumble goes low via a NAND gate (IC3) wired as an inverter.

Here is a photo of the soldered version of the circuit:

To do this project you will need to take apart a rumble pak and solder connections to the rumble latch output and ground. In my rumble pak a 7474 was used and it was a matter of finding the motor driver (a transistor) and seeing how the latch output was connected to the base resistor of the motor driver. An oscilloscope is a great help as you'll be able to see the digital pulses that are at the output of the rumble latch. I ran wires from the rumble pak but it would be better to add some kind of isolation between the controller and the sensing circuit.

As for the sweet dispenser, I bought one that has a capacitive sensor but disconnected the touch sensor from the motor driver. I soldered 2 wires, one to the motor drive base resistor and the other to ground. The sweet dispenser uses 3 AAA batteries and these power our circuit (above) with only a common ground connection to the rumble pak.

Testing

When everything is connected and has been checked over first turn on your N64 with the cheat code cartridge and the Shindou edition of SM64, add the code already mentioned and start the game. Power up the sweet dispenser; note that the motor may activate immediately but should go off quickly. In the game, go to a level, collect a red coin and see that the sweet dispenser gives out sweets. If it does not, check over your connections, check the batteries in the sweet dispenser and rumble pak work and if they are all good but still no sweets are given out, try adjusting PR1.

It should be mentioned that if you turn the sweet dispenser on before powering on the N64 the sweet dispenser will continually run but that can easily be fixed by putting a pull-down resistor of 10K from the rumble pak latch input to ground.

To see the project in action why not check out my video:

All content of this and related pages is copyright (c) James S. 2016-2022