Add support for Human68k 18.3 filenames in FAT.

This commit is contained in:
2019-04-28 18:12:44 +01:00
parent baf6f46eb2
commit 2d660035a9
5 changed files with 94 additions and 18 deletions

View File

@@ -867,6 +867,22 @@ namespace DiscImageChef.Filesystems.FAT
public readonly uint size;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct HumanDirectoryEntry
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] name1;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] extension;
public readonly FatAttributes attributes;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public readonly byte[] name2;
public readonly ushort mtime;
public readonly ushort mdate;
public readonly ushort start_cluster;
public readonly uint size;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct LfnEntry
{
@@ -897,17 +913,22 @@ namespace DiscImageChef.Filesystems.FAT
class CompleteDirectoryEntry
{
public DirectoryEntry Dirent;
public DirectoryEntry Fat32Ea;
public string Lfn;
public string Longname;
public string Shortname;
public DirectoryEntry Dirent;
public DirectoryEntry Fat32Ea;
public HumanDirectoryEntry HumanDirent;
public string HumanName;
public string Lfn;
public string Longname;
public string Shortname;
public override string ToString()
{
// This ensures LFN takes preference when eCS is in use
if(!string.IsNullOrEmpty(Lfn)) return Lfn;
// This ensures Humans takes preference when present
if(!string.IsNullOrEmpty(HumanName)) return HumanName;
return !string.IsNullOrEmpty(Longname) ? Longname : Shortname;
}
}