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 development > lost with file system libs

#152139 - alcoran - Mon Mar 10, 2008 4:49 pm

Hi

I'm beginner in nds dev and I've followed some tutorial http://www.double.co.nz/nintendo_ds/nds_develop6.html , and for filesystem, this tutorial advise to use gbfs. It runs well on emulator, but i have problem when running the same code in the nds device (GBFS_FILE is not found, find_first_gbfs_file returns null). I've checked on this forum, didn't found a solution to my problem, it seems all is done right. I saw gbfs only run on one slot, may be i used the wrong one?

Now i see there are some other choices for filesystem, but i would like to avoid redoing again and again my code because of a wrong file system choice.

i'd like a file system that works with emulator and ds device (not necessary external file, reading file embbeded to the .nds file is ok, even preferred, as gbfs do), and convenient to use. What is the best choice today?

thanks you for your help :-)

#152158 - josath - Mon Mar 10, 2008 9:10 pm

The most compatible & easiest to get going with is to use libfat. The only downside is that it is designed mostly for reading external files, not files embedded in the NDS. To use libfat, basically you follow these steps:
1. include '-lfat' in your makefile
2. #include <fat.h> in your .cpp file
3. "int result = fatInitDefault(); // 1 = success"
4. Use standard C file I/O functions like fopen, fread, fwrite, feof, ... many places explain how to use these

Later, if you want all your data contained in the .nds file, there are ways to handle this, but it takes a little more work, so I'd suggest starting with libfat.

PS: The doublec tutorials are unfortunately highly outdated. GBFS is pretty pointless these days on the DS, since it only works on slot-2 devices with RAM, which happen to copy the .nds file to the RAM before booting.

#152163 - alcoran - Mon Mar 10, 2008 10:28 pm

Hi Josath

Thank you for help and explanation, so i'll go for this library.