gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS Flash Equipment > Is there any way to backup and/or restore NDS savegames yet?

#43355 - Dark Knight ez - Sun May 22, 2005 6:29 pm

I've been wondering if it was possible to backup savegames from an NDS cartridge, and possibly restore it. Now, with the passme, flashme, and wifime, is there any reason why it couldn't be? (Program being on your gba flashcard, accessing the savefile on the NDS cartridge.)

Before asking a question on this matter, I searched for documentation (or a program for that matter) which does exactly this. All I could find on savegames was the size of the save space on several NDS game cartridges however (http://www.bottledlight.com/ds/index.php/Hardware/DSSavegame).

I did notice something on this forum though, a post by darkfader.


Quote:
Forget about cheating with AR DUO !
I just got 150 stars on SM64 :)

Code:

   FILE *fi = fopen("C:\\public\\SMDS.Save.Modifier.v1.0\\150.dss", "rb");
   if (!fi) exit(1);
   fseek(fi, 0x1F4, SEEK_SET);
   for (unsigned int address=0; address<4096; address+=32)
   {
      // set WEL (Write Enable Latch)
      reg_MI_MCCNT0 = REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_SEL_MASK | REG_MI_MCCNT0_MODE_MASK;
      reg_MI_MCD0 = 0x06;
      reg_MI_MCCNT0 = REG_MI_MCCNT0_MODE_MASK;

      // program 32 bytes
      reg_MI_MCCNT0 = REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_SEL_MASK | REG_MI_MCCNT0_MODE_MASK;
      reg_MI_MCD0 = 0x02;
      reg_MI_MCD0 = address >> 8;
      reg_MI_MCD0 = address & 0xFF;
      for (int i=0; i<32; i++) reg_MI_MCD0 = fgetc(fi);
      reg_MI_MCCNT0 = REG_MI_MCCNT0_MODE_MASK;

      // wait programming to finish
      reg_MI_MCCNT0 = REG_MI_MCCNT0_E_MASK | REG_MI_MCCNT0_SEL_MASK | REG_MI_MCCNT0_MODE_MASK;
      reg_MI_MCD0 = 0x05;
      do { reg_MI_MCD0 = 0x00; } while (reg_MI_MCD0 & 0x01);   // WIP (Write In Progress) ?
      reg_MI_MCCNT0 = REG_MI_MCCNT0_MODE_MASK;
   }
   fclose(fi);


I might not have much programming experience, but from what I can tell, it looks like darkfader was able to save an NDS savegame file to his computer (the path including C:) and (after modifying it) rewrite it to the NDS cartridge.
Does anyone know how? Is there an easy way to do this, does it differ per game (or per cartridge size)?


Yours sincerly,
Dark Knight ez.

#43945 - Dark Knight ez - Sat May 28, 2005 3:34 pm

I spotted some document on NDS memory maps and i/o.
It mentioned that "cart ram" started at location 0x0A000000, and ends at location 0x0A010000.

Is this the address to access the save information of the NDS cartridge?

#43948 - tepples - Sat May 28, 2005 3:56 pm

I suspect that 0x0A000000 corresponds to GBA 0x0E000000, for accessing GBA cart SRAM.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#44026 - Dark Knight ez - Sun May 29, 2005 3:15 pm

It seems you are right.
The NDSTech Wiki lists that address space as "GBA cart RAM".

Can't seem to find any information regarding the address space of the save space on the NDS cartridge though. If it _is_ listed on the NDSTech Wiki, then either I'm just stupid and missed it or it's been given a technical name which I didn't suspect it to be named.


edit:
Anyway, moving on for now to the other half of what needs to be done in order to back up NDS saves.
Assuming we know the way to access the save data, it will have to be saved on a flash card. Can it be saved on the flashcard as one big save (assuming the amount of save space on the flash card is big enough to handle that), or are saves on a flash card restricted to a certain size (since GBA savs are not nearly as big as most NDS savs are / will probably be).


edit #2:
If, as with GBA, NDS cartridge save RAM comes after the ROM, it could be the case that the save RAM location is not the same for each NDS cartridge (which IS the case with GBA cartridges, right?), but can always be calculated with help of the NDS Header.
The NDS Header contains information on the "Card size". It's possible that the save RAM location starts at the address equal to a base location (being the location of the beginning of the rom of the NDS cartridge) plus the card size. Of course, this is just speculation on my part, can anyone confirm this? And give any information on what the base location is?


Last edited by Dark Knight ez on Sun May 29, 2005 6:53 pm; edited 3 times in total

#44027 - Chetic - Sun May 29, 2005 4:22 pm

Oh please tell me I'll be able to cheat on Mario 64...
I just want the minigames :\
_________________
Packin':
Grey DS with FlashMe v7
1Gbit XG2T 2005 (Neoflash compatible)
GBAMP, Supercard CF, 512Mb Magic Key 3 and EZFA 256Mbit

#44037 - josath - Sun May 29, 2005 7:13 pm

The NDS Cart save is not mapped to memory like GBA sram. It is accessed through some registers. ndslib has some built in functions to access the nds cart save, but i think they have some bugs. look for the functions:

void cardReadEeprom(uint32 address, uint8 *data, uint32 length, uint32 addrtype)
and
void cardWriteEeprom(uint32 address, uint8 *data, uint32 length, uint32 addrtype)

#44085 - Sektor - Mon May 30, 2005 2:02 am

Action Replay can backup DS saves but a free open source solution would be nice.

#44272 - HoBoSexual@Q-C{514}Jesus$ - Tue May 31, 2005 4:22 pm

I think this can back up saves...if I understood correctly...

http://emuholic.emuboards.com/modules.php?name=News&file=article&sid=604&tbid=4

#44286 - whackawookie - Tue May 31, 2005 5:38 pm

personally, those thieves wont make a buck off me. to contribute to a scene is to give back, there not giving back, only stealing. they dont offer anything to anyone who doesnt pay, i got a action replay duo and that'll do just fine.

#44294 - Maverick - Tue May 31, 2005 6:46 pm

why not just write a tcp\ip nds file that sends the save to ur pc through wifi?

#44313 - maniacdevnull - Tue May 31, 2005 7:53 pm

Maverick wrote:
why not just write a tcp\ip nds file that sends the save to ur pc through wifi?


Why bother with that? Why not just use magic instead? It would be a ton easier to code. TCP/IP is limited by rules, but magic can do anything! WHEEE!

We don't have any clue how to work the wifi antenna on the DS. AT ALL. That would be a great idea, but let's put the horse before the cart.

#44326 - Maverick - Tue May 31, 2005 9:06 pm

who said i meant now?

#44406 - Dark Knight ez - Wed Jun 01, 2005 1:32 pm

Don't own a Ralink wifi card, nor do I intend to in the near future.
I do own a flashcard though, and creating a program (for free) to backup saves might be a fun way to roll into DS development.

Of course, if you feel it should be done in another way, you can always try and code it yourselfs.

#45313 - blueprint88 - Thu Jun 09, 2005 3:46 pm

It looks like many of the DS games use a 64k Eeprom. Most GBA flash cart use 64k sram banks. I was thinking the same thing as other which is couldn't a little DS homebrew app allow you copy the DS eeprom data to the flashcard sram bank. Then you could use your linker program to download the sram bank from your GBA flash cart. I asume the app would have to be somewhat customised for a particular brand/type of GBA flash carts but if you supported several of the main ones it would cover most users.....Say Neo/XG2, F2A, and EZF.

Something that worked wifi to grab your data from DS cart and send it to pc wifi would be incredibly super awesome.

Seeing that wifime just send data from PC to DS, I don't know if anyone has figured out how to get the DS to send data back to PC yet???

I might just buy a AR Dou myself. Other than the fact that my DS is starting to look like it is on life support it will have so many extra devices hanging from it.