Read Xbox FAT root directory.

This commit is contained in:
2019-04-07 13:31:27 +01:00
parent 6d43c83712
commit c25d37b3c2
4 changed files with 97 additions and 11 deletions

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.Filesystems.FATX
@@ -67,5 +68,35 @@ namespace DiscImageChef.Filesystems.FATX
throw new NotImplementedException();
}
uint[] GetClusters(uint startCluster)
{
if(startCluster == 0) return null;
if(fat16 is null)
{
if(startCluster >= fat32.Length) return null;
}
else if(startCluster >= fat16.Length) return null;
List<uint> clusters = new List<uint>();
uint nextCluster = startCluster;
if(fat16 is null)
while((nextCluster & FAT32_MASK) > 0 && (nextCluster & FAT32_MASK) <= FAT32_BAD)
{
clusters.Add(nextCluster);
nextCluster = fat32[nextCluster];
}
else
while(nextCluster > 0 && nextCluster <= FAT16_BAD)
{
clusters.Add(nextCluster);
nextCluster = fat16[nextCluster];
}
return clusters.ToArray();
}
}
}