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 = "";
|
information = "";
|
||||||
if(imagePlugin.Info.SectorSize < 512) return;
|
if(imagePlugin.Info.SectorSize < 512) return;
|
||||||
|
|
||||||
|
bool bigEndian = true;
|
||||||
|
|
||||||
byte[] sector = imagePlugin.ReadSector(partition.Start);
|
byte[] sector = imagePlugin.ReadSector(partition.Start);
|
||||||
|
|
||||||
Superblock fatxSb = Marshal.ByteArrayToStructureBigEndian<Superblock>(sector);
|
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;
|
if(fatxSb.magic != FATX_MAGIC) return;
|
||||||
|
|
||||||
@@ -79,12 +85,21 @@ namespace DiscImageChef.Filesystems.FATX
|
|||||||
.AppendLine();
|
.AppendLine();
|
||||||
sb.AppendFormat("Root directory starts on cluster {0}", fatxSb.rootDirectoryCluster).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();
|
information = sb.ToString();
|
||||||
|
|
||||||
XmlFsType = new FileSystemType
|
XmlFsType = new FileSystemType
|
||||||
{
|
{
|
||||||
Type = "FATX filesystem",
|
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 /
|
XmlFsType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize /
|
||||||
(ulong)XmlFsType.ClusterSize);
|
(ulong)XmlFsType.ClusterSize);
|
||||||
|
|||||||
@@ -39,11 +39,13 @@ namespace DiscImageChef.Filesystems.FATX
|
|||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
struct Superblock
|
struct Superblock
|
||||||
{
|
{
|
||||||
public uint magic;
|
public uint magic;
|
||||||
public uint id;
|
public uint id;
|
||||||
public uint sectorsPerCluster;
|
public uint sectorsPerCluster;
|
||||||
public uint rootDirectoryCluster;
|
public uint rootDirectoryCluster;
|
||||||
public ushort unknown;
|
// TODO: Undetermined size
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||||
|
public byte[] volumeLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
|||||||
Reference in New Issue
Block a user