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 > FAT lib errors

#81454 - HyperHacker - Sat Apr 29, 2006 6:41 am

I'm getting errors with the latest version of chishm's FAT library... managed to fix the major ones:

Quote:
gba_nds_fat.c: In function 'u32 FAT_ftell(FAT_FILE*)':
gba_nds_fat.c:2480: warning: converting negative value '-0x000000001' to 'u32'
io_nmmc.c: In function 'bool NMMC_WriteSectors(u32, u8, void*)':
io_nmmc.c:264: error: invalid conversion from 'void*' to 'u8*'
io_nmmc.c: In function 'bool NMMC_ReadSectors(u32, u8, void*)':
io_nmmc.c:312: error: invalid conversion from 'void*' to 'u8*'


The last 2 just need these two lines changed to "u8 *p=(u8*)buffer;". The first one seems to be a design flaw (u32 can't return -1) and was in old versions too.

Also I have to include all the io_xxxx.c and disc_io.c or it doesn't compile. Shouldn't this be done within the library, or made so the code needing them isn't included if they're not?

Finally, small change at the start of gba_nds_fat.h, to make it easier to use the same copy for multiple apps:
Code:
// Maximum number of files open at once
// Increase this to open more files, decrease to save memory
#ifndef MAX_FILES_OPEN
#define MAX_FILES_OPEN   4
#endif

// Allow file writing
// Disable this to remove file writing support
#ifndef NO_FILE_WRITE
#define CAN_WRITE_TO_DISC
#endif

#81458 - chishm - Sat Apr 29, 2006 7:19 am

Thanks for the heads up. The FAT_ftell problem is tricky, since files can be up to 4GB in size, needing a u32 to store the position.

The disc_io and io_???? files should be compiled with the project, without including the C files in your code. To do this, make sure the gba_nds_fat directory is in the list of sources in your makefile.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com