From 80a4a65934d79a4f3743a480577961776289167e Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 2 Jan 2019 05:26:45 +0000 Subject: [PATCH] Fix device-report. --- DiscImageChef.Core/Devices/Report/MMC.cs | 20 +++++++++++++++----- DiscImageChef/Commands/DeviceReport.cs | 10 +++++++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/DiscImageChef.Core/Devices/Report/MMC.cs b/DiscImageChef.Core/Devices/Report/MMC.cs index 1a073abb1..a3b2dc7c6 100644 --- a/DiscImageChef.Core/Devices/Report/MMC.cs +++ b/DiscImageChef.Core/Devices/Report/MMC.cs @@ -49,11 +49,14 @@ namespace DiscImageChef.Core.Devices.Report while(offset + 4 < response.Length) { ushort code = (ushort)((response[offset + 0] << 8) + response[offset + 1]); - - if(code != 0x0108) continue; - byte[] data = new byte[response[offset + 3] + 4]; + if(code != 0x0108) + { + offset += (uint)data.Length; + continue; + } + if(data.Length + offset > response.Length) data = new byte[response.Length - offset]; Array.Copy(data, 4, response, offset + 4, data.Length - 4); offset += (uint)data.Length; @@ -608,6 +611,10 @@ namespace DiscImageChef.Core.Devices.Report if(debug) mediaTest.DvdAacsData = buffer; break; case "BD-ROM": + case "Ultra HD Blu-ray movie": + case "PlayStation 3 game": + case "PlayStation 4 game": + case "Xbox One game": DicConsole.WriteLine("Querying BD BCA..."); mediaTest.CanReadBCA = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0, @@ -616,7 +623,8 @@ namespace DiscImageChef.Core.Devices.Report DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadBCA); if(debug) mediaTest.BluBcaData = buffer; break; - case "DVD-RAM": + case "DVD-RAM (1st gen, marked 2.6Gb or 5.2Gb)": + case "DVD-RAM (2nd gen, marked 4.7Gb or 9.4Gb)": case "HD DVD-RAM": mediaTest.CanReadDDS = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0, @@ -715,7 +723,9 @@ namespace DiscImageChef.Core.Devices.Report if(debug) mediaTest.DvdLayerData = buffer; } - if(mediaType.StartsWith("BD-R", StringComparison.Ordinal)) + if(mediaType.StartsWith("BD-R", StringComparison.Ordinal) || mediaType == "Ultra HD Blu-ray movie" || + mediaType == "PlayStation 3 game" || + mediaType == "PlayStation 4 game" || mediaType == "Xbox One game") { DicConsole.WriteLine("Querying BD Disc Information..."); mediaTest.CanReadDiscInformation = !dev.ReadDiscStructure(out buffer, out senseBuffer, diff --git a/DiscImageChef/Commands/DeviceReport.cs b/DiscImageChef/Commands/DeviceReport.cs index ab595dfc7..b4bc48de7 100644 --- a/DiscImageChef/Commands/DeviceReport.cs +++ b/DiscImageChef/Commands/DeviceReport.cs @@ -250,8 +250,7 @@ namespace DiscImageChef.Commands if(!Identify.Decode(buffer).HasValue) return; - Identify.IdentifyDevice? atapiIdNullable = Identify.Decode(buffer); - report.ATAPI.Identify = buffer; + report.ATAPI = new Ata {Identify = buffer}; goto case DeviceType.SCSI; case DeviceType.SCSI: @@ -327,7 +326,12 @@ namespace DiscImageChef.Commands } if(report.SCSI.MultiMediaDevice.ModeSense2A.ReadDVDROM) mediaTypes.Add("DVD-ROM"); - if(report.SCSI.MultiMediaDevice.ModeSense2A.ReadDVDRAM) mediaTypes.Add("DVD-RAM"); + if(report.SCSI.MultiMediaDevice.ModeSense2A.ReadDVDRAM) + { + mediaTypes.Add("DVD-RAM (1st gen, marked 2.6Gb or 5.2Gb)"); + mediaTypes.Add("DVD-RAM (2nd gen, marked 4.7Gb or 9.4Gb)"); + } + if(report.SCSI.MultiMediaDevice.ModeSense2A.ReadDVDR) mediaTypes.Add("DVD-R"); }