mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-30 15:14:18 +01:00
- just minor clean up
This commit is contained in:
parent
6b37a3c362
commit
8b2bacf223
@ -52,27 +52,23 @@ void DeviceHandler::SetMountUSB(bool using_usb)
|
|||||||
mount_usb = using_usb;
|
mount_usb = using_usb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceHandler::SetModes()
|
||||||
|
{
|
||||||
|
sdhc_mode_sd = 1;// use libogc and ios 58 (wiisd_libogc.c)
|
||||||
|
usb_libogc_mode = 1;// use libogc and ios 58 (usbstorage_libogc.c)
|
||||||
|
if(CustomIOS(CurrentIOS.Type))// if wiiflow is using a cios (force cios is on)
|
||||||
|
{
|
||||||
|
usb_libogc_mode = 0;// use cios for USB (usbstorage.c)
|
||||||
|
sdhc_mode_sd = 0;// use cios for SD (sdhc.c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceHandler::MountAll()
|
void DeviceHandler::MountAll()
|
||||||
{
|
{
|
||||||
MountSD();
|
MountSD();
|
||||||
MountAllUSB();
|
MountAllUSB();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandler::UnMountAll()
|
|
||||||
{
|
|
||||||
/* Kill possible USB thread */
|
|
||||||
//KillUSBKeepAliveThread();
|
|
||||||
|
|
||||||
for(u32 i = SD; i < MAXDEVICES; i++)
|
|
||||||
UnMount(i);
|
|
||||||
USBStorage2_Deinit();
|
|
||||||
USB_Deinitialize();
|
|
||||||
SDHC_Close();
|
|
||||||
|
|
||||||
sd.Cleanup();
|
|
||||||
usb.Cleanup();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeviceHandler::Mount(int dev)
|
bool DeviceHandler::Mount(int dev)
|
||||||
{
|
{
|
||||||
if(dev == SD)
|
if(dev == SD)
|
||||||
@ -84,35 +80,6 @@ bool DeviceHandler::Mount(int dev)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceHandler::IsInserted(int dev)
|
|
||||||
{
|
|
||||||
if(dev == SD)
|
|
||||||
return SD_Inserted() && sd.IsMounted(0);
|
|
||||||
else if(dev >= USB1 && dev <= USB8)
|
|
||||||
return usb.IsMounted(dev-USB1);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeviceHandler::UnMount(int dev)
|
|
||||||
{
|
|
||||||
if(dev == SD)
|
|
||||||
UnMountSD();
|
|
||||||
else if(dev >= USB1 && dev <= USB8)
|
|
||||||
UnMountUSB(dev-USB1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeviceHandler::SetModes()
|
|
||||||
{
|
|
||||||
sdhc_mode_sd = 1;// use libogc and ios 58 (wiisd_libogc.c)
|
|
||||||
usb_libogc_mode = 1;// use libogc and ios 58 (usbstorage_libogc.c)
|
|
||||||
if(CustomIOS(CurrentIOS.Type))// if wiiflow is using a cios (force cios is on)
|
|
||||||
{
|
|
||||||
usb_libogc_mode = 0;// use cios for USB (usbstorage.c)
|
|
||||||
sdhc_mode_sd = 0;// use cios for SD (sdhc.c)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeviceHandler::MountSD()
|
bool DeviceHandler::MountSD()
|
||||||
{
|
{
|
||||||
if(!sd.IsInserted() || !sd.IsMounted(0))
|
if(!sd.IsInserted() || !sd.IsMounted(0))
|
||||||
@ -128,7 +95,7 @@ bool DeviceHandler::MountSD()
|
|||||||
}
|
}
|
||||||
sd.SetDevice(&__io_sdhc);
|
sd.SetDevice(&__io_sdhc);
|
||||||
//! Mount only one SD Partition
|
//! Mount only one SD Partition
|
||||||
return sd.Mount(0, DeviceName[SD], true); /* Force FAT */
|
return sd.Mount(0, DeviceName[SD], true); /* Force FAT, SD cards should always be FAT */
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -147,12 +114,15 @@ bool DeviceHandler::MountAllUSB()
|
|||||||
|
|
||||||
/* Kill possible USB thread */
|
/* Kill possible USB thread */
|
||||||
//KillUSBKeepAliveThread();
|
//KillUSBKeepAliveThread();
|
||||||
|
|
||||||
/* usb spinup - Wait for our slowass HDD */
|
/* usb spinup - Wait for our slowass HDD */
|
||||||
if(WaitForDevice(GetUSBInterface()) == false)
|
if(WaitForDevice(GetUSBInterface()) == false)
|
||||||
return false;
|
return false;// failed to spin up in time or no USB HDD connected
|
||||||
/* Get Partitions and Mount them */
|
|
||||||
if(!usb.IsInserted() || !usb.IsMounted(0))
|
if(!usb.IsInserted() || !usb.IsMounted(0))
|
||||||
usb.SetDevice(GetUSBInterface());
|
usb.SetDevice(GetUSBInterface());
|
||||||
|
|
||||||
|
/* Get Partitions and Mount them */
|
||||||
bool result = false;
|
bool result = false;
|
||||||
int partCount = GetUSBPartitionCount();
|
int partCount = GetUSBPartitionCount();
|
||||||
for(int i = 0; i < partCount; i++)
|
for(int i = 0; i < partCount; i++)
|
||||||
@ -160,14 +130,49 @@ bool DeviceHandler::MountAllUSB()
|
|||||||
if(MountUSB(i))
|
if(MountUSB(i))
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
// why force FAT? why not just return result?
|
// in case no partition is mounted for some strange reason, we force mount the first partition to FAT
|
||||||
if(!result)
|
if(!result)
|
||||||
result = usb.Mount(0, DeviceName[USB1], true); /* Force FAT */
|
result = usb.Mount(0, DeviceName[USB1], true); /* Force FAT */
|
||||||
|
|
||||||
//if(result && usb_libogc_mode)
|
//if(result && usb_libogc_mode)
|
||||||
// CreateUSBKeepAliveThread();
|
// CreateUSBKeepAliveThread();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DeviceHandler::IsInserted(int dev)
|
||||||
|
{
|
||||||
|
if(dev == SD)
|
||||||
|
return sd.IsInserted() && sd.IsMounted(0);
|
||||||
|
else if(dev >= USB1 && dev <= USB8)
|
||||||
|
return usb.IsMounted(dev-USB1);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceHandler::UnMount(int dev)
|
||||||
|
{
|
||||||
|
if(dev == SD)
|
||||||
|
UnMountSD();
|
||||||
|
else if(dev >= USB1 && dev <= USB8)
|
||||||
|
UnMountUSB(dev-USB1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceHandler::UnMountAll()
|
||||||
|
{
|
||||||
|
/* Kill possible USB thread */
|
||||||
|
//KillUSBKeepAliveThread();
|
||||||
|
|
||||||
|
for(u32 i = SD; i < MAXDEVICES; i++)
|
||||||
|
UnMount(i);
|
||||||
|
USBStorage2_Deinit();
|
||||||
|
USB_Deinitialize();
|
||||||
|
SDHC_Close();
|
||||||
|
|
||||||
|
sd.Cleanup();
|
||||||
|
usb.Cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceHandler::UnMountUSB(int pos)
|
void DeviceHandler::UnMountUSB(int pos)
|
||||||
{
|
{
|
||||||
if(pos >= GetUSBPartitionCount())
|
if(pos >= GetUSBPartitionCount())
|
||||||
|
@ -1175,7 +1175,7 @@ void CMenu::_launchWii(dir_discHdr *hdr, bool dvd, bool disc_cfg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
emulate_mode = 0;//sets to off if we are using neek2o or launching a DVD game
|
emulate_mode = 0;//sets to off if we are launching a DVD game
|
||||||
|
|
||||||
// this is a temporary region change of real nand(rn) if 'tempregionrn' is set true.
|
// this is a temporary region change of real nand(rn) if 'tempregionrn' is set true.
|
||||||
// added by overjoy but he never added a gamesettings option. must be set by editing wiiflow_lite.ini.
|
// added by overjoy but he never added a gamesettings option. must be set by editing wiiflow_lite.ini.
|
||||||
|
Loading…
Reference in New Issue
Block a user