mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Reverse engineered S-Records, use them. They are a must for
V2.
This commit is contained in:
@@ -68,150 +68,194 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
if(extentCache.TryGetValue(fileId, out file))
|
if(extentCache.TryGetValue(fileId, out file))
|
||||||
return Errno.NoError;
|
return Errno.NoError;
|
||||||
|
|
||||||
// If the file is found but not its extents file we should suppose it's a directory
|
if(fileId >= srecords.Length)
|
||||||
bool fileFound = false;
|
return Errno.InvalidArgument;
|
||||||
|
|
||||||
for(ulong i = 0; i < device.GetSectors(); i++)
|
ulong ptr = srecords[fileId].extent_ptr;
|
||||||
|
|
||||||
|
if(ptr == 0xFFFFFFFF || ptr == 0x00000000)
|
||||||
|
return Errno.NoSuchFile;
|
||||||
|
|
||||||
|
ptr += mddf.mddf_block + volumePrefix;
|
||||||
|
|
||||||
|
Tag extTag;
|
||||||
|
|
||||||
|
// This happens on some disks.
|
||||||
|
// This is a filesystem corruption that makes LisaOS crash on scavenge.
|
||||||
|
// This code just allow to ignore that corruption
|
||||||
|
if(ptr >= device.ImageInfo.sectors)
|
||||||
{
|
{
|
||||||
Tag extTag;
|
bool found = false;
|
||||||
DecodeTag(device.ReadSectorTag(i, SectorTagType.AppleSectorTag), out extTag);
|
|
||||||
|
|
||||||
if(extTag.fileID == fileId)
|
for(ulong i = 0; i < device.ImageInfo.sectors; i++)
|
||||||
fileFound = true;
|
|
||||||
|
|
||||||
if(extTag.fileID == ((short)(-1 * fileId)))
|
|
||||||
{
|
{
|
||||||
byte[] sector = device.ReadSector((ulong)i);
|
DecodeTag(device.ReadSectorTag(i, SectorTagType.AppleSectorTag), out extTag);
|
||||||
|
if(extTag.fileID == fileId * -1)
|
||||||
if(sector[0] >= 32 || sector[0] == 0)
|
|
||||||
return Errno.InvalidArgument;
|
|
||||||
|
|
||||||
file.filenameLen = sector[0];
|
|
||||||
file.filename = new byte[file.filenameLen];
|
|
||||||
Array.Copy(sector, 0x01, file.filename, 0, file.filenameLen);
|
|
||||||
file.unknown1 = BigEndianBitConverter.ToUInt16(sector, 0x20);
|
|
||||||
file.file_uid = BigEndianBitConverter.ToUInt64(sector, 0x22);
|
|
||||||
file.unknown2 = sector[0x2A];
|
|
||||||
file.etype = sector[0x2B];
|
|
||||||
file.ftype = (FileType)sector[0x2C];
|
|
||||||
file.unknown3 = sector[0x2D];
|
|
||||||
file.dtc = BigEndianBitConverter.ToUInt32(sector, 0x2E);
|
|
||||||
file.dta = BigEndianBitConverter.ToUInt32(sector, 0x32);
|
|
||||||
file.dtm = BigEndianBitConverter.ToUInt32(sector, 0x36);
|
|
||||||
file.dtb = BigEndianBitConverter.ToUInt32(sector, 0x3A);
|
|
||||||
file.dts = BigEndianBitConverter.ToUInt32(sector, 0x3E);
|
|
||||||
file.serial = BigEndianBitConverter.ToUInt32(sector, 0x42);
|
|
||||||
file.unknown4 = sector[0x46];
|
|
||||||
file.locked = sector[0x47];
|
|
||||||
file.protect = sector[0x48];
|
|
||||||
file.master = sector[0x49];
|
|
||||||
file.scavenged = sector[0x4A];
|
|
||||||
file.closed = sector[0x4B];
|
|
||||||
file.open = sector[0x4C];
|
|
||||||
file.unknown5 = new byte[11];
|
|
||||||
Array.Copy(sector, 0x4D, file.unknown5, 0, 11);
|
|
||||||
file.release = BigEndianBitConverter.ToUInt16(sector, 0x58);
|
|
||||||
file.build = BigEndianBitConverter.ToUInt16(sector, 0x5A);
|
|
||||||
file.compatibility = BigEndianBitConverter.ToUInt16(sector, 0x5C);
|
|
||||||
file.revision = BigEndianBitConverter.ToUInt16(sector, 0x5E);
|
|
||||||
file.unknown6 = BigEndianBitConverter.ToUInt16(sector, 0x60);
|
|
||||||
file.password_valid = sector[0x62];
|
|
||||||
file.password = new byte[8];
|
|
||||||
Array.Copy(sector, 0x63, file.password, 0, 8);
|
|
||||||
file.unknown7 = new byte[3];
|
|
||||||
Array.Copy(sector, 0x6B, file.unknown7, 0, 3);
|
|
||||||
file.overhead = BigEndianBitConverter.ToUInt16(sector, 0x6E);
|
|
||||||
file.unknown8 = new byte[16];
|
|
||||||
Array.Copy(sector, 0x70, file.unknown8, 0, 16);
|
|
||||||
file.length = BigEndianBitConverter.ToInt32(sector, 0x80);
|
|
||||||
file.unknown9 = BigEndianBitConverter.ToInt32(sector, 0x84);
|
|
||||||
file.unknown10 = BigEndianBitConverter.ToInt16(sector, 0x17E);
|
|
||||||
file.LisaInfo = new byte[128];
|
|
||||||
Array.Copy(sector, 0x180, file.LisaInfo, 0, 128);
|
|
||||||
|
|
||||||
int extentsCount = 0;
|
|
||||||
|
|
||||||
for(int j = 0; j < 41; j++)
|
|
||||||
{
|
{
|
||||||
if(BigEndianBitConverter.ToInt16(sector, 0x88 + j * 6 + 4) == 0)
|
ptr = i;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
extentsCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file.extents = new Extent[extentsCount];
|
|
||||||
|
|
||||||
for(int j = 0; j < extentsCount; j++)
|
|
||||||
{
|
|
||||||
file.extents[j] = new Extent();
|
|
||||||
file.extents[j].start = BigEndianBitConverter.ToInt32(sector, 0x88 + j * 6);
|
|
||||||
file.extents[j].length = BigEndianBitConverter.ToInt16(sector, 0x88 + j * 6 + 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
extentCache.Add(fileId, file);
|
|
||||||
|
|
||||||
if(debug)
|
|
||||||
{
|
|
||||||
if(!printedExtents.Contains(fileId))
|
|
||||||
{
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filenameLen = {1}", fileId, file.filenameLen);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filename = {1}", fileId, StringHandlers.CToString(file.filename));
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown1 = 0x{1:X4}", fileId, file.unknown1);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].file_uid = 0x{1:X16}", fileId, file.file_uid);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown2 = 0x{1:X2}", fileId, file.unknown2);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].etype = 0x{1:X2}", fileId, file.etype);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].ftype = {1}", fileId, file.ftype);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown3 = 0x{1:X2}", fileId, file.unknown3);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dtc = {1}", fileId, file.dtc);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dta = {1}", fileId, file.dta);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dtm = {1}", fileId, file.dtm);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dtb = {1}", fileId, file.dtb);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dts = {1}", fileId, file.dts);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].serial = {1}", fileId, file.serial);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown4 = 0x{1:X2}", fileId, file.unknown4);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].locked = {1}", fileId, file.locked > 0);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].protect = {1}", fileId, file.protect > 0);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].master = {1}", fileId, file.master > 0);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].scavenged = {1}", fileId, file.scavenged > 0);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].closed = {1}", fileId, file.closed > 0);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].open = {1}", fileId, file.open > 0);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown5 = 0x{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}" +
|
|
||||||
"{10:X2}{11:X2}", fileId, file.unknown5[0], file.unknown5[1], file.unknown5[2], file.unknown5[3],
|
|
||||||
file.unknown5[4], file.unknown5[5], file.unknown5[6], file.unknown5[7], file.unknown5[8], file.unknown5[9],
|
|
||||||
file.unknown5[10]);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].release = {1}", fileId, file.release);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].build = {1}", fileId, file.build);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].compatibility = {1}", fileId, file.compatibility);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].revision = {1}", fileId, file.revision);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown6 = 0x{1:X4}", fileId, file.unknown6);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password_valid = {1}", fileId, file.password_valid > 0);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password = {1}", fileId, StringHandlers.CToString(file.password));
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown7 = 0x{1:X2}{2:X2}{3:X2}", fileId, file.unknown7[0],
|
|
||||||
file.unknown7[1], file.unknown7[2]);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].overhead = {1}", fileId, file.overhead);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown8 = 0x{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}" +
|
|
||||||
"{10:X2}{11:X2}{12:X2}{13:X2}{14:X2}{15:X2}{16:X2}", fileId, file.unknown8[0], file.unknown8[1], file.unknown8[2],
|
|
||||||
file.unknown8[3], file.unknown8[4], file.unknown8[5], file.unknown8[6], file.unknown8[7], file.unknown8[8],
|
|
||||||
file.unknown8[9], file.unknown8[10], file.unknown8[11], file.unknown8[12], file.unknown8[13], file.unknown8[14],
|
|
||||||
file.unknown8[15]);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].length = {1}", fileId, file.length);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown9 = 0x{1:X8}", fileId, file.unknown9);
|
|
||||||
for(int ext = 0; ext < file.extents.Length; ext++)
|
|
||||||
{
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].extents[{1}].start = {2}", fileId, ext, file.extents[ext].start);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].extents[{1}].length = {2}", fileId, ext, file.extents[ext].length);
|
|
||||||
}
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown10 = 0x{1:X4}", fileId, file.unknown10);
|
|
||||||
|
|
||||||
printedExtents.Add(fileId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Errno.NoError;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!found)
|
||||||
|
return Errno.InvalidArgument;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fileFound ? Errno.IsDirectory : Errno.NoSuchFile;
|
DecodeTag(device.ReadSectorTag(ptr, SectorTagType.AppleSectorTag), out extTag);
|
||||||
|
|
||||||
|
if(extTag.fileID == ((short)(-1 * fileId)))
|
||||||
|
{
|
||||||
|
byte[] sector = device.ReadSector(ptr);
|
||||||
|
|
||||||
|
if(sector[0] >= 32 || sector[0] == 0)
|
||||||
|
return Errno.InvalidArgument;
|
||||||
|
|
||||||
|
file.filenameLen = sector[0];
|
||||||
|
file.filename = new byte[file.filenameLen];
|
||||||
|
Array.Copy(sector, 0x01, file.filename, 0, file.filenameLen);
|
||||||
|
file.unknown1 = BigEndianBitConverter.ToUInt16(sector, 0x20);
|
||||||
|
file.file_uid = BigEndianBitConverter.ToUInt64(sector, 0x22);
|
||||||
|
file.unknown2 = sector[0x2A];
|
||||||
|
file.etype = sector[0x2B];
|
||||||
|
file.ftype = (FileType)sector[0x2C];
|
||||||
|
file.unknown3 = sector[0x2D];
|
||||||
|
file.dtc = BigEndianBitConverter.ToUInt32(sector, 0x2E);
|
||||||
|
file.dta = BigEndianBitConverter.ToUInt32(sector, 0x32);
|
||||||
|
file.dtm = BigEndianBitConverter.ToUInt32(sector, 0x36);
|
||||||
|
file.dtb = BigEndianBitConverter.ToUInt32(sector, 0x3A);
|
||||||
|
file.dts = BigEndianBitConverter.ToUInt32(sector, 0x3E);
|
||||||
|
file.serial = BigEndianBitConverter.ToUInt32(sector, 0x42);
|
||||||
|
file.unknown4 = sector[0x46];
|
||||||
|
file.locked = sector[0x47];
|
||||||
|
file.protect = sector[0x48];
|
||||||
|
file.master = sector[0x49];
|
||||||
|
file.scavenged = sector[0x4A];
|
||||||
|
file.closed = sector[0x4B];
|
||||||
|
file.open = sector[0x4C];
|
||||||
|
file.unknown5 = new byte[11];
|
||||||
|
Array.Copy(sector, 0x4D, file.unknown5, 0, 11);
|
||||||
|
file.release = BigEndianBitConverter.ToUInt16(sector, 0x58);
|
||||||
|
file.build = BigEndianBitConverter.ToUInt16(sector, 0x5A);
|
||||||
|
file.compatibility = BigEndianBitConverter.ToUInt16(sector, 0x5C);
|
||||||
|
file.revision = BigEndianBitConverter.ToUInt16(sector, 0x5E);
|
||||||
|
file.unknown6 = BigEndianBitConverter.ToUInt16(sector, 0x60);
|
||||||
|
file.password_valid = sector[0x62];
|
||||||
|
file.password = new byte[8];
|
||||||
|
Array.Copy(sector, 0x63, file.password, 0, 8);
|
||||||
|
file.unknown7 = new byte[3];
|
||||||
|
Array.Copy(sector, 0x6B, file.unknown7, 0, 3);
|
||||||
|
file.overhead = BigEndianBitConverter.ToUInt16(sector, 0x6E);
|
||||||
|
file.unknown8 = new byte[16];
|
||||||
|
Array.Copy(sector, 0x70, file.unknown8, 0, 16);
|
||||||
|
file.length = BigEndianBitConverter.ToInt32(sector, 0x80);
|
||||||
|
file.unknown9 = BigEndianBitConverter.ToInt32(sector, 0x84);
|
||||||
|
file.unknown10 = BigEndianBitConverter.ToInt16(sector, 0x17E);
|
||||||
|
file.LisaInfo = new byte[128];
|
||||||
|
Array.Copy(sector, 0x180, file.LisaInfo, 0, 128);
|
||||||
|
|
||||||
|
int extentsCount = 0;
|
||||||
|
|
||||||
|
for(int j = 0; j < 41; j++)
|
||||||
|
{
|
||||||
|
if(BigEndianBitConverter.ToInt16(sector, 0x88 + j * 6 + 4) == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
extentsCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
file.extents = new Extent[extentsCount];
|
||||||
|
|
||||||
|
for(int j = 0; j < extentsCount; j++)
|
||||||
|
{
|
||||||
|
file.extents[j] = new Extent();
|
||||||
|
file.extents[j].start = BigEndianBitConverter.ToInt32(sector, 0x88 + j * 6);
|
||||||
|
file.extents[j].length = BigEndianBitConverter.ToInt16(sector, 0x88 + j * 6 + 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
extentCache.Add(fileId, file);
|
||||||
|
|
||||||
|
if(debug)
|
||||||
|
{
|
||||||
|
if(!printedExtents.Contains(fileId))
|
||||||
|
{
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filenameLen = {1}", fileId, file.filenameLen);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filename = {1}", fileId, StringHandlers.CToString(file.filename));
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown1 = 0x{1:X4}", fileId, file.unknown1);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].file_uid = 0x{1:X16}", fileId, file.file_uid);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown2 = 0x{1:X2}", fileId, file.unknown2);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].etype = 0x{1:X2}", fileId, file.etype);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].ftype = {1}", fileId, file.ftype);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown3 = 0x{1:X2}", fileId, file.unknown3);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dtc = {1}", fileId, file.dtc);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dta = {1}", fileId, file.dta);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dtm = {1}", fileId, file.dtm);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dtb = {1}", fileId, file.dtb);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].dts = {1}", fileId, file.dts);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].serial = {1}", fileId, file.serial);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown4 = 0x{1:X2}", fileId, file.unknown4);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].locked = {1}", fileId, file.locked > 0);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].protect = {1}", fileId, file.protect > 0);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].master = {1}", fileId, file.master > 0);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].scavenged = {1}", fileId, file.scavenged > 0);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].closed = {1}", fileId, file.closed > 0);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].open = {1}", fileId, file.open > 0);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown5 = 0x{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}" +
|
||||||
|
"{10:X2}{11:X2}", fileId, file.unknown5[0], file.unknown5[1], file.unknown5[2], file.unknown5[3],
|
||||||
|
file.unknown5[4], file.unknown5[5], file.unknown5[6], file.unknown5[7], file.unknown5[8], file.unknown5[9],
|
||||||
|
file.unknown5[10]);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].release = {1}", fileId, file.release);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].build = {1}", fileId, file.build);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].compatibility = {1}", fileId, file.compatibility);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].revision = {1}", fileId, file.revision);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown6 = 0x{1:X4}", fileId, file.unknown6);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password_valid = {1}", fileId, file.password_valid > 0);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password = {1}", fileId, StringHandlers.CToString(file.password));
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown7 = 0x{1:X2}{2:X2}{3:X2}", fileId, file.unknown7[0],
|
||||||
|
file.unknown7[1], file.unknown7[2]);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].overhead = {1}", fileId, file.overhead);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown8 = 0x{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}" +
|
||||||
|
"{10:X2}{11:X2}{12:X2}{13:X2}{14:X2}{15:X2}{16:X2}", fileId, file.unknown8[0], file.unknown8[1], file.unknown8[2],
|
||||||
|
file.unknown8[3], file.unknown8[4], file.unknown8[5], file.unknown8[6], file.unknown8[7], file.unknown8[8],
|
||||||
|
file.unknown8[9], file.unknown8[10], file.unknown8[11], file.unknown8[12], file.unknown8[13], file.unknown8[14],
|
||||||
|
file.unknown8[15]);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].length = {1}", fileId, file.length);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown9 = 0x{1:X8}", fileId, file.unknown9);
|
||||||
|
for(int ext = 0; ext < file.extents.Length; ext++)
|
||||||
|
{
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].extents[{1}].start = {2}", fileId, ext, file.extents[ext].start);
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].extents[{1}].length = {2}", fileId, ext, file.extents[ext].length);
|
||||||
|
}
|
||||||
|
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown10 = 0x{1:X4}", fileId, file.unknown10);
|
||||||
|
|
||||||
|
printedExtents.Add(fileId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Errno.NoError;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Errno.NoSuchFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
Errno ReadSRecords()
|
||||||
|
{
|
||||||
|
if(!mounted)
|
||||||
|
return Errno.AccessDenied;
|
||||||
|
|
||||||
|
byte[] sectors = device.ReadSectors(mddf.srec_ptr + mddf.mddf_block + volumePrefix, mddf.srec_len);
|
||||||
|
|
||||||
|
srecords = new SRecord[sectors.Length / 14];
|
||||||
|
|
||||||
|
for(int s = 0; s < srecords.Length; s++)
|
||||||
|
{
|
||||||
|
srecords[s] = new SRecord();
|
||||||
|
srecords[s].extent_ptr = BigEndianBitConverter.ToUInt32(sectors, 0x00 + 14 * s);
|
||||||
|
srecords[s].unknown = BigEndianBitConverter.ToUInt32(sectors, 0x04 + 14 * s);
|
||||||
|
srecords[s].filesize = BigEndianBitConverter.ToUInt32(sectors, 0x08 + 14 * s);
|
||||||
|
srecords[s].flags = BigEndianBitConverter.ToUInt16(sectors, 0x0C + 14 * s);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Errno.NoError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,6 +204,21 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
if(fileId == FILEID_SRECORD)
|
||||||
|
{
|
||||||
|
if(!tags)
|
||||||
|
{
|
||||||
|
buf = device.ReadSectors(mddf.mddf_block + volumePrefix + mddf.srec_ptr, mddf.srec_len);
|
||||||
|
systemFileCache.Add(fileId, buf);
|
||||||
|
return Errno.NoError;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf = device.ReadSectorsTag(mddf.mddf_block + volumePrefix + mddf.srec_ptr, mddf.srec_len, SectorTagType.AppleSectorTag);
|
||||||
|
return Errno.NoError;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Tag sysTag;
|
Tag sysTag;
|
||||||
|
|
||||||
// Should be enough to check 100 sectors?
|
// Should be enough to check 100 sectors?
|
||||||
@@ -353,7 +368,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
stat.DeviceNo = 0;
|
stat.DeviceNo = 0;
|
||||||
int len;
|
int len;
|
||||||
if(!fileSizeCache.TryGetValue(fileId, out len))
|
if(!fileSizeCache.TryGetValue(fileId, out len))
|
||||||
stat.Length = file.length;
|
stat.Length = srecords[fileId].filesize;
|
||||||
else
|
else
|
||||||
stat.Length = len;
|
stat.Length = len;
|
||||||
stat.BlockSize = mddf.datasize;
|
stat.BlockSize = mddf.datasize;
|
||||||
|
|||||||
@@ -207,8 +207,9 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
mddf.clustersize = BigEndianBitConverter.ToUInt16(sector, 0x8A);
|
mddf.clustersize = BigEndianBitConverter.ToUInt16(sector, 0x8A);
|
||||||
mddf.fs_size = BigEndianBitConverter.ToUInt32(sector, 0x8C);
|
mddf.fs_size = BigEndianBitConverter.ToUInt32(sector, 0x8C);
|
||||||
mddf.unknown7 = BigEndianBitConverter.ToUInt32(sector, 0x90);
|
mddf.unknown7 = BigEndianBitConverter.ToUInt32(sector, 0x90);
|
||||||
mddf.unknown8 = BigEndianBitConverter.ToUInt32(sector, 0x94);
|
mddf.srec_ptr = BigEndianBitConverter.ToUInt32(sector, 0x94);
|
||||||
mddf.unknown9 = BigEndianBitConverter.ToUInt32(sector, 0x98);
|
mddf.unknown9 = BigEndianBitConverter.ToUInt16(sector, 0x98);
|
||||||
|
mddf.srec_len = BigEndianBitConverter.ToUInt16(sector, 0x9A);
|
||||||
mddf.unknown10 = BigEndianBitConverter.ToUInt32(sector, 0x9C);
|
mddf.unknown10 = BigEndianBitConverter.ToUInt32(sector, 0x9C);
|
||||||
mddf.unknown11 = BigEndianBitConverter.ToUInt32(sector, 0xA0);
|
mddf.unknown11 = BigEndianBitConverter.ToUInt32(sector, 0xA0);
|
||||||
mddf.unknown12 = BigEndianBitConverter.ToUInt32(sector, 0xA4);
|
mddf.unknown12 = BigEndianBitConverter.ToUInt32(sector, 0xA4);
|
||||||
@@ -259,8 +260,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown5 = 0x{0:X8} ({0})", mddf.unknown5);
|
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown5 = 0x{0:X8} ({0})", mddf.unknown5);
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown6 = 0x{0:X8} ({0})", mddf.unknown6);
|
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown6 = 0x{0:X8} ({0})", mddf.unknown6);
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown7 = 0x{0:X8} ({0})", mddf.unknown7);
|
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown7 = 0x{0:X8} ({0})", mddf.unknown7);
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown8 = 0x{0:X8} ({0})", mddf.unknown8);
|
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown9 = 0x{0:X4} ({0})", mddf.unknown9);
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown9 = 0x{0:X8} ({0})", mddf.unknown9);
|
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown10 = 0x{0:X8} ({0})", mddf.unknown10);
|
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown10 = 0x{0:X8} ({0})", mddf.unknown10);
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown11 = 0x{0:X8} ({0})", mddf.unknown11);
|
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown11 = 0x{0:X8} ({0})", mddf.unknown11);
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown12 = 0x{0:X8} ({0})", mddf.unknown12);
|
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown12 = 0x{0:X8} ({0})", mddf.unknown12);
|
||||||
@@ -362,6 +362,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
sb.AppendFormat("Boot code: 0x{0:X8}", mddf.boot_code).AppendLine();
|
sb.AppendFormat("Boot code: 0x{0:X8}", mddf.boot_code).AppendLine();
|
||||||
sb.AppendFormat("Boot environment: 0x{0:X8}", mddf.boot_environ).AppendLine();
|
sb.AppendFormat("Boot environment: 0x{0:X8}", mddf.boot_environ).AppendLine();
|
||||||
sb.AppendFormat("Overmount stamp: 0x{0:X16}", mddf.overmount_stamp).AppendLine();
|
sb.AppendFormat("Overmount stamp: 0x{0:X16}", mddf.overmount_stamp).AppendLine();
|
||||||
|
sb.AppendFormat("S-Records start at {0} and spans for {1} blocks", mddf.srec_ptr + mddf.mddf_block + before_mddf, mddf.srec_len).AppendLine();
|
||||||
|
|
||||||
if(mddf.vol_left_mounted == 0)
|
if(mddf.vol_left_mounted == 0)
|
||||||
sb.AppendLine("Volume is clean");
|
sb.AppendLine("Volume is clean");
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
MDDF mddf;
|
MDDF mddf;
|
||||||
ulong volumePrefix;
|
ulong volumePrefix;
|
||||||
int devTagSize;
|
int devTagSize;
|
||||||
|
SRecord[] srecords;
|
||||||
|
|
||||||
#region Caches
|
#region Caches
|
||||||
Dictionary<Int16, ExtentFile> extentCache;
|
Dictionary<Int16, ExtentFile> extentCache;
|
||||||
|
|||||||
@@ -94,10 +94,12 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
public UInt32 fs_size;
|
public UInt32 fs_size;
|
||||||
/// <summary>0x90, unknown</summary>
|
/// <summary>0x90, unknown</summary>
|
||||||
public UInt32 unknown7;
|
public UInt32 unknown7;
|
||||||
/// <summary>0x94, unknown</summary>
|
/// <summary>0x94, Pointer to S-Records</summary>
|
||||||
public UInt32 unknown8;
|
public UInt32 srec_ptr;
|
||||||
/// <summary>0x98, unknown</summary>
|
/// <summary>0x98, unknown</summary>
|
||||||
public UInt32 unknown9;
|
public UInt16 unknown9;
|
||||||
|
/// <summary>0x9A, S-Records length</summary>
|
||||||
|
public UInt16 srec_len;
|
||||||
/// <summary>0x9C, unknown</summary>
|
/// <summary>0x9C, unknown</summary>
|
||||||
public UInt32 unknown10;
|
public UInt32 unknown10;
|
||||||
/// <summary>0xA0, unknown</summary>
|
/// <summary>0xA0, unknown</summary>
|
||||||
@@ -355,6 +357,18 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
/// <summary>0x180, 128 bytes</summary>
|
/// <summary>0x180, 128 bytes</summary>
|
||||||
public byte[] LisaInfo;
|
public byte[] LisaInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct SRecord
|
||||||
|
{
|
||||||
|
/// <summary>0x00, block where ExtentsFile for this entry resides</summary>
|
||||||
|
public UInt32 extent_ptr;
|
||||||
|
/// <summary>0x04, unknown</summary>
|
||||||
|
public UInt32 unknown;
|
||||||
|
/// <summary>0x08, filesize in bytes</summary>
|
||||||
|
public UInt32 filesize;
|
||||||
|
/// <summary>0x0C, some kind of flags, meaning unknown</summary>
|
||||||
|
public UInt16 flags;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,8 +130,9 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
mddf.clustersize = BigEndianBitConverter.ToUInt16(sector, 0x8A);
|
mddf.clustersize = BigEndianBitConverter.ToUInt16(sector, 0x8A);
|
||||||
mddf.fs_size = BigEndianBitConverter.ToUInt32(sector, 0x8C);
|
mddf.fs_size = BigEndianBitConverter.ToUInt32(sector, 0x8C);
|
||||||
mddf.unknown7 = BigEndianBitConverter.ToUInt32(sector, 0x90);
|
mddf.unknown7 = BigEndianBitConverter.ToUInt32(sector, 0x90);
|
||||||
mddf.unknown8 = BigEndianBitConverter.ToUInt32(sector, 0x94);
|
mddf.srec_ptr = BigEndianBitConverter.ToUInt32(sector, 0x94);
|
||||||
mddf.unknown9 = BigEndianBitConverter.ToUInt32(sector, 0x98);
|
mddf.unknown9 = BigEndianBitConverter.ToUInt16(sector, 0x98);
|
||||||
|
mddf.srec_len = BigEndianBitConverter.ToUInt16(sector, 0x9A);
|
||||||
mddf.unknown10 = BigEndianBitConverter.ToUInt32(sector, 0x9C);
|
mddf.unknown10 = BigEndianBitConverter.ToUInt32(sector, 0x9C);
|
||||||
mddf.unknown11 = BigEndianBitConverter.ToUInt32(sector, 0xA0);
|
mddf.unknown11 = BigEndianBitConverter.ToUInt32(sector, 0xA0);
|
||||||
mddf.unknown12 = BigEndianBitConverter.ToUInt32(sector, 0xA4);
|
mddf.unknown12 = BigEndianBitConverter.ToUInt32(sector, 0xA4);
|
||||||
@@ -221,6 +222,13 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
printedExtents = new List<short>();
|
printedExtents = new List<short>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error = ReadSRecords();
|
||||||
|
if(error != Errno.NoError)
|
||||||
|
{
|
||||||
|
DicConsole.ErrorWriteLine("Error {0} reading S-Records file.", error);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
List<CatalogEntry> tempCat;
|
List<CatalogEntry> tempCat;
|
||||||
error = ReadCatalog((short)FILEID_DIRECTORY, out tempCat);
|
error = ReadCatalog((short)FILEID_DIRECTORY, out tempCat);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user