App to backup all .sav files on flashcart locally (not to PC)?

Discussion in 'NDS - Emulation and Homebrew' started by Martoon, Aug 8, 2010.

  1. Martoon
    OP

    Newcomer Martoon Member

    Joined:
    Nov 10, 2006
    Messages:
    14
    Country:
    United States
    Okay, after losing countless hours of progress in a game due to a corrupted .sav file, I've decided I should start backing up my game saves. I'm running akAIO 1.7.1, which provides a function to backup a .sav file, but it requires me to switch the file view to show .sav files, navigate to a game, and tell it to back up (doing this separately for each game). And I know there are general file managers for the DS that will let me browse files, manually copy them, etc., but again, I'd need to do it for each game.

    Is there an app that goes through each of your .sav files, checks the file timestamp against the current .bak file (if there is one), and copies the .sav file to the .bak file if the timestamp on the .sav file is newer?

    If there isn't an app like this, it seems like something that could be useful. Just a small, simple app that could be run periodically.
     


  2. tk_saturn

    Member tk_saturn GBAtemp Psycho!

    Joined:
    Jan 26, 2010
    Messages:
    3,327
    Country:
    United Kingdom
    I'm surpised there isn't one.

    You could see if my batch file will fill the gap http://filetrip.net/f12174-AKAIO-Wood-R4-S...anager-1-4.html but of course that requires you insert it into the PC.

    I'd have no idea where to start coding that as home brew.

    Logic says it's better to store you backups on your PC anyhow. Otherwise if your MicroSD card fails you will lose your backups at the same time.
     
  3. SifJar

    Member SifJar Not a pirate

    Joined:
    Apr 4, 2009
    Messages:
    6,022
    Country:
    United Kingdom
    In theory, it should be "simple" for a vaguely experienced coder. Simply find every *.sav file, and copy it to *.bak. However, I have NO experience with coding in C (only a little scripting in AHK) so can't attempt it. Although as tk_saturn says: Its probably best to backup to PC in case memory card fails.
     
  4. Martoon
    OP

    Newcomer Martoon Member

    Joined:
    Nov 10, 2006
    Messages:
    14
    Country:
    United States
    Yeah, I back up to my PC every so often (so I only lost about half my progress on that game, instead of all of it), but it just isn't that often that I get around to pulling the SD card out of my AK2 and putting it in a card reader on my PC. It'd be a lot easier to just run something on the DS, so I'd be inclined to do it more often. And if it checks the timestamps on the files and only copies ones that have been changed, it should only take it a few seconds to run, after the first time.

    I actually am an experienced coder (it's what I do for a living), but I've never messed with the DS dev kit. Once I was familiar with all of that, it would probably only take an hour or two to write the app. But I know from experience that setting up the development environment, getting the libraries, SDKs, compilers, etc., and figuring out the API for a platform I've never developed on before always takes a lot longer than I'd like.

    Do you think there'd be much interest in such an app from other DS flashcart users?
     
  5. ConJ

    Member ConJ The Toker

    Joined:
    Jul 18, 2008
    Messages:
    918
    Location:
    Glastonbury
    Country:
    United Kingdom
    Very much so. I would love to see this happen.
     
  6. UniqueGeek

    Member UniqueGeek PMD Researcher

    Joined:
    May 29, 2009
    Messages:
    1,368
    Country:
    United States
    The M3i Zero backs up a save every time a game loaded.
     
  7. SifJar

    Member SifJar Not a pirate

    Joined:
    Apr 4, 2009
    Messages:
    6,022
    Country:
    United Kingdom
    That helps the topic in no way.
     
  8. Martoon
    OP

    Newcomer Martoon Member

    Joined:
    Nov 10, 2006
    Messages:
    14
    Country:
    United States
    Okay. I've installed devkitPro, and I'm looking at the libfat example. I'll see what I come up with.
     
  9. Xenon++

    Member Xenon++ Taiju Yamada

    Joined:
    Dec 17, 2009
    Messages:
    1,394
    Country:
    Japan
    I might make one next week...
    BTW ndslink.nds in my mshl2tools should be a good example.
     
  10. dnniwa485

    Member dnniwa485 GBAtemp Fan

    Joined:
    Oct 4, 2009
    Messages:
    458
    Country:
  11. Martoon
    OP

    Newcomer Martoon Member

    Joined:
    Nov 10, 2006
    Messages:
    14
    Country:
    United States
    I'll take a look at mshl2tools. So far, my efforts have been hampered by (a) libfat doesn't work in emulators (though I think I'll get it working with the GBA CF patch thing with DeSmuME), which really slows down the build/test cycle, and (b) the libfatdir example in the devkit doesn't work completely correctly with my AK2 in my DS (it doesn't recognize directories). It'll be good to have a working example.

    Unless, of course, you make this thing next week, and I don't need to bother with this... ;)
     
  12. UniqueGeek

    Member UniqueGeek PMD Researcher

    Joined:
    May 29, 2009
    Messages:
    1,368
    Country:
    United States
    The topic is about backing up all save files, but the M3i Zero backs up the save file for whatever game you lauch when launched, and can be restored if nessesary
     
  13. SifJar

    Member SifJar Not a pirate

    Joined:
    Apr 4, 2009
    Messages:
    6,022
    Country:
    United Kingdom
    And OP doesn't have an M3i Zero. I doubt he wants to buy a new cart just for that feature.
     
  14. Xenon++

    Member Xenon++ Taiju Yamada

    Joined:
    Dec 17, 2009
    Messages:
    1,394
    Country:
    Japan
  15. 2-bias

    Member 2-bias GBAtemp Regular

    Joined:
    Jul 30, 2009
    Messages:
    142
    Location:
    Germany
    Country:
    Germany
    looks great, but doesnt really works on my ak2i. i got only some weird named .bak files spread in my folders.
    also, if any updates planned. a filter option would be nice to exclude some folders. eg the old moonshl 1.71 folder because it trys to backup the bookmark.sav files.
     
  16. Martoon
    OP

    Newcomer Martoon Member

    Joined:
    Nov 10, 2006
    Messages:
    14
    Country:
    United States
    Yeah, I ran it on my AK2i, and it didn't work quite right, either.

    The root of my SD card looks like this:

    07/12/2010 01:37 AM Games
    ? TEST
    01/01/2098 12:00 AM 524,288 Ga.bak
    01/01/2098 624 CFtpServer.ini
    07/14/2010 12:11 PM 570,432 akmenu4.nds
    08/07/2010 11:06 AM __aio
    08/07/2010 12:24 PM Apps
    01/01/2098 12:00 AM 524,288 D.bak
    08/08/2010 05:31 PM data
    08/14/2010 10:33 AM 524,288 4926 - Picross 3D (USA).sav
    08/19/2010 12:05 AM 164,416 savbackup.nds
    08/19/2010 12:05 AM 18 savbackup.ini

    There are 71 .sav files within the Games folder, and one .sav file in the root (as you can see). When I ran savbackup, it showed it going through all of the .sav files, recursively, and saying it was backing them up. Took a little while to run, then said to press A to shut down. I did, and it powered off.

    Looking at the SD card afterward, however, there are no new files in the Games folder, and just the two .bak files were created in the root as you can see above (Ga.bak and D.bak). I suspect it was just writing to one or both of those files repeatedly instead of the correctly named destination files when it was copying. It clearly read the directory structure correctly, because I could see it listing all of the .sav files in the Games folder while it ran, claiming to back them up. But it lost something when creating and writing to the destination files, so no .bak files were created in the Games folder.
     
  17. Xenon++

    Member Xenon++ Taiju Yamada

    Joined:
    Dec 17, 2009
    Messages:
    1,394
    Country:
    Japan
    There was a nasty bug. File updated. Make sure you are using 8/20 version.
     
  18. Martoon
    OP

    Newcomer Martoon Member

    Joined:
    Nov 10, 2006
    Messages:
    14
    Country:
    United States
    I grabbed it from your site again, tried it, and it still did the same thing. I just now came back here on a different computer to get the file again to make absolutely sure there was no chance I was getting an old cached version, and I see the files are no longer on your server. I'd be glad to try whatever version you're working on at any time, if you're still working on it.

    Thanks!
     
  19. Xenon++

    Member Xenon++ Taiju Yamada

    Joined:
    Dec 17, 2009
    Messages:
    1,394
    Country:
    Japan
    As internal test is ok, it is integrated to mshl2tools package...
     
  20. 2-bias

    Member 2-bias GBAtemp Regular

    Joined:
    Jul 30, 2009
    Messages:
    142
    Location:
    Germany
    Country:
    Germany
    awesome man, great tool.
    still, a folder filter would be great and also an option to specify an output folder would be nice.
    anyway that tool rocks, ist so simple and quick. [​IMG]
     

Share This Page