d0k3 / GodMode9

GodMode9 Explorer - A full access file browser for the Nintendo 3DS console :godmode:
GNU General Public License v3.0
2.15k stars 194 forks source link

[FEATURE REQUEST] Ability to Import Saves With GodMode9 #589

Open DeadSkullzJr opened 4 years ago

DeadSkullzJr commented 4 years ago

Got a great idea on how to improve GodMode9? Add the ability to import/inject .sav files into DS or 3DS game cartridges.

Describe the feature you'd like GodMode9 has the ability to access the save data for the game cartridges themselves, all you have to do is export the .sav to gm9/out and that's that. However one thing we don't have is the ability to import or inject (which ever you prefer to call it) .sav files into the game cartridges (at least I haven't found any option to do so). Not much else to say since it's pretty self explanatory on the process (it's basic after all).

You now might be wondering what the point of this would be? Emulation and or flash devices tend to have the ability to read .sav files, heavily prevalent in the DS side of things. The Nintendo 3DS has its own set of devices that utilize the .sav files as well. One could assume that you could just use software like JKSM or Checkpoint to import the 3DS save data into game cartridges, and while that's true, it's not 100% full proof for everything out there. You see, stuff like the Sky3DS and Stargate 3DS read save data a little differently, while true both utilize the same save structure like real game carts, they read the save data from the SD card utilized by the flashcart first, then that save is written to the "real" cartridge (the flashcart) (I did some extensive testing yesterday with a few of my game dumps and can confirm the workings of said devices). I tested with a .sav dump via GM9 from my real game cartridge to see if the flashcarts would utilize them, and the results were a success, it read the .sav from the SD card first and then imported that data to the flashcart. Knowing the flashcarts use the same save structure as the real game cartridges, in theory, we could just import/inject saves from the flashcarts to the real game cartridges.

This feature could be especially useful if you plan to take saves from these flashcarts or from another source outside real game carts and import them back into the game carts. Both sides of the field could benefit with this since now we would have another yet different option related to save exporting/importing.

As a side note, for those that utilize a Gateway 3DS still, this would still work regardless of the proprietary save format it uses. All you would have to do is import a .sav into a real game cartridge (or the Sky3DS/Stargate 3DS since those utilize the same save structures internally), then dump that save via Gateway, which will then turn that save dump into a usable format by the Gateway 3DS.

Describe alternatives you've considered No other alternative to this, only thing I can think of is a separate piece of homebrew software to do it rather than using GM9, I haven't found one that imports .sav though. Would be kind of pointless to make something like homebrew though when GM9 already gets part of the job done.

What I am NOT asking for I am not asking for something like JKSM or Checkpoint, those pieces of software don't produce any type of .sav files, instead those two produce save data in pieces (not that it's a bad thing, it's just not what I am looking for at the moment).

I hope all of this makes sense. Everything used to test this was with my own games that I physically own. I don't think this would benefit anyone who uses digital titles or anyone who doesn't own the real game cartridges, could be wrong though.

d0k3 commented 4 years ago

Not sure if this is even doable in baremetal. I'll leave this open for the time being, as I myself think it would actually be a good addition to GM9.

flarn2006 commented 3 years ago

Technically, if it's doable in the OS, isn't it necessarily doable in bare metal? The OS runs on bare metal, after all.

aspargas2 commented 2 years ago

I think we've gotten a little off the original topic of this issue here

danny8376 commented 1 year ago

https://gist.github.com/danny8376/1a894b7ba0e7686aba98b2260d469b44 Simple script to achieve this.

For save (SPI Flash) part, there aren't too much different between NTR/CTR protocol wise (only different clock speed), so we can simply treat it the same way for NDS/3DS games (except for card2 cartridges). And... NTR save writing is actually implemented before this issue even created.

Planing to add direct support within GodMode9 to eliminate this script, but not really sure how to implement it properly. Since it's not really possible to determine which game the save file actually belongs to by the contents (no common structure, need to detect game by game.), so the most feasible way is probably simply just determine by the filename? Another issue is that I'll prefer to only show option to restore/inject save when the inserted cartridge is matching, but that'll require initializing gamecart to read the cart name when open the file action menu, which probably isn't ideal? Another option is to show that option for all possible matching file name regardless, then error out when the game isn't exactly matching.

Also, i think it's also good to have if we can erase save with godmode9? (not really directly related to this issue though.)