mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Invert 'if' statements to reduce nesting.
This commit is contained in:
@@ -842,16 +842,16 @@ public sealed class Checksum
|
||||
dataChecksums.Add(chk);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Fletcher32))
|
||||
{
|
||||
chk = new ChecksumType
|
||||
{
|
||||
type = ChecksumTypeType.fletcher32,
|
||||
Value = f32CtxData.End()
|
||||
};
|
||||
if(!enabled.HasFlag(EnableChecksum.Fletcher32))
|
||||
return dataChecksums;
|
||||
|
||||
dataChecksums.Add(chk);
|
||||
}
|
||||
chk = new ChecksumType
|
||||
{
|
||||
type = ChecksumTypeType.fletcher32,
|
||||
Value = f32CtxData.End()
|
||||
};
|
||||
|
||||
dataChecksums.Add(chk);
|
||||
|
||||
return dataChecksums;
|
||||
}
|
||||
|
||||
@@ -179,12 +179,12 @@ public partial class Dump
|
||||
break;
|
||||
}
|
||||
|
||||
if(tmp.SequenceEqual(_gbaExtension))
|
||||
{
|
||||
gbaFound = true;
|
||||
if(!tmp.SequenceEqual(_gbaExtension))
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
gbaFound = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if(!sfcFound &&
|
||||
|
||||
@@ -128,62 +128,62 @@ partial class Dump
|
||||
bool tmpSense = dvdDecrypt.ReadTitleKey(out tmpBuf, out _, DvdCssKeyClass.DvdCssCppmOrCprm,
|
||||
i + j, _dev.Timeout, out _);
|
||||
|
||||
if(!tmpSense)
|
||||
if(tmpSense)
|
||||
continue;
|
||||
|
||||
CSS_CPRM.TitleKey? titleKey = CSS.DecodeTitleKey(tmpBuf, dvdDecrypt.BusKey);
|
||||
|
||||
if(titleKey.HasValue)
|
||||
outputFormat.WriteSectorTag(new[]
|
||||
{
|
||||
titleKey.Value.CMI
|
||||
}, i + j, SectorTagType.DvdCmi);
|
||||
else
|
||||
continue;
|
||||
|
||||
// If the CMI bit is 1, the sector is using copy protection, else it is not
|
||||
if((titleKey.Value.CMI & 0x80) >> 7 == 0)
|
||||
{
|
||||
CSS_CPRM.TitleKey? titleKey = CSS.DecodeTitleKey(tmpBuf, dvdDecrypt.BusKey);
|
||||
|
||||
if(titleKey.HasValue)
|
||||
outputFormat.WriteSectorTag(new[]
|
||||
{
|
||||
titleKey.Value.CMI
|
||||
}, i + j, SectorTagType.DvdCmi);
|
||||
else
|
||||
continue;
|
||||
|
||||
// If the CMI bit is 1, the sector is using copy protection, else it is not
|
||||
if((titleKey.Value.CMI & 0x80) >> 7 == 0)
|
||||
// The CMI indicates this sector is not encrypted.
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
// The CMI indicates this sector is not encrypted.
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdTitleKey);
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdTitleKey);
|
||||
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdTitleKeyDecrypted);
|
||||
|
||||
_resume.MissingTitleKeys.Remove(i + j);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// According to libdvdcss, if the key is all zeroes, the sector is actually
|
||||
// not encrypted even if the CMI says it is.
|
||||
if(titleKey.Value.Key.All(k => k == 0))
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdTitleKey);
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdTitleKeyDecrypted);
|
||||
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdTitleKeyDecrypted);
|
||||
_resume.MissingTitleKeys.Remove(i + j);
|
||||
|
||||
_resume.MissingTitleKeys.Remove(i + j);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
outputFormat.WriteSectorTag(titleKey.Value.Key, i + j, SectorTagType.DvdTitleKey);
|
||||
_resume.MissingTitleKeys.Remove(i + j);
|
||||
|
||||
CSS.DecryptTitleKey(0, discKey, titleKey.Value.Key, out tmpBuf);
|
||||
outputFormat.WriteSectorTag(tmpBuf, i + j, SectorTagType.DvdTitleKeyDecrypted);
|
||||
continue;
|
||||
}
|
||||
|
||||
// According to libdvdcss, if the key is all zeroes, the sector is actually
|
||||
// not encrypted even if the CMI says it is.
|
||||
if(titleKey.Value.Key.All(k => k == 0))
|
||||
{
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdTitleKey);
|
||||
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdTitleKeyDecrypted);
|
||||
|
||||
_resume.MissingTitleKeys.Remove(i + j);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
outputFormat.WriteSectorTag(titleKey.Value.Key, i + j, SectorTagType.DvdTitleKey);
|
||||
_resume.MissingTitleKeys.Remove(i + j);
|
||||
|
||||
CSS.DecryptTitleKey(0, discKey, titleKey.Value.Key, out tmpBuf);
|
||||
outputFormat.WriteSectorTag(tmpBuf, i + j, SectorTagType.DvdTitleKeyDecrypted);
|
||||
}
|
||||
|
||||
if(!_storeEncrypted)
|
||||
|
||||
@@ -89,7 +89,7 @@ partial class Dump
|
||||
|
||||
if(dcMode10?.Pages != null)
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage =>
|
||||
modePage.Page == 0x01 && modePage.Subpage == 0x00))
|
||||
modePage.Page == 0x01 && modePage.Subpage == 0x00))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ partial class Dump
|
||||
|
||||
if(dcMode6?.Pages != null)
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => modePage.Page == 0x01 &&
|
||||
modePage.Subpage == 0x00))
|
||||
modePage.Subpage == 0x00))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
|
||||
@@ -347,52 +347,51 @@ partial class Dump
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(sense || _dev.Error)
|
||||
continue;
|
||||
|
||||
CSS_CPRM.TitleKey? titleKey = CSS.DecodeTitleKey(buffer, dvdDecrypt.BusKey);
|
||||
|
||||
if(!titleKey.HasValue)
|
||||
continue;
|
||||
|
||||
outputFormat.WriteSectorTag(new[]
|
||||
{
|
||||
CSS_CPRM.TitleKey? titleKey = CSS.DecodeTitleKey(buffer, dvdDecrypt.BusKey);
|
||||
titleKey.Value.CMI
|
||||
}, missingKey, SectorTagType.DvdCmi);
|
||||
|
||||
if(titleKey.HasValue)
|
||||
// If the CMI bit is 1, the sector is using copy protection, else it is not
|
||||
// If the decoded title key is zeroed, there should be no copy protection
|
||||
if((titleKey.Value.CMI & 0x80) >> 7 == 0 ||
|
||||
titleKey.Value.Key.All(k => k == 0))
|
||||
{
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
outputFormat.WriteSectorTag(new[]
|
||||
{
|
||||
titleKey.Value.CMI
|
||||
}, missingKey, SectorTagType.DvdCmi);
|
||||
0, 0, 0, 0, 0
|
||||
}, missingKey, SectorTagType.DvdTitleKey);
|
||||
|
||||
// If the CMI bit is 1, the sector is using copy protection, else it is not
|
||||
// If the decoded title key is zeroed, there should be no copy protection
|
||||
if((titleKey.Value.CMI & 0x80) >> 7 == 0 ||
|
||||
titleKey.Value.Key.All(k => k == 0))
|
||||
{
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, missingKey, SectorTagType.DvdTitleKey);
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, missingKey, SectorTagType.DvdTitleKeyDecrypted);
|
||||
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, missingKey, SectorTagType.DvdTitleKeyDecrypted);
|
||||
_resume.MissingTitleKeys.Remove(missingKey);
|
||||
UpdateStatus?.Invoke($"Correctly retried title key {missingKey} in pass {pass}.");
|
||||
_dumpLog.WriteLine("Correctly retried title key {0} in pass {1}.", missingKey, pass);
|
||||
}
|
||||
else
|
||||
{
|
||||
outputFormat.WriteSectorTag(titleKey.Value.Key, missingKey, SectorTagType.DvdTitleKey);
|
||||
_resume.MissingTitleKeys.Remove(missingKey);
|
||||
|
||||
_resume.MissingTitleKeys.Remove(missingKey);
|
||||
UpdateStatus?.Invoke($"Correctly retried title key {missingKey} in pass {pass}.");
|
||||
_dumpLog.WriteLine("Correctly retried title key {0} in pass {1}.", missingKey, pass);
|
||||
}
|
||||
else
|
||||
{
|
||||
outputFormat.WriteSectorTag(titleKey.Value.Key, missingKey, SectorTagType.DvdTitleKey);
|
||||
_resume.MissingTitleKeys.Remove(missingKey);
|
||||
|
||||
if(discKey != null)
|
||||
{
|
||||
CSS.DecryptTitleKey(0, discKey, titleKey.Value.Key, out buffer);
|
||||
outputFormat.WriteSectorTag(buffer, missingKey, SectorTagType.DvdTitleKeyDecrypted);
|
||||
}
|
||||
|
||||
UpdateStatus?.Invoke($"Correctly retried title key {missingKey} in pass {pass}.");
|
||||
_dumpLog.WriteLine("Correctly retried title key {0} in pass {1}.", missingKey, pass);
|
||||
}
|
||||
if(discKey != null)
|
||||
{
|
||||
CSS.DecryptTitleKey(0, discKey, titleKey.Value.Key, out buffer);
|
||||
outputFormat.WriteSectorTag(buffer, missingKey, SectorTagType.DvdTitleKeyDecrypted);
|
||||
}
|
||||
|
||||
UpdateStatus?.Invoke($"Correctly retried title key {missingKey} in pass {pass}.");
|
||||
_dumpLog.WriteLine("Correctly retried title key {0} in pass {1}.", missingKey, pass);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2022,83 +2022,83 @@ public sealed partial class DeviceReport
|
||||
{
|
||||
ctx.AddTask("Trying MediaTek READ DRAM command for Lead-Out...").IsIndeterminate();
|
||||
|
||||
if(mediaTest.Blocks > 0)
|
||||
if(!(mediaTest.Blocks > 0))
|
||||
return;
|
||||
|
||||
if(mediaType == "Audio CD" &&
|
||||
mediaTest.SupportsReadCd == true)
|
||||
{
|
||||
if(mediaType == "Audio CD" &&
|
||||
mediaTest.SupportsReadCd == true)
|
||||
{
|
||||
_dev.ReadCd(out _, out _, (uint)(mediaTest.Blocks + 1), 2352, 1, MmcSectorTypes.Cdda, false,
|
||||
false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None,
|
||||
MmcSubchannel.None, _dev.Timeout, out _);
|
||||
_dev.ReadCd(out _, out _, (uint)(mediaTest.Blocks + 1), 2352, 1, MmcSectorTypes.Cdda, false, false,
|
||||
false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None,
|
||||
_dev.Timeout, out _);
|
||||
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if((mediaType.StartsWith("CD", StringComparison.OrdinalIgnoreCase) ||
|
||||
mediaType == "Enhanced CD (aka E-CD, CD-Plus or CD+)") &&
|
||||
mediaTest.SupportsReadCdRaw == true)
|
||||
{
|
||||
_dev.ReadCd(out _, out _, (uint)(mediaTest.Blocks + 1), 2352, 1, MmcSectorTypes.AllTypes, false,
|
||||
false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None,
|
||||
MmcSubchannel.None, _dev.Timeout, out _);
|
||||
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if((mediaType.StartsWith("CD", StringComparison.OrdinalIgnoreCase) ||
|
||||
mediaType == "Enhanced CD (aka E-CD, CD-Plus or CD+)") &&
|
||||
mediaTest.SupportsReadCd == true)
|
||||
{
|
||||
_dev.ReadCd(out _, out _, (uint)(mediaTest.Blocks + 1), 2048, 1, MmcSectorTypes.AllTypes, false,
|
||||
false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None,
|
||||
MmcSubchannel.None, _dev.Timeout, out _);
|
||||
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if(mediaTest.SupportsRead6 == true)
|
||||
{
|
||||
_dev.Read6(out _, out _, (uint)(mediaTest.Blocks + 1), 2048, _dev.Timeout, out _);
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if(mediaTest.SupportsRead10 == true)
|
||||
{
|
||||
_dev.Read10(out _, out _, 0, false, true, false, false, (uint)(mediaTest.Blocks + 1), 2048, 0,
|
||||
1, _dev.Timeout, out _);
|
||||
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if(mediaTest.SupportsRead12 == true)
|
||||
{
|
||||
_dev.Read12(out _, out _, 0, false, true, false, false, (uint)(mediaTest.Blocks + 1), 2048, 0,
|
||||
1, false, _dev.Timeout, out _);
|
||||
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if(mediaTest.SupportsRead16 == true)
|
||||
{
|
||||
_dev.Read16(out _, out _, 0, false, true, false, (ulong)(mediaTest.Blocks + 1), 2048, 0, 1,
|
||||
false, _dev.Timeout, out _);
|
||||
|
||||
triedLeadOut = true;
|
||||
}
|
||||
|
||||
if(triedLeadOut)
|
||||
{
|
||||
mediaTest.CanReadF1_06LeadOut =
|
||||
!_dev.MediaTekReadDram(out buffer, out senseBuffer, 0, 0xB00, _dev.Timeout, out _);
|
||||
|
||||
mediaTest.ReadF1_06LeadOutData = mediaTest.CanReadF1_06LeadOut == true ? buffer : senseBuffer;
|
||||
|
||||
// This means it has returned the same as previous read, so not really lead-out.
|
||||
if(mediaTest.CanReadF1_06 == true &&
|
||||
mediaTest.CanReadF1_06LeadOut == true &&
|
||||
mediaTest.ReadF1_06Data.SequenceEqual(mediaTest.ReadF1_06LeadOutData))
|
||||
{
|
||||
mediaTest.CanReadF1_06LeadOut = false;
|
||||
mediaTest.ReadF1_06LeadOutData = senseBuffer;
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadF1_06LeadOut);
|
||||
}
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if((mediaType.StartsWith("CD", StringComparison.OrdinalIgnoreCase) ||
|
||||
mediaType == "Enhanced CD (aka E-CD, CD-Plus or CD+)") &&
|
||||
mediaTest.SupportsReadCdRaw == true)
|
||||
{
|
||||
_dev.ReadCd(out _, out _, (uint)(mediaTest.Blocks + 1), 2352, 1, MmcSectorTypes.AllTypes, false,
|
||||
false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None,
|
||||
MmcSubchannel.None, _dev.Timeout, out _);
|
||||
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if((mediaType.StartsWith("CD", StringComparison.OrdinalIgnoreCase) ||
|
||||
mediaType == "Enhanced CD (aka E-CD, CD-Plus or CD+)") &&
|
||||
mediaTest.SupportsReadCd == true)
|
||||
{
|
||||
_dev.ReadCd(out _, out _, (uint)(mediaTest.Blocks + 1), 2048, 1, MmcSectorTypes.AllTypes, false,
|
||||
false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None,
|
||||
_dev.Timeout, out _);
|
||||
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if(mediaTest.SupportsRead6 == true)
|
||||
{
|
||||
_dev.Read6(out _, out _, (uint)(mediaTest.Blocks + 1), 2048, _dev.Timeout, out _);
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if(mediaTest.SupportsRead10 == true)
|
||||
{
|
||||
_dev.Read10(out _, out _, 0, false, true, false, false, (uint)(mediaTest.Blocks + 1), 2048, 0, 1,
|
||||
_dev.Timeout, out _);
|
||||
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if(mediaTest.SupportsRead12 == true)
|
||||
{
|
||||
_dev.Read12(out _, out _, 0, false, true, false, false, (uint)(mediaTest.Blocks + 1), 2048, 0, 1,
|
||||
false, _dev.Timeout, out _);
|
||||
|
||||
triedLeadOut = true;
|
||||
}
|
||||
else if(mediaTest.SupportsRead16 == true)
|
||||
{
|
||||
_dev.Read16(out _, out _, 0, false, true, false, (ulong)(mediaTest.Blocks + 1), 2048, 0, 1, false,
|
||||
_dev.Timeout, out _);
|
||||
|
||||
triedLeadOut = true;
|
||||
}
|
||||
|
||||
if(!triedLeadOut)
|
||||
return;
|
||||
|
||||
mediaTest.CanReadF1_06LeadOut =
|
||||
!_dev.MediaTekReadDram(out buffer, out senseBuffer, 0, 0xB00, _dev.Timeout, out _);
|
||||
|
||||
mediaTest.ReadF1_06LeadOutData = mediaTest.CanReadF1_06LeadOut == true ? buffer : senseBuffer;
|
||||
|
||||
// This means it has returned the same as previous read, so not really lead-out.
|
||||
if(mediaTest.CanReadF1_06 == true &&
|
||||
mediaTest.CanReadF1_06LeadOut == true &&
|
||||
mediaTest.ReadF1_06Data.SequenceEqual(mediaTest.ReadF1_06LeadOutData))
|
||||
{
|
||||
mediaTest.CanReadF1_06LeadOut = false;
|
||||
mediaTest.ReadF1_06LeadOutData = senseBuffer;
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadF1_06LeadOut);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2177,25 +2177,23 @@ public sealed partial class DeviceReport
|
||||
false, MmcErrorField.None,
|
||||
MmcSubchannel.Raw, _dev.Timeout, out _);
|
||||
|
||||
if(mediaTest.CanReadingIntersessionLeadOut != false)
|
||||
return;
|
||||
|
||||
mediaTest.CanReadingIntersessionLeadOut = !_dev.ReadCd(out buffer, out senseBuffer,
|
||||
firstSessionLeadOutLba, 2368, 1,
|
||||
MmcSectorTypes.AllTypes, false, false,
|
||||
false, MmcHeaderCodes.AllHeaders, true,
|
||||
false, MmcErrorField.None,
|
||||
MmcSubchannel.Q16, _dev.Timeout, out _);
|
||||
|
||||
if(mediaTest.CanReadingIntersessionLeadOut == false)
|
||||
{
|
||||
mediaTest.CanReadingIntersessionLeadOut = !_dev.ReadCd(out buffer, out senseBuffer,
|
||||
firstSessionLeadOutLba, 2368, 1,
|
||||
firstSessionLeadOutLba, 2352, 1,
|
||||
MmcSectorTypes.AllTypes, false, false,
|
||||
false, MmcHeaderCodes.AllHeaders, true,
|
||||
false, MmcErrorField.None,
|
||||
MmcSubchannel.Q16, _dev.Timeout, out _);
|
||||
|
||||
if(mediaTest.CanReadingIntersessionLeadOut == false)
|
||||
mediaTest.CanReadingIntersessionLeadOut = !_dev.ReadCd(out buffer, out senseBuffer,
|
||||
firstSessionLeadOutLba, 2352, 1,
|
||||
MmcSectorTypes.AllTypes, false,
|
||||
false, false,
|
||||
MmcHeaderCodes.AllHeaders, true,
|
||||
false, MmcErrorField.None,
|
||||
MmcSubchannel.None, _dev.Timeout,
|
||||
out _);
|
||||
}
|
||||
MmcSubchannel.None, _dev.Timeout, out _);
|
||||
});
|
||||
|
||||
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadingIntersessionLeadOut);
|
||||
@@ -2213,24 +2211,23 @@ public sealed partial class DeviceReport
|
||||
false, MmcErrorField.None,
|
||||
MmcSubchannel.Raw, _dev.Timeout, out _);
|
||||
|
||||
if(mediaTest.CanReadingIntersessionLeadIn != false)
|
||||
return;
|
||||
|
||||
mediaTest.CanReadingIntersessionLeadIn = !_dev.ReadCd(out buffer, out senseBuffer,
|
||||
secondSessionLeadInLba, 2368, 1,
|
||||
MmcSectorTypes.AllTypes, false, false,
|
||||
false, MmcHeaderCodes.AllHeaders, true,
|
||||
false, MmcErrorField.None,
|
||||
MmcSubchannel.Q16, _dev.Timeout, out _);
|
||||
|
||||
if(mediaTest.CanReadingIntersessionLeadIn == false)
|
||||
{
|
||||
mediaTest.CanReadingIntersessionLeadIn = !_dev.ReadCd(out buffer, out senseBuffer,
|
||||
secondSessionLeadInLba, 2368, 1,
|
||||
secondSessionLeadInLba, 2352, 1,
|
||||
MmcSectorTypes.AllTypes, false, false,
|
||||
false, MmcHeaderCodes.AllHeaders, true,
|
||||
false, MmcErrorField.None,
|
||||
MmcSubchannel.Q16, _dev.Timeout, out _);
|
||||
|
||||
if(mediaTest.CanReadingIntersessionLeadIn == false)
|
||||
mediaTest.CanReadingIntersessionLeadIn = !_dev.ReadCd(out buffer, out senseBuffer,
|
||||
secondSessionLeadInLba, 2352, 1,
|
||||
MmcSectorTypes.AllTypes, false, false,
|
||||
false, MmcHeaderCodes.AllHeaders,
|
||||
true, false, MmcErrorField.None,
|
||||
MmcSubchannel.None, _dev.Timeout,
|
||||
out _);
|
||||
}
|
||||
MmcSubchannel.None, _dev.Timeout, out _);
|
||||
});
|
||||
|
||||
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadingIntersessionLeadIn);
|
||||
|
||||
@@ -650,105 +650,107 @@ public sealed partial class DeviceReport
|
||||
}
|
||||
}
|
||||
|
||||
if((mediaTest.SupportsReadLong == true || mediaTest.SupportsReadLong16 == true) &&
|
||||
mediaTest.LongBlockSize == mediaTest.BlockSize)
|
||||
switch(mediaTest.BlockSize)
|
||||
if(mediaTest.SupportsReadLong != true && mediaTest.SupportsReadLong16 != true ||
|
||||
mediaTest.LongBlockSize != mediaTest.BlockSize)
|
||||
return;
|
||||
|
||||
switch(mediaTest.BlockSize)
|
||||
{
|
||||
case 512:
|
||||
{
|
||||
case 512:
|
||||
{
|
||||
foreach(ushort testSize in new ushort[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
514,
|
||||
foreach(ushort testSize in new ushort[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
514,
|
||||
|
||||
// Long sector sizes for SuperDisk
|
||||
536, 558,
|
||||
// Long sector sizes for SuperDisk
|
||||
536, 558,
|
||||
|
||||
// Long sector sizes for 512-byte magneto-opticals
|
||||
600, 610, 630
|
||||
})
|
||||
{
|
||||
sense = mediaTest.SupportsReadLong16 == true
|
||||
? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, testSize, _dev.Timeout,
|
||||
out _) : _dev.ReadLong10(out buffer, out senseBuffer, false,
|
||||
false, 0, testSize, _dev.Timeout, out _);
|
||||
|
||||
if(sense || _dev.Error)
|
||||
continue;
|
||||
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 1024:
|
||||
{
|
||||
foreach(ushort testSize in new ushort[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
1026,
|
||||
|
||||
// Long sector sizes for 1024-byte magneto-opticals
|
||||
1200
|
||||
})
|
||||
{
|
||||
sense = mediaTest.SupportsReadLong16 == true
|
||||
? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, testSize, _dev.Timeout,
|
||||
out _) : _dev.ReadLong10(out buffer, out senseBuffer, false,
|
||||
false, 0, testSize, _dev.Timeout, out _);
|
||||
|
||||
if(sense || _dev.Error)
|
||||
continue;
|
||||
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2048:
|
||||
// Long sector sizes for 512-byte magneto-opticals
|
||||
600, 610, 630
|
||||
})
|
||||
{
|
||||
sense = mediaTest.SupportsReadLong16 == true
|
||||
? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, 2380, _dev.Timeout, out _)
|
||||
: _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380, _dev.Timeout,
|
||||
out _);
|
||||
? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, testSize, _dev.Timeout,
|
||||
out _) : _dev.ReadLong10(out buffer, out senseBuffer, false,
|
||||
false, 0, testSize, _dev.Timeout, out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
mediaTest.LongBlockSize = 2380;
|
||||
if(sense || _dev.Error)
|
||||
continue;
|
||||
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
|
||||
break;
|
||||
}
|
||||
case 4096:
|
||||
{
|
||||
sense = mediaTest.SupportsReadLong16 == true
|
||||
? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, 4760, _dev.Timeout, out _)
|
||||
: _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760, _dev.Timeout,
|
||||
out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
mediaTest.LongBlockSize = 4760;
|
||||
|
||||
break;
|
||||
}
|
||||
case 8192:
|
||||
{
|
||||
sense = mediaTest.SupportsReadLong16 == true
|
||||
? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, 9424, _dev.Timeout, out _)
|
||||
: _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424, _dev.Timeout,
|
||||
out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
mediaTest.LongBlockSize = 9424;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1024:
|
||||
{
|
||||
foreach(ushort testSize in new ushort[]
|
||||
{
|
||||
// Long sector sizes for floppies
|
||||
1026,
|
||||
|
||||
// Long sector sizes for 1024-byte magneto-opticals
|
||||
1200
|
||||
})
|
||||
{
|
||||
sense = mediaTest.SupportsReadLong16 == true
|
||||
? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, testSize, _dev.Timeout,
|
||||
out _) : _dev.ReadLong10(out buffer, out senseBuffer, false,
|
||||
false, 0, testSize, _dev.Timeout, out _);
|
||||
|
||||
if(sense || _dev.Error)
|
||||
continue;
|
||||
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2048:
|
||||
{
|
||||
sense = mediaTest.SupportsReadLong16 == true
|
||||
? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, 2380, _dev.Timeout, out _)
|
||||
: _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380, _dev.Timeout,
|
||||
out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
mediaTest.LongBlockSize = 2380;
|
||||
|
||||
break;
|
||||
}
|
||||
case 4096:
|
||||
{
|
||||
sense = mediaTest.SupportsReadLong16 == true
|
||||
? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, 4760, _dev.Timeout, out _)
|
||||
: _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760, _dev.Timeout,
|
||||
out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
mediaTest.LongBlockSize = 4760;
|
||||
|
||||
break;
|
||||
}
|
||||
case 8192:
|
||||
{
|
||||
sense = mediaTest.SupportsReadLong16 == true
|
||||
? _dev.ReadLong16(out buffer, out senseBuffer, false, 0, 9424, _dev.Timeout, out _)
|
||||
: _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424, _dev.Timeout,
|
||||
out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
mediaTest.LongBlockSize = 9424;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Spectre.ProgressSingleSpinner(ctx =>
|
||||
|
||||
@@ -2222,18 +2222,18 @@ public static class MMC
|
||||
break;
|
||||
}
|
||||
|
||||
if(line.StartsWith("BOOT2=cdrom0:", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
ps2BootFile = line.Substring(13);
|
||||
if(!line.StartsWith("BOOT2=cdrom0:", StringComparison.InvariantCultureIgnoreCase))
|
||||
continue;
|
||||
|
||||
if(ps2BootFile.StartsWith('\\'))
|
||||
ps2BootFile = ps2BootFile.Substring(1);
|
||||
ps2BootFile = line.Substring(13);
|
||||
|
||||
if(ps2BootFile.EndsWith(";1", StringComparison.InvariantCultureIgnoreCase))
|
||||
ps2BootFile = ps2BootFile.Substring(0, ps2BootFile.Length - 2);
|
||||
if(ps2BootFile.StartsWith('\\'))
|
||||
ps2BootFile = ps2BootFile.Substring(1);
|
||||
|
||||
break;
|
||||
}
|
||||
if(ps2BootFile.EndsWith(";1", StringComparison.InvariantCultureIgnoreCase))
|
||||
ps2BootFile = ps2BootFile.Substring(0, ps2BootFile.Length - 2);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if(ps1BootFile != null &&
|
||||
|
||||
Reference in New Issue
Block a user