mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Split apple sector tags in specific types.
This commit is contained in:
@@ -325,7 +325,7 @@ public sealed partial class AppleMFS
|
||||
_volMdb.drAlBlSt +
|
||||
_partitionStart,
|
||||
(uint)_sectorsPerBlock,
|
||||
SectorTagType.AppleSectorTag,
|
||||
SectorTagType.AppleSonyTag,
|
||||
out byte[] sectors)
|
||||
: _device.ReadSectors((ulong)((nextBlock - 2) * _sectorsPerBlock) +
|
||||
_volMdb.drAlBlSt +
|
||||
|
||||
@@ -84,7 +84,7 @@ public sealed partial class AppleMFS
|
||||
_volMdb.drNxtFNum = BigEndianBitConverter.ToUInt32(_mdbBlocks, 0x01E);
|
||||
_volMdb.drFreeBks = BigEndianBitConverter.ToUInt16(_mdbBlocks, 0x022);
|
||||
_volMdb.drVNSiz = _mdbBlocks[0x024];
|
||||
byte[] variableSize = new byte[_volMdb.drVNSiz + 1];
|
||||
var variableSize = new byte[_volMdb.drVNSiz + 1];
|
||||
Array.Copy(_mdbBlocks, 0x024, variableSize, 0, _volMdb.drVNSiz + 1);
|
||||
_volMdb.drVN = StringHandlers.PascalToString(variableSize, _encoding);
|
||||
|
||||
@@ -105,10 +105,10 @@ public sealed partial class AppleMFS
|
||||
_blockMapBytes = new byte[bytesInBlockMap];
|
||||
Array.Copy(wholeMdb, BYTES_BEFORE_BLOCK_MAP, _blockMapBytes, 0, _blockMapBytes.Length);
|
||||
|
||||
int offset = 0;
|
||||
var offset = 0;
|
||||
_blockMap = new uint[_volMdb.drNmAlBlks + 2 + 1];
|
||||
|
||||
for(int i = 2; i < _volMdb.drNmAlBlks + 2; i += 8)
|
||||
for(var i = 2; i < _volMdb.drNmAlBlks + 2; i += 8)
|
||||
{
|
||||
uint tmp1 = 0;
|
||||
uint tmp2 = 0;
|
||||
@@ -141,19 +141,19 @@ public sealed partial class AppleMFS
|
||||
offset += 12;
|
||||
}
|
||||
|
||||
if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
|
||||
if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag))
|
||||
{
|
||||
_device.ReadSectorTag(2 + _partitionStart, SectorTagType.AppleSectorTag, out _mdbTags);
|
||||
_device.ReadSectorTag(0 + _partitionStart, SectorTagType.AppleSectorTag, out _bootTags);
|
||||
_device.ReadSectorTag(2 + _partitionStart, SectorTagType.AppleSonyTag, out _mdbTags);
|
||||
_device.ReadSectorTag(0 + _partitionStart, SectorTagType.AppleSonyTag, out _bootTags);
|
||||
|
||||
_device.ReadSectorsTag(_volMdb.drDirSt + _partitionStart,
|
||||
_volMdb.drBlLen,
|
||||
SectorTagType.AppleSectorTag,
|
||||
SectorTagType.AppleSonyTag,
|
||||
out _directoryTags);
|
||||
|
||||
_device.ReadSectorsTag(_partitionStart + 2,
|
||||
(uint)sectorsInWholeMdb,
|
||||
SectorTagType.AppleSectorTag,
|
||||
SectorTagType.AppleSonyTag,
|
||||
out _bitmapTags);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ public sealed partial class AppleMFS
|
||||
|
||||
_mounted = true;
|
||||
|
||||
ushort bbSig = BigEndianBitConverter.ToUInt16(_bootBlocks, 0x000);
|
||||
var bbSig = BigEndianBitConverter.ToUInt16(_bootBlocks, 0x000);
|
||||
|
||||
if(bbSig != AppleCommon.BB_MAGIC) _bootBlocks = null;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public sealed partial class AppleMFS
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
|
||||
{
|
||||
if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
|
||||
if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag))
|
||||
xattrs.Add("com.apple.macintosh.tags");
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
@@ -84,13 +84,13 @@ public sealed partial class AppleMFS
|
||||
{
|
||||
xattrs.Add("com.apple.ResourceFork");
|
||||
|
||||
if(_debug && _device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
|
||||
if(_debug && _device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag))
|
||||
xattrs.Add("com.apple.ResourceFork.tags");
|
||||
}
|
||||
|
||||
xattrs.Add("com.apple.FinderInfo");
|
||||
|
||||
if(_debug && _device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) && entry.flLgLen > 0)
|
||||
if(_debug && _device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag) && entry.flLgLen > 0)
|
||||
xattrs.Add("com.apple.macintosh.tags");
|
||||
|
||||
xattrs.Sort();
|
||||
@@ -120,7 +120,7 @@ public sealed partial class AppleMFS
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
|
||||
{
|
||||
if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) &&
|
||||
if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag) &&
|
||||
string.Compare(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture) == 0)
|
||||
{
|
||||
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
|
||||
@@ -185,8 +185,8 @@ public sealed partial class AppleMFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(!_debug ||
|
||||
!_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) ||
|
||||
if(!_debug ||
|
||||
!_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSonyTag) ||
|
||||
string.Compare(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture) != 0)
|
||||
return ErrorNumber.NoSuchExtendedAttribute;
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ public sealed partial class LisaFS
|
||||
|
||||
if(error != ErrorNumber.NoError) return error;
|
||||
|
||||
int offset = 0;
|
||||
var offset = 0;
|
||||
List<CatalogEntryV2> catalogV2 = [];
|
||||
|
||||
// For each entry on the catalog
|
||||
@@ -210,7 +210,7 @@ public sealed partial class LisaFS
|
||||
// If root catalog is not pointed in MDDF (unchecked) maybe it's always following S-Records File?
|
||||
for(ulong i = 0; i < _device.Info.Sectors; i++)
|
||||
{
|
||||
errno = _device.ReadSectorTag(i, SectorTagType.AppleSectorTag, out byte[] tag);
|
||||
errno = _device.ReadSectorTag(i, SectorTagType.AppleSonyTag, out byte[] tag);
|
||||
|
||||
if(errno != ErrorNumber.NoError) continue;
|
||||
|
||||
@@ -234,7 +234,7 @@ public sealed partial class LisaFS
|
||||
while(prevCatalogPointer != 0xFFFFFFFF)
|
||||
{
|
||||
errno = _device.ReadSectorTag(prevCatalogPointer + _mddf.mddf_block + _volumePrefix,
|
||||
SectorTagType.AppleSectorTag,
|
||||
SectorTagType.AppleSonyTag,
|
||||
out byte[] tag);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
@@ -260,7 +260,7 @@ public sealed partial class LisaFS
|
||||
while(nextCatalogPointer != 0xFFFFFFFF)
|
||||
{
|
||||
errno = _device.ReadSectorTag(nextCatalogPointer + _mddf.mddf_block + _volumePrefix,
|
||||
SectorTagType.AppleSectorTag,
|
||||
SectorTagType.AppleSonyTag,
|
||||
out byte[] tag);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
@@ -282,7 +282,7 @@ public sealed partial class LisaFS
|
||||
// Foreach catalog block
|
||||
foreach(byte[] buf in catalogBlocks)
|
||||
{
|
||||
int offset = 0;
|
||||
var offset = 0;
|
||||
|
||||
// Traverse all entries
|
||||
while(offset + 64 <= buf.Length)
|
||||
|
||||
@@ -71,11 +71,11 @@ public sealed partial class LisaFS
|
||||
// This code just allow to ignore that corruption by searching the Extents File using sector tags
|
||||
if(ptr >= _device.Info.Sectors)
|
||||
{
|
||||
bool found = false;
|
||||
var found = false;
|
||||
|
||||
for(ulong i = 0; i < _device.Info.Sectors; i++)
|
||||
{
|
||||
errno = _device.ReadSectorTag(i, SectorTagType.AppleSectorTag, out tag);
|
||||
errno = _device.ReadSectorTag(i, SectorTagType.AppleSonyTag, out tag);
|
||||
|
||||
if(errno != ErrorNumber.NoError) continue;
|
||||
|
||||
@@ -93,7 +93,7 @@ public sealed partial class LisaFS
|
||||
}
|
||||
|
||||
// Checks that the sector tag indicates its the Extents File we are searching for
|
||||
errno = _device.ReadSectorTag(ptr, SectorTagType.AppleSectorTag, out tag);
|
||||
errno = _device.ReadSectorTag(ptr, SectorTagType.AppleSonyTag, out tag);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
@@ -150,7 +150,7 @@ public sealed partial class LisaFS
|
||||
file.LisaInfo = new byte[128];
|
||||
Array.Copy(sector, 0x180, file.LisaInfo, 0, 128);
|
||||
|
||||
int extentsCount = 0;
|
||||
var extentsCount = 0;
|
||||
int extentsOffset;
|
||||
|
||||
if(_mddf.fsversion == LISA_V1)
|
||||
@@ -166,7 +166,7 @@ public sealed partial class LisaFS
|
||||
extentsOffset = 0x88;
|
||||
}
|
||||
|
||||
for(int j = 0; j < 41; j++)
|
||||
for(var j = 0; j < 41; j++)
|
||||
{
|
||||
if(BigEndianBitConverter.ToInt16(sector, extentsOffset + j * 6 + 4) == 0) break;
|
||||
|
||||
@@ -175,7 +175,7 @@ public sealed partial class LisaFS
|
||||
|
||||
file.extents = new Extent[extentsCount];
|
||||
|
||||
for(int j = 0; j < extentsCount; j++)
|
||||
for(var j = 0; j < extentsCount; j++)
|
||||
{
|
||||
file.extents[j] = new Extent
|
||||
{
|
||||
@@ -193,9 +193,9 @@ public sealed partial class LisaFS
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].filenameLen = {1}", fileId, file.filenameLen);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
"ExtentFile[{0}].filename = {1}",
|
||||
fileId,
|
||||
StringHandlers.CToString(file.filename, _encoding));
|
||||
"ExtentFile[{0}].filename = {1}",
|
||||
fileId,
|
||||
StringHandlers.CToString(file.filename, _encoding));
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].unknown1 = 0x{1:X4}", fileId, file.unknown1);
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].file_uid = 0x{1:X16}", fileId, file.file_uid);
|
||||
@@ -218,20 +218,20 @@ public sealed partial class LisaFS
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].open = {1}", fileId, file.open > 0);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
"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]);
|
||||
"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]);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].release = {1}", fileId, file.release);
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].build = {1}", fileId, file.build);
|
||||
@@ -241,62 +241,56 @@ public sealed partial class LisaFS
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].revision = {1}", fileId, file.revision);
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].unknown6 = 0x{1:X4}", fileId, file.unknown6);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
"ExtentFile[{0}].password_valid = {1}",
|
||||
fileId,
|
||||
file.password_valid > 0);
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].password_valid = {1}", fileId, file.password_valid > 0);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].password = {1}", fileId, _encoding.GetString(file.password));
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
"ExtentFile[{0}].password = {1}",
|
||||
fileId,
|
||||
_encoding.GetString(file.password));
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
"ExtentFile[{0}].unknown7 = 0x{1:X2}{2:X2}{3:X2}",
|
||||
fileId,
|
||||
file.unknown7[0],
|
||||
file.unknown7[1],
|
||||
file.unknown7[2]);
|
||||
"ExtentFile[{0}].unknown7 = 0x{1:X2}{2:X2}{3:X2}",
|
||||
fileId,
|
||||
file.unknown7[0],
|
||||
file.unknown7[1],
|
||||
file.unknown7[2]);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].overhead = {1}", fileId, file.overhead);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
"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]);
|
||||
"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]);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].length = {1}", fileId, file.length);
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].unknown9 = 0x{1:X8}", fileId, file.unknown9);
|
||||
|
||||
for(int ext = 0; ext < file.extents.Length; ext++)
|
||||
for(var ext = 0; ext < file.extents.Length; ext++)
|
||||
{
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
"ExtentFile[{0}].extents[{1}].start = {2}",
|
||||
fileId,
|
||||
ext,
|
||||
file.extents[ext].start);
|
||||
"ExtentFile[{0}].extents[{1}].start = {2}",
|
||||
fileId,
|
||||
ext,
|
||||
file.extents[ext].start);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
"ExtentFile[{0}].extents[{1}].length = {2}",
|
||||
fileId,
|
||||
ext,
|
||||
file.extents[ext].length);
|
||||
"ExtentFile[{0}].extents[{1}].length = {2}",
|
||||
fileId,
|
||||
ext,
|
||||
file.extents[ext].length);
|
||||
}
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "ExtentFile[{0}].unknown10 = 0x{1:X4}", fileId, file.unknown10);
|
||||
@@ -321,7 +315,7 @@ public sealed partial class LisaFS
|
||||
// Each entry takes 14 bytes
|
||||
_srecords = new SRecord[sectors.Length / 14];
|
||||
|
||||
for(int s = 0; s < _srecords.Length; s++)
|
||||
for(var s = 0; s < _srecords.Length; s++)
|
||||
{
|
||||
_srecords[s] = new SRecord
|
||||
{
|
||||
|
||||
@@ -220,12 +220,13 @@ public sealed partial class LisaFS
|
||||
if(!_mounted || !_debug) return ErrorNumber.AccessDenied;
|
||||
|
||||
if(fileId is > 4 or <= 0)
|
||||
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
{
|
||||
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) return ErrorNumber.InvalidArgument;
|
||||
}
|
||||
|
||||
if(_systemFileCache.TryGetValue(fileId, out buf) && !tags) return ErrorNumber.NoError;
|
||||
|
||||
int count = 0;
|
||||
var count = 0;
|
||||
|
||||
if(fileId == FILEID_SRECORD)
|
||||
{
|
||||
@@ -242,7 +243,7 @@ public sealed partial class LisaFS
|
||||
|
||||
errno = _device.ReadSectorsTag(_mddf.mddf_block + _volumePrefix + _mddf.srec_ptr,
|
||||
_mddf.srec_len,
|
||||
SectorTagType.AppleSectorTag,
|
||||
SectorTagType.AppleSonyTag,
|
||||
out buf);
|
||||
|
||||
return errno != ErrorNumber.NoError ? errno : ErrorNumber.NoError;
|
||||
@@ -253,7 +254,7 @@ public sealed partial class LisaFS
|
||||
// Should be enough to check 100 sectors?
|
||||
for(ulong i = 0; i < 100; i++)
|
||||
{
|
||||
errno = _device.ReadSectorTag(i, SectorTagType.AppleSectorTag, out byte[] tag);
|
||||
errno = _device.ReadSectorTag(i, SectorTagType.AppleSonyTag, out byte[] tag);
|
||||
|
||||
if(errno != ErrorNumber.NoError) continue;
|
||||
|
||||
@@ -269,7 +270,7 @@ public sealed partial class LisaFS
|
||||
// Should be enough to check 100 sectors?
|
||||
for(ulong i = 0; i < 100; i++)
|
||||
{
|
||||
errno = _device.ReadSectorTag(i, SectorTagType.AppleSectorTag, out byte[] tag);
|
||||
errno = _device.ReadSectorTag(i, SectorTagType.AppleSonyTag, out byte[] tag);
|
||||
|
||||
if(errno != ErrorNumber.NoError) continue;
|
||||
|
||||
@@ -279,7 +280,7 @@ public sealed partial class LisaFS
|
||||
|
||||
errno = !tags
|
||||
? _device.ReadSector(i, out byte[] sector)
|
||||
: _device.ReadSectorTag(i, SectorTagType.AppleSectorTag, out sector);
|
||||
: _device.ReadSectorTag(i, SectorTagType.AppleSonyTag, out sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError) continue;
|
||||
|
||||
@@ -408,11 +409,11 @@ public sealed partial class LisaFS
|
||||
else
|
||||
sectorSize = (int)_device.Info.SectorSize;
|
||||
|
||||
byte[] temp = new byte[file.length * sectorSize];
|
||||
var temp = new byte[file.length * sectorSize];
|
||||
|
||||
int offset = 0;
|
||||
var offset = 0;
|
||||
|
||||
for(int i = 0; i < file.extents.Length; i++)
|
||||
for(var i = 0; i < file.extents.Length; i++)
|
||||
{
|
||||
ErrorNumber errno = !tags
|
||||
? _device.ReadSectors((ulong)file.extents[i].start +
|
||||
@@ -424,7 +425,7 @@ public sealed partial class LisaFS
|
||||
_mddf.mddf_block +
|
||||
_volumePrefix,
|
||||
(uint)file.extents[i].length,
|
||||
SectorTagType.AppleSectorTag,
|
||||
SectorTagType.AppleSonyTag,
|
||||
out sector);
|
||||
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
@@ -436,8 +437,9 @@ public sealed partial class LisaFS
|
||||
if(!tags)
|
||||
{
|
||||
if(_fileSizeCache.TryGetValue(fileId, out int realSize))
|
||||
if(realSize > temp.Length)
|
||||
AaruLogging.Error(Localization.File_0_gets_truncated, fileId);
|
||||
{
|
||||
if(realSize > temp.Length) AaruLogging.Error(Localization.File_0_gets_truncated, fileId);
|
||||
}
|
||||
|
||||
buf = temp;
|
||||
|
||||
@@ -521,7 +523,7 @@ public sealed partial class LisaFS
|
||||
}
|
||||
}
|
||||
|
||||
for(int lvl = 0; lvl < pathElements.Length; lvl++)
|
||||
for(var lvl = 0; lvl < pathElements.Length; lvl++)
|
||||
{
|
||||
string wantedFilename = pathElements[0].Replace('-', '/');
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public sealed partial class LisaFS
|
||||
/// <inheritdoc />
|
||||
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
if(imagePlugin.Info.ReadableSectorTags?.Contains(SectorTagType.AppleSectorTag) != true) return false;
|
||||
if(imagePlugin.Info.ReadableSectorTags?.Contains(SectorTagType.AppleSonyTag) != true) return false;
|
||||
|
||||
// Minimal LisaOS disk is 3.5" single sided double density, 800 sectors
|
||||
if(imagePlugin.Info.Sectors < 800) return false;
|
||||
@@ -55,9 +55,9 @@ public sealed partial class LisaFS
|
||||
int beforeMddf = -1;
|
||||
|
||||
// LisaOS searches sectors until tag tells MDDF resides there, so we'll search 100 sectors
|
||||
for(int i = 0; i < 100; i++)
|
||||
for(var i = 0; i < 100; i++)
|
||||
{
|
||||
ErrorNumber errno = imagePlugin.ReadSectorTag((ulong)i, SectorTagType.AppleSectorTag, out byte[] tag);
|
||||
ErrorNumber errno = imagePlugin.ReadSectorTag((ulong)i, SectorTagType.AppleSonyTag, out byte[] tag);
|
||||
|
||||
if(errno != ErrorNumber.NoError) continue;
|
||||
|
||||
@@ -90,8 +90,8 @@ public sealed partial class LisaFS
|
||||
AaruLogging.Debug(MODULE_NAME, "mddf.vol_size - 1 = {0}", infoMddf.volsize_minus_one);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
"mddf.vol_size - mddf.mddf_block -1 = {0}",
|
||||
infoMddf.volsize_minus_mddf_minus_one);
|
||||
"mddf.vol_size - mddf.mddf_block -1 = {0}",
|
||||
infoMddf.volsize_minus_mddf_minus_one);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "Disk sector = {0} bytes", imagePlugin.Info.SectorSize);
|
||||
AaruLogging.Debug(MODULE_NAME, "mddf.blocksize = {0} bytes", infoMddf.blocksize);
|
||||
@@ -124,7 +124,7 @@ public sealed partial class LisaFS
|
||||
metadata = new FileSystem();
|
||||
var sb = new StringBuilder();
|
||||
|
||||
if(imagePlugin.Info.ReadableSectorTags?.Contains(SectorTagType.AppleSectorTag) != true) return;
|
||||
if(imagePlugin.Info.ReadableSectorTags?.Contains(SectorTagType.AppleSonyTag) != true) return;
|
||||
|
||||
// Minimal LisaOS disk is 3.5" single sided double density, 800 sectors
|
||||
if(imagePlugin.Info.Sectors < 800) return;
|
||||
@@ -132,9 +132,9 @@ public sealed partial class LisaFS
|
||||
int beforeMddf = -1;
|
||||
|
||||
// LisaOS searches sectors until tag tells MDDF resides there, so we'll search 100 sectors
|
||||
for(int i = 0; i < 100; i++)
|
||||
for(var i = 0; i < 100; i++)
|
||||
{
|
||||
ErrorNumber errno = imagePlugin.ReadSectorTag((ulong)i, SectorTagType.AppleSectorTag, out byte[] tag);
|
||||
ErrorNumber errno = imagePlugin.ReadSectorTag((ulong)i, SectorTagType.AppleSonyTag, out byte[] tag);
|
||||
|
||||
if(errno != ErrorNumber.NoError) continue;
|
||||
|
||||
@@ -150,8 +150,8 @@ public sealed partial class LisaFS
|
||||
|
||||
if(errno != ErrorNumber.NoError) continue;
|
||||
|
||||
var infoMddf = new MDDF();
|
||||
byte[] pString = new byte[33];
|
||||
var infoMddf = new MDDF();
|
||||
var pString = new byte[33];
|
||||
|
||||
infoMddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00);
|
||||
infoMddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
|
||||
@@ -166,7 +166,7 @@ public sealed partial class LisaFS
|
||||
infoMddf.unknown2 = sector[0x4F];
|
||||
infoMddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
|
||||
infoMddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
|
||||
uint lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58);
|
||||
var lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58);
|
||||
infoMddf.dtvc = DateHandlers.LisaToDateTime(lisaTime);
|
||||
lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x5C);
|
||||
infoMddf.dtcc = DateHandlers.LisaToDateTime(lisaTime);
|
||||
@@ -272,9 +272,9 @@ public sealed partial class LisaFS
|
||||
AaruLogging.Debug(MODULE_NAME, "mddf.unknown38 = 0x{0:X8} ({0})", infoMddf.unknown38);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
"mddf.unknown_timestamp = 0x{0:X8} ({0}, {1})",
|
||||
infoMddf.unknown_timestamp,
|
||||
DateHandlers.LisaToDateTime(infoMddf.unknown_timestamp));
|
||||
"mddf.unknown_timestamp = 0x{0:X8} ({0}, {1})",
|
||||
infoMddf.unknown_timestamp,
|
||||
DateHandlers.LisaToDateTime(infoMddf.unknown_timestamp));
|
||||
|
||||
if(infoMddf.mddf_block != i - beforeMddf) return;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public sealed partial class LisaFS
|
||||
// Lisa OS is unable to work on disks without tags.
|
||||
// This code is designed like that.
|
||||
// However with some effort the code may be modified to ignore them.
|
||||
if(_device.Info.ReadableSectorTags?.Contains(SectorTagType.AppleSectorTag) != true)
|
||||
if(_device.Info.ReadableSectorTags?.Contains(SectorTagType.AppleSonyTag) != true)
|
||||
{
|
||||
AaruLogging.Debug(MODULE_NAME, Localization.Underlying_device_does_not_support_Lisa_tags);
|
||||
|
||||
@@ -78,7 +78,7 @@ public sealed partial class LisaFS
|
||||
// LisaOS searches sectors until tag tells MDDF resides there, so we'll search 100 sectors
|
||||
for(ulong i = 0; i < 100; i++)
|
||||
{
|
||||
ErrorNumber errno = _device.ReadSectorTag(i, SectorTagType.AppleSectorTag, out byte[] tag);
|
||||
ErrorNumber errno = _device.ReadSectorTag(i, SectorTagType.AppleSonyTag, out byte[] tag);
|
||||
|
||||
if(errno != ErrorNumber.NoError) continue;
|
||||
|
||||
@@ -97,7 +97,7 @@ public sealed partial class LisaFS
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
_mddf = new MDDF();
|
||||
byte[] pString = new byte[33];
|
||||
var pString = new byte[33];
|
||||
|
||||
_mddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00);
|
||||
_mddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
|
||||
@@ -112,7 +112,7 @@ public sealed partial class LisaFS
|
||||
_mddf.unknown2 = sector[0x4F];
|
||||
_mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
|
||||
_mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
|
||||
uint lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58);
|
||||
var lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58);
|
||||
_mddf.dtvc = DateHandlers.LisaToDateTime(lisaTime);
|
||||
lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x5C);
|
||||
_mddf.dtcc = DateHandlers.LisaToDateTime(lisaTime);
|
||||
@@ -209,8 +209,7 @@ public sealed partial class LisaFS
|
||||
|
||||
break;
|
||||
default:
|
||||
AaruLogging.Error(Localization.Cannot_mount_LisaFS_version_0,
|
||||
_mddf.fsversion.ToString());
|
||||
AaruLogging.Error(Localization.Cannot_mount_LisaFS_version_0, _mddf.fsversion.ToString());
|
||||
|
||||
return ErrorNumber.NotSupported;
|
||||
}
|
||||
@@ -253,9 +252,7 @@ public sealed partial class LisaFS
|
||||
|
||||
if(error != ErrorNumber.NoError)
|
||||
{
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
Localization.Cannot_read_Catalog_File_error_0,
|
||||
error.ToString());
|
||||
AaruLogging.Debug(MODULE_NAME, Localization.Cannot_read_Catalog_File_error_0, error.ToString());
|
||||
|
||||
_mounted = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user