2017-05-31 01:00:58 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : MMC.cs
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
2017-05-31 01:00:58 +01:00
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : Core algorithms.
|
2017-05-31 01:00:58 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Dumps media from SCSI MultiMedia devices.
|
2017-05-31 01:00:58 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Copyright © 2011-2018 Natalia Portillo
|
2017-05-31 01:00:58 +01:00
|
|
|
|
// ****************************************************************************/
|
2017-12-19 03:50:57 +00:00
|
|
|
|
|
2017-05-31 01:00:58 +01:00
|
|
|
|
using System;
|
2018-01-19 01:21:01 +00:00
|
|
|
|
using System.Collections.Generic;
|
2017-12-19 01:38:11 +00:00
|
|
|
|
using System.Text;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
using DiscImageChef.Console;
|
2017-11-20 05:07:16 +00:00
|
|
|
|
using DiscImageChef.Core.Logging;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using DiscImageChef.Decoders.Bluray;
|
|
|
|
|
|
using DiscImageChef.Decoders.DVD;
|
|
|
|
|
|
using DiscImageChef.Decoders.SCSI;
|
|
|
|
|
|
using DiscImageChef.Decoders.SCSI.MMC;
|
|
|
|
|
|
using DiscImageChef.Devices;
|
2018-01-19 01:21:01 +00:00
|
|
|
|
using DiscImageChef.DiscImages;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using DiscImageChef.Metadata;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
using Schemas;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using DDS = DiscImageChef.Decoders.DVD.DDS;
|
|
|
|
|
|
using DMI = DiscImageChef.Decoders.Xbox.DMI;
|
|
|
|
|
|
using MediaType = DiscImageChef.CommonTypes.MediaType;
|
|
|
|
|
|
using Spare = DiscImageChef.Decoders.DVD.Spare;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
|
|
|
|
|
namespace DiscImageChef.Core.Devices.Dumping
|
|
|
|
|
|
{
|
2017-12-23 01:46:08 +00:00
|
|
|
|
/// <summary>
|
2017-12-23 17:41:23 +00:00
|
|
|
|
/// Implement dumping optical discs from MultiMedia devices
|
2017-12-23 01:46:08 +00:00
|
|
|
|
/// </summary>
|
2017-12-20 17:46:47 +00:00
|
|
|
|
static class Mmc
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2017-12-23 01:46:08 +00:00
|
|
|
|
/// <summary>
|
2017-12-23 17:41:23 +00:00
|
|
|
|
/// Dumps an optical disc
|
2017-12-23 01:46:08 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="dev">Device</param>
|
|
|
|
|
|
/// <param name="devicePath">Path to the device</param>
|
|
|
|
|
|
/// <param name="outputPrefix">Prefix for output data files</param>
|
2018-01-19 01:21:01 +00:00
|
|
|
|
/// <param name="outputPlugin">Plugin for output file</param>
|
2017-12-23 01:46:08 +00:00
|
|
|
|
/// <param name="retryPasses">How many times to retry</param>
|
|
|
|
|
|
/// <param name="force">Force to continue dump whenever possible</param>
|
|
|
|
|
|
/// <param name="dumpRaw">Dump raw/long sectors</param>
|
|
|
|
|
|
/// <param name="persistent">Store whatever data the drive returned on error</param>
|
|
|
|
|
|
/// <param name="stopOnError">Stop dump on first error</param>
|
|
|
|
|
|
/// <param name="resume">Information for dump resuming</param>
|
|
|
|
|
|
/// <param name="dumpLog">Dump logger</param>
|
|
|
|
|
|
/// <param name="encoding">Encoding to use when analyzing dump</param>
|
|
|
|
|
|
/// <param name="dskType">Disc type as detected in MMC layer</param>
|
|
|
|
|
|
/// <param name="dumpLeadIn">Try to read and dump as much Lead-in as possible</param>
|
2018-01-19 01:21:01 +00:00
|
|
|
|
/// <param name="outputPath">Path to output file</param>
|
|
|
|
|
|
/// <param name="formatOptions">Formats to pass to output file plugin</param>
|
2017-12-23 01:46:08 +00:00
|
|
|
|
/// <exception cref="NotImplementedException">If trying to dump GOD or WOD, or XGDs without a Kreon drive</exception>
|
2018-01-19 01:21:01 +00:00
|
|
|
|
internal static void Dump(Device dev, string devicePath, IWritableImage outputPlugin, ushort retryPasses,
|
|
|
|
|
|
bool force, bool dumpRaw, bool persistent, bool stopOnError,
|
|
|
|
|
|
ref MediaType dskType,
|
|
|
|
|
|
ref
|
|
|
|
|
|
Resume resume, ref DumpLog dumpLog, bool dumpLeadIn,
|
|
|
|
|
|
Encoding encoding,
|
|
|
|
|
|
string
|
|
|
|
|
|
outputPrefix, string outputPath, Dictionary<string, string> formatOptions)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
bool sense;
|
|
|
|
|
|
ulong blocks;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
byte[] tmpBuf;
|
2018-01-19 01:21:01 +00:00
|
|
|
|
bool compactDisc = true;
|
|
|
|
|
|
bool isXbox = false;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2017-11-20 05:07:16 +00:00
|
|
|
|
// TODO: Log not only what is it reading, but if it was read correctly or not.
|
|
|
|
|
|
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.GetConfiguration(out byte[] cmdBuf, out _, 0, MmcGetConfigurationRt.Current, dev.Timeout,
|
|
|
|
|
|
out _);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
2017-12-21 14:30:38 +00:00
|
|
|
|
Features.SeparatedFeatures ftr = Features.Separate(cmdBuf);
|
2017-11-20 05:07:16 +00:00
|
|
|
|
dumpLog.WriteLine("Device reports current profile is 0x{0:X4}", ftr.CurrentProfile);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
|
|
|
|
|
switch(ftr.CurrentProfile)
|
|
|
|
|
|
{
|
|
|
|
|
|
case 0x0001:
|
|
|
|
|
|
dskType = MediaType.GENERIC_HDD;
|
|
|
|
|
|
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;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0011:
|
|
|
|
|
|
dskType = MediaType.DVDR;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0012:
|
|
|
|
|
|
dskType = MediaType.DVDRAM;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0013:
|
|
|
|
|
|
case 0x0014:
|
|
|
|
|
|
dskType = MediaType.DVDRW;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0015:
|
|
|
|
|
|
case 0x0016:
|
|
|
|
|
|
dskType = MediaType.DVDRDL;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0017:
|
|
|
|
|
|
dskType = MediaType.DVDRWDL;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0018:
|
|
|
|
|
|
dskType = MediaType.DVDDownload;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x001A:
|
|
|
|
|
|
dskType = MediaType.DVDPRW;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x001B:
|
|
|
|
|
|
dskType = MediaType.DVDPR;
|
|
|
|
|
|
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;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x002B:
|
|
|
|
|
|
dskType = MediaType.DVDPRDL;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0040:
|
|
|
|
|
|
dskType = MediaType.BDROM;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0041:
|
|
|
|
|
|
case 0x0042:
|
|
|
|
|
|
dskType = MediaType.BDR;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0043:
|
|
|
|
|
|
dskType = MediaType.BDRE;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0050:
|
|
|
|
|
|
dskType = MediaType.HDDVDROM;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0051:
|
|
|
|
|
|
dskType = MediaType.HDDVDR;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0052:
|
|
|
|
|
|
dskType = MediaType.HDDVDRAM;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0053:
|
|
|
|
|
|
dskType = MediaType.HDDVDRW;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0058:
|
|
|
|
|
|
dskType = MediaType.HDDVDRDL;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x005A:
|
|
|
|
|
|
dskType = MediaType.HDDVDRWDL;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
default:
|
|
|
|
|
|
compactDisc = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(compactDisc)
|
|
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
CompactDisc.Dump(dev, devicePath, outputPlugin, retryPasses, force, dumpRaw, persistent, stopOnError,
|
|
|
|
|
|
ref dskType, ref resume, ref dumpLog, dumpLeadIn, outputPrefix, outputPath,
|
|
|
|
|
|
formatOptions);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Reader scsiReader = new Reader(dev, dev.Timeout, null, dumpRaw);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
blocks = scsiReader.GetDeviceBlocks();
|
2017-11-20 05:07:16 +00:00
|
|
|
|
dumpLog.WriteLine("Device reports disc has {0} blocks", blocks);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>();
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
|
|
|
|
|
#region Nintendo
|
2017-12-23 17:41:23 +00:00
|
|
|
|
switch(dskType)
|
|
|
|
|
|
{
|
2017-12-21 04:43:29 +00:00
|
|
|
|
case MediaType.Unknown when blocks > 0:
|
|
|
|
|
|
dumpLog.WriteLine("Reading Physical Format Information");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
2017-12-21 14:30:38 +00:00
|
|
|
|
PFI.PhysicalFormatInformation? nintendoPfi = PFI.Decode(cmdBuf);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
if(nintendoPfi != null)
|
2017-12-21 14:30:38 +00:00
|
|
|
|
if(nintendoPfi.Value.DiskCategory == DiskCategory.Nintendo &&
|
2018-01-19 01:21:01 +00:00
|
|
|
|
nintendoPfi.Value.PartVersion == 15)
|
2017-12-21 04:43:29 +00:00
|
|
|
|
{
|
|
|
|
|
|
dumpLog.WriteLine("Dumping Nintendo GameCube or Wii discs is not yet implemented.");
|
|
|
|
|
|
throw new
|
|
|
|
|
|
NotImplementedException("Dumping Nintendo GameCube or Wii discs is not yet implemented.");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-12-21 14:30:38 +00:00
|
|
|
|
if(PFI.Decode(cmdBuf).HasValue)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
|
2017-12-21 14:30:38 +00:00
|
|
|
|
PFI.PhysicalFormatInformation decPfi = PFI.Decode(cmdBuf).Value;
|
|
|
|
|
|
DicConsole.WriteLine("PFI:\n{0}", PFI.Prettify(decPfi));
|
2017-12-21 04:43:29 +00:00
|
|
|
|
|
|
|
|
|
|
// False book types
|
|
|
|
|
|
if(dskType == MediaType.DVDROM)
|
|
|
|
|
|
switch(decPfi.DiskCategory)
|
|
|
|
|
|
{
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.DVDPR:
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dskType = MediaType.DVDPR;
|
|
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.DVDPRDL:
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dskType = MediaType.DVDPRDL;
|
|
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.DVDPRW:
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dskType = MediaType.DVDPRW;
|
|
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.DVDPRWDL:
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dskType = MediaType.DVDPRWDL;
|
|
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.DVDR:
|
2017-12-21 23:00:30 +00:00
|
|
|
|
dskType = decPfi.PartVersion == 6 ? MediaType.DVDRDL : MediaType.DVDR;
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.DVDRAM:
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dskType = MediaType.DVDRAM;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
dskType = MediaType.DVDROM;
|
|
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.DVDRW:
|
2017-12-21 23:00:30 +00:00
|
|
|
|
dskType = decPfi.PartVersion == 3 ? MediaType.DVDRWDL : MediaType.DVDRW;
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.HDDVDR:
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dskType = MediaType.HDDVDR;
|
|
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.HDDVDRAM:
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dskType = MediaType.HDDVDRAM;
|
|
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.HDDVDROM:
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dskType = MediaType.HDDVDROM;
|
|
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.HDDVDRW:
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dskType = MediaType.HDDVDRW;
|
|
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.Nintendo:
|
2017-12-21 23:00:30 +00:00
|
|
|
|
dskType = decPfi.DiscSize == DVDSize.Eighty ? MediaType.GOD : MediaType.WOD;
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
case DiskCategory.UMD:
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dskType = MediaType.UMD;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dumpLog.WriteLine("Reading Disc Manufacturing Information");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
2017-12-21 04:43:29 +00:00
|
|
|
|
MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout,
|
2017-12-21 23:00:30 +00:00
|
|
|
|
out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2017-12-21 14:30:38 +00:00
|
|
|
|
if(DMI.IsXbox(cmdBuf) || DMI.IsXbox360(cmdBuf))
|
2017-06-08 21:12:05 +01:00
|
|
|
|
{
|
2017-12-21 14:30:38 +00:00
|
|
|
|
if(DMI.IsXbox(cmdBuf)) dskType = MediaType.XGD;
|
|
|
|
|
|
else if(DMI.IsXbox360(cmdBuf))
|
2017-12-21 04:43:29 +00:00
|
|
|
|
{
|
|
|
|
|
|
dskType = MediaType.XGD2;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
// All XGD3 all have the same number of blocks
|
2018-01-19 01:21:01 +00:00
|
|
|
|
if(blocks == 25063 || // Locked (or non compatible drive)
|
2017-12-21 04:43:29 +00:00
|
|
|
|
blocks == 4229664 || // Xtreme unlock
|
2018-01-19 01:21:01 +00:00
|
|
|
|
blocks == 4246304) // Wxripper unlock
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dskType = MediaType.XGD3;
|
|
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ScsiInquiry(out byte[] inqBuf, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
|
2017-12-23 17:41:23 +00:00
|
|
|
|
if(sense || !Inquiry.Decode(inqBuf).HasValue || Inquiry.Decode(inqBuf).HasValue &&
|
2017-12-21 14:30:38 +00:00
|
|
|
|
!Inquiry.Decode(inqBuf).Value.KreonPresent)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dumpLog.WriteLine("Dumping Xbox Game Discs requires a drive with Kreon firmware.");
|
|
|
|
|
|
throw new
|
|
|
|
|
|
NotImplementedException("Dumping Xbox Game Discs requires a drive with Kreon firmware.");
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
2017-11-20 05:07:16 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(dumpRaw && !force)
|
|
|
|
|
|
{
|
|
|
|
|
|
DicConsole
|
2018-01-19 01:21:01 +00:00
|
|
|
|
.ErrorWriteLine("Not continuing. If you want to continue reading cooked data when raw is not available use the force option.");
|
2017-12-21 04:43:29 +00:00
|
|
|
|
// TODO: Exit more gracefully
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
isXbox = true;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(cmdBuf.Length == 2052)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVD_DMI, tmpBuf);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
2017-12-21 04:43:29 +00:00
|
|
|
|
#endregion Nintendo
|
|
|
|
|
|
|
|
|
|
|
|
#region All DVD and HD DVD types
|
2017-05-31 01:00:58 +01:00
|
|
|
|
#endregion All DVD and HD DVD types
|
|
|
|
|
|
|
|
|
|
|
|
#region DVD-ROM
|
|
|
|
|
|
if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM)
|
|
|
|
|
|
{
|
2017-11-20 05:07:16 +00:00
|
|
|
|
dumpLog.WriteLine("Reading Lead-in Copyright Information.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
2017-12-23 17:41:23 +00:00
|
|
|
|
MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, out _);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
if(!sense)
|
2017-12-21 14:30:38 +00:00
|
|
|
|
if(CSS_CPRM.DecodeLeadInCopyright(cmdBuf).HasValue)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-05-31 01:00:58 +01:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVD_CMI, tmpBuf);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion DVD-ROM
|
|
|
|
|
|
|
2017-12-23 17:41:23 +00:00
|
|
|
|
switch(dskType)
|
|
|
|
|
|
{
|
2017-12-21 04:43:29 +00:00
|
|
|
|
#region DVD-ROM and HD DVD-ROM
|
|
|
|
|
|
case MediaType.DVDDownload:
|
|
|
|
|
|
case MediaType.DVDROM:
|
|
|
|
|
|
case MediaType.HDDVDROM:
|
|
|
|
|
|
dumpLog.WriteLine("Reading Burst Cutting Area.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-05-31 01:00:58 +01:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVD_BCA, tmpBuf);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion DVD-ROM and HD DVD-ROM
|
2017-12-23 17:41:23 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
#region DVD-RAM and HD DVD-RAM
|
|
|
|
|
|
case MediaType.DVDRAM:
|
|
|
|
|
|
case MediaType.HDDVDRAM:
|
|
|
|
|
|
dumpLog.WriteLine("Reading Disc Description Structure.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.DvdramDds, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-12-21 14:30:38 +00:00
|
|
|
|
if(DDS.Decode(cmdBuf).HasValue)
|
2017-12-21 04:43:29 +00:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVDRAM_DDS, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dumpLog.WriteLine("Reading Spare Area Information.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
2017-12-21 04:43:29 +00:00
|
|
|
|
MmcDiscStructureFormat.DvdramSpareAreaInformation, 0, dev.Timeout,
|
2017-12-21 23:00:30 +00:00
|
|
|
|
out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-12-21 14:30:38 +00:00
|
|
|
|
if(Spare.Decode(cmdBuf).HasValue)
|
2017-12-21 04:43:29 +00:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVDRAM_SpareArea, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion DVD-RAM and HD DVD-RAM
|
2017-12-23 17:41:23 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
#region DVD-R and DVD-RW
|
|
|
|
|
|
case MediaType.DVDR:
|
|
|
|
|
|
case MediaType.DVDRW:
|
|
|
|
|
|
dumpLog.WriteLine("Reading Pre-Recorded Information.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-05-31 01:00:58 +01:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVDR_PreRecordedInfo, tmpBuf);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion DVD-R and DVD-RW
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-23 17:41:23 +00:00
|
|
|
|
switch(dskType)
|
|
|
|
|
|
{
|
2017-12-21 04:43:29 +00:00
|
|
|
|
#region DVD-R, DVD-RW and HD DVD-R
|
|
|
|
|
|
case MediaType.DVDR:
|
|
|
|
|
|
case MediaType.DVDRW:
|
|
|
|
|
|
case MediaType.HDDVDR:
|
|
|
|
|
|
dumpLog.WriteLine("Reading Media Identifier.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
2017-12-23 17:41:23 +00:00
|
|
|
|
MmcDiscStructureFormat.DvdrMediaIdentifier, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-06-08 21:12:05 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVDR_MediaIdentifier, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dumpLog.WriteLine("Reading Recordable Physical Information.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
2017-12-21 04:43:29 +00:00
|
|
|
|
MmcDiscStructureFormat.DvdrPhysicalInformation, 0, dev.Timeout,
|
2017-12-21 23:00:30 +00:00
|
|
|
|
out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-06-08 21:12:05 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVDR_PFI, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion DVD-R, DVD-RW and HD DVD-R
|
2017-12-23 17:41:23 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
#region All DVD+
|
|
|
|
|
|
case MediaType.DVDPR:
|
|
|
|
|
|
case MediaType.DVDPRDL:
|
|
|
|
|
|
case MediaType.DVDPRW:
|
|
|
|
|
|
case MediaType.DVDPRWDL:
|
|
|
|
|
|
dumpLog.WriteLine("Reading ADdress In Pregroove.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.Adip, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-06-08 21:12:05 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVD_ADIP, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dumpLog.WriteLine("Reading Disc Control Blocks.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.Dcb, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-06-08 21:12:05 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DCB, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion All DVD+
|
2017-12-23 17:41:23 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
#region HD DVD-ROM
|
|
|
|
|
|
case MediaType.HDDVDROM:
|
|
|
|
|
|
dumpLog.WriteLine("Reading Lead-in Copyright Information.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
2017-12-21 04:43:29 +00:00
|
|
|
|
MmcDiscStructureFormat.HddvdCopyrightInformation, 0, dev.Timeout,
|
2017-12-21 23:00:30 +00:00
|
|
|
|
out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-05-31 01:00:58 +01:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.HDDVD_CPI, tmpBuf);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion HD DVD-ROM
|
2017-12-23 17:41:23 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
#region All Blu-ray
|
|
|
|
|
|
case MediaType.BDR:
|
|
|
|
|
|
case MediaType.BDRE:
|
|
|
|
|
|
case MediaType.BDROM:
|
|
|
|
|
|
case MediaType.BDRXL:
|
|
|
|
|
|
case MediaType.BDREXL:
|
|
|
|
|
|
dumpLog.WriteLine("Reading Disc Information.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-12-21 14:30:38 +00:00
|
|
|
|
if(DI.Decode(cmdBuf).HasValue)
|
2017-12-21 04:43:29 +00:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.BD_DI, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2018-01-19 01:21:01 +00:00
|
|
|
|
// TODO: PAC
|
|
|
|
|
|
/*
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dumpLog.WriteLine("Reading PAC.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.Pac, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-06-08 21:12:05 +01:00
|
|
|
|
{
|
2017-12-21 04:43:29 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.PAC, tmpBuf);
|
|
|
|
|
|
}*/
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion All Blu-ray
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-23 17:41:23 +00:00
|
|
|
|
switch(dskType)
|
|
|
|
|
|
{
|
2017-12-21 04:43:29 +00:00
|
|
|
|
#region BD-ROM only
|
|
|
|
|
|
case MediaType.BDROM:
|
|
|
|
|
|
dumpLog.WriteLine("Reading Burst Cutting Area.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.BdBurstCuttingArea, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-06-08 21:12:05 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.BD_BCA, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion BD-ROM only
|
2017-12-23 17:41:23 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
#region Writable Blu-ray only
|
|
|
|
|
|
case MediaType.BDR:
|
|
|
|
|
|
case MediaType.BDRE:
|
|
|
|
|
|
case MediaType.BDRXL:
|
|
|
|
|
|
case MediaType.BDREXL:
|
|
|
|
|
|
dumpLog.WriteLine("Reading Disc Definition Structure.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.BdDds, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-06-08 21:12:05 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.BD_DDS, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
dumpLog.WriteLine("Reading Spare Area Information.");
|
2017-12-21 23:00:30 +00:00
|
|
|
|
sense = dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
|
2017-12-23 17:41:23 +00:00
|
|
|
|
MmcDiscStructureFormat.BdSpareAreaInformation, 0, dev.Timeout, out _);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
if(!sense)
|
2017-06-08 21:12:05 +01:00
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.BD_SpareArea, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2017-12-21 04:43:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion Writable Blu-ray only
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(isXbox)
|
|
|
|
|
|
{
|
2018-01-19 01:21:01 +00:00
|
|
|
|
Xgd.Dump(dev, devicePath, outputPlugin, retryPasses, force, dumpRaw, persistent, stopOnError, mediaTags,
|
|
|
|
|
|
ref dskType, ref resume, ref dumpLog, encoding, outputPrefix, outputPath, formatOptions);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-19 01:21:01 +00:00
|
|
|
|
Sbc.Dump(dev, devicePath, outputPlugin, retryPasses, force, dumpRaw, persistent, stopOnError, mediaTags,
|
|
|
|
|
|
ref dskType, true, ref resume, ref dumpLog, encoding, outputPrefix, outputPath, formatOptions);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal static void AddMediaTagToSidecar(string outputPath,
|
|
|
|
|
|
KeyValuePair<MediaTagType, byte[]> tag,
|
|
|
|
|
|
ref CICMMetadataType sidecar)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch(tag.Key)
|
|
|
|
|
|
{
|
|
|
|
|
|
case MediaTagType.DVD_PFI:
|
|
|
|
|
|
sidecar.OpticalDisc[0].PFI = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVD_DMI:
|
|
|
|
|
|
sidecar.OpticalDisc[0].DMI = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVD_CMI:
|
|
|
|
|
|
case MediaTagType.HDDVD_CPI:
|
|
|
|
|
|
sidecar.OpticalDisc[0].CMI = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
CSS_CPRM.LeadInCopyright cpy = CSS_CPRM.DecodeLeadInCopyright(tag.Value).Value;
|
|
|
|
|
|
if(cpy.CopyrightType != CopyrightType.NoProtection)
|
|
|
|
|
|
sidecar.OpticalDisc[0].CopyProtection = cpy.CopyrightType.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVD_BCA:
|
|
|
|
|
|
case MediaTagType.BD_BCA:
|
|
|
|
|
|
sidecar.OpticalDisc[0].BCA = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.BD_DDS:
|
|
|
|
|
|
case MediaTagType.DVDRAM_DDS:
|
|
|
|
|
|
sidecar.OpticalDisc[0].DDS = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVDRAM_SpareArea:
|
|
|
|
|
|
case MediaTagType.BD_SpareArea:
|
|
|
|
|
|
sidecar.OpticalDisc[0].SAI = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVDR_PreRecordedInfo:
|
|
|
|
|
|
sidecar.OpticalDisc[0].PRI = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVD_MediaIdentifier:
|
|
|
|
|
|
sidecar.OpticalDisc[0].MediaID = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVDR_PFI:
|
|
|
|
|
|
sidecar.OpticalDisc[0].PFIR = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVD_ADIP:
|
|
|
|
|
|
sidecar.OpticalDisc[0].ADIP = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DCB:
|
|
|
|
|
|
sidecar.OpticalDisc[0].DCB = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.BD_DI:
|
|
|
|
|
|
sidecar.OpticalDisc[0].DI = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.Xbox_SecuritySector:
|
|
|
|
|
|
if(sidecar.OpticalDisc[0].Xbox == null) sidecar.OpticalDisc[0].Xbox = new XboxType();
|
|
|
|
|
|
|
|
|
|
|
|
sidecar.OpticalDisc[0].Xbox.SecuritySectors = new[]
|
|
|
|
|
|
{
|
|
|
|
|
|
new XboxSecuritySectorsType
|
|
|
|
|
|
{
|
|
|
|
|
|
RequestNumber = 0,
|
|
|
|
|
|
RequestVersion = 1,
|
|
|
|
|
|
SecuritySectors = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.Xbox_PFI:
|
|
|
|
|
|
if(sidecar.OpticalDisc[0].Xbox == null) sidecar.OpticalDisc[0].Xbox = new XboxType();
|
|
|
|
|
|
|
|
|
|
|
|
sidecar.OpticalDisc[0].Xbox.PFI = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.Xbox_DMI:
|
|
|
|
|
|
if(sidecar.OpticalDisc[0].Xbox == null) sidecar.OpticalDisc[0].Xbox = new XboxType();
|
|
|
|
|
|
|
|
|
|
|
|
sidecar.OpticalDisc[0].Xbox.DMI = new DumpType
|
|
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = tag.Value.Length,
|
|
|
|
|
|
Checksums = Checksum.GetChecksums(tag.Value).ToArray()
|
|
|
|
|
|
};
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|