diff --git a/DiscImageChef.Filesystems/FATX/Info.cs b/DiscImageChef.Filesystems/FATX/Info.cs index c79b0bdb6..51692303c 100644 --- a/DiscImageChef.Filesystems/FATX/Info.cs +++ b/DiscImageChef.Filesystems/FATX/Info.cs @@ -72,7 +72,7 @@ namespace DiscImageChef.Filesystems.FATX if(fatxSb.magic != FATX_MAGIC) return; - int logicalSectorsPerPhysicalSectors = partition.Offset == 0 ? 8 : 1; + int logicalSectorsPerPhysicalSectors = partition.Offset == 0 && !bigEndian ? 8 : 1; StringBuilder sb = new StringBuilder(); diff --git a/DiscImageChef.Filesystems/FATX/Super.cs b/DiscImageChef.Filesystems/FATX/Super.cs index 8dffb2295..df1a66b61 100644 --- a/DiscImageChef.Filesystems/FATX/Super.cs +++ b/DiscImageChef.Filesystems/FATX/Super.cs @@ -73,7 +73,7 @@ namespace DiscImageChef.Filesystems.FATX DicConsole.DebugWriteLine("Xbox FAT plugin", littleEndian ? "Filesystem is little endian" : "Filesystem is big endian"); - int logicalSectorsPerPhysicalSectors = partition.Offset == 0 ? 8 : 1; + int logicalSectorsPerPhysicalSectors = partition.Offset == 0 && littleEndian ? 8 : 1; DicConsole.DebugWriteLine("Xbox FAT plugin", "logicalSectorsPerPhysicalSectors = {0}", logicalSectorsPerPhysicalSectors); @@ -105,19 +105,19 @@ namespace DiscImageChef.Filesystems.FATX FreeBlocks = 0 // Requires traversing the FAT }; - DicConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.ClusterSize", XmlFsType.ClusterSize); - DicConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.VolumeName", XmlFsType.VolumeName); - DicConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.VolumeSerial", XmlFsType.VolumeSerial); - DicConsole.DebugWriteLine("Xbox FAT plugin", "stat.Blocks", statfs.Blocks); - DicConsole.DebugWriteLine("Xbox FAT plugin", "stat.FilenameLength", statfs.FilenameLength); - DicConsole.DebugWriteLine("Xbox FAT plugin", "stat.Id", statfs.Id); - DicConsole.DebugWriteLine("Xbox FAT plugin", "stat.Type", statfs.Type); + DicConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.ClusterSize: {0}", XmlFsType.ClusterSize); + DicConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.VolumeName: {0}", XmlFsType.VolumeName); + DicConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.VolumeSerial: {0}", XmlFsType.VolumeSerial); + DicConsole.DebugWriteLine("Xbox FAT plugin", "stat.Blocks: {0}", statfs.Blocks); + DicConsole.DebugWriteLine("Xbox FAT plugin", "stat.FilenameLength: {0}", statfs.FilenameLength); + DicConsole.DebugWriteLine("Xbox FAT plugin", "stat.Id: {0}", statfs.Id.Serial32); + DicConsole.DebugWriteLine("Xbox FAT plugin", "stat.Type: {0}", statfs.Type); byte[] buffer; fatStartSector = FAT_START / imagePlugin.Info.SectorSize + partition.Start; uint fatSize; - DicConsole.DebugWriteLine("Xbox FAT plugin", "fatStartSector", fatStartSector); + DicConsole.DebugWriteLine("Xbox FAT plugin", "fatStartSector: {0}", fatStartSector); if(statfs.Blocks > MAX_XFAT16_CLUSTERS) { @@ -125,6 +125,14 @@ namespace DiscImageChef.Filesystems.FATX fatSize = (uint)(statfs.Blocks * sizeof(uint) / imagePlugin.Info.SectorSize); if((uint)(statfs.Blocks * sizeof(uint) % imagePlugin.Info.SectorSize) > 0) fatSize++; + + if(!littleEndian) + { + long fatClusters = fatSize * imagePlugin.Info.SectorSize / XmlFsType.ClusterSize; + if(fatSize * imagePlugin.Info.SectorSize % XmlFsType.ClusterSize > 0) fatClusters++; + fatSize = (uint)(fatClusters * XmlFsType.ClusterSize / imagePlugin.Info.SectorSize); + } + DicConsole.DebugWriteLine("Xbox FAT plugin", "FAT is {0} sectors", fatSize); buffer = imagePlugin.ReadSectors(fatStartSector, fatSize); @@ -144,6 +152,14 @@ namespace DiscImageChef.Filesystems.FATX fatSize = (uint)(statfs.Blocks * sizeof(ushort) / imagePlugin.Info.SectorSize); if((uint)(statfs.Blocks * sizeof(ushort) % imagePlugin.Info.SectorSize) > 0) fatSize++; + + if(!littleEndian) + { + long fatClusters = fatSize * imagePlugin.Info.SectorSize / XmlFsType.ClusterSize; + if(fatSize * imagePlugin.Info.SectorSize % XmlFsType.ClusterSize > 0) fatClusters++; + fatSize = (uint)(fatClusters * XmlFsType.ClusterSize / imagePlugin.Info.SectorSize); + } + DicConsole.DebugWriteLine("Xbox FAT plugin", "FAT is {0} sectors", fatSize); buffer = imagePlugin.ReadSectors(fatStartSector, fatSize);