mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Support FATX volume label.
This commit is contained in:
@@ -58,11 +58,17 @@ namespace DiscImageChef.Filesystems.FATX
|
||||
information = "";
|
||||
if(imagePlugin.Info.SectorSize < 512) return;
|
||||
|
||||
bool bigEndian = true;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSector(partition.Start);
|
||||
|
||||
Superblock fatxSb = Marshal.ByteArrayToStructureBigEndian<Superblock>(sector);
|
||||
|
||||
if(fatxSb.magic == FATX_CIGAM) fatxSb = Marshal.ByteArrayToStructureLittleEndian<Superblock>(sector);
|
||||
if(fatxSb.magic == FATX_CIGAM)
|
||||
{
|
||||
fatxSb = Marshal.ByteArrayToStructureLittleEndian<Superblock>(sector);
|
||||
bigEndian = false;
|
||||
}
|
||||
|
||||
if(fatxSb.magic != FATX_MAGIC) return;
|
||||
|
||||
@@ -79,12 +85,21 @@ namespace DiscImageChef.Filesystems.FATX
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Root directory starts on cluster {0}", fatxSb.rootDirectoryCluster).AppendLine();
|
||||
|
||||
string volumeLabel = StringHandlers.CToString(fatxSb.volumeLabel,
|
||||
bigEndian ? Encoding.BigEndianUnicode : Encoding.Unicode,
|
||||
true);
|
||||
|
||||
sb.AppendFormat("Volume label: {0}", volumeLabel).AppendLine();
|
||||
|
||||
information = sb.ToString();
|
||||
|
||||
XmlFsType = new FileSystemType
|
||||
{
|
||||
Type = "FATX filesystem",
|
||||
ClusterSize = (int)(fatxSb.sectorsPerCluster * imagePlugin.Info.SectorSize)
|
||||
ClusterSize =
|
||||
(int)(fatxSb.sectorsPerCluster * logicalSectorsPerPhysicalSectors *
|
||||
imagePlugin.Info.SectorSize),
|
||||
VolumeName = volumeLabel
|
||||
};
|
||||
XmlFsType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize /
|
||||
(ulong)XmlFsType.ClusterSize);
|
||||
|
||||
@@ -43,7 +43,9 @@ namespace DiscImageChef.Filesystems.FATX
|
||||
public uint id;
|
||||
public uint sectorsPerCluster;
|
||||
public uint rootDirectoryCluster;
|
||||
public ushort unknown;
|
||||
// TODO: Undetermined size
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public byte[] volumeLabel;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
|
||||
Reference in New Issue
Block a user