Author Topic: N64 Save Support (FW v0.23)  (Read 1258 times)

Offline skaman

  • Global Moderator
  • Junior Retrode
  • *****
  • Posts: 91
  • Karma: +32/-0
    • View Profile
N64 Save Support (FW v0.23)
« on: 03/Nov/2017 12:43:27 PM »
Announcing the public release of the N64 Save Support Firmware v0.23.  This firmware adds the ability to read and write N64 saves (SRAM, FlashRAM, and EEPROM).  In addition, the N64 cart heuristics code was modified and cart size recognition should be improved.

N64 EEPROM save support should work with the production N64 plugin.  The prototype N64/GBx plugin needs modification to add 2 connections - CLK and S_DAT.  More details here:  http://forum.retrode.org/index.php/topic,154.msg2625.html#msg2625

I want to give a HUGE THANKS to the BETA testers.  As a group, the testers tested dozens, if not hundreds, of carts during the firmware development.  This firmware would not have been possible without their testing and feedback.

A few notes on using the firmware:
1)  When reading N64 carts, please set the voltage to 3.3V. 
2)  Remember the [saveReadonly] setting in the Config file.  Set it to 0 if you plan to write to the save file.
3)  Writes to FlashRAM and EEPROM16K save files take longer.  DO NOT RESET OR UNPLUG THE RETRODE WHILE THE LED IS ON.
4)  SRAM (.SRA) and FlashRAM (.FLA) save files need to be saveswapped to be used in Project64 (PJ64) and other emulators.
     EEPROM (.EEP) save files do not need to be saveswapped.
5)  Save swap programs are available here:
     saturnu's ED64-Saveswap:  https://github.com/sanni/cartreader/tree/master/extras/saveswap
     ssokolow's portable (cross-platform) alternative:  https://github.com/ssokolow/saveswap
6)  There is NO SUPPORT for Reproduction N64 carts.  Most reproduction carts will have problems either with cart recognition or accessing saves.  YMMV.

Here's the summary of the firmware changes:
Code: [Select]
v0.23 (2017-11-03)
- Changes by skaman:
-- N64 Saves!
-- Added N64 SRAM save support.
-- N64 SRAM carts should be identified by Cart ID and
   display the .SRA file.  The .SRA file can be read
   and written.
-- Added proper Dezaemon 3D 768Kbit SRAM support.
-- Added identification of the Hoshi no Kirby 64 (J)
   savetype based on the ROM version.  v1.0 & v1.1 are
   SRAM,  1.2 & v1.3 are EEPROM4K.
-- Added N64 FlashRAM save support.
-- N64 FlashRAM carts should be identified by Cart ID
   and display the .FLA file.  The .FLA file can be read
   and written.
-- WARNING:  FlashRAM writes take time to complete as
   the chip must first be erased before writing to it.
   ** WHEN SAVING AN UPDATED .FLA FILE, DO NOT RESET **
   **** OR UNPLUG THE RETRODE WHILE THE LED IS ON! ****
-- Added N64 EEPROM save support.
-- N64 EEPROM carts should be identified by Cart ID and
   display the .EEP file.  The .EEP file can be read
   and written.
-- WARNING:  EEPROM16K writes take time to complete.
   ** WHEN SAVING AN UPDATED .EEP FILE, DO NOT RESET **
   **** OR UNPLUG THE RETRODE WHILE THE LED IS ON! ****
-- Added reading of the N64 Gameshark.  When a working
   Gameshark is attached, the Gameshark.z64 ROM will be
   displayed.
-- Fixed the N64 heuristics code to recognize 20MB and
   40MB games.  These were previously overlooked by the
   code.  Fixes Donald Duck Goin' Quackers, Paper Mario,
   and Ogre Battle 64.
-- Fixed the N64 heuristics code for underdumps of Body
   Harvest and Paper Mario (E).  Modified the addresses
   checked to determine the cart size.
-- Modified the Config file to change the save file
   write protection setting from "[sramReadonly]" to
   "[saveReadonly]".  The change was made since the
   same setting is applied to all save types including
   SRAM, FlashRAM, and Controller Pak save files.
-- Modified the Config file's default N64 ROM extension
   to ".z64".  This is the correct extension for the
   native big endian format output by the Retrode.
-- WARNING:  THERE IS NO SUPPORT FOR REPRODUCTION N64
   CARTS.  MOST REPRODUCTION CARTS WILL HAVE CART
   RECOGNITION PROBLEMS AND/OR SAVE PROBLEMS.  YMMV.

The v0.23 firmware is available here:  http://www.mediafire.com/file/7gxgtbl0co7m0b8/Retrode-v0.23.zip
« Last Edit: 06/Nov/2017 01:50:49 AM by skaman »

Offline BadHombre

  • Baby Retrode
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #1 on: 03/Nov/2017 04:24:31 PM »
*buys Retrode immediately*

You guys are incredible... What a feat! Thank you for all of your hard work and commitment to this project.
« Last Edit: 04/Nov/2017 06:03:12 AM by BadHombre »

Offline Pat1986

  • Baby Retrode
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #2 on: 03/Nov/2017 04:31:35 PM »
Great release. Was fun testing all my cartridges. Now, let's go on to Master System!  ;D

Offline skaman

  • Global Moderator
  • Junior Retrode
  • *****
  • Posts: 91
  • Karma: +32/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #3 on: 04/Nov/2017 01:00:45 AM »
Yes, SEGA SMS/GG BETA firmware should be distributed to the BETA test group later today.

UPDATE:  There will be a delay in distributing the SMS/GG BETA.  I picked up a GG Codemasters cart (Micro Machines) that doesn't read properly with the Codemasters code that I implemented for GG Ernie Els Golf.  More testing to do...

UPDATE:  Looks like some Codemasters carts need the CLOCK for the mapper to work properly.  GG Ernie Els dumps properly without the CLOCK but others may not.  Unfortunately, the GG CLOCK pin is not connected on the production SMS adapter.
« Last Edit: 05/Nov/2017 10:32:17 AM by skaman »

Offline RazorX2014

  • Junior Retrode
  • **
  • Posts: 89
  • Karma: +1/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #4 on: 05/Nov/2017 05:53:14 PM »
Yes, SEGA SMS/GG BETA firmware should be distributed to the BETA test group later today.

UPDATE:  There will be a delay in distributing the SMS/GG BETA.  I picked up a GG Codemasters cart (Micro Machines) that doesn't read properly with the Codemasters code that I implemented for GG Ernie Els Golf.  More testing to do...

UPDATE:  Looks like some Codemasters carts need the CLOCK for the mapper to work properly.  GG Ernie Els dumps properly without the CLOCK but others may not.  Unfortunately, the GG CLOCK pin is not connected on the production SMS adapter.
how easy can this be added, would it just be a single wire?

Offline skaman

  • Global Moderator
  • Junior Retrode
  • *****
  • Posts: 91
  • Karma: +32/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #5 on: 05/Nov/2017 06:46:19 PM »
Yes, single wire from CLOCK pin to the cart edge connector.

I was going to do the mod anyway since the CLOCK is needed for the GG EEPROM save carts.  I didn't know about it also being needed for some Codemasters carts.

The SMS connector also lacks the CLOCK connection.  I'm waiting on a SMS Codemasters cart to check before I add that connection.

I'll document everything if I get it working.  I'm going to release the SMS/GG BETA as is since it isn't my code that is the problem.  If I can get the CLOCK mod working then I'll release an updated BETA with any code changes.

Offline RazorX2014

  • Junior Retrode
  • **
  • Posts: 89
  • Karma: +1/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #6 on: 05/Nov/2017 07:18:41 PM »
Yes, single wire from CLOCK pin to the cart edge connector.

I was going to do the mod anyway since the CLOCK is needed for the GG EEPROM save carts.  I didn't know about it also being needed for some Codemasters carts.

The SMS connector also lacks the CLOCK connection.  I'm waiting on a SMS Codemasters cart to check before I add that connection.

I'll document everything if I get it working.  I'm going to release the SMS/GG BETA as is since it isn't my code that is the problem.  If I can get the CLOCK mod working then I'll release an updated BETA with any code changes.

thanks, i have the official sms plugin with an added game gear connector so if there is a mod i can do to improve it more thats even better.

Offline ssokolow

  • Baby Retrode
  • *
  • Posts: 24
  • Karma: +12/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #7 on: 06/Nov/2017 12:57:44 AM »
It might be better to say that mine is a "portable" or "cross-platform" alternative, since there's nothing that should prevent it from working on Windows.

(ie. If it doesn't work on Windows, it's a bug that will be found and squashed when I have time to get back to working on it and set up AppVeyor CI testing.)

In fact, when I have time to get back to work on it, the partially written optional GUI was envisioned specifically to provide an alternative to ED64-Saveswap for people with over-sensitive virus scanners that hate AutoIt scripts.

Offline skaman

  • Global Moderator
  • Junior Retrode
  • *****
  • Posts: 91
  • Karma: +32/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #8 on: 06/Nov/2017 01:54:03 AM »
It might be better to say that mine is a "portable" or "cross-platform" alternative, since there's nothing that should prevent it from working on Windows.

(ie. If it doesn't work on Windows, it's a bug that will be found and squashed when I have time to get back to working on it and set up AppVeyor CI testing.)

In fact, when I have time to get back to work on it, the partially written optional GUI was envisioned specifically to provide an alternative to ED64-Saveswap for people with over-sensitive virus scanners that hate AutoIt scripts.

Done. :)

Linux users looking to use their saves with Mupen 64 using the libretro core should read these posts:
http://forum.retrode.org/index.php/topic,154.msg2692.html#msg2692
http://forum.retrode.org/index.php/topic,154.msg2695.html#msg2695

Offline Eureka

  • Baby Retrode
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #9 on: 08/Nov/2017 09:25:54 AM »
Thank you SO MUCH for figuring this out! My N64 plugin finally works and I can archive my cart saves to PC!

I do have to report that, after testing all the carts I own, Retrode did not detect a save file on my Majora's Mask cart.

EDIT: You said .EEP files didn't need to be altered in any way to work with emulators; this doesn't appear to be the case. Project64 couldn't read any of them.
« Last Edit: 08/Nov/2017 10:17:03 AM by Eureka »

Offline Pat1986

  • Baby Retrode
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #10 on: 08/Nov/2017 10:37:45 AM »
Maybe the save folder path is wrong?

Offline skaman

  • Global Moderator
  • Junior Retrode
  • *****
  • Posts: 91
  • Karma: +32/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #11 on: 08/Nov/2017 10:38:35 AM »
Thank you SO MUCH for figuring this out! My N64 plugin finally works and I can archive my cart saves to PC!

I do have to report that, after testing all the carts I own, Retrode did not detect a save file on my Majora's Mask cart.

EDIT: You said .EEP files didn't need to be altered in any way to work with emulators; this doesn't appear to be the case. Project64 couldn't read any of them.

Which region/version of Majora's Mask is the cart?  Try setting [saveReadonly] to 1 then read the Majora's Mask cart.

Do the .EEP files contain data or all FFs?  Are you using the early N64/GBx plugin or the later N64 plugin?

Offline Eureka

  • Baby Retrode
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #12 on: 08/Nov/2017 09:34:03 PM »
Thank you SO MUCH for figuring this out! My N64 plugin finally works and I can archive my cart saves to PC!

I do have to report that, after testing all the carts I own, Retrode did not detect a save file on my Majora's Mask cart.

EDIT: You said .EEP files didn't need to be altered in any way to work with emulators; this doesn't appear to be the case. Project64 couldn't read any of them.

Which region/version of Majora's Mask is the cart?  Try setting [saveReadonly] to 1 then read the Majora's Mask cart.

Do the .EEP files contain data or all FFs?  Are you using the early N64/GBx plugin or the later N64 plugin?
The Majora cart is the original NTSC release with the lenticular label. "Savereadonly" is already set to 1. I'm using Retrode 2 and the plugin built specifically for N64 carts (the one that says "Plug-In 64" on the label). I don't understand the "files" question.

I put the saves in the "Save" folder of Project64; it's where it gets them from. But I get a "Failed to open EEPROM" message when I try to use them.

You mentioned something about setting the voltage to 3.3V; that is something I forgot to do the first time. But when I dumped the saves again on the correct setting, I got the same results. The Majora cart did finally detect a save, though.

Of course it's an .FLA which means I can't test it immediately. That save-altering program you linked to is all Greek to me -- I have little experience with command line programs so I don't know how to use it. I do know that the .EEP files don't work.

Offline skaman

  • Global Moderator
  • Junior Retrode
  • *****
  • Posts: 91
  • Karma: +32/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #13 on: 08/Nov/2017 09:48:52 PM »
Yes, single wire from CLOCK pin to the cart edge connector.

I was going to do the mod anyway since the CLOCK is needed for the GG EEPROM save carts.  I didn't know about it also being needed for some Codemasters carts.

The SMS connector also lacks the CLOCK connection.  I'm waiting on a SMS Codemasters cart to check before I add that connection.

I'll document everything if I get it working.  I'm going to release the SMS/GG BETA as is since it isn't my code that is the problem.  If I can get the CLOCK mod working then I'll release an updated BETA with any code changes.

I opened up a GG EEPROM cart (World Series Baseball) and it doesn't use the CLOCK pin.  The SK pin for the EEPROM is connected to the SEGA 315-5557 chip.  The !RESET pin from the cart edge is also connected to the 315-5557 chip.  I'll have to connect my logic analyzer to the chips and see what is going on.

I haven't opened up the problem GG Codemasters cart as I've read that they are difficult to open without damaging them.  I've seen scans of the PCB and the CLOCK pin is connected.  I might build a passthru interface to plug into the GG so that I don't have to open the carts to capture the data.

More testing to do...

Offline ssokolow

  • Baby Retrode
  • *
  • Posts: 24
  • Karma: +12/-0
    • View Profile
Re: N64 Save Support (FW v0.23)
« Reply #14 on: 13/Nov/2017 01:05:53 AM »
Thank you SO MUCH for figuring this out! My N64 plugin finally works and I can archive my cart saves to PC!

I do have to report that, after testing all the carts I own, Retrode did not detect a save file on my Majora's Mask cart.

EDIT: You said .EEP files didn't need to be altered in any way to work with emulators; this doesn't appear to be the case. Project64 couldn't read any of them.

Which region/version of Majora's Mask is the cart?  Try setting [saveReadonly] to 1 then read the Majora's Mask cart.

Do the .EEP files contain data or all FFs?  Are you using the early N64/GBx plugin or the later N64 plugin?
The Majora cart is the original NTSC release with the lenticular label. "Savereadonly" is already set to 1. I'm using Retrode 2 and the plugin built specifically for N64 carts (the one that says "Plug-In 64" on the label). I don't understand the "files" question.

I put the saves in the "Save" folder of Project64; it's where it gets them from. But I get a "Failed to open EEPROM" message when I try to use them.

You mentioned something about setting the voltage to 3.3V; that is something I forgot to do the first time. But when I dumped the saves again on the correct setting, I got the same results. The Majora cart did finally detect a save, though.

Of course it's an .FLA which means I can't test it immediately. That save-altering program you linked to is all Greek to me -- I have little experience with command line programs so I don't know how to use it. I do know that the .EEP files don't work.

I've got a gold, lenticular NTSC Majora's Mask, so I took the liberty of testing it with Retrode firmware v0.23, my Plug-in64 adapter, the 3.3v setting, and the "[saveReadonly] 1" that I just leave on all the time.

I play whatever I can with Mupen64Plus, so I only have Project64 2.2.0.3 installed in Wine right now, but my and my brother's old save files appeared and loaded just fine when I did the following:

1. Copy "ZeldaMajora'sMask.NZSE.fla" from the Retrode to /home/ssokolow/.wine/drive_c/Program Files/Project64 2.2/Save
2. Rename the save file to "ZELDA MAJORA'S MASK.fla"
3. Unset the read-only attribute that the Retrode puts on it
4. Run "saveswap.py ZELDA MAJORA'S MASK.fla" in the terminal

(Mine doesn't have a GUI yet, but ED64-Saveswap does if you want something simpler. As for the name to rename it to, create a new save in your game and see what filename appears in Project64's Save folder.)
« Last Edit: 13/Nov/2017 01:09:34 AM by ssokolow »