Retrode Community Forum

General Category => General Discussion => Topic started by: Zerker on 01/Jun/2013 12:00:40 PM

Title: Progress on N64/GBA save support?
Post by: Zerker on 01/Jun/2013 12:00:40 PM
Hello. I was just wondering if there has been any support for EEPROM/FRAM/whatever else for N64 and GBA games? It may not be quite as trivial as the existing save ram support, but a quick Google search should be able to pull up the specs for any chip in question. For example, "Game & Watch Gallery 4" has an MB85R256:
http://www.datasheetcatalog.org/datasheets2/15/157103_1.pdf

Which doesn't look too difficult for the Retrode to support. Read-only support would be fine as a starting point, as there are quite a few games I'd like to be able to resume my on-cart progress.

If you are a bit too busy, I also have some embedded development experience and would be willing to help out here.
Title: Re: Progress on N64/GBA save support?
Post by: neora on 09/Jun/2013 09:04:18 PM
This is the only reason I haven't got myself a retrode yet.
The ability to dump ROMs or play carts on an emulator isn't something I need, but the retrodes ability to backup my saves is invaluable.

If N64 and GB(A) save backup support was added it would be an instant purchase for me, I really hope this does happen.
Title: Re: Progress on N64/GBA save support?
Post by: Matthias_H on 10/Jun/2013 06:07:21 AM
The technology is probably manageable, but autodetection isn't. For any game, you'd have to look up the technology (Memory Pak, SRAM, Flash, EEPROM) as well as the memory size by hand, and tell them to the Retrode prior to accessing the save data...
Title: Re: Progress on N64/GBA save support?
Post by: neora on 11/Jun/2013 12:36:28 PM
I'd be happy even without auto-detection, you can't have everything.

Manually selecting save types and sizes is a small price to pay to be able to backup and restore N64 and GB saves.
Title: Re: Progress on N64/GBA save support?
Post by: Zerker on 11/Jun/2013 10:09:49 PM
I found some information that may be helpful for the autodetection:

http://nocash.emubase.de/gbatek.htm#gbacartbackupids

Apparently backup ram type is often encoded into the ROM as a String, which the Retrode should be able to locate. That said, scanning the ROM for the string may increase detection time considerably...
Title: Re: Progress on N64/GBA save support?
Post by: BrentNewland on 27/Jan/2014 05:32:03 AM
The technology is probably manageable, but autodetection isn't. For any game, you'd have to look up the technology (Memory Pak, SRAM, Flash, EEPROM) as well as the memory size by hand, and tell them to the Retrode prior to accessing the save data...

Sorry to bump an old topic, but couldn't you create a database with this information manually and feed the necessary information to the Retrode? I'm assuming the game itself is recognizable, so you could have the Retrode simply load the ROM as usual, and if the (to be made) Retrode software is running, it can look up the game, send the info to the Retrode, which will then load up the save info and present it alongside the ROM.
Title: Re: Progress on N64/GBA save support?
Post by: Matthias_H on 27/Jan/2014 07:08:34 AM
Sorry to bump an old topic, but couldn't you create a database with this information manually

Someone surely could. I couldn't, since the Retrode project is by far not lucrative enough to become my main occupation.
Title: Re: Progress on N64/GBA save support?
Post by: BrentNewland on 27/Jan/2014 12:22:42 PM
I'm sure a database could be community made.

You said that to do these saves, you would have to send the Retrode information such as "Memory Pak, SRAM, Flash, EEPROM, and  memory size". If the Retrode firmware had some way to receive this information from the PC, someone could write a program (heck, I could do it, even in an odd language like PHP) to read the ROM, look it up in such a database, and automatically send the necessary information to the Retrode. It could even run as a Service or Daemon.

Some of this information is available. This site (http://www.advanscene.com/) has a list of games with the save type, save size, and game CRC for several consoles (specifically the GB based handhelds).

For the N64, this site (http://www.elitendo.com/n64/usa_boot_save_list.html) has a list of N64 games and the save method and size used by each game. And the N64 is known to use the following save types: "EEPROM (512 bytes), 4X EEPROM (2Kbytes), SRAM (32Kbytes), FlashRAM (128Kbytes), and the Controller Pak (256Kbytes)".

Any games that are missed can be researched and submitted by users or volunteers.

The same tool could be used for NES cartridge. As suggested in this thread (http://forum.retrode.org/index.php/topic,66.30.html), Retrode could read the first PRG ROM bank and list it as a file in the Retrode drive interface. The hypothetical software does a CRC check on the 16KB PRG file, looks it up in the database, and if found, sends the necessary information to the Retrode for it to read the cartridge properly. Databases containing info on NES cartridges is available here (http://bootgod.dyndns.org:7777/) and here (http://tuxnes.sourceforge.net/nesmapper.txt), the time consuming part would be creating the CRC/checksum/hash list to match to each game. Users would have to be presented with a list of known games to choose from and be given the option to submit the 16KB PRG CRC, and the option to choose their own memory controller and chip size for games not on any list.




I believe the biggest technical difficulty was limited storage in the Retrode for information like this, having it done through the PC would eliminate that problem.

What I would need to create such a hypothetical program is config options for "save type" (flash, eeprom, sram, etc.) and "save size". If those are available, creating the software to do everything else is at least possible.

And for implementing NES support, you would need to expand the "forceMapper"  to cover the different memory mappers used in the NES, the "forceSize" would probably need to be like the GB/GBC (pages, since all NES chips should be a multiple of 16KB), and the firmware would have to make available to the PC the 16KB PRG file (for checksum purposes). On top of programming the firmware to support the different MMC's/mappers, but there are resources online (particularly those geared towards Kazzo and USB CopyNES, and the NESDev wiki) that should help with that.

Besides all that, there would need to be some way to let the Retrode know to reload the config file after it's been updated and reprocess the cartridge. Like writing a blank file named "reload" to the Retrode drive.



If you could provide those options (and if I had a Retrode with the necessary adapters) I don't think I would have any problem creating the software necessary to automatically give Retrode the necessary information to access these cartridges and saves.


/edit Wouldn't even need a Retrode, almost all of the program I could write blind, only part a Retrode would be needed for is to verify the checksums the hypothetical program creates are the same as those from other sources, and there's at least one user (http://forum.retrode.org/index.php/topic,66.msg520.html#msg520) who knows PHP, has a Retrode, and has expressed interest in exactly this.
Title: Re: Progress on N64/GBA save support?
Post by: Matthias_H on 27/Jan/2014 03:26:29 PM
We've attempted a few things along the lines of community databases, and experience shows that we're far below the critical mass that it takes for such efforts to take off.

That said, if you want to give it a try, why not? I'd suggest using the four-character game code, which is readily available in GBA and N64 headers and would save us from having to compute a checksum across the entire ROM.

At the end of the day, _someone_ must implement savegame access on the device end, and as sad as it makes me, I simply don't have the time to do any development in the foreseeable future.
Title: Re: Progress on N64/GBA save support?
Post by: MasterOfPuppets on 06/Sep/2014 06:51:53 PM
May this help in adding N64 save support? He has an account on ASSEMbler.

http://themanbehindcurtain.blogspot.de/2013/08/n64-sramflashram-results.html
http://www.assemblergames.com/forums/showthread.php?53492-reading-writing-save-RAM-on-Nintendo-64&p=773179&viewfull=1#post773179

Title: Re: Progress on N64/GBA save support?
Post by: justin89 on 06/Nov/2014 10:08:27 PM
I'd like to see save support added for the N64 and GBA plugins.

As mentioned above, it's possible to search the GBA ROM for the codes that specify save type. Some games have two or three of these codes, so that isn't perfect. Here's another site (http://zork.net/~st/jottings/GBA_saves.html) on the header info that also includes links to MAME (http://mamedev.org/source/hash/gba.xml.html) and VBA-M (http://sourceforge.net/p/vbam/code/HEAD/tree/trunk/src/vba-over.ini) databases with GBA cartridge ID and save type.

N64 uses four cartridge save types: SRAM (32kb, possibly some with 64kb or 128kb?), EEPROM (4kb or 16kb), and FRAM (128kb).
I don't think the N64 ROM specifies the save type (does it?), so use a lookup table of game ID and cartridge save type, with an option for save type in case the cartridge uses a different save or isn't in the table. I found several sites that listed product IDs and save types of N64 games and made a largely complete table of US games and their IDs and save types. I attached that table to this post.
Title: Re: Progress on N64/GBA save support?
Post by: justin89 on 07/Nov/2014 09:01:30 PM
GBA uses several save types: SRAM (seems to be 64kb for most, though I have several 32kb SRAM saves too), EEPROM-4kb, EEPROM-64kb, FLASHRAM-512kb, and FLASHRAM-1M.

I went through the MAME database and collected the game IDs and save types. I don't think the list is completely accurate, because I noticed some errors and games with missing save types and corrected them. I attached the table I made. Besides that, an option to manually select the save type is helpful in case of a different save type or missing ID.
Title: Re: Progress on N64/GBA save support?
Post by: Matthias_H on 10/Nov/2014 04:37:48 AM
Oh, we all would love to see that implemented. Are you a programmer?
Title: Re: Progress on N64/GBA save support?
Post by: justin89 on 13/Nov/2014 02:53:36 AM
Not full-time, though I can program. I'd be happy to write the N64 and GBA save functions myself if that's convenient. As long as I can compile and test dump functions quickly I think I can figure out how to read and write the saves. Only problem I see is I don't have a full library of games to check if I made functions for all the mappings.

A while ago I did something I think is similar to this. I played around with the Kazzo NES programmer, which is like a Retrode for NES games, and was able to modify a save function to dump saves for several unsupported NES games. The Kazzo NES uses a program which makes you select a script to read the ROM or read/write the SRAM, so I was able to copy and modify another script until it worked with my games. All the code had to do was change a byte to enable the save RAM and turn off write protection, then read/write the save from the correct location with the correct length. I don't know if GBA or N64 has any more complicated mappings than that, but there are already save dumpers for GBA and I doubt N64 is any more complex.

After reading and writing saves works, the next step is to check the game's header and refer to a lookup table so it knows which save type to use. Then, I'd like there to be at least an option in the config file to select the save type manually. If there's a way to use a custom script, that would be better in case there's a game with an unsupported save mapping (like SNES Brain Lord).
Title: Re: Progress on N64/GBA save support?
Post by: justin89 on 21/Nov/2014 03:49:39 PM
I'll see if I can work on the save support myself. If anyone else works on this, the source codes posted above for the N64 saves should help, and I found this program (http://chishm.drunkencoders.com/SendSave/) with source for GBA saves.
Title: Re: Progress on N64/GBA save support?
Post by: Nori on 03/Dec/2014 10:10:30 PM
If this works everyone is going to want one of the adapters, and I believe it's sold out now. Wish I bought one too. :(
Title: Re: Progress on N64/GBA save support?
Post by: Haldrie on 21/Jan/2015 05:06:06 PM
I'm still itching to be able to test any firmware for this when someone gets one ready for testing for dumping N64 saves (and hopefully writing them back to the cartridge as well). I have a decent number of N64 games with various saves types that I am willing to test with. I would be happy even if we have to manually set the save type in the config file for each cartridge just to be able to dump the saves as I think this will make the Retrode the first device since the Doctor 64 to be able to dump all N64 save types if it works.
Title: Re: Progress on N64/GBA save support?
Post by: Matthias_H on 22/Jan/2015 06:40:23 PM
A Retrode user just contributed some code that can read GBA/N64 saves - but it hasn't been merged into the firmware yet. We'll have to give it some time to make sure we don't break existing functionality.
Title: Re: Progress on N64/GBA save support?
Post by: starlightknight on 30/Apr/2015 10:51:09 PM
A Retrode user just contributed some code that can read GBA/N64 saves - but it hasn't been merged into the firmware yet. We'll have to give it some time to make sure we don't break existing functionality.

Let me know if you need any help testing or regression testing that. I have the Retrode 2 and all of the plugins from the manufacturing run, as well as a wide variety of carts - and in particular, plenty of N64 carts that have been patiently waiting for the day save read support would be available :)
Title: Re: Progress on N64/GBA save support?
Post by: Haldrie on 04/Aug/2015 04:04:23 AM
Diddo with starlightknight though I didn't get the SMS plugin as I never had a need for it but I've been itching to play with N64 save support since I found this thread. I'm willing to test any firmware if a new beta is available for it. It's just a shame that there is so much time between updates.
Title: Re: Progress on N64/GBA save support?
Post by: RazorX2014 on 09/Aug/2015 07:10:39 AM
I also would.
Title: Re: Progress on N64/GBA save support?
Post by: Amitari on 06/Nov/2015 04:49:27 PM
I hope this update becomes available soon, I have Oracle of Ages and Oracle of Seasons I want to backup the save data on.
Title: Re: Progress on N64/GBA save support?
Post by: Wannado on 08/Nov/2015 06:17:25 PM
The contributed code does not fully support all types of savegames yet. It's as far as the author got. There are still problems such as save data corruption. Some of the code changes might be breaking other features.

AFAIK, nobody is currently working on those issues. I'm busy with the NES plug-in.
Title: Re: Progress on N64/GBA save support?
Post by: Raw64life on 15/Nov/2015 01:14:00 AM
Sad to hear. I've been checking this forum periodically for a number of years now waiting for this functionality to be added. I bought the N64 plugin when Dragonbox got another shipment in and have been patiently waiting ever since. Hopefully the batteries in my N64 cartridges will outlast this process.
Title: Re: Progress on N64/GBA save support?
Post by: Zerker on 28/Nov/2015 01:09:13 PM
I hope this update becomes available soon, I have Oracle of Ages and Oracle of Seasons I want to backup the save data on.

FYI: Those are both GBC games which are already supported. I should know, I've backed up my Oracle of Ages save AND transferred it back to the cartridge.
Title: Re: Progress on N64/GBA save support?
Post by: pmarshall on 26/Jan/2016 10:25:46 PM
Isn't part of the difficulty with accessing N64 saves in getting the file out in a form where an emulator can use it? The Gameshark method (see, e.g., https://www.kyleniewiada.org/blog/transferring-n64-saves/) involves visually inspecting the save file and using a hex editor to graft the save portion of the file into another file for use by the emulator.  However, wouldn't it be easier for the Retrode2 if one were only concerned, for example, with simply copying from the cartridge and writing back to the cartridge the save file in the exact format as it is used by the N64 console for backup, without concern for whether an emulator could use it?  That is the case for me, where I only play the games on my original console, and want to be able to use the Retrode2 to back up the save files for games where the cartridge uses battery-powered SRAM.  Then when the eventual day comes that the cartridge battery dies, I would replace the battery and use the Retrode2 to copy the save file back into the cartridge.  For me, some of this is for sentimental reasons - I have backed up the SNES DKK save file where my son (now grown) and his friends pulled an all-nighter to open up all of the levels, and the file where my nephew accumulated a huge fortune in SNES Vegas Stakes as the character 'Mr. Love', and would like to be able to do the same for the N64 Zelda Ocarina of Time save file that my son and I completed together.  Not a programmer myself (patent lawyer), so please forgive any ignorance on my part.
Title: Re: Progress on N64/GBA save support?
Post by: Wannado on 31/Jan/2016 08:00:06 PM
Isn't part of the difficulty with accessing N64 saves in getting the file out in a form where an emulator can use it? (...) However, wouldn't it be easier for the Retrode2 if one were only concerned, for example, with simply copying from the cartridge (...) in the exact format as it is used by the N64 console for backup (...)

It's not about the format. If we end up with something that requires you to use a hex editor, we'll happily release it.

The difficulties of getting N64 save support to the Retrode include:

See also reply #22 (http://forum.retrode.org/index.php/topic,154.msg2070.html#msg2070).
Title: Re: Progress on N64/GBA save support?
Post by: Nori on 03/Mar/2016 09:23:37 PM
I'm surprised so many want to carry their saves to their emus. I thought the vast majority just wants to back up their carts for future use and occasionally to change out the batteries in the carts.
Title: Re: Progress on N64/GBA save support?
Post by: ericbazinga on 04/Mar/2016 03:41:59 PM
Well, maybe they want to continue their progress when they have time, not specifically at home with their systems. For example, maybe the person want to finish their OOT game during their lunch break at work. An emulator would be the logical choice.
Title: Re: Progress on N64/GBA save support?
Post by: Raw64life on 04/Mar/2016 07:40:52 PM
My motivation for wanted saves backed up is simply to future proof them. The cartridge batteries aren't going to last forever.
Title: Re: Progress on N64/GBA save support?
Post by: DieKatzchen on 05/Mar/2016 01:13:22 AM
I also simply want to back up the SRAM based saves. I can use the Gameshark64 to back up some of them, but that thing is buggy and prone to failure. It also can't get at the saves for the WCW games, which I care less about but what if I want to replace a battery for someone else, someone who really cares about their WCW save?
Title: Re: Progress on N64/GBA save support?
Post by: Nori on 05/Mar/2016 08:59:22 PM
Yeah I've always been saying I think a Retrode that does only backup and restore of saves and promoted as such exclusively would be a huge huge hit, especially in these years where gamers are becoming aware of retro games having dying batteries and many have started replacing them
Title: Re: Progress on N64/GBA save support?
Post by: BlinksTale on 25/Mar/2016 07:11:58 PM
This is the biggest draw to Retrode for myself and the N64 community I think. I'd love to hear where that firmware went.
Title: Re: Progress on N64/GBA save support?
Post by: chesteraarthur2 on 19/Jan/2017 03:02:25 AM
A Retrode user just contributed some code that can read GBA/N64 saves - but it hasn't been merged into the firmware yet. We'll have to give it some time to make sure we don't break existing functionality.

2017 bump and progress inquiry

Any luck on the firmware update? Also, has anyone tried to do a Master System backup as well (need it for Phantasy Star!)?
Title: Re: Progress on N64/GBA save support?
Post by: Wannado on 26/Jan/2017 10:44:55 PM
Sorry, nothing has changed since reply #26 (http://forum.retrode.org/index.php/topic,154.msg2130.html#msg2130).

Also, this is not the top item on my list. In the past six months, I often thought about at least trying to merge the simple pieces that work (according to justin89). But I didn't even get close to having time for that.
Title: Re: Progress on N64/GBA save support?
Post by: chesteraarthur2 on 11/May/2017 07:08:26 PM
nuts
Title: Re: Progress on N64/GBA save support?
Post by: Raw64life on 11/Aug/2017 04:04:08 AM
I'm in the same boat. Been waiting years for this or any other way I could back up my N64 cart saves and play them on an emulator. I backed up what I could using a DexDrive/Gameshark 3.0 but it only works for eeprom and AFAIK still no way to get those saves working on an emulator.

Hopefully one of these years someone comes up with something before my carts start to rot lol
Title: Re: Progress on N64/GBA save support?
Post by: skaman on 11/Aug/2017 04:12:55 AM
The Arduino Cart Reader can backup all of your N64 saves.

Current build info is here:  https://github.com/sanni/cartreader/

Project started here:  https://forum.arduino.cc/index.php?topic=158974.0

All of my SNES enhanced code that was recently added to the Retrode started on the Arduino reader.

Title: Re: Progress on N64/GBA save support?
Post by: skaman on 14/Aug/2017 07:04:17 PM
Since many people have asked about the N64 saves, I took a look at the SRAM and it is possible to read out the saves.  The timing used to read out the save data seems critical so it isn't working 100% perfect at the moment.  If I can get the routines right, then I'll open a new BETA firmware test.
Title: Re: Progress on N64/GBA save support?
Post by: skaman on 16/Aug/2017 10:09:31 AM
N64 cart SRAM reads are working.  Added a lookup table to identify the SRAM carts by cart ID.  I still need to add Dezaemon 3D's large SRAM then I'll be working on the SRAM writes.
Title: Re: Progress on N64/GBA save support?
Post by: skaman on 18/Aug/2017 08:38:57 AM
N64 SRAM save support is complete.  I'm sending out the BETA firmware to the members of the test group.
Title: Re: Progress on N64/GBA save support?
Post by: newbie2 on 19/Aug/2017 01:33:48 AM
Really appreciate the work you put into this!
Title: Re: Progress on N64/GBA save support?
Post by: skaman on 19/Aug/2017 06:27:12 PM
If you want to use your SRAM save in the PJ64 emulator, then you'll need to save swap the file.

You can use saturnu's ED64-Saveswap program:  http://krikzz.com/forum/index.php?topic=1396.0

If have an Ocarina of Time save and want to check it without using an emulator, you can use this page:  https://bkacjios.github.io/OOT-Save-Converter/

After saveswapping the OOT .SRA, then use the first option "Import save file".  The save data will show in the bottom.  Click on the File# to see the details on each save slot.

I'm going to work on adding FlashRAM save reads.