Saving like a commerical game
Posted: Fri Oct 10, 2014 8:16 pm
I am aware that it is possible to write to the microSD using stdio calls with libfat, for example:
However I was wondering if it is possible to write data the same way as a commercial game, so that the flashcard handles the file writing, so that game.nds writes to game.sav for example. This would mean saving would have higher compatibility with flashcards since they are primarily designed for commercial games.
I came across the example found at "devkitPro\examples\nds\card\eeprom", however could not get it to work for saving data to the flashcard.
I tried adding this code to the example (while keeping all of the init stuff like sysSetBusOwners(true, true);):
But it doesn't work.
Code: Select all
FILE *f = fopen("gameSave.bin", "wb");
fwrite(data, dataLen, 1, f);
fclose(f);
I came across the example found at "devkitPro\examples\nds\card\eeprom", however could not get it to work for saving data to the flashcard.
I tried adding this code to the example (while keeping all of the init stuff like sysSetBusOwners(true, true);):
Code: Select all
memset(data, 'a', 512);
cardWriteEeprom(0, data, 512, type);
cardReadEeprom(0, data, 512, type);