Read CD-i filesystem.

This commit is contained in:
2019-07-31 17:44:51 +01:00
parent c9bbf22e18
commit 838b5f8307
2 changed files with 20 additions and 7 deletions

View File

@@ -69,9 +69,10 @@ namespace DiscImageChef.Filesystems.ISO9660
long sizeInSectors = (size + offsetInSector) / 2048;
if((size + offsetInSector) % 2048 > 0) sizeInSectors++;
MemoryStream ms = new MemoryStream();
byte[] buffer = ReadSectors((ulong)(entry.Extent + firstSector), (uint)sizeInSectors);
// No need to check mode, if we know it is CD-DA
byte[] buffer = entry.CdiSystemArea?.attributes.HasFlag(CdiAttributes.DigitalAudio) == true
? image.ReadSectors((ulong)(entry.Extent + firstSector), (uint)sizeInSectors)
: ReadSectors((ulong)(entry.Extent + firstSector), (uint)sizeInSectors);
buf = new byte[size];
Array.Copy(buffer, offsetInSector, buf, 0, size);
@@ -202,6 +203,18 @@ namespace DiscImageChef.Filesystems.ISO9660
if(entry.XattrLength == 0 || cdi || highSierra) return Errno.NoError;
if(entry.CdiSystemArea != null)
{
stat.UID = entry.CdiSystemArea.Value.owner;
stat.GID = entry.CdiSystemArea.Value.group;
if(entry.CdiSystemArea.Value.attributes.HasFlag(CdiAttributes.GroupExecute)) stat.Mode |= 8;
if(entry.CdiSystemArea.Value.attributes.HasFlag(CdiAttributes.GroupRead)) stat.Mode |= 32;
if(entry.CdiSystemArea.Value.attributes.HasFlag(CdiAttributes.OtherExecute)) stat.Mode |= 1;
if(entry.CdiSystemArea.Value.attributes.HasFlag(CdiAttributes.OtherRead)) stat.Mode |= 4;
if(entry.CdiSystemArea.Value.attributes.HasFlag(CdiAttributes.OwnerExecute)) stat.Mode |= 64;
if(entry.CdiSystemArea.Value.attributes.HasFlag(CdiAttributes.OwnerRead)) stat.Mode |= 256;
}
// TODO: XA
uint eaSizeInSectors = (uint)(entry.XattrLength / 2048);
if(entry.XattrLength % 2048 > 0) eaSizeInSectors++;

View File

@@ -202,7 +202,7 @@ namespace DiscImageChef.Filesystems.ISO9660
uint pathTableSizeInSectors = 0;
uint pathTableMsbLocation;
uint pathTableLsbLocation;
uint pathTableLsbLocation = 0; // Initialize to 0 as ignored in CD-i
image = imagePlugin;
@@ -231,9 +231,6 @@ namespace DiscImageChef.Filesystems.ISO9660
// TODO: Until escape sequences are implemented this is the default CD-i encoding.
Encoding = Encoding.GetEncoding("iso8859-1");
// TODO: Implement CD-i
return Errno.NotImplemented;
}
else
{
@@ -295,6 +292,9 @@ namespace DiscImageChef.Filesystems.ISO9660
useTransTbl = false;
}
// In case the path table is incomplete
if(usePathTable && pathTableData.Length == 1) usePathTable = false;
if(rootLocation + rootSize >= imagePlugin.Info.Sectors) return Errno.InvalidArgument;
byte[] rootDir = ReadSectors(rootLocation, rootSize);