Decode Amiga extensions to ISO9660.

This commit is contained in:
2019-07-28 17:29:45 +01:00
parent f761df9fc9
commit 282781cfd1
4 changed files with 63 additions and 0 deletions

View File

@@ -390,6 +390,44 @@ namespace DiscImageChef.Filesystems.ISO9660
// All of these follow the SUSP indication of 2 bytes for signature 1 byte for length
case AAIP_MAGIC:
case AMIGA_MAGIC:
AmigaEntry amiga =
Marshal.ByteArrayToStructureBigEndian<AmigaEntry>(data, systemAreaOff,
Marshal.SizeOf<AmigaEntry>());
int protectionLength = 0;
if(amiga.flags.HasFlag(AmigaFlags.Protection))
{
entry.AmigaProtection =
Marshal.ByteArrayToStructureBigEndian<AmigaProtection>(data,
systemAreaOff +
Marshal.SizeOf<AmigaEntry>(),
Marshal
.SizeOf<AmigaProtection>());
protectionLength = Marshal.SizeOf<AmigaProtection>();
}
if(amiga.flags.HasFlag(AmigaFlags.Comment))
{
if(entry.AmigaComment is null) entry.AmigaComment = new byte[0];
byte[] newComment = new byte[entry.AmigaComment.Length +
data
[systemAreaOff + Marshal.SizeOf<AmigaEntry>() + protectionLength] -
1];
Array.Copy(entry.AmigaComment, 0, newComment, 0, entry.AmigaComment.Length);
Array.Copy(data, systemAreaOff + Marshal.SizeOf<AmigaEntry>() + protectionLength,
newComment, entry.AmigaComment.Length,
data[systemAreaOff + Marshal.SizeOf<AmigaEntry>() + protectionLength] - 1);
entry.AmigaComment = newComment;
}
systemAreaOff += amiga.length;
break;
case RRIP_MAGIC:
case RRIP_POSIX_ATTRIBUTES:
case RRIP_POSIX_DEV_NO:

View File

@@ -132,6 +132,21 @@ namespace DiscImageChef.Filesystems.ISO9660
stat.Inode = entry.XA.Value.filenumber;
}
if(entry.AmigaProtection != null)
{
if(entry.AmigaProtection.Value.Multiuser.HasFlag(AmigaMultiuser.GroupExec)) stat.Mode |= 8;
if(entry.AmigaProtection.Value.Multiuser.HasFlag(AmigaMultiuser.GroupRead)) stat.Mode |= 32;
if(entry.AmigaProtection.Value.Multiuser.HasFlag(AmigaMultiuser.GroupWrite)) stat.Mode |= 16;
if(entry.AmigaProtection.Value.Multiuser.HasFlag(AmigaMultiuser.OtherExec)) stat.Mode |= 1;
if(entry.AmigaProtection.Value.Multiuser.HasFlag(AmigaMultiuser.OtherRead)) stat.Mode |= 4;
if(entry.AmigaProtection.Value.Multiuser.HasFlag(AmigaMultiuser.OtherWrite)) stat.Mode |= 2;
if(entry.AmigaProtection.Value.Protection.HasFlag(AmigaAttributes.OwnerExec)) stat.Mode |= 64;
if(entry.AmigaProtection.Value.Protection.HasFlag(AmigaAttributes.OwnerRead)) stat.Mode |= 256;
if(entry.AmigaProtection.Value.Protection.HasFlag(AmigaAttributes.OwnerWrite)) stat.Mode |= 128;
if(entry.AmigaProtection.Value.Protection.HasFlag(AmigaAttributes.Archive))
stat.Attributes |= FileAttributes.Archive;
}
if(entry.AssociatedFile is null || entry.AssociatedFile.Extent == 0 || entry.AssociatedFile.Size == 0)
return Errno.NoError;

View File

@@ -57,6 +57,8 @@ namespace DiscImageChef.Filesystems.ISO9660
class DecodedDirectoryEntry
{
public byte[] AmigaComment;
public AmigaProtection? AmigaProtection;
public byte? AppleDosType;
public byte[] AppleIcon;
public ushort? AppleProDosType;

View File

@@ -22,6 +22,7 @@ namespace DiscImageChef.Filesystems.ISO9660
if(entry.ResourceFork != null) xattrs.Add("com.apple.ResourceFork");
if(entry.FinderInfo != null) xattrs.Add("com.apple.FinderInfo");
if(entry.AppleIcon != null) xattrs.Add("com.apple.Macintosh.Icon");
if(entry.AmigaComment != null) xattrs.Add("com.amiga.comments");
return Errno.NoError;
}
@@ -115,6 +116,13 @@ namespace DiscImageChef.Filesystems.ISO9660
buf = new byte[entry.AppleIcon.Length];
Array.Copy(entry.AppleIcon, 0, buf, 0, entry.AppleIcon.Length);
return Errno.NoError;
case "com.amiga.comments":
if(entry.AmigaComment is null) return Errno.NoSuchExtendedAttribute;
buf = new byte[entry.AmigaComment.Length];
Array.Copy(entry.AmigaComment, 0, buf, 0, entry.AmigaComment.Length);
return Errno.NoError;
default: return Errno.NoSuchExtendedAttribute;
}