2009-05-15 22:03:19 +02:00
|
|
|
#include <fat.h>
|
2009-06-10 01:26:03 +02:00
|
|
|
#include <string.h>
|
2009-05-15 22:03:19 +02:00
|
|
|
#include <ogc/lwp_watchdog.h>
|
|
|
|
#include <ogc/mutex.h>
|
2009-05-19 02:46:14 +02:00
|
|
|
#include <ogc/system.h>
|
2009-05-15 22:03:19 +02:00
|
|
|
#include <ogc/usbstorage.h>
|
|
|
|
#include <sdcard/wiisd_io.h>
|
2009-06-13 02:24:36 +02:00
|
|
|
|
|
|
|
#include "usbloader/usbstorage.h"
|
2009-05-15 22:03:19 +02:00
|
|
|
|
2009-06-01 19:50:42 +02:00
|
|
|
//these are the only stable and speed is good
|
2009-06-14 14:59:38 +02:00
|
|
|
#define CACHE 8
|
|
|
|
#define SECTORS 64
|
2009-05-15 22:03:19 +02:00
|
|
|
|
|
|
|
int USBDevice_Init()
|
|
|
|
{
|
2009-06-01 17:50:18 +02:00
|
|
|
//closing all open Files write back the cache and then shutdown em!
|
|
|
|
fatUnmount("USB:/");
|
2009-06-10 01:26:03 +02:00
|
|
|
//right now mounts first FAT-partition
|
2009-07-03 00:04:47 +02:00
|
|
|
if (fatMount("USB", &__io_wiiums, 0, CACHE, SECTORS)) {
|
2009-06-10 13:27:19 +02:00
|
|
|
//try first mount with cIOS
|
2009-06-10 01:26:03 +02:00
|
|
|
return 1;
|
2009-07-03 00:04:47 +02:00
|
|
|
} else if (fatMount("USB", &__io_usbstorage, 0, CACHE, SECTORS)) {
|
2009-06-10 13:27:19 +02:00
|
|
|
//try now mount with libogc
|
2009-06-01 17:50:18 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return -1;
|
2009-05-15 22:03:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void USBDevice_deInit()
|
|
|
|
{
|
2009-06-01 17:50:18 +02:00
|
|
|
//closing all open Files write back the cache and then shutdown em!
|
|
|
|
fatUnmount("USB:/");
|
2009-05-15 22:03:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int isSdInserted()
|
|
|
|
{
|
|
|
|
return __io_wiisd.isInserted();
|
|
|
|
}
|
|
|
|
|
2009-06-10 01:26:03 +02:00
|
|
|
int isInserted(const char *path)
|
|
|
|
{
|
|
|
|
if(!strncmp(path, "USB:", 4))
|
|
|
|
return 1;
|
2009-07-05 08:39:56 +02:00
|
|
|
|
|
|
|
return __io_wiisd.isInserted();
|
2009-06-10 01:26:03 +02:00
|
|
|
}
|
2009-05-15 22:03:19 +02:00
|
|
|
int SDCard_Init()
|
|
|
|
{
|
2009-06-01 17:50:18 +02:00
|
|
|
//closing all open Files write back the cache and then shutdown em!
|
|
|
|
fatUnmount("SD:/");
|
2009-06-10 01:26:03 +02:00
|
|
|
//right now mounts first FAT-partition
|
2009-07-03 00:04:47 +02:00
|
|
|
if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS))
|
2009-06-01 17:50:18 +02:00
|
|
|
return 1;
|
|
|
|
return -1;
|
2009-05-15 22:03:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void SDCard_deInit()
|
|
|
|
{
|
2009-06-01 17:50:18 +02:00
|
|
|
//closing all open Files write back the cache and then shutdown em!
|
|
|
|
fatUnmount("SD:/");
|
2009-05-15 22:03:19 +02:00
|
|
|
}
|