Talk:Libfat

From WiiBrew
Jump to navigation Jump to search

'fatInitDefault' and 'USB_OpenDevice' Not Playing Well Together

'USB_OpenDevice' works well on its own, but whenever I use 'fatInitDefault' (or 'fatInit') somewhere, all calls to 'USB_OpenDevice' after that fail. I am using the latest version of libogc and devkitpro. Anyone know what's wrong? --PunMaster 18:45, 27 December 2008 (UTC)

Yes, that's a known bug. If possible do your libfat initialization after your other USB calls. --Tantric 21:46, 27 December 2008 (UTC)
I've put together the following code, which will mount the SD card without touching USB. If all you need to access is the SD card, this code can be used in place of 'fatInit' (while preserving USB functionality). After that, just access files as 'sd:/...'. --PunMaster 04:10, 28 December 2008 (UTC)
#include <sdcard/wiisd_io.h>
#include <fat.h>

// ...

void SDCard_Init()
{
    __io_wiisd.startup();
    fatMountSimple("sd", &__io_wiisd);
}


libfat and mkdir

I'm seeing something strange when I make directories on my sdcard with my homebrew. I'm just calling 'mkdir (path, 0777)'. It seems to work just fine, but when I look at the sdcard in XP or Vista and do a 'dir' I see:

The parameter is incorrect.
01/15/2009  02:15 AM    <DIR>          saves

Any ideas? Other directories and files that were created on the PC don't show this error. Also, a 'chkdsk' doesn't reveal any issues.