• Welcome to SCdev.org. Please log in.

Welcome to the new SCdev forums!

SD card access from GBA mode

Started by torne, January 24, 2007, 12:51:12 PM

Previous topic - Next topic

torne

Does anyone have any documentation/examples on how you can access the Supercard's SD card from GBA mode? (i.e. once you have booted from the supercard with a normal GBA rom that gets loaded into the SC's RAM)

As far as I can see from disassembling roms patched by the Supercard software, there is some magic write sequence which opens up the SD IO ports inside the Nintendo logo area of the header (which is pretty cunning if that's what it's doing, since that's the one part of the ROM memory map that's basically guaranteed not to be accessed again after boot), but it's extremely complicated and hard to interpret using just the patched rom as many execution paths depend on data fetched from this magic IO area, which I can only replicate by painstakingly repeating the same magic in a GBA program of my own and dumping stuff.

I could've misinterpreted all this, of course, as it's pretty horrid work that I did quite some time ago.

The goal is to remove the requirement for saving by L+R+Select+A or QPCing. This shouldn't really be difficult if the SD access procedure is known, as all is required is to replace the Nintendo backup library functions with equivalents that emulate the behaviour by going directly to the SD filesystem (thus not using sram at all).

Any information anyone has at all would be very useful :)

Hi

Two things

1. good luck with the project. It would be very nice to not have automatic save-even if more games would slow down. I don't mind the slowdowns.

2. Could you make it work on the sccf to???
_______________________________________

torne

Quote from: "Hi"1. good luck with the project. It would be very nice to not have automatic save-even if more games would slow down. I don't mind the slowdowns.
It would eliminate the slowdown caused by SC's save patching, because rather than having to intercept every interrupt to check if the buttons are being pressed, it only has to respond when the Nintendo backup library functions are called, which doesn't require interfering with interrupts. It won't do anything for the games that are too slow even without save patches of course, that's just the SC's ram being cheap.

Quote2. Could you make it work on the sccf to???
Potentially, though the code will be different to some degree. I don't have one to try it on, though, so someone else would have to do all the investigative work.

felix

size=8]DS3, FM7, SCmSD1.80/2.60, WRT54GL with Tomato Firmware[/size]

torne

Well, I'm kinda looking at this again a bit. The biggest problem is knowing where to save to :) As far as I can tell from my previous reversing work, the SC firmware, upon loading a GBA rom, stashes the details of where to save to somewhere (though, er, where is not clear). It might store a filename but more likely it stores a list of sectors to avoid the actual saving code having to understand FAT. The hotkey handling code injected into the rom retrieves this and uses it to save.

Using libfat or similar, it doesn't seem that it would be very difficult to patch a rom with a standard N backup library to save directly to a *fixed* place on the card. This isn't very usable for normal mortals, though.

However I just saw the progress people have made getting at the actual code for the SC firmware and modifying it. This may well help me figure it all out if I dump that and stuff it into IDA, then read the GBA rom loading stuff :)

So don't hold your breath, and i'm pretty busy trying to find somewhere new to live atm, but hey, you never know.