mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-30 07:04:17 +01:00
- possible fix for GPT drives with partition types other than FAT (NTFS, EXT2).
This commit is contained in:
parent
57e7e64b1f
commit
1989cb3222
BIN
out/boot.dol
BIN
out/boot.dol
Binary file not shown.
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
@ -119,10 +119,11 @@ bool DeviceHandler::MountAllUSB()
|
|||||||
if(WaitForDevice(GetUSBInterface()) == false)
|
if(WaitForDevice(GetUSBInterface()) == false)
|
||||||
return false;// failed to spin up in time or no USB HDD connected
|
return false;// failed to spin up in time or no USB HDD connected
|
||||||
|
|
||||||
|
/* calls FindPartitions() to read MBR and get list of partitions from MBR */
|
||||||
if(!usb.IsInserted() || !usb.IsMounted(0))
|
if(!usb.IsInserted() || !usb.IsMounted(0))
|
||||||
usb.SetDevice(GetUSBInterface());
|
usb.SetDevice(GetUSBInterface());
|
||||||
|
|
||||||
/* Get Partitions and Mount them */
|
/* Mount partitions */
|
||||||
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++)
|
||||||
@ -134,6 +135,7 @@ bool DeviceHandler::MountAllUSB()
|
|||||||
if(!result)
|
if(!result)
|
||||||
result = usb.Mount(0, DeviceName[USB1], true); /* Force FAT */
|
result = usb.Mount(0, DeviceName[USB1], true); /* Force FAT */
|
||||||
|
|
||||||
|
/* if a partition is mounted and wiiflow is in iOS58 libogc mode then start the USBKeepAliveThread */
|
||||||
if(result && usb_libogc_mode)
|
if(result && usb_libogc_mode)
|
||||||
CreateUSBKeepAliveThread();
|
CreateUSBKeepAliveThread();
|
||||||
|
|
||||||
|
@ -122,16 +122,20 @@ bool PartitionHandle::IsMounted(int pos)
|
|||||||
|
|
||||||
bool PartitionHandle::Mount(int pos, const char *name, bool forceFAT)
|
bool PartitionHandle::Mount(int pos, const char *name, bool forceFAT)
|
||||||
{
|
{
|
||||||
if(valid(pos))
|
if(!valid(pos))
|
||||||
UnMount(pos);
|
return false;
|
||||||
|
|
||||||
if(!name || strlen(name) > 8)
|
if(!name || strlen(name) > 8)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
UnMount(pos);
|
||||||
|
|
||||||
if(pos >= (int)MountNameList.size())
|
if(pos >= (int)MountNameList.size())
|
||||||
MountNameList.resize(pos + 1);
|
MountNameList.resize(pos + 1);
|
||||||
|
|
||||||
MountNameList[pos] = name;
|
MountNameList[pos] = name;
|
||||||
|
|
||||||
|
/* this is used for the gprintf's */
|
||||||
char DeviceSyn[10];
|
char DeviceSyn[10];
|
||||||
strcpy(DeviceSyn, name);
|
strcpy(DeviceSyn, name);
|
||||||
strcat(DeviceSyn, ":");
|
strcat(DeviceSyn, ":");
|
||||||
@ -150,13 +154,11 @@ bool PartitionHandle::Mount(int pos, const char *name, bool forceFAT)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!valid(pos))
|
|
||||||
{
|
|
||||||
gprintf("No valid partition position found! Failed to mount any partition.\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetWbfsHandle(pos, NULL);
|
SetWbfsHandle(pos, NULL);// set this to NULL even if not a WBFS drive
|
||||||
|
|
||||||
|
// GPT drive partition FSName are first added as "GUID-Entry"
|
||||||
|
// Partition FSName is changed once we determine the partition type by trying to mount it
|
||||||
if(strncmp(GetFSName(pos), "FAT", 3) == 0 || strcmp(GetFSName(pos), "GUID-Entry") == 0)
|
if(strncmp(GetFSName(pos), "FAT", 3) == 0 || strcmp(GetFSName(pos), "GUID-Entry") == 0)
|
||||||
{
|
{
|
||||||
if(fatMount(MountNameList[pos].c_str(), interface, GetLBAStart(pos), CACHE, SECTORS))
|
if(fatMount(MountNameList[pos].c_str(), interface, GetLBAStart(pos), CACHE, SECTORS))
|
||||||
@ -166,7 +168,7 @@ bool PartitionHandle::Mount(int pos, const char *name, bool forceFAT)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(strncmp(GetFSName(pos), "NTFS", 4) == 0 || strcmp(GetFSName(pos), "GUID-Entry") == 0)
|
if(strncmp(GetFSName(pos), "NTFS", 4) == 0 || strcmp(GetFSName(pos), "GUID-Entry") == 0)
|
||||||
{
|
{
|
||||||
if(ntfsMount(MountNameList[pos].c_str(), interface, GetLBAStart(pos), CACHE, SECTORS, NTFS_SHOW_HIDDEN_FILES | NTFS_RECOVER))
|
if(ntfsMount(MountNameList[pos].c_str(), interface, GetLBAStart(pos), CACHE, SECTORS, NTFS_SHOW_HIDDEN_FILES | NTFS_RECOVER))
|
||||||
{
|
{
|
||||||
@ -175,7 +177,7 @@ bool PartitionHandle::Mount(int pos, const char *name, bool forceFAT)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(strncmp(GetFSName(pos), "LINUX", 5) == 0 || strcmp(GetFSName(pos), "GUID-Entry") == 0)
|
if(strncmp(GetFSName(pos), "LINUX", 5) == 0 || strcmp(GetFSName(pos), "GUID-Entry") == 0)
|
||||||
{
|
{
|
||||||
if(ext2Mount(MountNameList[pos].c_str(), interface, GetLBAStart(pos), CACHE, SECTORS, EXT2_FLAG_DEFAULT))
|
if(ext2Mount(MountNameList[pos].c_str(), interface, GetLBAStart(pos), CACHE, SECTORS, EXT2_FLAG_DEFAULT))
|
||||||
{
|
{
|
||||||
@ -184,7 +186,7 @@ bool PartitionHandle::Mount(int pos, const char *name, bool forceFAT)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(strncmp(GetFSName(pos), "WBFS", 4) == 0)
|
if(strncmp(GetFSName(pos), "WBFS", 4) == 0)
|
||||||
{
|
{
|
||||||
if(interface == &__io_usbstorage2_port0 || interface == &__io_usbstorage2_port1)
|
if(interface == &__io_usbstorage2_port0 || interface == &__io_usbstorage2_port1)
|
||||||
SetWbfsHandle(pos, wbfs_open_partition(__WBFS_ReadUSB, __WBFS_WriteUSB, NULL, USBStorage2_GetSectorSize(), GetSecCount(pos), GetLBAStart(pos), 0));
|
SetWbfsHandle(pos, wbfs_open_partition(__WBFS_ReadUSB, __WBFS_WriteUSB, NULL, USBStorage2_GetSectorSize(), GetSecCount(pos), GetLBAStart(pos), 0));
|
||||||
@ -193,12 +195,11 @@ bool PartitionHandle::Mount(int pos, const char *name, bool forceFAT)
|
|||||||
if(GetWbfsHandle(pos))
|
if(GetWbfsHandle(pos))
|
||||||
{
|
{
|
||||||
gprintf("WBFS Partition at %s mounted.\n", DeviceSyn);
|
gprintf("WBFS Partition at %s mounted.\n", DeviceSyn);
|
||||||
PartitionList[pos].FSName = "WBFS";
|
//PartitionList[pos].FSName = "WBFS";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* FAIL */
|
/* FAIL */
|
||||||
gprintf("Exhausted all supported filesystem types! Failed to mount any partition.\n");
|
|
||||||
MountNameList[pos].clear();
|
MountNameList[pos].clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user