Author Topic: Guide: Reading/writing an N64 Controller Pak memory card (MemPak)  (Read 8690 times)

Offline Wannado

  • Sgt. Retrode
  • ***
  • Posts: 106
  • Karma: +13/-0

Starting with firmware version 0.18d beta 1, the Retrode supports reading from and writing to the N64 Controller Pak also known as Memory Pak or MemPak, a memory card that stores data in battery buffered SRAM.

Note that access to savegame data stored inside N64 game cartridges (SRAM/Flash/EEPROM) is still unsupported.

Hardware Requirements

To use this feature, you need:
- a Retrode 1 or 2
- a Plug-IN64 (with controller ports)
- an N64 Controller
- a MemPak, obviously.

If you're using a Retrode 1, you also need the 3.3V adapter that came with the old N64/GBx plugin (which had no shell and no controller ports).


1. Update the firmware, if necessary (version 0.18d beta 1 or later is required).
2. Disconnect the Retrode from the USB host (PC or whatever you're using), so that the Retrode is unpowered.
3. The N64 hardware is designed to work with 3.3 volts.
Retrode 1: Attach the 3.3V adapter to the Retrode's USB cable.
Retrode 2: Set the voltage switch (reachable through the SNES slot) to 3.3V.
4. Plug the Plug-IN64 into the SEGA slot of the Retrode.
5. If desired, plug an N64 game cartridge into the Plug-IN64.
6. Plug the MemPak into the N64 Controller.
7. Plug the N64 Controller with the MemPak into the left port of the Plug-IN64.
8. If desired, plug another N64 Controller (without MemPak) into the right port.
9. As the last step, connect the Retrode to the USB host (Retrode 1: using the cable with the 3.3V adapter on it).

Accessing MemPak Data

If everything is connected properly, the Retrode's filesystem will show a file named "Mempak1.mpk" with a size of 32 kiB. Programs can read and write the raw MemPak data through this file.
Of course, writing is allowed only if you set [sramReadonly] 0 in the configuration file "RETRODE.CFG".

I recommend that the first thing you do is to make a backup copy of "Mempak1.mpk" and put it somewhere safe. Then disconnect and reconnect (or just reset) the Retrode and make another copy of "Mempak1.mpk". If possible, compare both copies. If they do not match, retry this procedure.

This is necessary because there is a chance of read errors. I tuned the code's timing to eliminate read errors on my controllers and MemPaks, but I cannot tell if results will be as stable on yours.

Write errors are possible, too. If you find that a savegame doesn't work on the real N64, you may need to write it again. You might try to verify the written file by comparing copies as described above.

Use In Emulators

I strongly recommend that you never let an emulator read or write your MemPak directly, even if it could. (See the discussion of read/write errors above.)

I successfully loaded the MemPak file into Project 64 2.0 as well as an old version of Mupen64. Hints: Look for (input plugin) options called Controller Pak, Memory Pak or MemPak. Find the directory where the emulator stores savegames and look for files bearing the .mpk extension.

Note that Project 64 may grow the file (to 160 kiB, then 256 kiB).

I will update this section with more details when I have more time. Feel free to share your own findings in the meantime. :)

Offline MasterOfPuppets

  • Sgt. Retrode
  • ***
  • Posts: 110
  • Karma: +2/-0
Thanks for adding this! I will test and let you know how it works at a later date.

Offline Khaz

  • Baby Retrode
  • *
  • Posts: 13
  • Karma: +2/-0
So I just tried following your instructions to extract some Quest 64 saves off my memory pak and as far as I can tell it worked.  I extracted the rom and the memory pak both twice, I can run the rom in project64 and I did a file compare on the two memory pak files and there were no differences.

Problem is I can't seem to make Project64 read the memory pak file.  I've observed that when I run the rom it creates a "Quest 64.mpk" file in the Save subdirectory, so I assumed that I could just delete that and slip my memory pak file in its place.  When I try to load my game though, it says there's no Quest 64 data on the memory pak.

Here's my memory pak file:

It's entirely possible I just don't know how to use project64 but does anyone have any ideas?

Offline Khaz

  • Baby Retrode
  • *
  • Posts: 13
  • Karma: +2/-0
Solved my own problem, kinda...

I made it work.  By comparing my file and one generated by pj64, I found out that $0300 in both files is a table of the 16 "notes" on the pak.  I tried writing zeros to one of the $20 lines and it miraculously worked, but then I discovered something weird. It miraculously works anyways if I simply open the file with hex editor FrHed and then immediately save it unchanged. I took the before and after .mpk files and did a binary comparison (windows command line fc /b) and it tells me they're identical.

How can this POSSIBLY be? How can two identical files produce different results?  Probably a question for the guy who made Project64 rather than you, but my mind is kinda blown.

Anyways.  The data is all there and confirmed working, so that's good!

EDIT:  Also of note is that, when I try to just open the original .mpk file and "Save" it straight back it gives me a "Could not save the file" error, whereas if I "Save As" as new file and open THAT it works fine.

What's wrong with my fiiile?
« Last Edit: 07/Jul/2014 10:47:13 PM by Khaz »

Offline Khaz

  • Baby Retrode
  • *
  • Posts: 13
  • Karma: +2/-0
The original file was Read-Only.

I feel like the dumbest person ever.  Thanks for the firmware, it works perfectly