mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add root directory, volume descriptors, path tables and IP.BIN to ISO9660 debug root directory.
This commit is contained in:
@@ -72,6 +72,11 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
int hsOff = 0;
|
int hsOff = 0;
|
||||||
if(highSierra) hsOff = 8;
|
if(highSierra) hsOff = 8;
|
||||||
cdi = false;
|
cdi = false;
|
||||||
|
List<ulong> bvdSectors = new List<ulong>();
|
||||||
|
List<ulong> pvdSectors = new List<ulong>();
|
||||||
|
List<ulong> svdSectors = new List<ulong>();
|
||||||
|
List<ulong> evdSectors = new List<ulong>();
|
||||||
|
List<ulong> vpdSectors = new List<ulong>();
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
@@ -110,9 +115,7 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
bvd = Marshal.ByteArrayToStructureLittleEndian<BootRecord>(vdSector, hsOff, 2048 - hsOff);
|
if(debug) bvdSectors.Add(16 + counter + partition.Start);
|
||||||
|
|
||||||
// TODO: Add boot file to debug root directory
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -126,6 +129,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
fsvd = Marshal.ByteArrayToStructureBigEndian<FileStructureVolumeDescriptor>(vdSector);
|
fsvd = Marshal.ByteArrayToStructureBigEndian<FileStructureVolumeDescriptor>(vdSector);
|
||||||
else pvd = Marshal.ByteArrayToStructureLittleEndian<PrimaryVolumeDescriptor>(vdSector);
|
else pvd = Marshal.ByteArrayToStructureLittleEndian<PrimaryVolumeDescriptor>(vdSector);
|
||||||
|
|
||||||
|
if(debug) pvdSectors.Add(16 + counter + partition.Start);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,13 +149,19 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
else
|
else
|
||||||
DicConsole.WriteLine("ISO9660 plugin",
|
DicConsole.WriteLine("ISO9660 plugin",
|
||||||
"Found unknown supplementary volume descriptor");
|
"Found unknown supplementary volume descriptor");
|
||||||
|
if(debug) svdSectors.Add(16 + counter + partition.Start);
|
||||||
}
|
}
|
||||||
else if(useEvd)
|
else
|
||||||
{
|
{
|
||||||
// Basically until escape sequences are implemented, let the user chose the encoding.
|
if(debug) evdSectors.Add(16 + counter + partition.Start);
|
||||||
// This is the same as user chosing Romeo namespace, but using the EVD instead of the PVD
|
|
||||||
this.@namespace = Namespace.Romeo;
|
if(useEvd)
|
||||||
pvd = svd;
|
{
|
||||||
|
// Basically until escape sequences are implemented, let the user chose the encoding.
|
||||||
|
// This is the same as user chosing Romeo namespace, but using the EVD instead of the PVD
|
||||||
|
this.@namespace = Namespace.Romeo;
|
||||||
|
pvd = svd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -158,7 +169,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
// Unused
|
if(debug) vpdSectors.Add(16 + counter + partition.Start);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,6 +200,10 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
string fsFormat;
|
string fsFormat;
|
||||||
byte[] pathTableData;
|
byte[] pathTableData;
|
||||||
uint pathTableSizeInSectors = 0;
|
uint pathTableSizeInSectors = 0;
|
||||||
|
|
||||||
|
uint pathTableMsbLocation;
|
||||||
|
uint pathTableLsbLocation;
|
||||||
|
|
||||||
if(highSierra)
|
if(highSierra)
|
||||||
{
|
{
|
||||||
pathTableSizeInSectors = hsvd.Value.path_table_size / 2048;
|
pathTableSizeInSectors = hsvd.Value.path_table_size / 2048;
|
||||||
@@ -197,6 +213,9 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
imagePlugin.ReadSectors(Swapping.Swap(hsvd.Value.mandatory_path_table_msb), pathTableSizeInSectors);
|
imagePlugin.ReadSectors(Swapping.Swap(hsvd.Value.mandatory_path_table_msb), pathTableSizeInSectors);
|
||||||
|
|
||||||
fsFormat = "High Sierra Format";
|
fsFormat = "High Sierra Format";
|
||||||
|
|
||||||
|
pathTableMsbLocation = hsvd.Value.mandatory_path_table_msb;
|
||||||
|
pathTableLsbLocation = hsvd.Value.mandatory_path_table_lsb;
|
||||||
}
|
}
|
||||||
else if(cdi)
|
else if(cdi)
|
||||||
{
|
{
|
||||||
@@ -206,6 +225,9 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
pathTableData = imagePlugin.ReadSectors(fsvd.Value.path_table_addr, pathTableSizeInSectors);
|
pathTableData = imagePlugin.ReadSectors(fsvd.Value.path_table_addr, pathTableSizeInSectors);
|
||||||
|
|
||||||
fsFormat = "CD-i";
|
fsFormat = "CD-i";
|
||||||
|
|
||||||
|
pathTableMsbLocation = fsvd.Value.path_table_addr;
|
||||||
|
|
||||||
// TODO: Implement CD-i
|
// TODO: Implement CD-i
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
@@ -218,6 +240,9 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
imagePlugin.ReadSectors(Swapping.Swap(pvd.Value.type_m_path_table), pathTableSizeInSectors);
|
imagePlugin.ReadSectors(Swapping.Swap(pvd.Value.type_m_path_table), pathTableSizeInSectors);
|
||||||
|
|
||||||
fsFormat = "ISO9660";
|
fsFormat = "ISO9660";
|
||||||
|
|
||||||
|
pathTableMsbLocation = pvd.Value.type_m_path_table;
|
||||||
|
pathTableLsbLocation = pvd.Value.type_l_path_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
pathTable = highSierra ? DecodeHighSierraPathTable(pathTableData) : DecodePathTable(pathTableData);
|
pathTable = highSierra ? DecodeHighSierraPathTable(pathTableData) : DecodePathTable(pathTableData);
|
||||||
@@ -259,21 +284,18 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
if(rootEntry.size % fsvd.Value.logical_block_size > 0) rootSize++;
|
if(rootEntry.size % fsvd.Value.logical_block_size > 0) rootSize++;
|
||||||
|
|
||||||
usePathTable = true;
|
usePathTable = true;
|
||||||
useTransTbl = false;
|
useTransTbl = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rootLocation + rootSize >= imagePlugin.Info.Sectors) return Errno.InvalidArgument;
|
if(rootLocation + rootSize >= imagePlugin.Info.Sectors) return Errno.InvalidArgument;
|
||||||
|
|
||||||
byte[] rootDir = imagePlugin.ReadSectors(rootLocation, rootSize);
|
byte[] rootDir = imagePlugin.ReadSectors(rootLocation, rootSize);
|
||||||
|
|
||||||
byte[] ipbinSector = imagePlugin.ReadSector(0 + partition.Start);
|
byte[] ipbinSector = imagePlugin.ReadSector(partition.Start);
|
||||||
CD.IPBin? segaCd = CD.DecodeIPBin(ipbinSector);
|
CD.IPBin? segaCd = CD.DecodeIPBin(ipbinSector);
|
||||||
Saturn.IPBin? saturn = Saturn.DecodeIPBin(ipbinSector);
|
Saturn.IPBin? saturn = Saturn.DecodeIPBin(ipbinSector);
|
||||||
Dreamcast.IPBin? dreamcast = Dreamcast.DecodeIPBin(ipbinSector);
|
Dreamcast.IPBin? dreamcast = Dreamcast.DecodeIPBin(ipbinSector);
|
||||||
|
|
||||||
// TODO: Add IP.BIN to debug root directory
|
|
||||||
// TODO: Add volume descriptors to debug root directory
|
|
||||||
|
|
||||||
if(this.@namespace == Namespace.Joliet || this.@namespace == Namespace.Rrip)
|
if(this.@namespace == Namespace.Joliet || this.@namespace == Namespace.Rrip)
|
||||||
{
|
{
|
||||||
usePathTable = false;
|
usePathTable = false;
|
||||||
@@ -292,6 +314,117 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
|
|
||||||
XmlFsType.Type = fsFormat;
|
XmlFsType.Type = fsFormat;
|
||||||
|
|
||||||
|
if(debug)
|
||||||
|
{
|
||||||
|
rootDirectoryCache.Add("$",
|
||||||
|
new DecodedDirectoryEntry
|
||||||
|
{
|
||||||
|
Extent = rootLocation,
|
||||||
|
Filename = "$",
|
||||||
|
Size = 2048,
|
||||||
|
Timestamp = decodedVd.CreationTime
|
||||||
|
});
|
||||||
|
|
||||||
|
if(!cdi)
|
||||||
|
rootDirectoryCache.Add("$PATH_TABLE.LSB",
|
||||||
|
new DecodedDirectoryEntry
|
||||||
|
{
|
||||||
|
Extent = pathTableLsbLocation,
|
||||||
|
Filename = "$PATH_TABLE.LSB",
|
||||||
|
Size = (uint)pathTableData.Length,
|
||||||
|
Timestamp = decodedVd.CreationTime
|
||||||
|
});
|
||||||
|
|
||||||
|
rootDirectoryCache.Add("$PATH_TABLE.MSB",
|
||||||
|
new DecodedDirectoryEntry
|
||||||
|
{
|
||||||
|
Extent = pathTableMsbLocation,
|
||||||
|
Filename = "$PATH_TABLE.MSB",
|
||||||
|
Size = (uint)pathTableData.Length,
|
||||||
|
Timestamp = decodedVd.CreationTime
|
||||||
|
});
|
||||||
|
|
||||||
|
for(int i = 0; i < bvdSectors.Count; i++)
|
||||||
|
rootDirectoryCache.Add(i == 0 ? "$BOOT" : $"$BOOT_{i}",
|
||||||
|
new DecodedDirectoryEntry
|
||||||
|
{
|
||||||
|
Extent = (uint)i,
|
||||||
|
Filename = i == 0 ? "$BOOT" : $"$BOOT_{i}",
|
||||||
|
Size = 2048,
|
||||||
|
Timestamp = decodedVd.CreationTime
|
||||||
|
});
|
||||||
|
|
||||||
|
for(int i = 0; i < pvdSectors.Count; i++)
|
||||||
|
rootDirectoryCache.Add(i == 0 ? "$PVD" : $"$PVD{i}",
|
||||||
|
new DecodedDirectoryEntry
|
||||||
|
{
|
||||||
|
Extent = (uint)i,
|
||||||
|
Filename = i == 0 ? "$PVD" : $"PVD_{i}",
|
||||||
|
Size = 2048,
|
||||||
|
Timestamp = decodedVd.CreationTime
|
||||||
|
});
|
||||||
|
|
||||||
|
for(int i = 0; i < svdSectors.Count; i++)
|
||||||
|
rootDirectoryCache.Add(i == 0 ? "$SVD" : $"$SVD_{i}",
|
||||||
|
new DecodedDirectoryEntry
|
||||||
|
{
|
||||||
|
Extent = (uint)i,
|
||||||
|
Filename = i == 0 ? "$SVD" : $"$SVD_{i}",
|
||||||
|
Size = 2048,
|
||||||
|
Timestamp = decodedVd.CreationTime
|
||||||
|
});
|
||||||
|
|
||||||
|
for(int i = 0; i < evdSectors.Count; i++)
|
||||||
|
rootDirectoryCache.Add(i == 0 ? "$EVD" : $"$EVD_{i}",
|
||||||
|
new DecodedDirectoryEntry
|
||||||
|
{
|
||||||
|
Extent = (uint)i,
|
||||||
|
Filename = i == 0 ? "$EVD" : $"$EVD_{i}",
|
||||||
|
Size = 2048,
|
||||||
|
Timestamp = decodedVd.CreationTime
|
||||||
|
});
|
||||||
|
|
||||||
|
for(int i = 0; i < vpdSectors.Count; i++)
|
||||||
|
rootDirectoryCache.Add(i == 0 ? "$VPD" : $"$VPD_{i}",
|
||||||
|
new DecodedDirectoryEntry
|
||||||
|
{
|
||||||
|
Extent = (uint)i,
|
||||||
|
Filename = i == 0 ? "$VPD" : $"$VPD_{i}",
|
||||||
|
Size = 2048,
|
||||||
|
Timestamp = decodedVd.CreationTime
|
||||||
|
});
|
||||||
|
|
||||||
|
if(segaCd != null)
|
||||||
|
rootDirectoryCache.Add("$IP.BIN",
|
||||||
|
new DecodedDirectoryEntry
|
||||||
|
{
|
||||||
|
Extent = 0,
|
||||||
|
Filename = "$IP.BIN",
|
||||||
|
Size = (uint)Marshal.SizeOf<CD.IPBin>(),
|
||||||
|
Timestamp = decodedVd.CreationTime
|
||||||
|
});
|
||||||
|
|
||||||
|
if(saturn != null)
|
||||||
|
rootDirectoryCache.Add("$IP.BIN",
|
||||||
|
new DecodedDirectoryEntry
|
||||||
|
{
|
||||||
|
Extent = 0,
|
||||||
|
Filename = "$IP.BIN",
|
||||||
|
Size = (uint)Marshal.SizeOf<Saturn.IPBin>(),
|
||||||
|
Timestamp = decodedVd.CreationTime
|
||||||
|
});
|
||||||
|
|
||||||
|
if(dreamcast != null)
|
||||||
|
rootDirectoryCache.Add("$IP.BIN",
|
||||||
|
new DecodedDirectoryEntry
|
||||||
|
{
|
||||||
|
Extent = 0,
|
||||||
|
Filename = "$IP.BIN",
|
||||||
|
Size = (uint)Marshal.SizeOf<Dreamcast.IPBin>(),
|
||||||
|
Timestamp = decodedVd.CreationTime
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(jolietvd != null && (this.@namespace == Namespace.Joliet || this.@namespace == Namespace.Rrip))
|
if(jolietvd != null && (this.@namespace == Namespace.Joliet || this.@namespace == Namespace.Rrip))
|
||||||
{
|
{
|
||||||
rootLocation = jolietvd.Value.root_directory_record.extent;
|
rootLocation = jolietvd.Value.root_directory_record.extent;
|
||||||
|
|||||||
Reference in New Issue
Block a user