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 homebrew announcements > Very basic EEPROM backup tool (Rein clone with DLDI)

#123453 - josath - Wed Mar 28, 2007 9:02 am

http://davr.org/ds2/eepinator.nds

It has various transfer functions, basically:
DS Cart Info
DS Cart --> File
File --> DS Cart
DS Cart --> GBA SRAM
GBA SRAM --> DS Cart
GBA SRAM --> FAT
FAT --> GBA SRAM

Though I don't have any GBA games, so I don't know how well the SRAM functions work, but it seems to work on the SRAM on my supercard. (going dscart -> sram, then sram -> fat, and i get the saved game out ok.)

It MAY work for some slot-1 card users, because I have a bunch of pauses in there (so you can insert the right card at the right time). But I've heard that it wont work for some cards because inserting the slot-1 flashcart causes a reset. (the reset never happens with a commercial game cart it seems, I can pop my metroid cart in & out all day long with no reset, so this is quite odd)

Let me know if it works, or if it wipes out your precious save games :)

#123464 - felix123 - Wed Mar 28, 2007 10:46 am

Patched with the normal SCSD. Doesn't work, says it cannot access FAT. Plus my SD card is corrupted.

#123465 - Diddl - Wed Mar 28, 2007 10:50 am

felix123 wrote:Patched with the normal SCSD. Doesn't work, says it cannot access FAT. Plus my SD card is corrupted.
SCSD is suported by libfat without DLDI patch, isn't it?

I think all slot 2 cartridges are supported by libfat without DLDI?

#123470 - chishm - Wed Mar 28, 2007 11:17 am

josath wrote:But I've heard that it wont work for some cards because inserting the slot-1 flashcart causes a reset. (the reset never happens with a commercial game cart it seems, I can pop my metroid cart in & out all day long with no reset, so this is quite odd)
EEPROM access isn't encrypted at all, but accessing the normal DS card ROM is. The new Slot-1 cards all use the ROM interface, and the encryption on the card side gets reset when power cycled.

#123475 - tyraen - Wed Mar 28, 2007 12:40 pm

I thought it was up to the developer what support was included with the build. For example... actually I don't have one. But DSO comes with a different built-in driver than something else (DSO has the card DragonMinded uses built-in I believe).

#123519 - cherryt - Wed Mar 28, 2007 8:20 pm

So wait... sorry for being a newbie, but
What exactly is this tool for?

#123520 - josath - Wed Mar 28, 2007 8:23 pm

It copies the save game from your commercial DS carts to your CF/SD card, and vice versa.

You can make backups of you save games, to share with others, to cheat, or just to have a safe copy in case your game gets messed up.

It's also useful in a couple specialized cases, like Band Bros. where you can insert songs created by others into the savegame.

#123523 - cherryt - Wed Mar 28, 2007 8:51 pm

O i c...
Thanks. Might be useful for Animal Crossing :)

#123527 - tepples - Wed Mar 28, 2007 9:40 pm

cherryt wrote:Thanks. Might be useful for Animal Crossing :)
I too play ACWW, and I currently use REIN to back up Picken about once a week. It's too bad about the lack of support for pak-swapping among some popular SLOT-1 cards (R4, M3 DS Simply, DS-X).

(You're cherryt, but where are peart, peacht, and oranget?)

#123530 - josath - Wed Mar 28, 2007 9:49 pm

tepples wrote:
cherryt wrote:...
(You're cherryt, but where are peart, peacht, and oranget?)
I prefer greent

#123549 - Volsfan91 - Thu Mar 29, 2007 12:28 am

Hey David. Thanks for your great work on the program. Keep up the great work and hopefully it will get working on the M3 Simply!

#123572 - Tets - Thu Mar 29, 2007 5:46 am

Works great with my MMD. I'm looking forward to further developments, specifically with this "GBA SRAM --> DS cart" option. Sounds intriguing.

#123615 - josath - Thu Mar 29, 2007 5:26 pm

added support for transfering between GBA SRAM as well. This can be useful for people who have a slot-1 flashcard, but also have some GBA game with SRAM. You can get your save files using this method:

1. boot eepinator
2. eject slot-1 card, insert ds game
3. copy ds cart --> SRAM
4. reset DS, boot eepinator again, keep slot-1 card in
5. copy SRAM --> FAT

of course, SRAM is only 64KB, so until I add some compression, you cannot use it for the larger save files.

#123617 - tepples - Thu Mar 29, 2007 5:31 pm

Are the 2 Mbit save files such as that of ACWW always so compressible? I seem to remember that Mario Kart DS encrypts its save file.

#123623 - Pinesal - Thu Mar 29, 2007 6:06 pm

can I use these backuped saves on my backuped games using M3CF?

#123629 - josath - Thu Mar 29, 2007 7:12 pm

tepples wrote:
Are the 2 Mbit save files such as that of ACWW always so compressible? I seem to remember that Mario Kart DS encrypts its save file.

I downloaded all the files here:
http://www.gamefaqs.com/portable/ds/save/920786.html
And ran 'gzip' on them as a test (since zlib should be easy to use for compression on the DS).
The largest after compression was 44KB, and the smallest was 10KB, so the chances are for ACWW.

Mario kart was not as good though, the saves ranged from 26KB to 140KB after compression, only 3 of the 5 saves on GameFaq's page would fit into SRAM.

#123639 - Volsfan91 - Thu Mar 29, 2007 8:57 pm

Hey Josath... quick question.

Is there something you can do to fix R4 or M3 Simply support, or will it have to come from a higher level? I understand it has something to do with the card resetting when inserted.

If it's something that has to be addressed at a firmware level, I'll try to talk to a contact of mine that is in touch with the R4 team and see what I can do.

#123640 - josath - Thu Mar 29, 2007 9:06 pm

Volsfan91 wrote:
Hey Josath... quick question.

Is there something you can do to fix R4 or M3 Simply support, or will it have to come from a higher level? I understand it has something to do with the card resetting when inserted.

If it's something that has to be addressed at a firmware level, I'll try to talk to a contact of mine that is in touch with the R4 team and see what I can do.


1. if the DS ITSELF resets when the card is inserted, than I am pretty sure this is a HARDWARE problem, with the flashcart not being 100% electrically the same as a retail ds cart, tripping something or other in the ds. This can only be fixed by a new piece of hardware from the flashcart makers.

2. if the DS does not reset when the card is inserted, then the reason you cannot write to FAT most likely it is due to the card itself being reset. This cannot really be helped, since DS cards need complex initialization to get them into encrypted mode. I might look into doing this, if it seems like this would help.

#123641 - Volsfan91 - Thu Mar 29, 2007 9:09 pm

Yeah, I meant I read something about the DS card itself "resetting"... I read something about it in the Updated Rein thread that's floating around here...

Anyway, just give it your best shot. I would really like to see it happen, but I know there are limitations. :)

#123819 - rhionsligo2 - Sat Mar 31, 2007 4:03 pm

The reason is likely #2. I have a R4 cartridge, and I tried it.
The DS does not turn off.

#123821 - tepples - Sat Mar 31, 2007 4:20 pm

You're right: #2 is true of R4. But #1 is true of DS-X.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#125991 - Visenya - Wed Apr 18, 2007 11:00 pm

Sorry for the late bump, but will this work on 4Mb saves? I've heard that REIN doesn't handle those very well and I'd really like to be able to transfer saves from my flash cart to the original cart (for Pokemon when it's released this week).

#126179 - Wuschmaster - Fri Apr 20, 2007 6:38 pm

Code:
Reading...
Ready to write FAT?
Press start...
fatInit: 0
ERROR Opening Fat!!
Press start...


I did DLDI patch it. What am I doing wrong? Or is R4DS not supported yet?

#126196 - tepples - Fri Apr 20, 2007 10:06 pm

R4 does not support reading or writing the file system after being reinserted into a powered-on DS. See previous discussion about card swapping. This will not be fixed until somebody dumps and reverse-engineers the init code in the R4's ARM7 and ARM9 binaries.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#126217 - Dood77 - Sat Apr 21, 2007 1:27 am

tepples wrote:
This will not be fixed until somebody dumps and reverse-engineers the init code in the R4's ARM7 and ARM9 binaries.

Do you see anyone here who's capable of this without extensive and most likely annoying help from you and the other gurus?

#126220 - tepples - Sat Apr 21, 2007 1:37 am

Dood77 wrote:
Do you see anyone here who's capable of this without extensive and most likely annoying help from you and the other gurus?

Exactly. If you want to back up saves, get a SLOT-2 card.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#126276 - Shuny - Sat Apr 21, 2007 5:22 pm

I tested this great homebrew on my DS-X :

DS card => file : does NOT work : Freeze at ready to write fat
file => DS Card : Works perfectly

Nice job ;)

#126792 - Tockit - Thu Apr 26, 2007 7:28 pm

hey, so I tried this with my m3sd and converted the save file for my r4, and it works like a charm.

you're like a hero.

not the sandwich.. :P
_________________
-01011101001010101010 (frank)

#126900 - ziot - Fri Apr 27, 2007 11:58 pm

Shuny wrote:
I tested this great homebrew on my DS-X :

DS card => file : does NOT work : Freeze at ready to write fat
file => DS Card : Works perfectly

Nice job ;)


I am assuming there is no way to get the save files from DS-X then? I have tried a bunch of different ways but I have had no results. :(~

#127145 - SkH - Mon Apr 30, 2007 10:38 am

This app is very good and usefull!!!!!

Can you update it with GBA FLASH 2M support? (Restore and backup)

#127388 - Link_of_Hyrule - Wed May 02, 2007 3:38 am

ok this site converts the files http://www.shunyweb.info/index.php but what format should i convert them to so i can upload it to my card?

EDIT:

nvm i got it i used a combination of this site http://www.shunyweb.info/index.php and the G6 Save Converter ( http://forums.maxconsole.net/showthread.php?t=26252 )

i converted the .0 to the .duc and then i used the other application to convert it to the .sav file and put it in the directory on my card next i used RAC ( http://www.pineight.com/dx/RAC ) to transfer it to my card

This should work with any slot-2 card if its format is supported by that site.

#129817 - tepples - Sun May 27, 2007 4:44 pm

Today, my cousin tried to use eepinator to back up the 4 Mbit save file of Pok?mon Pearl to the SD card in his SuperCard SD adapter using scsd_moon.dldi. Trouble is, the card had 1 GB of 1 GB full. Instead of gracefully giving an error and canceling the operation, eepinator deleted all the files on the SD card, turning them into lost cluster chains.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#129843 - Dood77 - Mon May 28, 2007 2:10 am

Ouch. Maybe some kind of exception should be coded straight into libfat for when you run out of space for a write? I guess checking every time would slow some programs down... but then maybe add an option to not check the size whenever you want your program to write?

(before you call me and idiot for this post, read my sig :P)
_________________
If I use a term wrong or something then feel free to correct, I?m not much of a programmer.

Original DS Phat obtained on day of release + flashme v7
Supercard: miniSD, Kingston 1GB, Kingston 2GB
Ralink chipset PCI NIC

#129898 - cory1492 - Mon May 28, 2007 10:06 pm

Monitoring ferror is a way to catch file errors before they cause problems... I learned this the hard way as well (and mentioned the problem in the libfat thread), as I normally keep a lot of free space on cards I use for testing code. Not entirely sure why libfat does anything at all to the directory structure when free clusters can't be found though... it really shouldn't, though thankfully it does provide a way to catch such problems.

I have used this to detect space problems and report the exact error, and as far as I know no corruption has resulted since.
Code:
#include <errno.h> // errno and errors defined in there
...
bool writeData(u8* data, uint32 size, FILE* fp)
{
    int write = 1, error = 0;
    uint32 count = 0;

    while((count < size) && (write == 1))
    {
        write = fwrite(data, 512, 1, fp);
        address += 512;
        count++;

        if ((ferror(fp) != 0) || (write != 1))
        {
            // Error detected
            error = errno;
            iprintf("ERROR WRITING!\n");
            if (error == ENOSPC) // errno was set to out of space
                iprintf("Out of space!\n");
            else
                iprintf("error: %i\n", error);
            fclose (fp);
            return false;
        }
    }
}

I'm sure Josath's code would look much better than this though.

#130549 - ECas123 - Tue Jun 05, 2007 4:33 am

Ok, I have an unflashed (And want to keep it that way) DS and an R4DS (Dont think it works with this) can someone tell me what slot-2 carts work with this?

#130550 - dantheman - Tue Jun 05, 2007 4:39 am

Most slot-2 devices will work with this. If you want to manage your saves with your R4, check out the topic for SavSender, which will work with pretty much any device. I've made a how-to guide for SavSender at http://scdev.org/forum/viewtopic.php?t=9915

#130551 - ECas123 - Tue Jun 05, 2007 5:13 am

dantheman wrote:
Most slot-2 devices will work with this. If you want to manage your saves with your R4, check out the topic for SavSender, which will work with pretty much any device. I've made a how-to guide for SavSender at http://scdev.org/forum/viewtopic.php?t=9915

Well I dont have wifi so I need a slot2 card so I can just put this on it and simply run it

#130602 - tepples - Tue Jun 05, 2007 7:51 pm

Buy a SuperCard. You won't need a SuperKey because you will use your R4 for that.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#130633 - ECas123 - Tue Jun 05, 2007 11:05 pm

tepples wrote:
Buy a SuperCard. You won't need a SuperKey because you will use your R4 for that.

So I just buy a supercard lite and then launch this program and swap the R4 with the cartridge?

#130646 - tepples - Wed Jun 06, 2007 3:20 am

Yes.
  1. Insert SuperCard Lite and R4, and turn on the DS.
  2. In the R4 menu, choose the NoPass action (my DS isn't in front of me, but it's the button on the far right).
  3. SuperCard file chooser should start in DS mode. While the SuperCard file chooser is on screen, eject the R4 and put in pokeymans.
  4. Start the backup program.

_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#130650 - Tockit - Wed Jun 06, 2007 4:18 am

tepples instructions are the same thing I went through with my m3, and all worked just fine.
once you dump the info onto your slot-2, you can convert it to the r4's .sav format (512k) with the software that came with your r4.
just make sure the .sav and .nds file are of corresponding names. (der)
_________________
-01011101001010101010 (frank)

#130651 - tepples - Wed Jun 06, 2007 4:19 am

Tockit wrote:
just make sure the .sav and .nds file are of corresponding names. (der)

What .nds file? RAC? SavSender? Eepinator?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#131108 - ECas123 - Mon Jun 11, 2007 4:34 am

tepples wrote:
Tockit wrote:
just make sure the .sav and .nds file are of corresponding names. (der)

What .nds file? RAC? SavSender? Eepinator?

I think he means the save and the rom (i.e. Example_game.nds and Example_game.sav)

#131133 - tepples - Mon Jun 11, 2007 12:05 pm

But does any homebrew .nds game use .sav files, unless it's some sort of save backup tool like eepinator?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#131177 - Dood77 - Mon Jun 11, 2007 11:24 pm

I think if the program uses gba save space, and you used Supercard QPC then it creates a .sav with the name of the corresponding .nds
_________________
If I use a term wrong or something then feel free to correct, I?m not much of a programmer.

Original DS Phat obtained on day of release + flashme v7
Supercard: miniSD, Kingston 1GB, Kingston 2GB
Ralink chipset PCI NIC

#131547 - dantheman - Sun Jun 17, 2007 4:46 am

I think with Supercard QPC saving, you need to provide the *.sav file yourself, as is the case with SnezziDS.