static void DoScsiMediaInfo(bool debug, bool verbose, string outputPrefix, Devices.Device dev) { var scsiInfo = new ScsiInfo(dev); if (!scsiInfo.MediaInserted) { return; } if (scsiInfo.DeviceInfo.ScsiModeSense6 != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_scsi_modesense6.bin", "SCSI MODE SENSE (6)", scsiInfo.DeviceInfo.ScsiModeSense6); } if (scsiInfo.DeviceInfo.ScsiModeSense10 != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_scsi_modesense10.bin", "SCSI MODE SENSE (10)", scsiInfo.DeviceInfo.ScsiModeSense10); } switch (dev.ScsiType) { case PeripheralDeviceTypes.DirectAccess: case PeripheralDeviceTypes.MultiMediaDevice: case PeripheralDeviceTypes.OCRWDevice: case PeripheralDeviceTypes.OpticalDevice: case PeripheralDeviceTypes.SimplifiedDevice: case PeripheralDeviceTypes.WriteOnceDevice: if (scsiInfo.ReadCapacity != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity.bin", "SCSI READ CAPACITY", scsiInfo.ReadCapacity); } if (scsiInfo.ReadCapacity16 != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity16.bin", "SCSI READ CAPACITY(16)", scsiInfo.ReadCapacity16); } if (scsiInfo.Blocks != 0 && scsiInfo.BlockSize != 0) { AaruConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", scsiInfo.Blocks, scsiInfo.BlockSize, scsiInfo.Blocks * scsiInfo.BlockSize); } break; case PeripheralDeviceTypes.SequentialAccess: if (scsiInfo.DensitySupport != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIA)", scsiInfo.DensitySupport); if (scsiInfo.DensitySupportHeader.HasValue) { AaruConsole.WriteLine("Densities supported by currently inserted media:"); AaruConsole.WriteLine(DensitySupport.PrettifyDensity(scsiInfo.DensitySupportHeader)); } } if (scsiInfo.MediaTypeSupport != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_medium_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", scsiInfo.MediaTypeSupport); if (scsiInfo.MediaTypeSupportHeader.HasValue) { AaruConsole.WriteLine("Medium types currently inserted in device:"); AaruConsole.WriteLine(DensitySupport.PrettifyMediumType(scsiInfo.MediaTypeSupportHeader)); } AaruConsole.WriteLine(DensitySupport.PrettifyMediumType(scsiInfo.MediaTypeSupport)); } break; } if (dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice) { if (scsiInfo.MmcConfiguration != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_getconfiguration_current.bin", "SCSI GET CONFIGURATION", scsiInfo.MmcConfiguration); } if (scsiInfo.RecognizedFormatLayers != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_formatlayers.bin", "SCSI READ DISC STRUCTURE", scsiInfo.RecognizedFormatLayers); } if (scsiInfo.WriteProtectionStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_writeprotection.bin", "SCSI READ DISC STRUCTURE", scsiInfo.WriteProtectionStatus); } if (scsiInfo.DvdPfi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pfi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPfi); if (scsiInfo.DecodedPfi.HasValue) { AaruConsole.WriteLine("PFI:\n{0}", PFI.Prettify(scsiInfo.DecodedPfi)); } } if (scsiInfo.DvdDmi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_dmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdDmi); if (DMI.IsXbox(scsiInfo.DvdDmi)) { AaruConsole.WriteLine("Xbox DMI:\n{0}", DMI.PrettifyXbox(scsiInfo.DvdDmi)); } else if (DMI.IsXbox360(scsiInfo.DvdDmi)) { AaruConsole.WriteLine("Xbox 360 DMI:\n{0}", DMI.PrettifyXbox360(scsiInfo.DvdDmi)); } } if (scsiInfo.DvdCmi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_cmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdCmi); AaruConsole.WriteLine("Lead-In CMI:\n{0}", CSS_CPRM.PrettifyLeadInCopyright(scsiInfo.DvdCmi)); } if (scsiInfo.DvdBca != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_bca.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdBca); } if (scsiInfo.DvdAacs != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_aacs.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdAacs); } if (scsiInfo.DvdRamDds != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_dds.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamDds); AaruConsole.WriteLine("Disc Definition Structure:\n{0}", DDS.Prettify(scsiInfo.DvdRamDds)); } if (scsiInfo.DvdRamCartridgeStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_status.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamCartridgeStatus); AaruConsole.WriteLine("Medium Status:\n{0}", Cartridge.Prettify(scsiInfo.DvdRamCartridgeStatus)); } if (scsiInfo.DvdRamSpareArea != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_spare.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamSpareArea); AaruConsole.WriteLine("Spare Area Information:\n{0}", Spare.Prettify(scsiInfo.DvdRamSpareArea)); } if (scsiInfo.LastBorderOutRmd != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", "SCSI READ DISC STRUCTURE", scsiInfo.LastBorderOutRmd); } if (scsiInfo.DvdPreRecordedInfo != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pri.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPreRecordedInfo); } if (scsiInfo.DvdrMediaIdentifier != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_mediaid.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrMediaIdentifier); } if (scsiInfo.DvdrPhysicalInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_pfi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrPhysicalInformation); } if (scsiInfo.DvdPlusAdip != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_adip.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusAdip); } if (scsiInfo.DvdPlusDcb != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_dcb.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusDcb); } if (scsiInfo.HddvdCopyrightInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvd_cmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdCopyrightInformation); } if (scsiInfo.HddvdrMediumStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_status.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrMediumStatus); } if (scsiInfo.HddvdrLastRmd != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrLastRmd); } if (scsiInfo.DvdrLayerCapacity != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_layercap.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrLayerCapacity); } if (scsiInfo.DvdrDlMiddleZoneStart != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_mzs.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlMiddleZoneStart); } if (scsiInfo.DvdrDlJumpIntervalSize != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_jis.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlJumpIntervalSize); } if (scsiInfo.DvdrDlManualLayerJumpStartLba != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_manuallj.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlManualLayerJumpStartLba); } if (scsiInfo.DvdrDlRemapAnchorPoint != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlRemapAnchorPoint); } if (scsiInfo.BlurayDiscInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_di.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDiscInformation); AaruConsole.WriteLine("Blu-ray Disc Information:\n{0}", DI.Prettify(scsiInfo.BlurayDiscInformation)); } if (scsiInfo.BlurayPac != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_pac.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayPac); } if (scsiInfo.BlurayBurstCuttingArea != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_bca.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayBurstCuttingArea); AaruConsole.WriteLine("Blu-ray Burst Cutting Area:\n{0}", BCA.Prettify(scsiInfo.BlurayBurstCuttingArea)); } if (scsiInfo.BlurayDds != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dds.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDds); AaruConsole.WriteLine("Blu-ray Disc Definition Structure:\n{0}", Decoders.Bluray.DDS.Prettify(scsiInfo.BlurayDds)); } if (scsiInfo.BlurayCartridgeStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_cartstatus.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayCartridgeStatus); AaruConsole.WriteLine("Blu-ray Cartridge Status:\n{0}", Decoders.Bluray.Cartridge.Prettify(scsiInfo.BlurayCartridgeStatus)); } if (scsiInfo.BluraySpareAreaInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_spare.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BluraySpareAreaInformation); AaruConsole.WriteLine("Blu-ray Spare Area Information:\n{0}", Decoders.Bluray.Spare.Prettify(scsiInfo.BluraySpareAreaInformation)); } if (scsiInfo.BlurayRawDfl != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dfl.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayRawDfl); } if (scsiInfo.BlurayTrackResources != null) { AaruConsole.WriteLine("Track Resources Information:\n{0}", DiscInformation.Prettify(scsiInfo.BlurayTrackResources)); DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_001b.bin", "SCSI READ DISC INFORMATION", scsiInfo.BlurayTrackResources); } if (scsiInfo.BlurayPowResources != null) { AaruConsole.WriteLine("POW Resources Information:\n{0}", DiscInformation.Prettify(scsiInfo.BlurayPowResources)); DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_010b.bin", "SCSI READ DISC INFORMATION", scsiInfo.BlurayPowResources); } if (scsiInfo.Toc != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_toc.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Toc); if (scsiInfo.DecodedToc.HasValue) { AaruConsole.WriteLine("TOC:\n{0}", TOC.Prettify(scsiInfo.DecodedToc)); } } if (scsiInfo.Atip != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Atip); if (scsiInfo.DecodedAtip.HasValue) { AaruConsole.WriteLine("ATIP:\n{0}", ATIP.Prettify(scsiInfo.DecodedAtip)); } } if (scsiInfo.CompactDiscInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_000b.bin", "SCSI READ DISC INFORMATION", scsiInfo.CompactDiscInformation); if (scsiInfo.DecodedCompactDiscInformation.HasValue) { AaruConsole.WriteLine("Standard Disc Information:\n{0}", DiscInformation.Prettify000b(scsiInfo.DecodedCompactDiscInformation)); } } if (scsiInfo.Session != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_session.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Session); if (scsiInfo.DecodedSession.HasValue) { AaruConsole.WriteLine("Session information:\n{0}", Session.Prettify(scsiInfo.DecodedSession)); } } if (scsiInfo.RawToc != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_rawtoc.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.RawToc); if (scsiInfo.FullToc.HasValue) { AaruConsole.WriteLine("Raw TOC:\n{0}", FullTOC.Prettify(scsiInfo.RawToc)); } } if (scsiInfo.Pma != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_pma.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Pma); AaruConsole.WriteLine("PMA:\n{0}", PMA.Prettify(scsiInfo.Pma)); } if (scsiInfo.CdTextLeadIn != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.CdTextLeadIn); if (scsiInfo.DecodedCdTextLeadIn.HasValue) { AaruConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", CDTextOnLeadIn.Prettify(scsiInfo.DecodedCdTextLeadIn)); } } if (!string.IsNullOrEmpty(scsiInfo.Mcn)) { AaruConsole.WriteLine("MCN: {0}", scsiInfo.Mcn); } if (scsiInfo.Isrcs != null) { foreach (KeyValuePair <byte, string> isrc in scsiInfo.Isrcs) { AaruConsole.WriteLine("Track's {0} ISRC: {1}", isrc.Key, isrc.Value); } } if (scsiInfo.XboxSecuritySector != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_xbox_ss.bin", "KREON EXTRACT SS", scsiInfo.XboxSecuritySector); } if (scsiInfo.DecodedXboxSecuritySector.HasValue) { AaruConsole.WriteLine("Xbox Security Sector:\n{0}", SS.Prettify(scsiInfo.DecodedXboxSecuritySector)); } if (scsiInfo.XgdInfo != null) { AaruConsole.WriteLine("Video layer 0 size: {0} sectors", scsiInfo.XgdInfo.L0Video); AaruConsole.WriteLine("Video layer 1 size: {0} sectors", scsiInfo.XgdInfo.L1Video); AaruConsole.WriteLine("Middle zone size: {0} sectors", scsiInfo.XgdInfo.MiddleZone); AaruConsole.WriteLine("Game data size: {0} sectors", scsiInfo.XgdInfo.GameSize); AaruConsole.WriteLine("Total size: {0} sectors", scsiInfo.XgdInfo.TotalSize); AaruConsole.WriteLine("Real layer break: {0}", scsiInfo.XgdInfo.LayerBreak); AaruConsole.WriteLine(); } } if (scsiInfo.MediaSerialNumber != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_mediaserialnumber.bin", "SCSI READ MEDIA SERIAL NUMBER", scsiInfo.MediaSerialNumber); AaruConsole.Write("Media Serial Number: "); for (int i = 4; i < scsiInfo.MediaSerialNumber.Length; i++) { AaruConsole.Write("{0:X2}", scsiInfo.MediaSerialNumber[i]); } AaruConsole.WriteLine(); } AaruConsole.WriteLine("Media identified as {0}", scsiInfo.MediaType); Statistics.AddMedia(scsiInfo.MediaType, true); if (scsiInfo.Toc != null || scsiInfo.RawToc != null) { uint blockSize = 2352; Track[] tracks = Dump.GetCdTracks(ref blockSize, dev, scsiInfo.MediaType, null, false, out long lastSector, null, null, null, TrackSubchannelType.None, out _, null, null); if (tracks != null) { bool supportsPqSubchannel = Dump.SupportsPqSubchannel(dev, null, null); bool supportsRwSubchannel = Dump.SupportsRwSubchannel(dev, null, null); // Open master database var ctx = AaruContext.Create(Settings.Settings.MasterDbPath); // Search for device in master database Database.Models.Device dbDev = ctx.Devices.FirstOrDefault(d => d.Manufacturer == dev.Manufacturer && d.Model == dev.Model && d.Revision == dev.FirmwareRevision); Dump.SolveTrackPregaps(dev, null, null, tracks, supportsPqSubchannel, supportsRwSubchannel, dbDev, out bool inexactPositioning); for (int t = 1; t < tracks.Length; t++) { tracks[t - 1].TrackEndSector = tracks[t].TrackStartSector - 1; } tracks[tracks.Length - 1].TrackEndSector = (ulong)lastSector; AaruConsole.WriteLine(); AaruConsole.WriteLine("Track calculations:"); if (inexactPositioning) { AaruConsole. WriteLine("WARNING: The drive has returned incorrect Q positioning when calculating pregaps. A best effort has been tried but they may be incorrect."); } foreach (Track track in tracks) { AaruConsole. WriteLine("Track {0} starts at LBA {1}, ends at LBA {2}, has a pregap of {3} sectors and is of type {4}", track.TrackSequence, track.TrackStartSector, track.TrackEndSector, track.TrackPregap, track.TrackType); } AaruConsole.WriteLine(); AaruConsole.WriteLine("Offsets:"); CdOffset cdOffset = null; // Search for read offset in master database cdOffset = ctx.CdOffsets.FirstOrDefault(d => d.Manufacturer == dev.Manufacturer && d.Model == dev.Model); CompactDisc.GetOffset(cdOffset, dbDev, debug, dev, scsiInfo.MediaType, null, tracks, null, out int?driveOffset, out int?combinedOffset, out _); if (combinedOffset is null) { if (driveOffset is null) { AaruConsole.WriteLine("Drive reading offset not found in database."); AaruConsole.WriteLine("Disc offset cannot be calculated."); } else { AaruConsole. WriteLine($"Drive reading offset is {driveOffset} bytes ({driveOffset / 4} samples)."); AaruConsole.WriteLine("Disc write offset is unknown."); } } else { int offsetBytes = combinedOffset.Value; if (driveOffset is null) { AaruConsole.WriteLine("Drive reading offset not found in database."); AaruConsole. WriteLine($"Combined disc and drive offset are {offsetBytes} bytes ({offsetBytes / 4} samples)."); } else { AaruConsole. WriteLine($"Drive reading offset is {driveOffset} bytes ({driveOffset / 4} samples)."); AaruConsole. WriteLine($"Combined offset is {offsetBytes} bytes ({offsetBytes / 4} samples)"); int?discOffset = offsetBytes - driveOffset; AaruConsole.WriteLine($"Disc offset is {discOffset} bytes ({discOffset / 4} samples)"); } } } } dev.Close(); }
// TODO: More graphically aware decoders void OnCmbTagSelectedIndexChanged(object sender, EventArgs e) { if (!(cmbTag.SelectedValue is MediaTagWithData tagWithData)) { return; } // TODO: Decoders should be able to handle tags with/without length header txtPrintHex.Text = PrintHex.ByteArrayToHexArrayString(tagWithData.Data, HEX_COLUMNS); tabDecoded.Visible = true; switch (tagWithData.Tag) { case MediaTagType.CD_TOC: txtDecoded.Text = TOC.Prettify(tagWithData.Data); break; case MediaTagType.CD_SessionInfo: txtDecoded.Text = Session.Prettify(tagWithData.Data); break; case MediaTagType.CD_FullTOC: txtDecoded.Text = FullTOC.Prettify(tagWithData.Data); break; case MediaTagType.CD_PMA: txtDecoded.Text = PMA.Prettify(tagWithData.Data); break; case MediaTagType.CD_ATIP: txtDecoded.Text = ATIP.Prettify(tagWithData.Data); break; case MediaTagType.CD_TEXT: txtDecoded.Text = CDTextOnLeadIn.Prettify(tagWithData.Data); break; case MediaTagType.CD_MCN: txtDecoded.Text = Encoding.ASCII.GetString(tagWithData.Data); break; case MediaTagType.DVD_PFI: txtDecoded.Text = PFI.Prettify(tagWithData.Data); break; case MediaTagType.DVD_CMI: txtDecoded.Text = CSS_CPRM.PrettifyLeadInCopyright(tagWithData.Data); break; case MediaTagType.DVDRAM_DDS: txtDecoded.Text = DDS.Prettify(tagWithData.Data); break; case MediaTagType.DVDRAM_SpareArea: txtDecoded.Text = Spare.Prettify(tagWithData.Data); break; case MediaTagType.DVDR_PFI: txtDecoded.Text = PFI.Prettify(tagWithData.Data); break; case MediaTagType.HDDVD_MediumStatus: txtDecoded.Text = PFI.Prettify(tagWithData.Data); break; case MediaTagType.BD_DI: txtDecoded.Text = DI.Prettify(tagWithData.Data); break; case MediaTagType.BD_BCA: txtDecoded.Text = BCA.Prettify(tagWithData.Data); break; case MediaTagType.BD_DDS: txtDecoded.Text = Decoders.Bluray.DDS.Prettify(tagWithData.Data); break; case MediaTagType.BD_CartridgeStatus: txtDecoded.Text = Cartridge.Prettify(tagWithData.Data); break; case MediaTagType.BD_SpareArea: txtDecoded.Text = Decoders.Bluray.Spare.Prettify(tagWithData.Data); break; case MediaTagType.MMC_WriteProtection: txtDecoded.Text = WriteProtect.PrettifyWriteProtectionStatus(tagWithData.Data); break; case MediaTagType.MMC_DiscInformation: txtDecoded.Text = DiscInformation.Prettify(tagWithData.Data); break; case MediaTagType.SCSI_INQUIRY: txtDecoded.Text = Inquiry.Prettify(tagWithData.Data); break; case MediaTagType.SCSI_MODEPAGE_2A: txtDecoded.Text = Modes.PrettifyModePage_2A(tagWithData.Data); break; case MediaTagType.ATA_IDENTIFY: case MediaTagType.ATAPI_IDENTIFY: txtDecoded.Text = Identify.Prettify(tagWithData.Data); break; case MediaTagType.Xbox_SecuritySector: txtDecoded.Text = SS.Prettify(tagWithData.Data); break; case MediaTagType.SCSI_MODESENSE_6: txtDecoded.Text = Modes.PrettifyModeHeader6(tagWithData.Data, PeripheralDeviceTypes.DirectAccess); break; case MediaTagType.SCSI_MODESENSE_10: txtDecoded.Text = Modes.PrettifyModeHeader10(tagWithData.Data, PeripheralDeviceTypes.DirectAccess); break; case MediaTagType.Xbox_DMI: txtDecoded.Text = DMI.IsXbox360(tagWithData.Data) ? DMI.PrettifyXbox360(tagWithData.Data) : DMI.PrettifyXbox(tagWithData.Data); break; default: tabDecoded.Visible = false; break; } }
/// <summary>Dumps an optical disc</summary> void Mmc() { MediaType dskType = MediaType.Unknown; bool sense; byte[] tmpBuf; bool compactDisc = true; bool isXbox = false; _speedMultiplier = 1; // TODO: Log not only what is it reading, but if it was read correctly or not. sense = _dev.GetConfiguration(out byte[] cmdBuf, out _, 0, MmcGetConfigurationRt.Current, _dev.Timeout, out _); if (!sense) { Features.SeparatedFeatures ftr = Features.Separate(cmdBuf); _dumpLog.WriteLine("Device reports current profile is 0x{0:X4}", ftr.CurrentProfile); switch (ftr.CurrentProfile) { case 0x0001: dskType = MediaType.GENERIC_HDD; _speedMultiplier = -1; goto default; case 0x0002: dskType = MediaType.PD650; _speedMultiplier = -1; goto default; case 0x0005: dskType = MediaType.CDMO; break; case 0x0008: dskType = MediaType.CD; break; case 0x0009: dskType = MediaType.CDR; break; case 0x000A: dskType = MediaType.CDRW; break; case 0x0010: dskType = MediaType.DVDROM; _speedMultiplier = 9; goto default; case 0x0011: dskType = MediaType.DVDR; _speedMultiplier = 9; goto default; case 0x0012: dskType = MediaType.DVDRAM; _speedMultiplier = 9; goto default; case 0x0013: case 0x0014: dskType = MediaType.DVDRW; _speedMultiplier = 9; goto default; case 0x0015: case 0x0016: dskType = MediaType.DVDRDL; _speedMultiplier = 9; goto default; case 0x0017: dskType = MediaType.DVDRWDL; _speedMultiplier = 9; goto default; case 0x0018: dskType = MediaType.DVDDownload; _speedMultiplier = 9; goto default; case 0x001A: dskType = MediaType.DVDPRW; _speedMultiplier = 9; goto default; case 0x001B: dskType = MediaType.DVDPR; _speedMultiplier = 9; goto default; case 0x0020: dskType = MediaType.DDCD; goto default; case 0x0021: dskType = MediaType.DDCDR; goto default; case 0x0022: dskType = MediaType.DDCDRW; goto default; case 0x002A: dskType = MediaType.DVDPRWDL; _speedMultiplier = 9; goto default; case 0x002B: dskType = MediaType.DVDPRDL; _speedMultiplier = 9; goto default; case 0x0040: dskType = MediaType.BDROM; _speedMultiplier = 30; goto default; case 0x0041: case 0x0042: dskType = MediaType.BDR; _speedMultiplier = 30; goto default; case 0x0043: dskType = MediaType.BDRE; _speedMultiplier = 30; goto default; case 0x0050: dskType = MediaType.HDDVDROM; _speedMultiplier = 30; goto default; case 0x0051: dskType = MediaType.HDDVDR; _speedMultiplier = 30; goto default; case 0x0052: dskType = MediaType.HDDVDRAM; _speedMultiplier = 30; goto default; case 0x0053: dskType = MediaType.HDDVDRW; _speedMultiplier = 30; goto default; case 0x0058: dskType = MediaType.HDDVDRDL; _speedMultiplier = 30; goto default; case 0x005A: dskType = MediaType.HDDVDRWDL; _speedMultiplier = 30; goto default; default: compactDisc = false; break; } } if (compactDisc) { _speedMultiplier *= 177; CompactDisc(); return; } _speedMultiplier *= 150; var scsiReader = new Reader(_dev, _dev.Timeout, null, _dumpRaw); ulong blocks = scsiReader.GetDeviceBlocks(); _dumpLog.WriteLine("Device reports disc has {0} blocks", blocks); Dictionary <MediaTagType, byte[]> mediaTags = new Dictionary <MediaTagType, byte[]>(); if (dskType == MediaType.PD650) { switch (blocks + 1) { case 1281856: dskType = MediaType.PD650_WORM; break; case 58620544: dskType = MediaType.REV120; break; case 17090880: dskType = MediaType.REV35; break; // TODO: Unknown value default: dskType = MediaType.REV70; break; } } #region Nintendo switch (dskType) { case MediaType.Unknown when blocks > 0: _dumpLog.WriteLine("Reading Physical Format Information"); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, _dev.Timeout, out _); if (!sense) { PFI.PhysicalFormatInformation?nintendoPfi = PFI.Decode(cmdBuf); if (nintendoPfi != null) { if (nintendoPfi.Value.DiskCategory == DiskCategory.Nintendo && nintendoPfi.Value.PartVersion == 15) { _dumpLog.WriteLine("Dumping Nintendo GameCube or Wii discs is not yet implemented."); StoppingErrorMessage?. Invoke("Dumping Nintendo GameCube or Wii discs is not yet implemented."); return; } } } break; case MediaType.DVDDownload: case MediaType.DVDPR: case MediaType.DVDPRDL: case MediaType.DVDPRW: case MediaType.DVDPRWDL: case MediaType.DVDR: case MediaType.DVDRAM: case MediaType.DVDRDL: case MediaType.DVDROM: case MediaType.DVDRW: case MediaType.DVDRWDL: case MediaType.HDDVDR: case MediaType.HDDVDRAM: case MediaType.HDDVDRDL: case MediaType.HDDVDROM: case MediaType.HDDVDRW: case MediaType.HDDVDRWDL: _dumpLog.WriteLine("Reading Physical Format Information"); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, _dev.Timeout, out _); if (!sense) { if (PFI.Decode(cmdBuf).HasValue) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf); PFI.PhysicalFormatInformation decPfi = PFI.Decode(cmdBuf).Value; UpdateStatus?.Invoke($"PFI:\n{PFI.Prettify(decPfi)}"); // False book types if (dskType == MediaType.DVDROM) { switch (decPfi.DiskCategory) { case DiskCategory.DVDPR: dskType = MediaType.DVDPR; break; case DiskCategory.DVDPRDL: dskType = MediaType.DVDPRDL; break; case DiskCategory.DVDPRW: dskType = MediaType.DVDPRW; break; case DiskCategory.DVDPRWDL: dskType = MediaType.DVDPRWDL; break; case DiskCategory.DVDR: dskType = decPfi.PartVersion == 6 ? MediaType.DVDRDL : MediaType.DVDR; break; case DiskCategory.DVDRAM: dskType = MediaType.DVDRAM; break; default: dskType = MediaType.DVDROM; break; case DiskCategory.DVDRW: dskType = decPfi.PartVersion == 3 ? MediaType.DVDRWDL : MediaType.DVDRW; break; case DiskCategory.HDDVDR: dskType = MediaType.HDDVDR; break; case DiskCategory.HDDVDRAM: dskType = MediaType.HDDVDRAM; break; case DiskCategory.HDDVDROM: dskType = MediaType.HDDVDROM; break; case DiskCategory.HDDVDRW: dskType = MediaType.HDDVDRW; break; case DiskCategory.Nintendo: dskType = decPfi.DiscSize == DVDSize.Eighty ? MediaType.GOD : MediaType.WOD; break; case DiskCategory.UMD: dskType = MediaType.UMD; break; } } } } _dumpLog.WriteLine("Reading Disc Manufacturing Information"); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, _dev.Timeout, out _); if (!sense) { if (DMI.IsXbox(cmdBuf) || DMI.IsXbox360(cmdBuf)) { if (DMI.IsXbox(cmdBuf)) { dskType = MediaType.XGD; } else if (DMI.IsXbox360(cmdBuf)) { dskType = MediaType.XGD2; // All XGD3 all have the same number of blocks if (blocks == 25063 || // Locked (or non compatible drive) blocks == 4229664 || // Xtreme unlock blocks == 4246304) // Wxripper unlock { dskType = MediaType.XGD3; } } sense = _dev.ScsiInquiry(out byte[] inqBuf, out _); if (sense || !Inquiry.Decode(inqBuf).HasValue || (Inquiry.Decode(inqBuf).HasValue&& !Inquiry.Decode(inqBuf).Value.KreonPresent)) { _dumpLog.WriteLine("Dumping Xbox Game Discs requires a drive with Kreon firmware."); StoppingErrorMessage?. Invoke("Dumping Xbox Game Discs requires a drive with Kreon firmware."); return; } if (_dumpRaw && !_force) { StoppingErrorMessage?. Invoke("Not continuing. If you want to continue reading cooked data when raw is not available use the force option."); // TODO: Exit more gracefully return; } isXbox = true; } if (cmdBuf.Length == 2052) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.DVD_DMI, tmpBuf); } } break; } #endregion Nintendo #region All DVD and HD DVD types #endregion All DVD and HD DVD types #region DVD-ROM if (dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM) { _dumpLog.WriteLine("Reading Lead-in Copyright Information."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.CopyrightInformation, 0, _dev.Timeout, out _); if (!sense) { if (CSS_CPRM.DecodeLeadInCopyright(cmdBuf).HasValue) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.DVD_CMI, tmpBuf); } } } #endregion DVD-ROM switch (dskType) { #region DVD-ROM and HD DVD-ROM case MediaType.DVDDownload: case MediaType.DVDROM: case MediaType.HDDVDROM: _dumpLog.WriteLine("Reading Burst Cutting Area."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.BurstCuttingArea, 0, _dev.Timeout, out _); if (!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.DVD_BCA, tmpBuf); } break; #endregion DVD-ROM and HD DVD-ROM #region DVD-RAM and HD DVD-RAM case MediaType.DVDRAM: case MediaType.HDDVDRAM: _dumpLog.WriteLine("Reading Disc Description Structure."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.DvdramDds, 0, _dev.Timeout, out _); if (!sense) { if (DDS.Decode(cmdBuf).HasValue) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.DVDRAM_DDS, tmpBuf); } } _dumpLog.WriteLine("Reading Spare Area Information."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.DvdramSpareAreaInformation, 0, _dev.Timeout, out _); if (!sense) { if (Spare.Decode(cmdBuf).HasValue) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.DVDRAM_SpareArea, tmpBuf); } } break; #endregion DVD-RAM and HD DVD-RAM #region DVD-R and DVD-RW case MediaType.DVDR: case MediaType.DVDRW: _dumpLog.WriteLine("Reading Pre-Recorded Information."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.PreRecordedInfo, 0, _dev.Timeout, out _); if (!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.DVDR_PreRecordedInfo, tmpBuf); } break; #endregion DVD-R and DVD-RW } switch (dskType) { #region DVD-R, DVD-RW and HD DVD-R case MediaType.DVDR: case MediaType.DVDRW: case MediaType.HDDVDR: _dumpLog.WriteLine("Reading Media Identifier."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.DvdrMediaIdentifier, 0, _dev.Timeout, out _); if (!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.DVDR_MediaIdentifier, tmpBuf); } _dumpLog.WriteLine("Reading Recordable Physical Information."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.DvdrPhysicalInformation, 0, _dev.Timeout, out _); if (!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.DVDR_PFI, tmpBuf); } break; #endregion DVD-R, DVD-RW and HD DVD-R #region All DVD+ case MediaType.DVDPR: case MediaType.DVDPRDL: case MediaType.DVDPRW: case MediaType.DVDPRWDL: _dumpLog.WriteLine("Reading ADdress In Pregroove."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.Adip, 0, _dev.Timeout, out _); if (!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.DVD_ADIP, tmpBuf); } _dumpLog.WriteLine("Reading Disc Control Blocks."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.Dcb, 0, _dev.Timeout, out _); if (!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.DCB, tmpBuf); } break; #endregion All DVD+ #region HD DVD-ROM case MediaType.HDDVDROM: _dumpLog.WriteLine("Reading Lead-in Copyright Information."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0, MmcDiscStructureFormat.HddvdCopyrightInformation, 0, _dev.Timeout, out _); if (!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.HDDVD_CPI, tmpBuf); } break; #endregion HD DVD-ROM #region All Blu-ray case MediaType.BDR: case MediaType.BDRE: case MediaType.BDROM: case MediaType.BDRXL: case MediaType.BDREXL: _dumpLog.WriteLine("Reading Disc Information."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0, MmcDiscStructureFormat.DiscInformation, 0, _dev.Timeout, out _); if (!sense) { if (DI.Decode(cmdBuf).HasValue) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.BD_DI, tmpBuf); } } // TODO: PAC /* * dumpLog.WriteLine("Reading PAC."); * sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0, * MmcDiscStructureFormat.Pac, 0, dev.Timeout, out _); * if(!sense) * { * tmpBuf = new byte[cmdBuf.Length - 4]; * Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); * mediaTags.Add(MediaTagType.PAC, tmpBuf); * }*/ break; #endregion All Blu-ray } switch (dskType) { #region BD-ROM only case MediaType.BDROM: _dumpLog.WriteLine("Reading Burst Cutting Area."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0, MmcDiscStructureFormat.BdBurstCuttingArea, 0, _dev.Timeout, out _); if (!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.BD_BCA, tmpBuf); } break; #endregion BD-ROM only #region Writable Blu-ray only case MediaType.BDR: case MediaType.BDRE: case MediaType.BDRXL: case MediaType.BDREXL: _dumpLog.WriteLine("Reading Disc Definition Structure."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0, MmcDiscStructureFormat.BdDds, 0, _dev.Timeout, out _); if (!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.BD_DDS, tmpBuf); } _dumpLog.WriteLine("Reading Spare Area Information."); sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0, MmcDiscStructureFormat.BdSpareAreaInformation, 0, _dev.Timeout, out _); if (!sense) { tmpBuf = new byte[cmdBuf.Length - 4]; Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); mediaTags.Add(MediaTagType.BD_SpareArea, tmpBuf); } break; #endregion Writable Blu-ray only } if (isXbox) { Xgd(mediaTags, dskType); return; } Sbc(mediaTags, dskType, true); }
static void DoScsiMediaInfo(bool debug, string outputPrefix, Devices.Device dev) { var scsiInfo = new ScsiInfo(dev); if (!scsiInfo.MediaInserted) { return; } if (scsiInfo.DeviceInfo.ScsiModeSense6 != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_scsi_modesense6.bin", "SCSI MODE SENSE (6)", scsiInfo.DeviceInfo.ScsiModeSense6); } if (scsiInfo.DeviceInfo.ScsiModeSense10 != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_scsi_modesense10.bin", "SCSI MODE SENSE (10)", scsiInfo.DeviceInfo.ScsiModeSense10); } switch (dev.ScsiType) { case PeripheralDeviceTypes.DirectAccess: case PeripheralDeviceTypes.MultiMediaDevice: case PeripheralDeviceTypes.OCRWDevice: case PeripheralDeviceTypes.OpticalDevice: case PeripheralDeviceTypes.SimplifiedDevice: case PeripheralDeviceTypes.WriteOnceDevice: case PeripheralDeviceTypes.BridgingExpander when dev.Model.StartsWith("MDM", StringComparison.Ordinal) || dev.Model.StartsWith("MDH", StringComparison.Ordinal): if (scsiInfo.ReadCapacity != null) DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity.bin", "SCSI READ CAPACITY", scsiInfo.ReadCapacity); if (scsiInfo.ReadCapacity16 != null) DataFile.WriteTo("Media-Info command", outputPrefix, "_readcapacity16.bin", "SCSI READ CAPACITY(16)", scsiInfo.ReadCapacity16); if (scsiInfo.Blocks != 0 && scsiInfo.BlockSize != 0) { ulong totalSize = scsiInfo.Blocks * scsiInfo.BlockSize; if (totalSize > 1099511627776) { AaruConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2:F3} TiB)", scsiInfo.Blocks, scsiInfo.BlockSize, totalSize / 1099511627776d); } else if (totalSize > 1073741824) { AaruConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2:F3} GiB)", scsiInfo.Blocks, scsiInfo.BlockSize, totalSize / 1073741824d); } else if (totalSize > 1048576) { AaruConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2:F3} MiB)", scsiInfo.Blocks, scsiInfo.BlockSize, totalSize / 1048576d); } else if (totalSize > 1024) { AaruConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2:F3} KiB)", scsiInfo.Blocks, scsiInfo.BlockSize, totalSize / 1024d); } else { AaruConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", scsiInfo.Blocks, scsiInfo.BlockSize, totalSize); } } break; case PeripheralDeviceTypes.SequentialAccess: if (scsiInfo.DensitySupport != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIA)", scsiInfo.DensitySupport); if (scsiInfo.DensitySupportHeader.HasValue) { AaruConsole.WriteLine("Densities supported by currently inserted media:"); AaruConsole.WriteLine(DensitySupport.PrettifyDensity(scsiInfo.DensitySupportHeader)); } } if (scsiInfo.MediaTypeSupport != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_ssc_reportdensitysupport_medium_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", scsiInfo.MediaTypeSupport); if (scsiInfo.MediaTypeSupportHeader.HasValue) { AaruConsole.WriteLine("Medium types currently inserted in device:"); AaruConsole.WriteLine(DensitySupport.PrettifyMediumType(scsiInfo.MediaTypeSupportHeader)); } AaruConsole.WriteLine(DensitySupport.PrettifyMediumType(scsiInfo.MediaTypeSupport)); } break; } if (dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice) { if (scsiInfo.MmcConfiguration != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_getconfiguration_current.bin", "SCSI GET CONFIGURATION", scsiInfo.MmcConfiguration); } if (scsiInfo.RecognizedFormatLayers != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_formatlayers.bin", "SCSI READ DISC STRUCTURE", scsiInfo.RecognizedFormatLayers); } if (scsiInfo.WriteProtectionStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_writeprotection.bin", "SCSI READ DISC STRUCTURE", scsiInfo.WriteProtectionStatus); } if (scsiInfo.DvdPfi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pfi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPfi); if (scsiInfo.DecodedPfi.HasValue) { AaruConsole.WriteLine("PFI:\n{0}", PFI.Prettify(scsiInfo.DecodedPfi)); } } if (scsiInfo.DvdDmi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_dmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdDmi); if (DMI.IsXbox(scsiInfo.DvdDmi)) { AaruConsole.WriteLine("Xbox DMI:\n{0}", DMI.PrettifyXbox(scsiInfo.DvdDmi)); } else if (DMI.IsXbox360(scsiInfo.DvdDmi)) { AaruConsole.WriteLine("Xbox 360 DMI:\n{0}", DMI.PrettifyXbox360(scsiInfo.DvdDmi)); } } if (scsiInfo.DvdCmi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_cmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdCmi); AaruConsole.WriteLine("Lead-In CMI:\n{0}", CSS_CPRM.PrettifyLeadInCopyright(scsiInfo.DvdCmi)); } if (scsiInfo.DvdDiscKey != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_disckey.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdDiscKey); } if (scsiInfo.DvdSectorCmi != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_sectorcmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdSectorCmi); } if (scsiInfo.DvdBca != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_bca.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdBca); } if (scsiInfo.DvdAacs != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_aacs.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdAacs); } if (scsiInfo.DvdRamDds != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_dds.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamDds); AaruConsole.WriteLine("Disc Definition Structure:\n{0}", DDS.Prettify(scsiInfo.DvdRamDds)); } if (scsiInfo.DvdRamCartridgeStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_status.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamCartridgeStatus); AaruConsole.WriteLine("Medium Status:\n{0}", Cartridge.Prettify(scsiInfo.DvdRamCartridgeStatus)); } if (scsiInfo.DvdRamSpareArea != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdram_spare.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdRamSpareArea); AaruConsole.WriteLine("Spare Area Information:\n{0}", Spare.Prettify(scsiInfo.DvdRamSpareArea)); } if (scsiInfo.LastBorderOutRmd != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", "SCSI READ DISC STRUCTURE", scsiInfo.LastBorderOutRmd); } if (scsiInfo.DvdPreRecordedInfo != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_pri.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPreRecordedInfo); if (scsiInfo.DecodedDvdPrePitInformation.HasValue) { AaruConsole.WriteLine("DVD-R(W) Pre-Recorded Information:\n{0}", PRI.Prettify(scsiInfo.DecodedDvdPrePitInformation)); } } if (scsiInfo.DvdrMediaIdentifier != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_mediaid.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrMediaIdentifier); } if (scsiInfo.DvdrPhysicalInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_pfi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrPhysicalInformation); if (scsiInfo.DecodedDvdrPfi.HasValue) { AaruConsole.WriteLine("DVD-R(W) PFI:\n{0}", PFI.Prettify(scsiInfo.DecodedDvdrPfi)); } } if (scsiInfo.DvdPlusAdip != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_adip.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusAdip); } if (scsiInfo.DvdPlusDcb != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd+_dcb.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdPlusDcb); } if (scsiInfo.HddvdCopyrightInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvd_cmi.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdCopyrightInformation); } if (scsiInfo.HddvdrMediumStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_status.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrMediumStatus); } if (scsiInfo.HddvdrLastRmd != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin", "SCSI READ DISC STRUCTURE", scsiInfo.HddvdrLastRmd); } if (scsiInfo.DvdrLayerCapacity != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvdr_layercap.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrLayerCapacity); } if (scsiInfo.DvdrDlMiddleZoneStart != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_mzs.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlMiddleZoneStart); } if (scsiInfo.DvdrDlJumpIntervalSize != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_jis.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlJumpIntervalSize); } if (scsiInfo.DvdrDlManualLayerJumpStartLba != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_manuallj.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlManualLayerJumpStartLba); } if (scsiInfo.DvdrDlRemapAnchorPoint != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", "SCSI READ DISC STRUCTURE", scsiInfo.DvdrDlRemapAnchorPoint); } if (scsiInfo.BlurayDiscInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_di.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDiscInformation); AaruConsole.WriteLine("Blu-ray Disc Information:\n{0}", DI.Prettify(scsiInfo.BlurayDiscInformation)); } if (scsiInfo.BlurayPac != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_pac.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayPac); } if (scsiInfo.BlurayBurstCuttingArea != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_bca.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayBurstCuttingArea); AaruConsole.WriteLine("Blu-ray Burst Cutting Area:\n{0}", BCA.Prettify(scsiInfo.BlurayBurstCuttingArea)); } if (scsiInfo.BlurayDds != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dds.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayDds); AaruConsole.WriteLine("Blu-ray Disc Definition Structure:\n{0}", Decoders.Bluray.DDS.Prettify(scsiInfo.BlurayDds)); } if (scsiInfo.BlurayCartridgeStatus != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_cartstatus.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayCartridgeStatus); AaruConsole.WriteLine("Blu-ray Cartridge Status:\n{0}", Decoders.Bluray.Cartridge.Prettify(scsiInfo.BlurayCartridgeStatus)); } if (scsiInfo.BluraySpareAreaInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_spare.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BluraySpareAreaInformation); AaruConsole.WriteLine("Blu-ray Spare Area Information:\n{0}", Decoders.Bluray.Spare.Prettify(scsiInfo.BluraySpareAreaInformation)); } if (scsiInfo.BlurayRawDfl != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscstructure_bd_dfl.bin", "SCSI READ DISC STRUCTURE", scsiInfo.BlurayRawDfl); } if (scsiInfo.BlurayTrackResources != null) { AaruConsole.WriteLine("Track Resources Information:\n{0}", DiscInformation.Prettify(scsiInfo.BlurayTrackResources)); DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_001b.bin", "SCSI READ DISC INFORMATION", scsiInfo.BlurayTrackResources); } if (scsiInfo.BlurayPowResources != null) { AaruConsole.WriteLine("POW Resources Information:\n{0}", DiscInformation.Prettify(scsiInfo.BlurayPowResources)); DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_010b.bin", "SCSI READ DISC INFORMATION", scsiInfo.BlurayPowResources); } if (scsiInfo.Toc != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_toc.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Toc); if (scsiInfo.DecodedToc.HasValue) { AaruConsole.WriteLine("TOC:\n{0}", TOC.Prettify(scsiInfo.DecodedToc)); } } if (scsiInfo.Atip != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Atip); if (scsiInfo.DecodedAtip != null) { AaruConsole.WriteLine("ATIP:\n{0}", ATIP.Prettify(scsiInfo.DecodedAtip)); } } if (scsiInfo.DiscInformation != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_readdiscinformation_000b.bin", "SCSI READ DISC INFORMATION", scsiInfo.DiscInformation); if (scsiInfo.DecodedDiscInformation.HasValue) { AaruConsole.WriteLine("Standard Disc Information:\n{0}", DiscInformation.Prettify000b(scsiInfo.DecodedDiscInformation)); } } if (scsiInfo.Session != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_session.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Session); if (scsiInfo.DecodedSession.HasValue) { AaruConsole.WriteLine("Session information:\n{0}", Session.Prettify(scsiInfo.DecodedSession)); } } if (scsiInfo.RawToc != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_rawtoc.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.RawToc); if (scsiInfo.FullToc.HasValue) { AaruConsole.WriteLine("Raw TOC:\n{0}", FullTOC.Prettify(scsiInfo.RawToc)); } } if (scsiInfo.Pma != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_pma.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.Pma); AaruConsole.WriteLine("PMA:\n{0}", PMA.Prettify(scsiInfo.Pma)); } if (scsiInfo.CdTextLeadIn != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", scsiInfo.CdTextLeadIn); if (scsiInfo.DecodedCdTextLeadIn.HasValue) { AaruConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", CDTextOnLeadIn.Prettify(scsiInfo.DecodedCdTextLeadIn)); } } if (!string.IsNullOrEmpty(scsiInfo.Mcn)) { AaruConsole.WriteLine("MCN: {0}", scsiInfo.Mcn); } if (scsiInfo.Isrcs != null) { foreach (KeyValuePair <byte, string> isrc in scsiInfo.Isrcs) { AaruConsole.WriteLine("Track's {0} ISRC: {1}", isrc.Key, isrc.Value); } } if (scsiInfo.XboxSecuritySector != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_xbox_ss.bin", "KREON EXTRACT SS", scsiInfo.XboxSecuritySector); } if (scsiInfo.DecodedXboxSecuritySector.HasValue) { AaruConsole.WriteLine("Xbox Security Sector:\n{0}", SS.Prettify(scsiInfo.DecodedXboxSecuritySector)); } if (scsiInfo.XgdInfo != null) { AaruConsole.WriteLine("Video layer 0 size: {0} sectors", scsiInfo.XgdInfo.L0Video); AaruConsole.WriteLine("Video layer 1 size: {0} sectors", scsiInfo.XgdInfo.L1Video); AaruConsole.WriteLine("Middle zone size: {0} sectors", scsiInfo.XgdInfo.MiddleZone); AaruConsole.WriteLine("Game data size: {0} sectors", scsiInfo.XgdInfo.GameSize); AaruConsole.WriteLine("Total size: {0} sectors", scsiInfo.XgdInfo.TotalSize); AaruConsole.WriteLine("Real layer break: {0}", scsiInfo.XgdInfo.LayerBreak); AaruConsole.WriteLine(); } } if (scsiInfo.MediaSerialNumber != null) { DataFile.WriteTo("Media-Info command", outputPrefix, "_mediaserialnumber.bin", "SCSI READ MEDIA SERIAL NUMBER", scsiInfo.MediaSerialNumber); AaruConsole.Write("Media Serial Number: "); for (int i = 4; i < scsiInfo.MediaSerialNumber.Length; i++) { AaruConsole.Write("{0:X2}", scsiInfo.MediaSerialNumber[i]); } AaruConsole.WriteLine(); } AaruConsole.WriteLine("Media identified as {0}", scsiInfo.MediaType); Statistics.AddMedia(scsiInfo.MediaType, true); if (scsiInfo.Toc != null || scsiInfo.RawToc != null) { Track[] tracks = Dump.GetCdTracks(dev, null, false, out long lastSector, null, null, null, out _, null, null); if (tracks != null) { uint firstLba = (uint)tracks.Min(t => t.TrackStartSector); bool supportsPqSubchannel = Dump.SupportsPqSubchannel(dev, null, null, firstLba); bool supportsRwSubchannel = Dump.SupportsRwSubchannel(dev, null, null, firstLba); // Open main database var ctx = AaruContext.Create(Settings.Settings.MainDbPath); // Search for device in main database Aaru.Database.Models.Device dbDev = ctx.Devices.FirstOrDefault(d => d.Manufacturer == dev.Manufacturer && d.Model == dev.Model && d.Revision == dev.FirmwareRevision); Dump.SolveTrackPregaps(dev, null, null, tracks, supportsPqSubchannel, supportsRwSubchannel, dbDev, out bool inexactPositioning, false); for (int t = 1; t < tracks.Length; t++) { tracks[t - 1].TrackEndSector = tracks[t].TrackStartSector - 1; } tracks[^ 1].TrackEndSector = (ulong)lastSector;