mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Invert 'if' statement to reduce nesting.
This commit is contained in:
@@ -385,12 +385,11 @@ namespace DiscImageChef.Filesystems
|
||||
rootBlk.sec_type = BigEndianBitConverter.ToUInt32(RootBlockSector, RootBlockSector.Length - 4);
|
||||
DicConsole.DebugWriteLine("AmigaDOS plugin", "rootBlk.sec_type = {0}", rootBlk.sec_type);
|
||||
|
||||
if(rootBlk.sec_type == SubTypeRoot && rootBlk.checksum == rsum)
|
||||
{
|
||||
RootBlockSector = imagePlugin.ReadSectors(root_ptr, sectorsPerBlock);
|
||||
root_found = true;
|
||||
break;
|
||||
}
|
||||
if(rootBlk.sec_type != SubTypeRoot || rootBlk.checksum != rsum) continue;
|
||||
|
||||
RootBlockSector = imagePlugin.ReadSectors(root_ptr, sectorsPerBlock);
|
||||
root_found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!root_found) return;
|
||||
|
||||
@@ -103,17 +103,15 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(xattr, "com.apple.dos.tracksectorlist", StringComparison.InvariantCulture) == 0 && debug)
|
||||
{
|
||||
byte[] ts;
|
||||
if(!extentCache.TryGetValue(filename, out ts)) return Errno.InvalidArgument;
|
||||
if(string.Compare(xattr, "com.apple.dos.tracksectorlist", StringComparison.InvariantCulture) != 0 || !debug)
|
||||
return Errno.NoSuchExtendedAttribute;
|
||||
|
||||
buf = new byte[ts.Length];
|
||||
Array.Copy(ts, 0, buf, 0, buf.Length);
|
||||
return Errno.NoError;
|
||||
}
|
||||
byte[] ts;
|
||||
if(!extentCache.TryGetValue(filename, out ts)) return Errno.InvalidArgument;
|
||||
|
||||
return Errno.NoSuchExtendedAttribute;
|
||||
buf = new byte[ts.Length];
|
||||
Array.Copy(ts, 0, buf, 0, buf.Length);
|
||||
return Errno.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,14 +93,13 @@ namespace DiscImageChef.Filesystems
|
||||
foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00})
|
||||
{
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, offset);
|
||||
if(drSigWord == HFS_MAGIC)
|
||||
{
|
||||
drSigWord =
|
||||
BigEndianBitConverter
|
||||
.ToUInt16(mdb_sector, offset + 0x7C); // Seek to embedded HFS+ signature
|
||||
if(drSigWord != HFS_MAGIC) continue;
|
||||
|
||||
return drSigWord != HFSP_MAGIC;
|
||||
}
|
||||
drSigWord =
|
||||
BigEndianBitConverter
|
||||
.ToUInt16(mdb_sector, offset + 0x7C); // Seek to embedded HFS+ signature
|
||||
|
||||
return drSigWord != HFSP_MAGIC;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -108,12 +107,11 @@ namespace DiscImageChef.Filesystems
|
||||
mdb_sector = imagePlugin.ReadSector(2 + partition.Start);
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0);
|
||||
|
||||
if(drSigWord == HFS_MAGIC)
|
||||
{
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0x7C); // Seek to embedded HFS+ signature
|
||||
if(drSigWord != HFS_MAGIC) return false;
|
||||
|
||||
return drSigWord != HFSP_MAGIC;
|
||||
}
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0x7C); // Seek to embedded HFS+ signature
|
||||
|
||||
return drSigWord != HFSP_MAGIC;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -143,15 +141,14 @@ namespace DiscImageChef.Filesystems
|
||||
foreach(int offset in new[] {0, 0x200, 0x400, 0x600, 0x800, 0xA00})
|
||||
{
|
||||
drSigWord = BigEndianBitConverter.ToUInt16(tmp_sector, offset);
|
||||
if(drSigWord == HFS_MAGIC)
|
||||
{
|
||||
bb_sector = new byte[1024];
|
||||
mdb_sector = new byte[512];
|
||||
if(offset >= 0x400) Array.Copy(tmp_sector, offset - 0x400, bb_sector, 0, 1024);
|
||||
Array.Copy(tmp_sector, offset, mdb_sector, 0, 512);
|
||||
APMFromHDDOnCD = true;
|
||||
break;
|
||||
}
|
||||
if(drSigWord != HFS_MAGIC) continue;
|
||||
|
||||
bb_sector = new byte[1024];
|
||||
mdb_sector = new byte[512];
|
||||
if(offset >= 0x400) Array.Copy(tmp_sector, offset - 0x400, bb_sector, 0, 1024);
|
||||
Array.Copy(tmp_sector, offset, mdb_sector, 0, 512);
|
||||
APMFromHDDOnCD = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!APMFromHDDOnCD) return;
|
||||
|
||||
@@ -159,14 +159,12 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
if(debug && device.ImageInfo.ReadableSectorTags.Contains(DiscImages.SectorTagType.AppleSectorTag) &&
|
||||
string.Compare(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture) == 0)
|
||||
{
|
||||
error = ReadFile(path, out buf, false, true);
|
||||
return error;
|
||||
}
|
||||
if(!debug || !device.ImageInfo.ReadableSectorTags.Contains(DiscImages.SectorTagType.AppleSectorTag) ||
|
||||
string.Compare(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture) != 0)
|
||||
return Errno.NoSuchExtendedAttribute;
|
||||
|
||||
return Errno.NoSuchExtendedAttribute;
|
||||
error = ReadFile(path, out buf, false, true);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,8 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
for(int i = 0; i < def.sectorsPerTrack; i++) def.side1.sectorIds[i] = i + 1;
|
||||
}
|
||||
|
||||
if(def.sides == 2 && def.side2 == null)
|
||||
if(def.sides != 2 || def.side2 != null) continue;
|
||||
|
||||
{
|
||||
def.side2 = new Side();
|
||||
def.side2.sideId = 1;
|
||||
|
||||
@@ -53,13 +53,10 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
if(statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out fInfo))
|
||||
{
|
||||
attributes = fInfo.Attributes;
|
||||
return Errno.NoError;
|
||||
}
|
||||
if(!statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out fInfo)) return Errno.NoSuchFile;
|
||||
|
||||
return Errno.NoSuchFile;
|
||||
attributes = fInfo.Attributes;
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public override Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
||||
|
||||
@@ -794,166 +794,166 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
{
|
||||
ulong sectors = (ulong)(def.cylinders * def.sides * def.sectorsPerTrack);
|
||||
|
||||
if(sectors != imagePlugin.GetSectors() || def.bytesPerSector != imagePlugin.GetSectorSize())
|
||||
continue;
|
||||
|
||||
// Definition seems to describe current disk, at least, same number of volume sectors and bytes per sector
|
||||
if(sectors == imagePlugin.GetSectors() && def.bytesPerSector == imagePlugin.GetSectorSize())
|
||||
DicConsole.DebugWriteLine("CP/M Plugin", "Trying definition \"{0}\"", def.comment);
|
||||
ulong offset;
|
||||
if(def.sofs != 0) offset = (ulong)def.sofs;
|
||||
else offset = (ulong)(def.ofs * def.sectorsPerTrack);
|
||||
|
||||
int dirLen = (def.drm + 1) * 32 / def.bytesPerSector;
|
||||
|
||||
if(def.sides == 1)
|
||||
{
|
||||
DicConsole.DebugWriteLine("CP/M Plugin", "Trying definition \"{0}\"", def.comment);
|
||||
ulong offset;
|
||||
if(def.sofs != 0) offset = (ulong)def.sofs;
|
||||
else offset = (ulong)(def.ofs * def.sectorsPerTrack);
|
||||
|
||||
int dirLen = (def.drm + 1) * 32 / def.bytesPerSector;
|
||||
|
||||
if(def.sides == 1)
|
||||
sectorMask = new int[def.side1.sectorIds.Length];
|
||||
for(int m = 0; m < sectorMask.Length; m++)
|
||||
sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Head changes after every track
|
||||
if(string.Compare(def.order, "SIDES",
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
{
|
||||
sectorMask = new int[def.side1.sectorIds.Length];
|
||||
for(int m = 0; m < sectorMask.Length; m++)
|
||||
sectorMask = new int[def.side1.sectorIds.Length + def.side2.sectorIds.Length];
|
||||
for(int m = 0; m < def.side1.sectorIds.Length; m++)
|
||||
sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
|
||||
// Skip first track (first side)
|
||||
for(int m = 0; m < def.side2.sectorIds.Length; m++)
|
||||
sectorMask[m + def.side1.sectorIds.Length] =
|
||||
def.side2.sectorIds[m] - def.side2.sectorIds[0] +
|
||||
def.side1.sectorIds.Length;
|
||||
}
|
||||
// Head changes after whole side
|
||||
else if(string.Compare(def.order, "CYLINDERS",
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
{
|
||||
for(int m = 0; m < def.side1.sectorIds.Length; m++)
|
||||
sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
|
||||
// Skip first track (first side) and first track (second side)
|
||||
for(int m = 0; m < def.side1.sectorIds.Length; m++)
|
||||
sectorMask[m + def.side1.sectorIds.Length] =
|
||||
def.side1.sectorIds[m] - def.side1.sectorIds[0] +
|
||||
def.side1.sectorIds.Length + def.side2.sectorIds.Length;
|
||||
}
|
||||
// TODO: Implement COLUMBIA ordering
|
||||
else if(string.Compare(def.order, "COLUMBIA",
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
{
|
||||
DicConsole.DebugWriteLine("CP/M Plugin",
|
||||
"Don't know how to handle COLUMBIA ordering, not proceeding with this definition.");
|
||||
continue;
|
||||
}
|
||||
// TODO: Implement EAGLE ordering
|
||||
else if(string.Compare(def.order, "EAGLE",
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
{
|
||||
DicConsole.DebugWriteLine("CP/M Plugin",
|
||||
"Don't know how to handle EAGLE ordering, not proceeding with this definition.");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Head changes after every track
|
||||
if(string.Compare(def.order, "SIDES",
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
{
|
||||
sectorMask = new int[def.side1.sectorIds.Length + def.side2.sectorIds.Length];
|
||||
for(int m = 0; m < def.side1.sectorIds.Length; m++)
|
||||
sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
|
||||
// Skip first track (first side)
|
||||
for(int m = 0; m < def.side2.sectorIds.Length; m++)
|
||||
sectorMask[m + def.side1.sectorIds.Length] =
|
||||
def.side2.sectorIds[m] - def.side2.sectorIds[0] +
|
||||
def.side1.sectorIds.Length;
|
||||
}
|
||||
// Head changes after whole side
|
||||
else if(string.Compare(def.order, "CYLINDERS",
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
{
|
||||
for(int m = 0; m < def.side1.sectorIds.Length; m++)
|
||||
sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
|
||||
// Skip first track (first side) and first track (second side)
|
||||
for(int m = 0; m < def.side1.sectorIds.Length; m++)
|
||||
sectorMask[m + def.side1.sectorIds.Length] =
|
||||
def.side1.sectorIds[m] - def.side1.sectorIds[0] +
|
||||
def.side1.sectorIds.Length + def.side2.sectorIds.Length;
|
||||
}
|
||||
// TODO: Implement COLUMBIA ordering
|
||||
else if(string.Compare(def.order, "COLUMBIA",
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
{
|
||||
DicConsole.DebugWriteLine("CP/M Plugin",
|
||||
"Don't know how to handle COLUMBIA ordering, not proceeding with this definition.");
|
||||
continue;
|
||||
}
|
||||
// TODO: Implement EAGLE ordering
|
||||
else if(string.Compare(def.order, "EAGLE",
|
||||
StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||
{
|
||||
DicConsole.DebugWriteLine("CP/M Plugin",
|
||||
"Don't know how to handle EAGLE ordering, not proceeding with this definition.");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
DicConsole.DebugWriteLine("CP/M Plugin",
|
||||
"Unknown order type \"{0}\", not proceeding with this definition.",
|
||||
def.order);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Read the directory marked by this definition
|
||||
MemoryStream ms = new MemoryStream();
|
||||
for(int p = 0; p < dirLen; p++)
|
||||
{
|
||||
byte[] dirSector =
|
||||
imagePlugin.ReadSector((ulong)((int)offset + (int)partition.Start +
|
||||
p / sectorMask.Length * sectorMask.Length +
|
||||
sectorMask[p % sectorMask.Length]));
|
||||
ms.Write(dirSector, 0, dirSector.Length);
|
||||
}
|
||||
|
||||
directory = ms.ToArray();
|
||||
|
||||
if(def.evenOdd)
|
||||
DicConsole.DebugWriteLine("CP/M Plugin",
|
||||
"Definition contains EVEN-ODD field, with unknown meaning, detection may be wrong.");
|
||||
|
||||
// Complement of the directory bytes if needed
|
||||
if(def.complement)
|
||||
for(int b = 0; b < directory.Length; b++)
|
||||
directory[b] = (byte)(~directory[b] & 0xFF);
|
||||
|
||||
// Check the directory
|
||||
if(CheckDir(directory))
|
||||
{
|
||||
DicConsole.DebugWriteLine("CP/M Plugin",
|
||||
"Definition \"{0}\" has a correct directory",
|
||||
def.comment);
|
||||
|
||||
// Build a Disc Parameter Block
|
||||
workingDefinition = def;
|
||||
dpb = new DiscParameterBlock();
|
||||
dpb.al0 = (byte)def.al0;
|
||||
dpb.al1 = (byte)def.al1;
|
||||
dpb.blm = (byte)def.blm;
|
||||
dpb.bsh = (byte)def.bsh;
|
||||
dpb.cks = 0; // Needed?
|
||||
dpb.drm = (ushort)def.drm;
|
||||
dpb.dsm = (ushort)def.dsm;
|
||||
dpb.exm = (byte)def.exm;
|
||||
dpb.off = (ushort)def.ofs;
|
||||
switch(def.bytesPerSector)
|
||||
{
|
||||
case 128:
|
||||
dpb.psh = 0;
|
||||
dpb.phm = 0;
|
||||
break;
|
||||
case 256:
|
||||
dpb.psh = 1;
|
||||
dpb.phm = 1;
|
||||
break;
|
||||
case 512:
|
||||
dpb.psh = 2;
|
||||
dpb.phm = 3;
|
||||
break;
|
||||
case 1024:
|
||||
dpb.psh = 3;
|
||||
dpb.phm = 7;
|
||||
break;
|
||||
case 2048:
|
||||
dpb.psh = 4;
|
||||
dpb.phm = 15;
|
||||
break;
|
||||
case 4096:
|
||||
dpb.psh = 5;
|
||||
dpb.phm = 31;
|
||||
break;
|
||||
case 8192:
|
||||
dpb.psh = 6;
|
||||
dpb.phm = 63;
|
||||
break;
|
||||
case 16384:
|
||||
dpb.psh = 7;
|
||||
dpb.phm = 127;
|
||||
break;
|
||||
case 32768:
|
||||
dpb.psh = 8;
|
||||
dpb.phm = 255;
|
||||
break;
|
||||
}
|
||||
|
||||
dpb.spt = (ushort)(def.sectorsPerTrack * def.bytesPerSector / 128);
|
||||
cpmFound = true;
|
||||
workingDefinition = def;
|
||||
|
||||
return true;
|
||||
"Unknown order type \"{0}\", not proceeding with this definition.",
|
||||
def.order);
|
||||
continue;
|
||||
}
|
||||
|
||||
label = null;
|
||||
labelCreationDate = null;
|
||||
labelUpdateDate = null;
|
||||
}
|
||||
|
||||
// Read the directory marked by this definition
|
||||
MemoryStream ms = new MemoryStream();
|
||||
for(int p = 0; p < dirLen; p++)
|
||||
{
|
||||
byte[] dirSector =
|
||||
imagePlugin.ReadSector((ulong)((int)offset + (int)partition.Start +
|
||||
p / sectorMask.Length * sectorMask.Length +
|
||||
sectorMask[p % sectorMask.Length]));
|
||||
ms.Write(dirSector, 0, dirSector.Length);
|
||||
}
|
||||
|
||||
directory = ms.ToArray();
|
||||
|
||||
if(def.evenOdd)
|
||||
DicConsole.DebugWriteLine("CP/M Plugin",
|
||||
"Definition contains EVEN-ODD field, with unknown meaning, detection may be wrong.");
|
||||
|
||||
// Complement of the directory bytes if needed
|
||||
if(def.complement)
|
||||
for(int b = 0; b < directory.Length; b++)
|
||||
directory[b] = (byte)(~directory[b] & 0xFF);
|
||||
|
||||
// Check the directory
|
||||
if(CheckDir(directory))
|
||||
{
|
||||
DicConsole.DebugWriteLine("CP/M Plugin",
|
||||
"Definition \"{0}\" has a correct directory",
|
||||
def.comment);
|
||||
|
||||
// Build a Disc Parameter Block
|
||||
workingDefinition = def;
|
||||
dpb = new DiscParameterBlock();
|
||||
dpb.al0 = (byte)def.al0;
|
||||
dpb.al1 = (byte)def.al1;
|
||||
dpb.blm = (byte)def.blm;
|
||||
dpb.bsh = (byte)def.bsh;
|
||||
dpb.cks = 0; // Needed?
|
||||
dpb.drm = (ushort)def.drm;
|
||||
dpb.dsm = (ushort)def.dsm;
|
||||
dpb.exm = (byte)def.exm;
|
||||
dpb.off = (ushort)def.ofs;
|
||||
switch(def.bytesPerSector)
|
||||
{
|
||||
case 128:
|
||||
dpb.psh = 0;
|
||||
dpb.phm = 0;
|
||||
break;
|
||||
case 256:
|
||||
dpb.psh = 1;
|
||||
dpb.phm = 1;
|
||||
break;
|
||||
case 512:
|
||||
dpb.psh = 2;
|
||||
dpb.phm = 3;
|
||||
break;
|
||||
case 1024:
|
||||
dpb.psh = 3;
|
||||
dpb.phm = 7;
|
||||
break;
|
||||
case 2048:
|
||||
dpb.psh = 4;
|
||||
dpb.phm = 15;
|
||||
break;
|
||||
case 4096:
|
||||
dpb.psh = 5;
|
||||
dpb.phm = 31;
|
||||
break;
|
||||
case 8192:
|
||||
dpb.psh = 6;
|
||||
dpb.phm = 63;
|
||||
break;
|
||||
case 16384:
|
||||
dpb.psh = 7;
|
||||
dpb.phm = 127;
|
||||
break;
|
||||
case 32768:
|
||||
dpb.psh = 8;
|
||||
dpb.phm = 255;
|
||||
break;
|
||||
}
|
||||
|
||||
dpb.spt = (ushort)(def.sectorsPerTrack * def.bytesPerSector / 128);
|
||||
cpmFound = true;
|
||||
workingDefinition = def;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
label = null;
|
||||
labelCreationDate = null;
|
||||
labelUpdateDate = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,12 +164,11 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
blockMs.Write(sector, 0, sector.Length);
|
||||
sectorsPerBlock++;
|
||||
|
||||
if(sectorsPerBlock == blockSize / sector.Length)
|
||||
{
|
||||
allocationBlocks.Add(blockNo++, blockMs.ToArray());
|
||||
sectorsPerBlock = 0;
|
||||
blockMs = new MemoryStream();
|
||||
}
|
||||
if(sectorsPerBlock != blockSize / sector.Length) continue;
|
||||
|
||||
allocationBlocks.Add(blockNo++, blockMs.ToArray());
|
||||
sectorsPerBlock = 0;
|
||||
blockMs = new MemoryStream();
|
||||
}
|
||||
// CP/M blocks are same size than physical sectors
|
||||
else allocationBlocks.Add(blockNo++, sector);
|
||||
@@ -628,14 +627,15 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
{
|
||||
List<ushort> alBlks;
|
||||
|
||||
if(extents.TryGetValue(ex, out alBlks))
|
||||
foreach(ushort alBlk in alBlks)
|
||||
{
|
||||
byte[] blk = new byte[blockSize];
|
||||
allocationBlocks.TryGetValue(alBlk, out blk);
|
||||
fileMs.Write(blk, 0, blk.Length);
|
||||
fInfo.Blocks++;
|
||||
}
|
||||
if(!extents.TryGetValue(ex, out alBlks)) continue;
|
||||
|
||||
foreach(ushort alBlk in alBlks)
|
||||
{
|
||||
byte[] blk = new byte[blockSize];
|
||||
allocationBlocks.TryGetValue(alBlk, out blk);
|
||||
fileMs.Write(blk, 0, blk.Length);
|
||||
fInfo.Blocks++;
|
||||
}
|
||||
}
|
||||
|
||||
// If you insist to call CP/M "extent based"
|
||||
|
||||
@@ -55,7 +55,10 @@ namespace DiscImageChef.Filesystems.CPM
|
||||
|
||||
if(string.Compare(xattr, "com.caldera.cpm.password", StringComparison.InvariantCulture) == 0) if(!passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)) return Errno.NoError;
|
||||
|
||||
if(string.Compare(xattr, "com.caldera.cpm.password.text", StringComparison.InvariantCulture) == 0) if(!passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)) return Errno.NoError;
|
||||
if(string.Compare(xattr, "com.caldera.cpm.password.text", StringComparison.InvariantCulture) != 0)
|
||||
return Errno.NoSuchExtendedAttribute;
|
||||
|
||||
if(!passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)) return Errno.NoError;
|
||||
|
||||
return Errno.NoSuchExtendedAttribute;
|
||||
}
|
||||
|
||||
@@ -708,20 +708,21 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
ISOMetadata.AppendLine("\t\tImage contains ATAPI drivers");
|
||||
if(flags.HasFlag(ElToritoFlags.SCSI)) ISOMetadata.AppendLine("\t\tImage contains SCSI drivers");
|
||||
|
||||
if(flags.HasFlag(ElToritoFlags.Continued))
|
||||
while(true && torito_off < vd_sector.Length)
|
||||
{
|
||||
ElToritoSectionEntryExtension section_extension = new ElToritoSectionEntryExtension();
|
||||
ptr = Marshal.AllocHGlobal(ElToritoEntrySize);
|
||||
Marshal.Copy(vd_sector, torito_off, ptr, ElToritoEntrySize);
|
||||
section_extension =
|
||||
(ElToritoSectionEntryExtension)
|
||||
Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntryExtension));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
torito_off += ElToritoEntrySize;
|
||||
if(!flags.HasFlag(ElToritoFlags.Continued)) continue;
|
||||
|
||||
if(!section_extension.extension_flags.HasFlag(ElToritoFlags.Continued)) break;
|
||||
}
|
||||
while(true && torito_off < vd_sector.Length)
|
||||
{
|
||||
ElToritoSectionEntryExtension section_extension = new ElToritoSectionEntryExtension();
|
||||
ptr = Marshal.AllocHGlobal(ElToritoEntrySize);
|
||||
Marshal.Copy(vd_sector, torito_off, ptr, ElToritoEntrySize);
|
||||
section_extension =
|
||||
(ElToritoSectionEntryExtension)
|
||||
Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntryExtension));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
torito_off += ElToritoEntrySize;
|
||||
|
||||
if(!section_extension.extension_flags.HasFlag(ElToritoFlags.Continued)) break;
|
||||
}
|
||||
}
|
||||
|
||||
if(section_header.header_id == ElToritoIndicator.LastHeader) break;
|
||||
|
||||
@@ -145,19 +145,18 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
{
|
||||
ExtentFile ext;
|
||||
error = ReadExtentsFile(entV2.fileID, out ext);
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
CatalogEntry entV3 = new CatalogEntry();
|
||||
entV3.fileID = entV2.fileID;
|
||||
entV3.filename = new byte[32];
|
||||
Array.Copy(entV2.filename, 0, entV3.filename, 0, entV2.filenameLen);
|
||||
entV3.fileType = entV2.fileType;
|
||||
entV3.length = (int)srecords[entV2.fileID].filesize;
|
||||
entV3.dtc = ext.dtc;
|
||||
entV3.dtm = ext.dtm;
|
||||
if(error != Errno.NoError) continue;
|
||||
|
||||
catalogCache.Add(entV3);
|
||||
}
|
||||
CatalogEntry entV3 = new CatalogEntry();
|
||||
entV3.fileID = entV2.fileID;
|
||||
entV3.filename = new byte[32];
|
||||
Array.Copy(entV2.filename, 0, entV3.filename, 0, entV2.filenameLen);
|
||||
entV3.fileType = entV2.fileType;
|
||||
entV3.length = (int)srecords[entV2.fileID].filesize;
|
||||
entV3.dtc = ext.dtc;
|
||||
entV3.dtm = ext.dtm;
|
||||
|
||||
catalogCache.Add(entV3);
|
||||
}
|
||||
|
||||
return Errno.NoError;
|
||||
@@ -173,11 +172,10 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
LisaTag.PriamTag catTag;
|
||||
DecodeTag(device.ReadSectorTag(i, SectorTagType.AppleSectorTag), out catTag);
|
||||
|
||||
if(catTag.fileID == FILEID_CATALOG && catTag.relPage == 0)
|
||||
{
|
||||
firstCatalogBlock = device.ReadSectors(i, 4);
|
||||
break;
|
||||
}
|
||||
if(catTag.fileID != FILEID_CATALOG || catTag.relPage != 0) continue;
|
||||
|
||||
firstCatalogBlock = device.ReadSectors(i, 4);
|
||||
break;
|
||||
}
|
||||
|
||||
// Catalog not found
|
||||
|
||||
@@ -85,11 +85,10 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
for(ulong i = 0; i < device.ImageInfo.Sectors; i++)
|
||||
{
|
||||
DecodeTag(device.ReadSectorTag(i, SectorTagType.AppleSectorTag), out extTag);
|
||||
if(extTag.fileID == fileId * -1)
|
||||
{
|
||||
ptr = i;
|
||||
break;
|
||||
}
|
||||
if(extTag.fileID != fileId * -1) continue;
|
||||
|
||||
ptr = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!found) return Errno.InvalidArgument;
|
||||
@@ -98,180 +97,169 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
// Checks that the sector tag indicates its the Extents File we are searching for
|
||||
DecodeTag(device.ReadSectorTag(ptr, SectorTagType.AppleSectorTag), out extTag);
|
||||
|
||||
if(extTag.fileID == (short)(-1 * fileId))
|
||||
if(extTag.fileID != (short)(-1 * fileId)) return Errno.NoSuchFile;
|
||||
|
||||
byte[] sector;
|
||||
|
||||
if(mddf.fsversion == LisaFSv1) sector = device.ReadSectors(ptr, 2);
|
||||
else 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.unknown10 = BigEndianBitConverter.ToInt16(sector, 0x17E);
|
||||
file.LisaInfo = new byte[128];
|
||||
Array.Copy(sector, 0x180, file.LisaInfo, 0, 128);
|
||||
|
||||
int extentsCount = 0;
|
||||
int extentsOffset;
|
||||
|
||||
if(mddf.fsversion == LisaFSv1)
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(mddf.fsversion == LisaFSv1) sector = device.ReadSectors(ptr, 2);
|
||||
else 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.unknown10 = BigEndianBitConverter.ToInt16(sector, 0x17E);
|
||||
file.LisaInfo = new byte[128];
|
||||
Array.Copy(sector, 0x180, file.LisaInfo, 0, 128);
|
||||
|
||||
int extentsCount = 0;
|
||||
int extentsOffset;
|
||||
|
||||
if(mddf.fsversion == LisaFSv1)
|
||||
{
|
||||
file.length = BigEndianBitConverter.ToInt32(sector, 0x200);
|
||||
file.unknown9 = BigEndianBitConverter.ToInt32(sector, 0x204);
|
||||
extentsOffset = 0x208;
|
||||
}
|
||||
else
|
||||
{
|
||||
file.length = BigEndianBitConverter.ToInt32(sector, 0x80);
|
||||
file.unknown9 = BigEndianBitConverter.ToInt32(sector, 0x84);
|
||||
extentsOffset = 0x88;
|
||||
}
|
||||
|
||||
for(int j = 0; j < 41; j++)
|
||||
{
|
||||
if(BigEndianBitConverter.ToInt16(sector, extentsOffset + 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, extentsOffset + j * 6);
|
||||
file.extents[j].length = BigEndianBitConverter.ToInt16(sector, extentsOffset + 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, CurrentEncoding));
|
||||
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,
|
||||
CurrentEncoding.GetString(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;
|
||||
file.length = BigEndianBitConverter.ToInt32(sector, 0x200);
|
||||
file.unknown9 = BigEndianBitConverter.ToInt32(sector, 0x204);
|
||||
extentsOffset = 0x208;
|
||||
}
|
||||
else
|
||||
{
|
||||
file.length = BigEndianBitConverter.ToInt32(sector, 0x80);
|
||||
file.unknown9 = BigEndianBitConverter.ToInt32(sector, 0x84);
|
||||
extentsOffset = 0x88;
|
||||
}
|
||||
|
||||
return Errno.NoSuchFile;
|
||||
for(int j = 0; j < 41; j++)
|
||||
{
|
||||
if(BigEndianBitConverter.ToInt16(sector, extentsOffset + 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, extentsOffset + j * 6);
|
||||
file.extents[j].length = BigEndianBitConverter.ToInt16(sector, extentsOffset + j * 6 + 4);
|
||||
}
|
||||
|
||||
extentCache.Add(fileId, file);
|
||||
|
||||
if(!debug) return Errno.NoError;
|
||||
|
||||
if(printedExtents.Contains(fileId)) return Errno.NoError;
|
||||
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filenameLen = {1}", fileId,
|
||||
file.filenameLen);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filename = {1}", fileId,
|
||||
StringHandlers.CToString(file.filename, CurrentEncoding));
|
||||
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,
|
||||
CurrentEncoding.GetString(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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -208,18 +208,17 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
{
|
||||
DecodeTag(device.ReadSectorTag(i, SectorTagType.AppleSectorTag), out sysTag);
|
||||
|
||||
if(sysTag.fileID == fileId)
|
||||
{
|
||||
byte[] sector;
|
||||
if(sysTag.fileID != fileId) continue;
|
||||
|
||||
if(!tags) sector = device.ReadSector(i);
|
||||
else sector = device.ReadSectorTag(i, SectorTagType.AppleSectorTag);
|
||||
byte[] sector;
|
||||
|
||||
// Relative block for $Loader starts at $Boot block
|
||||
if(sysTag.fileID == FILEID_LOADER_SIGNED) sysTag.relPage--;
|
||||
if(!tags) sector = device.ReadSector(i);
|
||||
else sector = device.ReadSectorTag(i, SectorTagType.AppleSectorTag);
|
||||
|
||||
Array.Copy(sector, 0, buf, sector.Length * sysTag.relPage, sector.Length);
|
||||
}
|
||||
// Relative block for $Loader starts at $Boot block
|
||||
if(sysTag.fileID == FILEID_LOADER_SIGNED) sysTag.relPage--;
|
||||
|
||||
Array.Copy(sector, 0, buf, sector.Length * sysTag.relPage, sector.Length);
|
||||
}
|
||||
|
||||
if(!tags) systemFileCache.Add(fileId, buf);
|
||||
@@ -445,18 +444,17 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
string filename = StringHandlers.CToString(entry.filename, CurrentEncoding);
|
||||
|
||||
// LisaOS is case insensitive
|
||||
if(string.Compare(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) == 0 &&
|
||||
entry.parentID == fileId)
|
||||
{
|
||||
fileId = entry.fileID;
|
||||
isDir = entry.fileType == 0x01;
|
||||
if(string.Compare(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) != 0 ||
|
||||
entry.parentID != fileId) continue;
|
||||
|
||||
// Not last path element, and it's not a directory
|
||||
if(lvl != pathElements.Length - 1 && !isDir) return Errno.NotDirectory;
|
||||
fileId = entry.fileID;
|
||||
isDir = entry.fileType == 0x01;
|
||||
|
||||
// Arrived last path element
|
||||
if(lvl == pathElements.Length - 1) return Errno.NoError;
|
||||
}
|
||||
// Not last path element, and it's not a directory
|
||||
if(lvl != pathElements.Length - 1 && !isDir) return Errno.NotDirectory;
|
||||
|
||||
// Arrived last path element
|
||||
if(lvl == pathElements.Length - 1) return Errno.NoError;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,48 +67,44 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
if(before_mddf == -1 && searchTag.fileID == FILEID_LOADER_SIGNED) before_mddf = i - 1;
|
||||
|
||||
if(searchTag.fileID == FILEID_MDDF)
|
||||
{
|
||||
byte[] sector = imagePlugin.ReadSector((ulong)i);
|
||||
MDDF info_mddf = new MDDF();
|
||||
if(searchTag.fileID != FILEID_MDDF) continue;
|
||||
|
||||
info_mddf.mddf_block = BigEndianBitConverter.ToUInt32(sector, 0x6C);
|
||||
info_mddf.volsize_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x70);
|
||||
info_mddf.volsize_minus_mddf_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x74);
|
||||
info_mddf.vol_size = BigEndianBitConverter.ToUInt32(sector, 0x78);
|
||||
info_mddf.blocksize = BigEndianBitConverter.ToUInt16(sector, 0x7C);
|
||||
info_mddf.datasize = BigEndianBitConverter.ToUInt16(sector, 0x7E);
|
||||
byte[] sector = imagePlugin.ReadSector((ulong)i);
|
||||
MDDF info_mddf = new MDDF();
|
||||
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Current sector = {0}", i);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.mddf_block = {0}", info_mddf.mddf_block);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Disk size = {0} sectors", imagePlugin.GetSectors());
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size = {0} sectors", info_mddf.vol_size);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - 1 = {0}",
|
||||
info_mddf.volsize_minus_one);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - mddf.mddf_block -1 = {0}",
|
||||
info_mddf.volsize_minus_mddf_minus_one);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Disk sector = {0} bytes",
|
||||
imagePlugin.GetSectorSize());
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.blocksize = {0} bytes", info_mddf.blocksize);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.datasize = {0} bytes", info_mddf.datasize);
|
||||
info_mddf.mddf_block = BigEndianBitConverter.ToUInt32(sector, 0x6C);
|
||||
info_mddf.volsize_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x70);
|
||||
info_mddf.volsize_minus_mddf_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x74);
|
||||
info_mddf.vol_size = BigEndianBitConverter.ToUInt32(sector, 0x78);
|
||||
info_mddf.blocksize = BigEndianBitConverter.ToUInt16(sector, 0x7C);
|
||||
info_mddf.datasize = BigEndianBitConverter.ToUInt16(sector, 0x7E);
|
||||
|
||||
if(info_mddf.mddf_block != i - before_mddf) return false;
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Current sector = {0}", i);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.mddf_block = {0}", info_mddf.mddf_block);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Disk size = {0} sectors", imagePlugin.GetSectors());
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size = {0} sectors", info_mddf.vol_size);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - 1 = {0}", info_mddf.volsize_minus_one);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - mddf.mddf_block -1 = {0}",
|
||||
info_mddf.volsize_minus_mddf_minus_one);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Disk sector = {0} bytes", imagePlugin.GetSectorSize());
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.blocksize = {0} bytes", info_mddf.blocksize);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.datasize = {0} bytes", info_mddf.datasize);
|
||||
|
||||
if(info_mddf.vol_size > imagePlugin.GetSectors()) return false;
|
||||
if(info_mddf.mddf_block != i - before_mddf) return false;
|
||||
|
||||
if(info_mddf.vol_size - 1 != info_mddf.volsize_minus_one) return false;
|
||||
if(info_mddf.vol_size > imagePlugin.GetSectors()) return false;
|
||||
|
||||
if(info_mddf.vol_size - i - 1 != info_mddf.volsize_minus_mddf_minus_one - before_mddf)
|
||||
return false;
|
||||
if(info_mddf.vol_size - 1 != info_mddf.volsize_minus_one) return false;
|
||||
|
||||
if(info_mddf.datasize > info_mddf.blocksize) return false;
|
||||
if(info_mddf.vol_size - i - 1 != info_mddf.volsize_minus_mddf_minus_one - before_mddf) return false;
|
||||
|
||||
if(info_mddf.blocksize < imagePlugin.GetSectorSize()) return false;
|
||||
if(info_mddf.datasize > info_mddf.blocksize) return false;
|
||||
|
||||
if(info_mddf.datasize != imagePlugin.GetSectorSize()) return false;
|
||||
if(info_mddf.blocksize < imagePlugin.GetSectorSize()) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
if(info_mddf.datasize != imagePlugin.GetSectorSize()) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -149,272 +145,233 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
if(before_mddf == -1 && searchTag.fileID == FILEID_LOADER_SIGNED) before_mddf = i - 1;
|
||||
|
||||
if(searchTag.fileID == FILEID_MDDF)
|
||||
if(searchTag.fileID != FILEID_MDDF) continue;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSector((ulong)i);
|
||||
MDDF info_mddf = new MDDF();
|
||||
byte[] pString = new byte[33];
|
||||
uint lisa_time;
|
||||
|
||||
info_mddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00);
|
||||
info_mddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
|
||||
info_mddf.volnum = BigEndianBitConverter.ToUInt16(sector, 0x0A);
|
||||
Array.Copy(sector, 0x0C, pString, 0, 33);
|
||||
info_mddf.volname = StringHandlers.PascalToString(pString, CurrentEncoding);
|
||||
info_mddf.unknown1 = sector[0x2D];
|
||||
Array.Copy(sector, 0x2E, pString, 0, 33);
|
||||
// Prevent garbage
|
||||
if(pString[0] <= 32) info_mddf.password = StringHandlers.PascalToString(pString, CurrentEncoding);
|
||||
else info_mddf.password = "";
|
||||
info_mddf.unknown2 = sector[0x4F];
|
||||
info_mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
|
||||
info_mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x58);
|
||||
info_mddf.dtvc = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x5C);
|
||||
info_mddf.dtcc = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x60);
|
||||
info_mddf.dtvb = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x64);
|
||||
info_mddf.dtvs = DateHandlers.LisaToDateTime(lisa_time);
|
||||
info_mddf.unknown3 = BigEndianBitConverter.ToUInt32(sector, 0x68);
|
||||
info_mddf.mddf_block = BigEndianBitConverter.ToUInt32(sector, 0x6C);
|
||||
info_mddf.volsize_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x70);
|
||||
info_mddf.volsize_minus_mddf_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x74);
|
||||
info_mddf.vol_size = BigEndianBitConverter.ToUInt32(sector, 0x78);
|
||||
info_mddf.blocksize = BigEndianBitConverter.ToUInt16(sector, 0x7C);
|
||||
info_mddf.datasize = BigEndianBitConverter.ToUInt16(sector, 0x7E);
|
||||
info_mddf.unknown4 = BigEndianBitConverter.ToUInt16(sector, 0x80);
|
||||
info_mddf.unknown5 = BigEndianBitConverter.ToUInt32(sector, 0x82);
|
||||
info_mddf.unknown6 = BigEndianBitConverter.ToUInt32(sector, 0x86);
|
||||
info_mddf.clustersize = BigEndianBitConverter.ToUInt16(sector, 0x8A);
|
||||
info_mddf.fs_size = BigEndianBitConverter.ToUInt32(sector, 0x8C);
|
||||
info_mddf.unknown7 = BigEndianBitConverter.ToUInt32(sector, 0x90);
|
||||
info_mddf.srec_ptr = BigEndianBitConverter.ToUInt32(sector, 0x94);
|
||||
info_mddf.unknown9 = BigEndianBitConverter.ToUInt16(sector, 0x98);
|
||||
info_mddf.srec_len = BigEndianBitConverter.ToUInt16(sector, 0x9A);
|
||||
info_mddf.unknown10 = BigEndianBitConverter.ToUInt32(sector, 0x9C);
|
||||
info_mddf.unknown11 = BigEndianBitConverter.ToUInt32(sector, 0xA0);
|
||||
info_mddf.unknown12 = BigEndianBitConverter.ToUInt32(sector, 0xA4);
|
||||
info_mddf.unknown13 = BigEndianBitConverter.ToUInt32(sector, 0xA8);
|
||||
info_mddf.unknown14 = BigEndianBitConverter.ToUInt32(sector, 0xAC);
|
||||
info_mddf.filecount = BigEndianBitConverter.ToUInt16(sector, 0xB0);
|
||||
info_mddf.unknown15 = BigEndianBitConverter.ToUInt32(sector, 0xB2);
|
||||
info_mddf.unknown16 = BigEndianBitConverter.ToUInt32(sector, 0xB6);
|
||||
info_mddf.freecount = BigEndianBitConverter.ToUInt32(sector, 0xBA);
|
||||
info_mddf.unknown17 = BigEndianBitConverter.ToUInt16(sector, 0xBE);
|
||||
info_mddf.unknown18 = BigEndianBitConverter.ToUInt32(sector, 0xC0);
|
||||
info_mddf.overmount_stamp = BigEndianBitConverter.ToUInt64(sector, 0xC4);
|
||||
info_mddf.serialization = BigEndianBitConverter.ToUInt32(sector, 0xCC);
|
||||
info_mddf.unknown19 = BigEndianBitConverter.ToUInt32(sector, 0xD0);
|
||||
info_mddf.unknown_timestamp = BigEndianBitConverter.ToUInt32(sector, 0xD4);
|
||||
info_mddf.unknown20 = BigEndianBitConverter.ToUInt32(sector, 0xD8);
|
||||
info_mddf.unknown21 = BigEndianBitConverter.ToUInt32(sector, 0xDC);
|
||||
info_mddf.unknown22 = BigEndianBitConverter.ToUInt32(sector, 0xE0);
|
||||
info_mddf.unknown23 = BigEndianBitConverter.ToUInt32(sector, 0xE4);
|
||||
info_mddf.unknown24 = BigEndianBitConverter.ToUInt32(sector, 0xE8);
|
||||
info_mddf.unknown25 = BigEndianBitConverter.ToUInt32(sector, 0xEC);
|
||||
info_mddf.unknown26 = BigEndianBitConverter.ToUInt32(sector, 0xF0);
|
||||
info_mddf.unknown27 = BigEndianBitConverter.ToUInt32(sector, 0xF4);
|
||||
info_mddf.unknown28 = BigEndianBitConverter.ToUInt32(sector, 0xF8);
|
||||
info_mddf.unknown29 = BigEndianBitConverter.ToUInt32(sector, 0xFC);
|
||||
info_mddf.unknown30 = BigEndianBitConverter.ToUInt32(sector, 0x100);
|
||||
info_mddf.unknown31 = BigEndianBitConverter.ToUInt32(sector, 0x104);
|
||||
info_mddf.unknown32 = BigEndianBitConverter.ToUInt32(sector, 0x108);
|
||||
info_mddf.unknown33 = BigEndianBitConverter.ToUInt32(sector, 0x10C);
|
||||
info_mddf.unknown34 = BigEndianBitConverter.ToUInt32(sector, 0x110);
|
||||
info_mddf.unknown35 = BigEndianBitConverter.ToUInt32(sector, 0x114);
|
||||
info_mddf.backup_volid = BigEndianBitConverter.ToUInt64(sector, 0x118);
|
||||
info_mddf.label_size = BigEndianBitConverter.ToUInt16(sector, 0x120);
|
||||
info_mddf.fs_overhead = BigEndianBitConverter.ToUInt16(sector, 0x122);
|
||||
info_mddf.result_scavenge = BigEndianBitConverter.ToUInt16(sector, 0x124);
|
||||
info_mddf.boot_code = BigEndianBitConverter.ToUInt16(sector, 0x126);
|
||||
info_mddf.boot_environ = BigEndianBitConverter.ToUInt16(sector, 0x6C);
|
||||
info_mddf.unknown36 = BigEndianBitConverter.ToUInt32(sector, 0x12A);
|
||||
info_mddf.unknown37 = BigEndianBitConverter.ToUInt32(sector, 0x12E);
|
||||
info_mddf.unknown38 = BigEndianBitConverter.ToUInt32(sector, 0x132);
|
||||
info_mddf.vol_sequence = BigEndianBitConverter.ToUInt16(sector, 0x136);
|
||||
info_mddf.vol_left_mounted = sector[0x138];
|
||||
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown1 = 0x{0:X2} ({0})", info_mddf.unknown1);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown2 = 0x{0:X2} ({0})", info_mddf.unknown2);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown3 = 0x{0:X8} ({0})", info_mddf.unknown3);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown4 = 0x{0:X4} ({0})", info_mddf.unknown4);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown5 = 0x{0:X8} ({0})", info_mddf.unknown5);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown6 = 0x{0:X8} ({0})", info_mddf.unknown6);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown7 = 0x{0:X8} ({0})", info_mddf.unknown7);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown9 = 0x{0:X4} ({0})", info_mddf.unknown9);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown10 = 0x{0:X8} ({0})", info_mddf.unknown10);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown11 = 0x{0:X8} ({0})", info_mddf.unknown11);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown12 = 0x{0:X8} ({0})", info_mddf.unknown12);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown13 = 0x{0:X8} ({0})", info_mddf.unknown13);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown14 = 0x{0:X8} ({0})", info_mddf.unknown14);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown15 = 0x{0:X8} ({0})", info_mddf.unknown15);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown16 = 0x{0:X8} ({0})", info_mddf.unknown16);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown17 = 0x{0:X4} ({0})", info_mddf.unknown17);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown18 = 0x{0:X8} ({0})", info_mddf.unknown18);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown19 = 0x{0:X8} ({0})", info_mddf.unknown19);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown20 = 0x{0:X8} ({0})", info_mddf.unknown20);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown21 = 0x{0:X8} ({0})", info_mddf.unknown21);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown22 = 0x{0:X8} ({0})", info_mddf.unknown22);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown23 = 0x{0:X8} ({0})", info_mddf.unknown23);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown24 = 0x{0:X8} ({0})", info_mddf.unknown24);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown25 = 0x{0:X8} ({0})", info_mddf.unknown25);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown26 = 0x{0:X8} ({0})", info_mddf.unknown26);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown27 = 0x{0:X8} ({0})", info_mddf.unknown27);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown28 = 0x{0:X8} ({0})", info_mddf.unknown28);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown29 = 0x{0:X8} ({0})", info_mddf.unknown29);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown30 = 0x{0:X8} ({0})", info_mddf.unknown30);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown31 = 0x{0:X8} ({0})", info_mddf.unknown31);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown32 = 0x{0:X8} ({0})", info_mddf.unknown32);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown33 = 0x{0:X8} ({0})", info_mddf.unknown33);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown34 = 0x{0:X8} ({0})", info_mddf.unknown34);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown35 = 0x{0:X8} ({0})", info_mddf.unknown35);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown36 = 0x{0:X8} ({0})", info_mddf.unknown36);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown37 = 0x{0:X8} ({0})", info_mddf.unknown37);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown38 = 0x{0:X8} ({0})", info_mddf.unknown38);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown_timestamp = 0x{0:X8} ({0}, {1})",
|
||||
info_mddf.unknown_timestamp,
|
||||
DateHandlers.LisaToDateTime(info_mddf.unknown_timestamp));
|
||||
|
||||
if(info_mddf.mddf_block != i - before_mddf) return;
|
||||
|
||||
if(info_mddf.vol_size > imagePlugin.GetSectors()) return;
|
||||
|
||||
if(info_mddf.vol_size - 1 != info_mddf.volsize_minus_one) return;
|
||||
|
||||
if(info_mddf.vol_size - i - 1 != info_mddf.volsize_minus_mddf_minus_one - before_mddf) return;
|
||||
|
||||
if(info_mddf.datasize > info_mddf.blocksize) return;
|
||||
|
||||
if(info_mddf.blocksize < imagePlugin.GetSectorSize()) return;
|
||||
|
||||
if(info_mddf.datasize != imagePlugin.GetSectorSize()) return;
|
||||
|
||||
switch(info_mddf.fsversion)
|
||||
{
|
||||
byte[] sector = imagePlugin.ReadSector((ulong)i);
|
||||
MDDF info_mddf = new MDDF();
|
||||
byte[] pString = new byte[33];
|
||||
uint lisa_time;
|
||||
|
||||
info_mddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00);
|
||||
info_mddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
|
||||
info_mddf.volnum = BigEndianBitConverter.ToUInt16(sector, 0x0A);
|
||||
Array.Copy(sector, 0x0C, pString, 0, 33);
|
||||
info_mddf.volname = StringHandlers.PascalToString(pString, CurrentEncoding);
|
||||
info_mddf.unknown1 = sector[0x2D];
|
||||
Array.Copy(sector, 0x2E, pString, 0, 33);
|
||||
// Prevent garbage
|
||||
if(pString[0] <= 32)
|
||||
info_mddf.password = StringHandlers.PascalToString(pString, CurrentEncoding);
|
||||
else info_mddf.password = "";
|
||||
info_mddf.unknown2 = sector[0x4F];
|
||||
info_mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
|
||||
info_mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x58);
|
||||
info_mddf.dtvc = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x5C);
|
||||
info_mddf.dtcc = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x60);
|
||||
info_mddf.dtvb = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x64);
|
||||
info_mddf.dtvs = DateHandlers.LisaToDateTime(lisa_time);
|
||||
info_mddf.unknown3 = BigEndianBitConverter.ToUInt32(sector, 0x68);
|
||||
info_mddf.mddf_block = BigEndianBitConverter.ToUInt32(sector, 0x6C);
|
||||
info_mddf.volsize_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x70);
|
||||
info_mddf.volsize_minus_mddf_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x74);
|
||||
info_mddf.vol_size = BigEndianBitConverter.ToUInt32(sector, 0x78);
|
||||
info_mddf.blocksize = BigEndianBitConverter.ToUInt16(sector, 0x7C);
|
||||
info_mddf.datasize = BigEndianBitConverter.ToUInt16(sector, 0x7E);
|
||||
info_mddf.unknown4 = BigEndianBitConverter.ToUInt16(sector, 0x80);
|
||||
info_mddf.unknown5 = BigEndianBitConverter.ToUInt32(sector, 0x82);
|
||||
info_mddf.unknown6 = BigEndianBitConverter.ToUInt32(sector, 0x86);
|
||||
info_mddf.clustersize = BigEndianBitConverter.ToUInt16(sector, 0x8A);
|
||||
info_mddf.fs_size = BigEndianBitConverter.ToUInt32(sector, 0x8C);
|
||||
info_mddf.unknown7 = BigEndianBitConverter.ToUInt32(sector, 0x90);
|
||||
info_mddf.srec_ptr = BigEndianBitConverter.ToUInt32(sector, 0x94);
|
||||
info_mddf.unknown9 = BigEndianBitConverter.ToUInt16(sector, 0x98);
|
||||
info_mddf.srec_len = BigEndianBitConverter.ToUInt16(sector, 0x9A);
|
||||
info_mddf.unknown10 = BigEndianBitConverter.ToUInt32(sector, 0x9C);
|
||||
info_mddf.unknown11 = BigEndianBitConverter.ToUInt32(sector, 0xA0);
|
||||
info_mddf.unknown12 = BigEndianBitConverter.ToUInt32(sector, 0xA4);
|
||||
info_mddf.unknown13 = BigEndianBitConverter.ToUInt32(sector, 0xA8);
|
||||
info_mddf.unknown14 = BigEndianBitConverter.ToUInt32(sector, 0xAC);
|
||||
info_mddf.filecount = BigEndianBitConverter.ToUInt16(sector, 0xB0);
|
||||
info_mddf.unknown15 = BigEndianBitConverter.ToUInt32(sector, 0xB2);
|
||||
info_mddf.unknown16 = BigEndianBitConverter.ToUInt32(sector, 0xB6);
|
||||
info_mddf.freecount = BigEndianBitConverter.ToUInt32(sector, 0xBA);
|
||||
info_mddf.unknown17 = BigEndianBitConverter.ToUInt16(sector, 0xBE);
|
||||
info_mddf.unknown18 = BigEndianBitConverter.ToUInt32(sector, 0xC0);
|
||||
info_mddf.overmount_stamp = BigEndianBitConverter.ToUInt64(sector, 0xC4);
|
||||
info_mddf.serialization = BigEndianBitConverter.ToUInt32(sector, 0xCC);
|
||||
info_mddf.unknown19 = BigEndianBitConverter.ToUInt32(sector, 0xD0);
|
||||
info_mddf.unknown_timestamp = BigEndianBitConverter.ToUInt32(sector, 0xD4);
|
||||
info_mddf.unknown20 = BigEndianBitConverter.ToUInt32(sector, 0xD8);
|
||||
info_mddf.unknown21 = BigEndianBitConverter.ToUInt32(sector, 0xDC);
|
||||
info_mddf.unknown22 = BigEndianBitConverter.ToUInt32(sector, 0xE0);
|
||||
info_mddf.unknown23 = BigEndianBitConverter.ToUInt32(sector, 0xE4);
|
||||
info_mddf.unknown24 = BigEndianBitConverter.ToUInt32(sector, 0xE8);
|
||||
info_mddf.unknown25 = BigEndianBitConverter.ToUInt32(sector, 0xEC);
|
||||
info_mddf.unknown26 = BigEndianBitConverter.ToUInt32(sector, 0xF0);
|
||||
info_mddf.unknown27 = BigEndianBitConverter.ToUInt32(sector, 0xF4);
|
||||
info_mddf.unknown28 = BigEndianBitConverter.ToUInt32(sector, 0xF8);
|
||||
info_mddf.unknown29 = BigEndianBitConverter.ToUInt32(sector, 0xFC);
|
||||
info_mddf.unknown30 = BigEndianBitConverter.ToUInt32(sector, 0x100);
|
||||
info_mddf.unknown31 = BigEndianBitConverter.ToUInt32(sector, 0x104);
|
||||
info_mddf.unknown32 = BigEndianBitConverter.ToUInt32(sector, 0x108);
|
||||
info_mddf.unknown33 = BigEndianBitConverter.ToUInt32(sector, 0x10C);
|
||||
info_mddf.unknown34 = BigEndianBitConverter.ToUInt32(sector, 0x110);
|
||||
info_mddf.unknown35 = BigEndianBitConverter.ToUInt32(sector, 0x114);
|
||||
info_mddf.backup_volid = BigEndianBitConverter.ToUInt64(sector, 0x118);
|
||||
info_mddf.label_size = BigEndianBitConverter.ToUInt16(sector, 0x120);
|
||||
info_mddf.fs_overhead = BigEndianBitConverter.ToUInt16(sector, 0x122);
|
||||
info_mddf.result_scavenge = BigEndianBitConverter.ToUInt16(sector, 0x124);
|
||||
info_mddf.boot_code = BigEndianBitConverter.ToUInt16(sector, 0x126);
|
||||
info_mddf.boot_environ = BigEndianBitConverter.ToUInt16(sector, 0x6C);
|
||||
info_mddf.unknown36 = BigEndianBitConverter.ToUInt32(sector, 0x12A);
|
||||
info_mddf.unknown37 = BigEndianBitConverter.ToUInt32(sector, 0x12E);
|
||||
info_mddf.unknown38 = BigEndianBitConverter.ToUInt32(sector, 0x132);
|
||||
info_mddf.vol_sequence = BigEndianBitConverter.ToUInt16(sector, 0x136);
|
||||
info_mddf.vol_left_mounted = sector[0x138];
|
||||
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown1 = 0x{0:X2} ({0})",
|
||||
info_mddf.unknown1);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown2 = 0x{0:X2} ({0})",
|
||||
info_mddf.unknown2);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown3 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown3);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown4 = 0x{0:X4} ({0})",
|
||||
info_mddf.unknown4);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown5 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown5);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown6 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown6);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown7 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown7);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown9 = 0x{0:X4} ({0})",
|
||||
info_mddf.unknown9);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown10 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown10);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown11 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown11);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown12 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown12);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown13 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown13);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown14 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown14);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown15 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown15);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown16 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown16);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown17 = 0x{0:X4} ({0})",
|
||||
info_mddf.unknown17);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown18 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown18);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown19 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown19);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown20 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown20);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown21 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown21);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown22 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown22);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown23 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown23);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown24 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown24);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown25 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown25);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown26 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown26);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown27 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown27);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown28 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown28);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown29 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown29);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown30 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown30);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown31 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown31);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown32 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown32);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown33 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown33);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown34 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown34);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown35 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown35);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown36 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown36);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown37 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown37);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown38 = 0x{0:X8} ({0})",
|
||||
info_mddf.unknown38);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown_timestamp = 0x{0:X8} ({0}, {1})",
|
||||
info_mddf.unknown_timestamp,
|
||||
DateHandlers.LisaToDateTime(info_mddf.unknown_timestamp));
|
||||
|
||||
if(info_mddf.mddf_block != i - before_mddf) return;
|
||||
|
||||
if(info_mddf.vol_size > imagePlugin.GetSectors()) return;
|
||||
|
||||
if(info_mddf.vol_size - 1 != info_mddf.volsize_minus_one) return;
|
||||
|
||||
if(info_mddf.vol_size - i - 1 != info_mddf.volsize_minus_mddf_minus_one - before_mddf) return;
|
||||
|
||||
if(info_mddf.datasize > info_mddf.blocksize) return;
|
||||
|
||||
if(info_mddf.blocksize < imagePlugin.GetSectorSize()) return;
|
||||
|
||||
if(info_mddf.datasize != imagePlugin.GetSectorSize()) return;
|
||||
|
||||
switch(info_mddf.fsversion)
|
||||
{
|
||||
case LisaFSv1:
|
||||
sb.AppendLine("LisaFS v1");
|
||||
break;
|
||||
case LisaFSv2:
|
||||
sb.AppendLine("LisaFS v2");
|
||||
break;
|
||||
case LisaFSv3:
|
||||
sb.AppendLine("LisaFS v3");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Uknown LisaFS version {0}", info_mddf.fsversion).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
sb.AppendFormat("Volume name: \"{0}\"", info_mddf.volname).AppendLine();
|
||||
sb.AppendFormat("Volume password: \"{0}\"", info_mddf.password).AppendLine();
|
||||
sb.AppendFormat("Volume ID: 0x{0:X16}", info_mddf.volid).AppendLine();
|
||||
sb.AppendFormat("Backup volume ID: 0x{0:X16}", info_mddf.backup_volid).AppendLine();
|
||||
|
||||
sb.AppendFormat("Master copy ID: 0x{0:X8}", info_mddf.master_copy_id).AppendLine();
|
||||
|
||||
sb.AppendFormat("Volume is number {0} of {1}", info_mddf.volnum, info_mddf.vol_sequence)
|
||||
.AppendLine();
|
||||
|
||||
sb.AppendFormat("Serial number of Lisa computer that created this volume: {0}",
|
||||
info_mddf.machine_id).AppendLine();
|
||||
sb.AppendFormat("Serial number of Lisa computer that can use this volume's software {0}",
|
||||
info_mddf.serialization).AppendLine();
|
||||
|
||||
sb.AppendFormat("Volume created on {0}", info_mddf.dtvc).AppendLine();
|
||||
sb.AppendFormat("Some timestamp, says {0}", info_mddf.dtcc).AppendLine();
|
||||
sb.AppendFormat("Volume backed up on {0}", info_mddf.dtvb).AppendLine();
|
||||
sb.AppendFormat("Volume scavenged on {0}", info_mddf.dtvs).AppendLine();
|
||||
sb.AppendFormat("MDDF is in block {0}", info_mddf.mddf_block + before_mddf).AppendLine();
|
||||
sb.AppendFormat("There are {0} reserved blocks before volume", before_mddf).AppendLine();
|
||||
sb.AppendFormat("{0} blocks minus one", info_mddf.volsize_minus_one).AppendLine();
|
||||
sb.AppendFormat("{0} blocks minus one minus MDDF offset",
|
||||
info_mddf.volsize_minus_mddf_minus_one).AppendLine();
|
||||
sb.AppendFormat("{0} blocks in volume", info_mddf.vol_size).AppendLine();
|
||||
sb.AppendFormat("{0} bytes per sector (uncooked)", info_mddf.blocksize).AppendLine();
|
||||
sb.AppendFormat("{0} bytes per sector", info_mddf.datasize).AppendLine();
|
||||
sb.AppendFormat("{0} blocks per cluster", info_mddf.clustersize).AppendLine();
|
||||
sb.AppendFormat("{0} blocks in filesystem", info_mddf.fs_size).AppendLine();
|
||||
sb.AppendFormat("{0} files in volume", info_mddf.filecount).AppendLine();
|
||||
sb.AppendFormat("{0} blocks free", info_mddf.freecount).AppendLine();
|
||||
sb.AppendFormat("{0} bytes in LisaInfo", info_mddf.label_size).AppendLine();
|
||||
sb.AppendFormat("Filesystem overhead: {0}", info_mddf.fs_overhead).AppendLine();
|
||||
sb.AppendFormat("Scanvenger result code: 0x{0:X8}", info_mddf.result_scavenge).AppendLine();
|
||||
sb.AppendFormat("Boot code: 0x{0:X8}", info_mddf.boot_code).AppendLine();
|
||||
sb.AppendFormat("Boot environment: 0x{0:X8}", info_mddf.boot_environ).AppendLine();
|
||||
sb.AppendFormat("Overmount stamp: 0x{0:X16}", info_mddf.overmount_stamp).AppendLine();
|
||||
sb.AppendFormat("S-Records start at {0} and spans for {1} blocks",
|
||||
info_mddf.srec_ptr + info_mddf.mddf_block + before_mddf, info_mddf.srec_len)
|
||||
.AppendLine();
|
||||
|
||||
if(info_mddf.vol_left_mounted == 0) sb.AppendLine("Volume is clean");
|
||||
else sb.AppendLine("Volume is dirty");
|
||||
|
||||
information = sb.ToString();
|
||||
|
||||
xmlFSType = new Schemas.FileSystemType();
|
||||
if(DateTime.Compare(info_mddf.dtvb, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
{
|
||||
xmlFSType.BackupDate = info_mddf.dtvb;
|
||||
xmlFSType.BackupDateSpecified = true;
|
||||
}
|
||||
xmlFSType.Clusters = info_mddf.vol_size;
|
||||
xmlFSType.ClusterSize = info_mddf.clustersize * info_mddf.datasize;
|
||||
if(DateTime.Compare(info_mddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
{
|
||||
xmlFSType.CreationDate = info_mddf.dtvc;
|
||||
xmlFSType.CreationDateSpecified = true;
|
||||
}
|
||||
xmlFSType.Dirty = info_mddf.vol_left_mounted != 0;
|
||||
xmlFSType.Files = info_mddf.filecount;
|
||||
xmlFSType.FilesSpecified = true;
|
||||
xmlFSType.FreeClusters = info_mddf.freecount;
|
||||
xmlFSType.FreeClustersSpecified = true;
|
||||
xmlFSType.Type = "LisaFS";
|
||||
xmlFSType.VolumeName = info_mddf.volname;
|
||||
xmlFSType.VolumeSerial = string.Format("{0:X16}", info_mddf.volid);
|
||||
|
||||
return;
|
||||
case LisaFSv1:
|
||||
sb.AppendLine("LisaFS v1");
|
||||
break;
|
||||
case LisaFSv2:
|
||||
sb.AppendLine("LisaFS v2");
|
||||
break;
|
||||
case LisaFSv3:
|
||||
sb.AppendLine("LisaFS v3");
|
||||
break;
|
||||
default:
|
||||
sb.AppendFormat("Uknown LisaFS version {0}", info_mddf.fsversion).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
sb.AppendFormat("Volume name: \"{0}\"", info_mddf.volname).AppendLine();
|
||||
sb.AppendFormat("Volume password: \"{0}\"", info_mddf.password).AppendLine();
|
||||
sb.AppendFormat("Volume ID: 0x{0:X16}", info_mddf.volid).AppendLine();
|
||||
sb.AppendFormat("Backup volume ID: 0x{0:X16}", info_mddf.backup_volid).AppendLine();
|
||||
|
||||
sb.AppendFormat("Master copy ID: 0x{0:X8}", info_mddf.master_copy_id).AppendLine();
|
||||
|
||||
sb.AppendFormat("Volume is number {0} of {1}", info_mddf.volnum, info_mddf.vol_sequence)
|
||||
.AppendLine();
|
||||
|
||||
sb.AppendFormat("Serial number of Lisa computer that created this volume: {0}",
|
||||
info_mddf.machine_id).AppendLine();
|
||||
sb.AppendFormat("Serial number of Lisa computer that can use this volume's software {0}",
|
||||
info_mddf.serialization).AppendLine();
|
||||
|
||||
sb.AppendFormat("Volume created on {0}", info_mddf.dtvc).AppendLine();
|
||||
sb.AppendFormat("Some timestamp, says {0}", info_mddf.dtcc).AppendLine();
|
||||
sb.AppendFormat("Volume backed up on {0}", info_mddf.dtvb).AppendLine();
|
||||
sb.AppendFormat("Volume scavenged on {0}", info_mddf.dtvs).AppendLine();
|
||||
sb.AppendFormat("MDDF is in block {0}", info_mddf.mddf_block + before_mddf).AppendLine();
|
||||
sb.AppendFormat("There are {0} reserved blocks before volume", before_mddf).AppendLine();
|
||||
sb.AppendFormat("{0} blocks minus one", info_mddf.volsize_minus_one).AppendLine();
|
||||
sb.AppendFormat("{0} blocks minus one minus MDDF offset", info_mddf.volsize_minus_mddf_minus_one)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("{0} blocks in volume", info_mddf.vol_size).AppendLine();
|
||||
sb.AppendFormat("{0} bytes per sector (uncooked)", info_mddf.blocksize).AppendLine();
|
||||
sb.AppendFormat("{0} bytes per sector", info_mddf.datasize).AppendLine();
|
||||
sb.AppendFormat("{0} blocks per cluster", info_mddf.clustersize).AppendLine();
|
||||
sb.AppendFormat("{0} blocks in filesystem", info_mddf.fs_size).AppendLine();
|
||||
sb.AppendFormat("{0} files in volume", info_mddf.filecount).AppendLine();
|
||||
sb.AppendFormat("{0} blocks free", info_mddf.freecount).AppendLine();
|
||||
sb.AppendFormat("{0} bytes in LisaInfo", info_mddf.label_size).AppendLine();
|
||||
sb.AppendFormat("Filesystem overhead: {0}", info_mddf.fs_overhead).AppendLine();
|
||||
sb.AppendFormat("Scanvenger result code: 0x{0:X8}", info_mddf.result_scavenge).AppendLine();
|
||||
sb.AppendFormat("Boot code: 0x{0:X8}", info_mddf.boot_code).AppendLine();
|
||||
sb.AppendFormat("Boot environment: 0x{0:X8}", info_mddf.boot_environ).AppendLine();
|
||||
sb.AppendFormat("Overmount stamp: 0x{0:X16}", info_mddf.overmount_stamp).AppendLine();
|
||||
sb.AppendFormat("S-Records start at {0} and spans for {1} blocks",
|
||||
info_mddf.srec_ptr + info_mddf.mddf_block + before_mddf, info_mddf.srec_len)
|
||||
.AppendLine();
|
||||
|
||||
if(info_mddf.vol_left_mounted == 0) sb.AppendLine("Volume is clean");
|
||||
else sb.AppendLine("Volume is dirty");
|
||||
|
||||
information = sb.ToString();
|
||||
|
||||
xmlFSType = new Schemas.FileSystemType();
|
||||
if(DateTime.Compare(info_mddf.dtvb, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
{
|
||||
xmlFSType.BackupDate = info_mddf.dtvb;
|
||||
xmlFSType.BackupDateSpecified = true;
|
||||
}
|
||||
xmlFSType.Clusters = info_mddf.vol_size;
|
||||
xmlFSType.ClusterSize = info_mddf.clustersize * info_mddf.datasize;
|
||||
if(DateTime.Compare(info_mddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
{
|
||||
xmlFSType.CreationDate = info_mddf.dtvc;
|
||||
xmlFSType.CreationDateSpecified = true;
|
||||
}
|
||||
xmlFSType.Dirty = info_mddf.vol_left_mounted != 0;
|
||||
xmlFSType.Files = info_mddf.filecount;
|
||||
xmlFSType.FilesSpecified = true;
|
||||
xmlFSType.FreeClusters = info_mddf.freecount;
|
||||
xmlFSType.FreeClustersSpecified = true;
|
||||
xmlFSType.Type = "LisaFS";
|
||||
xmlFSType.VolumeName = info_mddf.volname;
|
||||
xmlFSType.VolumeSerial = string.Format("{0:X16}", info_mddf.volid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -89,230 +89,229 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
if(volumePrefix == device.ImageInfo.Sectors && searchTag.fileID == FILEID_LOADER_SIGNED)
|
||||
volumePrefix = i - 1;
|
||||
|
||||
if(searchTag.fileID == FILEID_MDDF)
|
||||
if(searchTag.fileID != FILEID_MDDF) continue;
|
||||
|
||||
devTagSize = device.ReadSectorTag(i, SectorTagType.AppleSectorTag).Length;
|
||||
|
||||
byte[] sector = device.ReadSector(i);
|
||||
mddf = new MDDF();
|
||||
byte[] pString = new byte[33];
|
||||
uint lisa_time;
|
||||
|
||||
mddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00);
|
||||
mddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
|
||||
mddf.volnum = BigEndianBitConverter.ToUInt16(sector, 0x0A);
|
||||
Array.Copy(sector, 0x0C, pString, 0, 33);
|
||||
mddf.volname = StringHandlers.PascalToString(pString, CurrentEncoding);
|
||||
mddf.unknown1 = sector[0x2D];
|
||||
Array.Copy(sector, 0x2E, pString, 0, 33);
|
||||
// Prevent garbage
|
||||
if(pString[0] <= 32) mddf.password = StringHandlers.PascalToString(pString, CurrentEncoding);
|
||||
else mddf.password = "";
|
||||
mddf.unknown2 = sector[0x4F];
|
||||
mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
|
||||
mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x58);
|
||||
mddf.dtvc = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x5C);
|
||||
mddf.dtcc = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x60);
|
||||
mddf.dtvb = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x64);
|
||||
mddf.dtvs = DateHandlers.LisaToDateTime(lisa_time);
|
||||
mddf.unknown3 = BigEndianBitConverter.ToUInt32(sector, 0x68);
|
||||
mddf.mddf_block = BigEndianBitConverter.ToUInt32(sector, 0x6C);
|
||||
mddf.volsize_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x70);
|
||||
mddf.volsize_minus_mddf_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x74);
|
||||
mddf.vol_size = BigEndianBitConverter.ToUInt32(sector, 0x78);
|
||||
mddf.blocksize = BigEndianBitConverter.ToUInt16(sector, 0x7C);
|
||||
mddf.datasize = BigEndianBitConverter.ToUInt16(sector, 0x7E);
|
||||
mddf.unknown4 = BigEndianBitConverter.ToUInt16(sector, 0x80);
|
||||
mddf.unknown5 = BigEndianBitConverter.ToUInt32(sector, 0x82);
|
||||
mddf.unknown6 = BigEndianBitConverter.ToUInt32(sector, 0x86);
|
||||
mddf.clustersize = BigEndianBitConverter.ToUInt16(sector, 0x8A);
|
||||
mddf.fs_size = BigEndianBitConverter.ToUInt32(sector, 0x8C);
|
||||
mddf.unknown7 = BigEndianBitConverter.ToUInt32(sector, 0x90);
|
||||
mddf.srec_ptr = BigEndianBitConverter.ToUInt32(sector, 0x94);
|
||||
mddf.unknown9 = BigEndianBitConverter.ToUInt16(sector, 0x98);
|
||||
mddf.srec_len = BigEndianBitConverter.ToUInt16(sector, 0x9A);
|
||||
mddf.unknown10 = BigEndianBitConverter.ToUInt32(sector, 0x9C);
|
||||
mddf.unknown11 = BigEndianBitConverter.ToUInt32(sector, 0xA0);
|
||||
mddf.unknown12 = BigEndianBitConverter.ToUInt32(sector, 0xA4);
|
||||
mddf.unknown13 = BigEndianBitConverter.ToUInt32(sector, 0xA8);
|
||||
mddf.unknown14 = BigEndianBitConverter.ToUInt32(sector, 0xAC);
|
||||
mddf.filecount = BigEndianBitConverter.ToUInt16(sector, 0xB0);
|
||||
mddf.unknown15 = BigEndianBitConverter.ToUInt32(sector, 0xB2);
|
||||
mddf.unknown16 = BigEndianBitConverter.ToUInt32(sector, 0xB6);
|
||||
mddf.freecount = BigEndianBitConverter.ToUInt32(sector, 0xBA);
|
||||
mddf.unknown17 = BigEndianBitConverter.ToUInt16(sector, 0xBE);
|
||||
mddf.unknown18 = BigEndianBitConverter.ToUInt32(sector, 0xC0);
|
||||
mddf.overmount_stamp = BigEndianBitConverter.ToUInt64(sector, 0xC4);
|
||||
mddf.serialization = BigEndianBitConverter.ToUInt32(sector, 0xCC);
|
||||
mddf.unknown19 = BigEndianBitConverter.ToUInt32(sector, 0xD0);
|
||||
mddf.unknown_timestamp = BigEndianBitConverter.ToUInt32(sector, 0xD4);
|
||||
mddf.unknown20 = BigEndianBitConverter.ToUInt32(sector, 0xD8);
|
||||
mddf.unknown21 = BigEndianBitConverter.ToUInt32(sector, 0xDC);
|
||||
mddf.unknown22 = BigEndianBitConverter.ToUInt32(sector, 0xE0);
|
||||
mddf.unknown23 = BigEndianBitConverter.ToUInt32(sector, 0xE4);
|
||||
mddf.unknown24 = BigEndianBitConverter.ToUInt32(sector, 0xE8);
|
||||
mddf.unknown25 = BigEndianBitConverter.ToUInt32(sector, 0xEC);
|
||||
mddf.unknown26 = BigEndianBitConverter.ToUInt32(sector, 0xF0);
|
||||
mddf.unknown27 = BigEndianBitConverter.ToUInt32(sector, 0xF4);
|
||||
mddf.unknown28 = BigEndianBitConverter.ToUInt32(sector, 0xF8);
|
||||
mddf.unknown29 = BigEndianBitConverter.ToUInt32(sector, 0xFC);
|
||||
mddf.unknown30 = BigEndianBitConverter.ToUInt32(sector, 0x100);
|
||||
mddf.unknown31 = BigEndianBitConverter.ToUInt32(sector, 0x104);
|
||||
mddf.unknown32 = BigEndianBitConverter.ToUInt32(sector, 0x108);
|
||||
mddf.unknown33 = BigEndianBitConverter.ToUInt32(sector, 0x10C);
|
||||
mddf.unknown34 = BigEndianBitConverter.ToUInt32(sector, 0x110);
|
||||
mddf.unknown35 = BigEndianBitConverter.ToUInt32(sector, 0x114);
|
||||
mddf.backup_volid = BigEndianBitConverter.ToUInt64(sector, 0x118);
|
||||
mddf.label_size = BigEndianBitConverter.ToUInt16(sector, 0x120);
|
||||
mddf.fs_overhead = BigEndianBitConverter.ToUInt16(sector, 0x122);
|
||||
mddf.result_scavenge = BigEndianBitConverter.ToUInt16(sector, 0x124);
|
||||
mddf.boot_code = BigEndianBitConverter.ToUInt16(sector, 0x126);
|
||||
mddf.boot_environ = BigEndianBitConverter.ToUInt16(sector, 0x6C);
|
||||
mddf.unknown36 = BigEndianBitConverter.ToUInt32(sector, 0x12A);
|
||||
mddf.unknown37 = BigEndianBitConverter.ToUInt32(sector, 0x12E);
|
||||
mddf.unknown38 = BigEndianBitConverter.ToUInt32(sector, 0x132);
|
||||
mddf.vol_sequence = BigEndianBitConverter.ToUInt16(sector, 0x136);
|
||||
mddf.vol_left_mounted = sector[0x138];
|
||||
|
||||
// Check that the MDDF is correct
|
||||
if(mddf.mddf_block != i - volumePrefix || mddf.vol_size > device.GetSectors() ||
|
||||
mddf.vol_size - 1 != mddf.volsize_minus_one ||
|
||||
mddf.vol_size - i - 1 != mddf.volsize_minus_mddf_minus_one - volumePrefix ||
|
||||
mddf.datasize > mddf.blocksize || mddf.blocksize < device.GetSectorSize() ||
|
||||
mddf.datasize != device.GetSectorSize())
|
||||
{
|
||||
devTagSize = device.ReadSectorTag(i, SectorTagType.AppleSectorTag).Length;
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Incorrect MDDF found");
|
||||
return Errno.InvalidArgument;
|
||||
}
|
||||
|
||||
byte[] sector = device.ReadSector(i);
|
||||
mddf = new MDDF();
|
||||
byte[] pString = new byte[33];
|
||||
uint lisa_time;
|
||||
// Check MDDF version
|
||||
switch(mddf.fsversion)
|
||||
{
|
||||
case LisaFSv1:
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Mounting LisaFS v1");
|
||||
break;
|
||||
case LisaFSv2:
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Mounting LisaFS v2");
|
||||
break;
|
||||
case LisaFSv3:
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Mounting LisaFS v3");
|
||||
break;
|
||||
default:
|
||||
DicConsole.ErrorWriteLine("Cannot mount LisaFS version {0}", mddf.fsversion.ToString());
|
||||
return Errno.NotSupported;
|
||||
}
|
||||
|
||||
mddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00);
|
||||
mddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
|
||||
mddf.volnum = BigEndianBitConverter.ToUInt16(sector, 0x0A);
|
||||
Array.Copy(sector, 0x0C, pString, 0, 33);
|
||||
mddf.volname = StringHandlers.PascalToString(pString, CurrentEncoding);
|
||||
mddf.unknown1 = sector[0x2D];
|
||||
Array.Copy(sector, 0x2E, pString, 0, 33);
|
||||
// Prevent garbage
|
||||
if(pString[0] <= 32) mddf.password = StringHandlers.PascalToString(pString, CurrentEncoding);
|
||||
else mddf.password = "";
|
||||
mddf.unknown2 = sector[0x4F];
|
||||
mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
|
||||
mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x58);
|
||||
mddf.dtvc = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x5C);
|
||||
mddf.dtcc = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x60);
|
||||
mddf.dtvb = DateHandlers.LisaToDateTime(lisa_time);
|
||||
lisa_time = BigEndianBitConverter.ToUInt32(sector, 0x64);
|
||||
mddf.dtvs = DateHandlers.LisaToDateTime(lisa_time);
|
||||
mddf.unknown3 = BigEndianBitConverter.ToUInt32(sector, 0x68);
|
||||
mddf.mddf_block = BigEndianBitConverter.ToUInt32(sector, 0x6C);
|
||||
mddf.volsize_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x70);
|
||||
mddf.volsize_minus_mddf_minus_one = BigEndianBitConverter.ToUInt32(sector, 0x74);
|
||||
mddf.vol_size = BigEndianBitConverter.ToUInt32(sector, 0x78);
|
||||
mddf.blocksize = BigEndianBitConverter.ToUInt16(sector, 0x7C);
|
||||
mddf.datasize = BigEndianBitConverter.ToUInt16(sector, 0x7E);
|
||||
mddf.unknown4 = BigEndianBitConverter.ToUInt16(sector, 0x80);
|
||||
mddf.unknown5 = BigEndianBitConverter.ToUInt32(sector, 0x82);
|
||||
mddf.unknown6 = BigEndianBitConverter.ToUInt32(sector, 0x86);
|
||||
mddf.clustersize = BigEndianBitConverter.ToUInt16(sector, 0x8A);
|
||||
mddf.fs_size = BigEndianBitConverter.ToUInt32(sector, 0x8C);
|
||||
mddf.unknown7 = BigEndianBitConverter.ToUInt32(sector, 0x90);
|
||||
mddf.srec_ptr = BigEndianBitConverter.ToUInt32(sector, 0x94);
|
||||
mddf.unknown9 = BigEndianBitConverter.ToUInt16(sector, 0x98);
|
||||
mddf.srec_len = BigEndianBitConverter.ToUInt16(sector, 0x9A);
|
||||
mddf.unknown10 = BigEndianBitConverter.ToUInt32(sector, 0x9C);
|
||||
mddf.unknown11 = BigEndianBitConverter.ToUInt32(sector, 0xA0);
|
||||
mddf.unknown12 = BigEndianBitConverter.ToUInt32(sector, 0xA4);
|
||||
mddf.unknown13 = BigEndianBitConverter.ToUInt32(sector, 0xA8);
|
||||
mddf.unknown14 = BigEndianBitConverter.ToUInt32(sector, 0xAC);
|
||||
mddf.filecount = BigEndianBitConverter.ToUInt16(sector, 0xB0);
|
||||
mddf.unknown15 = BigEndianBitConverter.ToUInt32(sector, 0xB2);
|
||||
mddf.unknown16 = BigEndianBitConverter.ToUInt32(sector, 0xB6);
|
||||
mddf.freecount = BigEndianBitConverter.ToUInt32(sector, 0xBA);
|
||||
mddf.unknown17 = BigEndianBitConverter.ToUInt16(sector, 0xBE);
|
||||
mddf.unknown18 = BigEndianBitConverter.ToUInt32(sector, 0xC0);
|
||||
mddf.overmount_stamp = BigEndianBitConverter.ToUInt64(sector, 0xC4);
|
||||
mddf.serialization = BigEndianBitConverter.ToUInt32(sector, 0xCC);
|
||||
mddf.unknown19 = BigEndianBitConverter.ToUInt32(sector, 0xD0);
|
||||
mddf.unknown_timestamp = BigEndianBitConverter.ToUInt32(sector, 0xD4);
|
||||
mddf.unknown20 = BigEndianBitConverter.ToUInt32(sector, 0xD8);
|
||||
mddf.unknown21 = BigEndianBitConverter.ToUInt32(sector, 0xDC);
|
||||
mddf.unknown22 = BigEndianBitConverter.ToUInt32(sector, 0xE0);
|
||||
mddf.unknown23 = BigEndianBitConverter.ToUInt32(sector, 0xE4);
|
||||
mddf.unknown24 = BigEndianBitConverter.ToUInt32(sector, 0xE8);
|
||||
mddf.unknown25 = BigEndianBitConverter.ToUInt32(sector, 0xEC);
|
||||
mddf.unknown26 = BigEndianBitConverter.ToUInt32(sector, 0xF0);
|
||||
mddf.unknown27 = BigEndianBitConverter.ToUInt32(sector, 0xF4);
|
||||
mddf.unknown28 = BigEndianBitConverter.ToUInt32(sector, 0xF8);
|
||||
mddf.unknown29 = BigEndianBitConverter.ToUInt32(sector, 0xFC);
|
||||
mddf.unknown30 = BigEndianBitConverter.ToUInt32(sector, 0x100);
|
||||
mddf.unknown31 = BigEndianBitConverter.ToUInt32(sector, 0x104);
|
||||
mddf.unknown32 = BigEndianBitConverter.ToUInt32(sector, 0x108);
|
||||
mddf.unknown33 = BigEndianBitConverter.ToUInt32(sector, 0x10C);
|
||||
mddf.unknown34 = BigEndianBitConverter.ToUInt32(sector, 0x110);
|
||||
mddf.unknown35 = BigEndianBitConverter.ToUInt32(sector, 0x114);
|
||||
mddf.backup_volid = BigEndianBitConverter.ToUInt64(sector, 0x118);
|
||||
mddf.label_size = BigEndianBitConverter.ToUInt16(sector, 0x120);
|
||||
mddf.fs_overhead = BigEndianBitConverter.ToUInt16(sector, 0x122);
|
||||
mddf.result_scavenge = BigEndianBitConverter.ToUInt16(sector, 0x124);
|
||||
mddf.boot_code = BigEndianBitConverter.ToUInt16(sector, 0x126);
|
||||
mddf.boot_environ = BigEndianBitConverter.ToUInt16(sector, 0x6C);
|
||||
mddf.unknown36 = BigEndianBitConverter.ToUInt32(sector, 0x12A);
|
||||
mddf.unknown37 = BigEndianBitConverter.ToUInt32(sector, 0x12E);
|
||||
mddf.unknown38 = BigEndianBitConverter.ToUInt32(sector, 0x132);
|
||||
mddf.vol_sequence = BigEndianBitConverter.ToUInt16(sector, 0x136);
|
||||
mddf.vol_left_mounted = sector[0x138];
|
||||
// Initialize caches
|
||||
extentCache = new Dictionary<short, ExtentFile>();
|
||||
systemFileCache = new Dictionary<short, byte[]>();
|
||||
fileCache = new Dictionary<short, byte[]>();
|
||||
//catalogCache = new Dictionary<short, List<CatalogEntry>>();
|
||||
fileSizeCache = new Dictionary<short, int>();
|
||||
|
||||
// Check that the MDDF is correct
|
||||
if(mddf.mddf_block != i - volumePrefix || mddf.vol_size > device.GetSectors() ||
|
||||
mddf.vol_size - 1 != mddf.volsize_minus_one ||
|
||||
mddf.vol_size - i - 1 != mddf.volsize_minus_mddf_minus_one - volumePrefix ||
|
||||
mddf.datasize > mddf.blocksize || mddf.blocksize < device.GetSectorSize() ||
|
||||
mddf.datasize != device.GetSectorSize())
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Incorrect MDDF found");
|
||||
return Errno.InvalidArgument;
|
||||
}
|
||||
Errno error;
|
||||
|
||||
// Check MDDF version
|
||||
switch(mddf.fsversion)
|
||||
{
|
||||
case LisaFSv1:
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Mounting LisaFS v1");
|
||||
break;
|
||||
case LisaFSv2:
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Mounting LisaFS v2");
|
||||
break;
|
||||
case LisaFSv3:
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Mounting LisaFS v3");
|
||||
break;
|
||||
default:
|
||||
DicConsole.ErrorWriteLine("Cannot mount LisaFS version {0}", mddf.fsversion.ToString());
|
||||
return Errno.NotSupported;
|
||||
}
|
||||
mounted = true;
|
||||
this.debug = debug;
|
||||
|
||||
// Initialize caches
|
||||
extentCache = new Dictionary<short, ExtentFile>();
|
||||
systemFileCache = new Dictionary<short, byte[]>();
|
||||
fileCache = new Dictionary<short, byte[]>();
|
||||
//catalogCache = new Dictionary<short, List<CatalogEntry>>();
|
||||
fileSizeCache = new Dictionary<short, int>();
|
||||
if(debug) printedExtents = new List<short>();
|
||||
|
||||
Errno error;
|
||||
// Read the S-Records file
|
||||
error = ReadSRecords();
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Error {0} reading S-Records file.", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
mounted = true;
|
||||
this.debug = debug;
|
||||
directoryDTCCache = new Dictionary<short, DateTime>();
|
||||
directoryDTCCache.Add(DIRID_ROOT, mddf.dtcc);
|
||||
|
||||
if(debug) printedExtents = new List<short>();
|
||||
// Read the Catalog File
|
||||
error = ReadCatalog();
|
||||
|
||||
// Read the S-Records file
|
||||
error = ReadSRecords();
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Cannot read Catalog File, error {0}",
|
||||
error.ToString());
|
||||
mounted = false;
|
||||
return error;
|
||||
}
|
||||
|
||||
// If debug, cache system files
|
||||
if(debug)
|
||||
{
|
||||
byte[] temp;
|
||||
|
||||
error = ReadSystemFile(FILEID_BOOT_SIGNED, out temp);
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Error {0} reading S-Records file.", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
directoryDTCCache = new Dictionary<short, DateTime>();
|
||||
directoryDTCCache.Add(DIRID_ROOT, mddf.dtcc);
|
||||
|
||||
// Read the Catalog File
|
||||
error = ReadCatalog();
|
||||
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Cannot read Catalog File, error {0}",
|
||||
error.ToString());
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Unable to read boot blocks");
|
||||
mounted = false;
|
||||
return error;
|
||||
}
|
||||
|
||||
// If debug, cache system files
|
||||
if(debug)
|
||||
error = ReadSystemFile(FILEID_LOADER_SIGNED, out temp);
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
byte[] temp;
|
||||
|
||||
error = ReadSystemFile(FILEID_BOOT_SIGNED, out temp);
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Unable to read boot blocks");
|
||||
mounted = false;
|
||||
return error;
|
||||
}
|
||||
|
||||
error = ReadSystemFile(FILEID_LOADER_SIGNED, out temp);
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Unable to read boot loader");
|
||||
mounted = false;
|
||||
return error;
|
||||
}
|
||||
|
||||
error = ReadSystemFile((short)FILEID_MDDF, out temp);
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Unable to read MDDF");
|
||||
mounted = false;
|
||||
return error;
|
||||
}
|
||||
|
||||
error = ReadSystemFile((short)FILEID_BITMAP, out temp);
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Unable to read volume bitmap");
|
||||
mounted = false;
|
||||
return error;
|
||||
}
|
||||
|
||||
error = ReadSystemFile((short)FILEID_SRECORD, out temp);
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Unable to read S-Records file");
|
||||
mounted = false;
|
||||
return error;
|
||||
}
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Unable to read boot loader");
|
||||
mounted = false;
|
||||
return error;
|
||||
}
|
||||
|
||||
// Create XML metadata for mounted filesystem
|
||||
xmlFSType = new Schemas.FileSystemType();
|
||||
if(DateTime.Compare(mddf.dtvb, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
error = ReadSystemFile((short)FILEID_MDDF, out temp);
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
xmlFSType.BackupDate = mddf.dtvb;
|
||||
xmlFSType.BackupDateSpecified = true;
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Unable to read MDDF");
|
||||
mounted = false;
|
||||
return error;
|
||||
}
|
||||
xmlFSType.Clusters = mddf.vol_size;
|
||||
xmlFSType.ClusterSize = mddf.clustersize * mddf.datasize;
|
||||
if(DateTime.Compare(mddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
{
|
||||
xmlFSType.CreationDate = mddf.dtvc;
|
||||
xmlFSType.CreationDateSpecified = true;
|
||||
}
|
||||
xmlFSType.Dirty = mddf.vol_left_mounted != 0;
|
||||
xmlFSType.Files = mddf.filecount;
|
||||
xmlFSType.FilesSpecified = true;
|
||||
xmlFSType.FreeClusters = mddf.freecount;
|
||||
xmlFSType.FreeClustersSpecified = true;
|
||||
xmlFSType.Type = "LisaFS";
|
||||
xmlFSType.VolumeName = mddf.volname;
|
||||
xmlFSType.VolumeSerial = string.Format("{0:X16}", mddf.volid);
|
||||
|
||||
return Errno.NoError;
|
||||
error = ReadSystemFile((short)FILEID_BITMAP, out temp);
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Unable to read volume bitmap");
|
||||
mounted = false;
|
||||
return error;
|
||||
}
|
||||
|
||||
error = ReadSystemFile((short)FILEID_SRECORD, out temp);
|
||||
if(error != Errno.NoError)
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Unable to read S-Records file");
|
||||
mounted = false;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
// Create XML metadata for mounted filesystem
|
||||
xmlFSType = new Schemas.FileSystemType();
|
||||
if(DateTime.Compare(mddf.dtvb, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
{
|
||||
xmlFSType.BackupDate = mddf.dtvb;
|
||||
xmlFSType.BackupDateSpecified = true;
|
||||
}
|
||||
xmlFSType.Clusters = mddf.vol_size;
|
||||
xmlFSType.ClusterSize = mddf.clustersize * mddf.datasize;
|
||||
if(DateTime.Compare(mddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
{
|
||||
xmlFSType.CreationDate = mddf.dtvc;
|
||||
xmlFSType.CreationDateSpecified = true;
|
||||
}
|
||||
xmlFSType.Dirty = mddf.vol_left_mounted != 0;
|
||||
xmlFSType.Files = mddf.filecount;
|
||||
xmlFSType.FilesSpecified = true;
|
||||
xmlFSType.FreeClusters = mddf.freecount;
|
||||
xmlFSType.FreeClustersSpecified = true;
|
||||
xmlFSType.Type = "LisaFS";
|
||||
xmlFSType.VolumeName = mddf.volname;
|
||||
xmlFSType.VolumeSerial = string.Format("{0:X16}", mddf.volid);
|
||||
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Not a Lisa filesystem");
|
||||
|
||||
@@ -91,19 +91,18 @@ namespace DiscImageChef.Filesystems
|
||||
if(magic == "DECFILE11A " || magic == "DECFILE11B ") return true;
|
||||
|
||||
// Optical disc
|
||||
if(imagePlugin.ImageInfo.XmlMediaType == DiscImages.XmlMediaType.OpticalDisc)
|
||||
{
|
||||
if(hb_sector.Length < 0x400) return false;
|
||||
if(imagePlugin.ImageInfo.XmlMediaType != DiscImages.XmlMediaType.OpticalDisc) return false;
|
||||
|
||||
hb_sector = imagePlugin.ReadSector(partition.Start);
|
||||
if(hb_sector.Length < 0x400) return false;
|
||||
|
||||
Array.Copy(hb_sector, 0x3F0, magic_b, 0, 12);
|
||||
magic = Encoding.ASCII.GetString(magic_b);
|
||||
hb_sector = imagePlugin.ReadSector(partition.Start);
|
||||
|
||||
DicConsole.DebugWriteLine("Files-11 plugin", "unaligned magic: \"{0}\"", magic);
|
||||
Array.Copy(hb_sector, 0x3F0, magic_b, 0, 12);
|
||||
magic = Encoding.ASCII.GetString(magic_b);
|
||||
|
||||
if(magic == "DECFILE11A " || magic == "DECFILE11B ") return true;
|
||||
}
|
||||
DicConsole.DebugWriteLine("Files-11 plugin", "unaligned magic: \"{0}\"", magic);
|
||||
|
||||
if(magic == "DECFILE11A " || magic == "DECFILE11B ") return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -191,11 +191,10 @@ namespace DiscImageChef.Filesystems
|
||||
xmlFSType.FreeClusters = reiserSb.free_blocks;
|
||||
xmlFSType.FreeClustersSpecified = true;
|
||||
xmlFSType.Dirty = reiserSb.umount_state == 2;
|
||||
if(reiserSb.version >= 2)
|
||||
{
|
||||
xmlFSType.VolumeName = CurrentEncoding.GetString(reiserSb.label);
|
||||
xmlFSType.VolumeSerial = reiserSb.uuid.ToString();
|
||||
}
|
||||
if(reiserSb.version < 2) return;
|
||||
|
||||
xmlFSType.VolumeName = CurrentEncoding.GetString(reiserSb.label);
|
||||
xmlFSType.VolumeSerial = reiserSb.uuid.ToString();
|
||||
}
|
||||
|
||||
public override Errno Mount()
|
||||
|
||||
@@ -165,24 +165,26 @@ namespace DiscImageChef.Filesystems
|
||||
s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); // 7th edition's s_nfree
|
||||
s_ninode = BitConverter.ToUInt16(sb_sector, 0x0D0); // 7th edition's s_ninode
|
||||
|
||||
if(s_fsize > 0 && s_fsize < 0xFFFFFFFF && s_nfree > 0 && s_nfree < 0xFFFF && s_ninode > 0 &&
|
||||
s_ninode < 0xFFFF)
|
||||
{
|
||||
if((s_fsize & 0xFF) == 0x00 && (s_nfree & 0xFF) == 0x00 && (s_ninode & 0xFF) == 0x00)
|
||||
{
|
||||
// Byteswap
|
||||
s_fsize = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) +
|
||||
((s_fsize & 0xFF000000) >> 24);
|
||||
s_nfree = (ushort)(s_nfree >> 8);
|
||||
s_ninode = (ushort)(s_ninode >> 8);
|
||||
}
|
||||
if(s_fsize <= 0 || s_fsize >= 0xFFFFFFFF || s_nfree <= 0 || s_nfree >= 0xFFFF || s_ninode <= 0 ||
|
||||
s_ninode >= 0xFFFF) continue;
|
||||
|
||||
if((s_fsize & 0xFF000000) == 0x00 && (s_nfree & 0xFF00) == 0x00 && (s_ninode & 0xFF00) == 0x00)
|
||||
if(s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD)
|
||||
if(s_fsize * 1024 == (partition.End - partition.Start) * imagePlugin.GetSectorSize() ||
|
||||
s_fsize * 512 == (partition.End - partition.Start) * imagePlugin.GetSectorSize())
|
||||
return true;
|
||||
if((s_fsize & 0xFF) == 0x00 && (s_nfree & 0xFF) == 0x00 && (s_ninode & 0xFF) == 0x00)
|
||||
{
|
||||
// Byteswap
|
||||
s_fsize = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) +
|
||||
((s_fsize & 0xFF000000) >> 24);
|
||||
s_nfree = (ushort)(s_nfree >> 8);
|
||||
s_ninode = (ushort)(s_ninode >> 8);
|
||||
}
|
||||
|
||||
if((s_fsize & 0xFF000000) != 0x00 || (s_nfree & 0xFF00) != 0x00 ||
|
||||
(s_ninode & 0xFF00) != 0x00) continue;
|
||||
|
||||
if(s_fsize >= V7_MAXSIZE || s_nfree >= V7_NICFREE || s_ninode >= V7_NICINOD) continue;
|
||||
|
||||
if(s_fsize * 1024 == (partition.End - partition.Start) * imagePlugin.GetSectorSize() ||
|
||||
s_fsize * 512 == (partition.End - partition.Start) * imagePlugin.GetSectorSize())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -313,29 +315,30 @@ namespace DiscImageChef.Filesystems
|
||||
s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); // 7th edition's s_nfree
|
||||
s_ninode = BitConverter.ToUInt16(sb_sector, 0x0D0); // 7th edition's s_ninode
|
||||
|
||||
if(s_fsize > 0 && s_fsize < 0xFFFFFFFF && s_nfree > 0 && s_nfree < 0xFFFF && s_ninode > 0 &&
|
||||
s_ninode < 0xFFFF)
|
||||
{
|
||||
if((s_fsize & 0xFF) == 0x00 && (s_nfree & 0xFF) == 0x00 && (s_ninode & 0xFF) == 0x00)
|
||||
{
|
||||
// Byteswap
|
||||
s_fsize = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) +
|
||||
((s_fsize & 0xFF000000) >> 24);
|
||||
s_nfree = (ushort)(s_nfree >> 8);
|
||||
s_ninode = (ushort)(s_ninode >> 8);
|
||||
}
|
||||
if(s_fsize <= 0 || s_fsize >= 0xFFFFFFFF || s_nfree <= 0 || s_nfree >= 0xFFFF || s_ninode <= 0 ||
|
||||
s_ninode >= 0xFFFF) continue;
|
||||
|
||||
if((s_fsize & 0xFF000000) == 0x00 && (s_nfree & 0xFF00) == 0x00 && (s_ninode & 0xFF00) == 0x00)
|
||||
if(s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD)
|
||||
if(s_fsize * 1024 == (partition.End - partition.Start) * imagePlugin.GetSectorSize() ||
|
||||
s_fsize * 512 == (partition.End - partition.Start) * imagePlugin.GetSectorSize())
|
||||
{
|
||||
sys7th = true;
|
||||
BigEndianBitConverter.IsLittleEndian = true;
|
||||
start = i;
|
||||
break;
|
||||
}
|
||||
if((s_fsize & 0xFF) == 0x00 && (s_nfree & 0xFF) == 0x00 && (s_ninode & 0xFF) == 0x00)
|
||||
{
|
||||
// Byteswap
|
||||
s_fsize = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) +
|
||||
((s_fsize & 0xFF000000) >> 24);
|
||||
s_nfree = (ushort)(s_nfree >> 8);
|
||||
s_ninode = (ushort)(s_ninode >> 8);
|
||||
}
|
||||
|
||||
if((s_fsize & 0xFF000000) != 0x00 || (s_nfree & 0xFF00) != 0x00 ||
|
||||
(s_ninode & 0xFF00) != 0x00) continue;
|
||||
|
||||
if(s_fsize >= V7_MAXSIZE || s_nfree >= V7_NICFREE || s_ninode >= V7_NICINOD) continue;
|
||||
|
||||
if(s_fsize * 1024 != (partition.End - partition.Start) * imagePlugin.GetSectorSize() &&
|
||||
s_fsize * 512 != (partition.End - partition.Start) * imagePlugin.GetSectorSize()) continue;
|
||||
|
||||
sys7th = true;
|
||||
BigEndianBitConverter.IsLittleEndian = true;
|
||||
start = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!sys7th && !sysv && !coherent && !xenix && !xenix3) return;
|
||||
|
||||
@@ -54,11 +54,10 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
PascalFileEntry entry;
|
||||
Errno error = GetFileEntry(path, out entry);
|
||||
|
||||
if(error == Errno.NoError)
|
||||
{
|
||||
attributes = new FileAttributes();
|
||||
attributes = FileAttributes.File;
|
||||
}
|
||||
if(error != Errno.NoError) return error;
|
||||
|
||||
attributes = new FileAttributes();
|
||||
attributes = FileAttributes.File;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -278,13 +278,12 @@ namespace DiscImageChef.Filesystems
|
||||
DicConsole.DebugWriteLine("UDF Plugin", "anchor.reserveVolumeDescriptorSequenceExtent.location = {0}",
|
||||
anchor.reserveVolumeDescriptorSequenceExtent.location);
|
||||
|
||||
if(anchor.tag.tagIdentifier == TagIdentifier.AnchorVolumeDescriptorPointer &&
|
||||
anchor.tag.tagLocation == position &&
|
||||
anchor.mainVolumeDescriptorSequenceExtent.location + partition.Start < partition.End)
|
||||
{
|
||||
anchorFound = true;
|
||||
break;
|
||||
}
|
||||
if(anchor.tag.tagIdentifier != TagIdentifier.AnchorVolumeDescriptorPointer ||
|
||||
anchor.tag.tagLocation != position ||
|
||||
anchor.mainVolumeDescriptorSequenceExtent.location + partition.Start >= partition.End) continue;
|
||||
|
||||
anchorFound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!anchorFound) return false;
|
||||
|
||||
@@ -259,12 +259,11 @@ namespace DiscImageChef.Filesystems
|
||||
if(magic == ZEC_Magic || magic == ZEC_Cigam) return true;
|
||||
}
|
||||
|
||||
if(partition.Start + 16 < partition.End)
|
||||
{
|
||||
sector = imagePlugin.ReadSector(partition.Start + 16);
|
||||
magic = BitConverter.ToUInt64(sector, 0x1D8);
|
||||
if(magic == ZEC_Magic || magic == ZEC_Cigam) return true;
|
||||
}
|
||||
if(partition.Start + 16 >= partition.End) return false;
|
||||
|
||||
sector = imagePlugin.ReadSector(partition.Start + 16);
|
||||
magic = BitConverter.ToUInt64(sector, 0x1D8);
|
||||
if(magic == ZEC_Magic || magic == ZEC_Cigam) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user