mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-03 18:15:06 +01:00
30535c6f5d
formatted the code to make it easier to read. no functional changes at all. i didn't put anything from the libwiigui folder or banner folder in the beautifier. my automated .bat seems to have done a good job. the only places i see it fucked up was on (GXColor){blablabla}. it treated the brackets in the color like all the other brackets and put the color on a new line and indented it. i think i fixed most of them. not sure if it messed up anywhere else. also not sure about how it handled different linebreaks. it looks fine on windows. if it looks messed up on linux, it can be reverted. the code still compiles and runs fine.
57 lines
1.4 KiB
C
57 lines
1.4 KiB
C
#include <fat.h>
|
|
#include <string.h>
|
|
#include <ogc/lwp_watchdog.h>
|
|
#include <ogc/mutex.h>
|
|
#include <ogc/system.h>
|
|
#include <ogc/usbstorage.h>
|
|
#include <sdcard/wiisd_io.h>
|
|
|
|
#include "usbloader/usbstorage.h"
|
|
|
|
//these are the only stable and speed is good
|
|
#define CACHE 8
|
|
#define SECTORS 64
|
|
|
|
int USBDevice_Init() {
|
|
//closing all open Files write back the cache and then shutdown em!
|
|
fatUnmount("USB:/");
|
|
//right now mounts first FAT-partition
|
|
if (fatMount("USB", &__io_wiiums, 0, CACHE, SECTORS)) {
|
|
//try first mount with cIOS
|
|
return 1;
|
|
} else if (fatMount("USB", &__io_usbstorage, 0, CACHE, SECTORS)) {
|
|
//try now mount with libogc
|
|
return 1;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
void USBDevice_deInit() {
|
|
//closing all open Files write back the cache and then shutdown em!
|
|
fatUnmount("USB:/");
|
|
}
|
|
|
|
int isSdInserted() {
|
|
return __io_wiisd.isInserted();
|
|
}
|
|
|
|
int isInserted(const char *path) {
|
|
if (!strncmp(path, "USB:", 4))
|
|
return 1;
|
|
|
|
return __io_wiisd.isInserted();
|
|
}
|
|
int SDCard_Init() {
|
|
//closing all open Files write back the cache and then shutdown em!
|
|
fatUnmount("SD:/");
|
|
//right now mounts first FAT-partition
|
|
if (fatMount("SD", &__io_wiisd, 0, CACHE, SECTORS))
|
|
return 1;
|
|
return -1;
|
|
}
|
|
|
|
void SDCard_deInit() {
|
|
//closing all open Files write back the cache and then shutdown em!
|
|
fatUnmount("SD:/");
|
|
}
|