2017-05-31 01:00:58 +01:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2017-05-31 01:00:58 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// 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/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2022-12-03 16:07:10 +00:00
|
|
|
|
// Copyright © 2011-2023 Natalia Portillo
|
|
|
|
|
|
// Copyright © 2020-2023 Rebecca Wallander
|
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;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Aaru.CommonTypes;
|
2022-12-15 22:21:07 +00:00
|
|
|
|
using Aaru.CommonTypes.AaruMetadata;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Aaru.CommonTypes.Enums;
|
|
|
|
|
|
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
|
|
|
|
|
using Aaru.Decoders.Bluray;
|
|
|
|
|
|
using Aaru.Decoders.DVD;
|
2020-12-04 00:31:30 +00:00
|
|
|
|
using Aaru.Decoders.SCSI;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Aaru.Decoders.SCSI.MMC;
|
2021-01-13 23:37:05 +01:00
|
|
|
|
using Aaru.Decryption;
|
|
|
|
|
|
using Aaru.Decryption.DVD;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Aaru.Devices;
|
|
|
|
|
|
using DDS = Aaru.Decoders.DVD.DDS;
|
|
|
|
|
|
using DMI = Aaru.Decoders.Xbox.DMI;
|
2022-11-15 15:58:43 +00:00
|
|
|
|
using DVDDecryption = Aaru.Decryption.DVD.Dump;
|
2020-12-04 00:31:30 +00:00
|
|
|
|
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Spare = Aaru.Decoders.DVD.Spare;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
// ReSharper disable JoinDeclarationAndInitializer
|
|
|
|
|
|
|
|
|
|
|
|
namespace Aaru.Core.Devices.Dumping;
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
/// <summary>Implement dumping optical discs from MultiMedia devices</summary>
|
|
|
|
|
|
partial class Dump
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
/// <summary>Dumps an optical disc</summary>
|
|
|
|
|
|
void Mmc()
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
MediaType dskType = MediaType.Unknown;
|
|
|
|
|
|
bool sense;
|
|
|
|
|
|
byte[] tmpBuf;
|
2022-11-15 15:58:43 +00:00
|
|
|
|
bool compactDisc = true;
|
|
|
|
|
|
bool gotConfiguration = false;
|
|
|
|
|
|
bool isXbox = false;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
DVDDecryption dvdDecrypt = null;
|
|
|
|
|
|
_speedMultiplier = 1;
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Log not only what is it reading, but if it was read correctly or not.
|
2022-03-07 07:36:44 +00:00
|
|
|
|
sense = _dev.GetConfiguration(out byte[] cmdBuf, out _, 0, MmcGetConfigurationRt.Current, _dev.Timeout, out _);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
|
|
if(!sense)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
gotConfiguration = true;
|
|
|
|
|
|
Features.SeparatedFeatures ftr = Features.Separate(cmdBuf);
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Device_reports_current_profile_is_0, ftr.CurrentProfile);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
switch(ftr.CurrentProfile)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
case 0x0001:
|
|
|
|
|
|
dskType = MediaType.GENERIC_HDD;
|
|
|
|
|
|
_speedMultiplier = -1;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0002:
|
|
|
|
|
|
dskType = MediaType.PD650;
|
|
|
|
|
|
_speedMultiplier = -1;
|
|
|
|
|
|
goto default;
|
|
|
|
|
|
case 0x0005:
|
|
|
|
|
|
dskType = MediaType.CDMO;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case 0x0008:
|
|
|
|
|
|
dskType = MediaType.CD;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case 0x0009:
|
|
|
|
|
|
dskType = MediaType.CDR;
|
2020-12-04 00:31:30 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case 0x000A:
|
|
|
|
|
|
dskType = MediaType.CDRW;
|
2020-12-04 00:31:30 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
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;
|
2020-12-04 00:31:30 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
2020-12-04 00:31:30 +00:00
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Modes.DecodedMode? decMode = null;
|
|
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
|
sense = _dev.ModeSense6(out cmdBuf, out _, true, ScsiModeSensePageControl.Current, 0x00, _dev.Timeout, out _);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
|
|
if(sense || _dev.Error)
|
|
|
|
|
|
{
|
|
|
|
|
|
sense = _dev.ModeSense6(out cmdBuf, out _, false, ScsiModeSensePageControl.Current, 0x00, _dev.Timeout,
|
|
|
|
|
|
out _);
|
|
|
|
|
|
|
|
|
|
|
|
if(!sense &&
|
|
|
|
|
|
!_dev.Error)
|
2020-12-04 00:31:30 +00:00
|
|
|
|
decMode = Modes.DecodeMode6(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
decMode = Modes.DecodeMode6(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice);
|
2020-12-04 00:31:30 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(decMode is null)
|
|
|
|
|
|
{
|
|
|
|
|
|
sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00,
|
|
|
|
|
|
_dev.Timeout, out _);
|
|
|
|
|
|
|
|
|
|
|
|
if(sense || _dev.Error)
|
2020-12-04 00:31:30 +00:00
|
|
|
|
{
|
2022-03-07 07:36:44 +00:00
|
|
|
|
sense = _dev.ModeSense10(out cmdBuf, out _, false, false, ScsiModeSensePageControl.Current, 0x3F, 0x00,
|
|
|
|
|
|
_dev.Timeout, out _);
|
2020-12-04 00:31:30 +00:00
|
|
|
|
|
|
|
|
|
|
if(sense || _dev.Error)
|
|
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x00,
|
2020-12-04 00:31:30 +00:00
|
|
|
|
0x00, _dev.Timeout, out _);
|
|
|
|
|
|
|
|
|
|
|
|
if(sense || _dev.Error)
|
|
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ModeSense10(out cmdBuf, out _, false, false, ScsiModeSensePageControl.Current,
|
|
|
|
|
|
0x00, 0x00, _dev.Timeout, out _);
|
2020-12-04 00:31:30 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense &&
|
|
|
|
|
|
!_dev.Error)
|
2020-12-04 00:31:30 +00:00
|
|
|
|
decMode = Modes.DecodeMode10(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
decMode = Modes.DecodeMode10(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
decMode = Modes.DecodeMode10(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice);
|
|
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
else
|
|
|
|
|
|
decMode = Modes.DecodeMode10(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice);
|
|
|
|
|
|
}
|
2020-12-04 00:31:30 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(decMode.HasValue &&
|
|
|
|
|
|
_dev.IsUsb &&
|
|
|
|
|
|
!gotConfiguration &&
|
2022-03-16 11:47:00 +00:00
|
|
|
|
decMode.Value.Header.MediumType is MediumTypes.UnknownBlockDevice or MediumTypes.ReadOnlyBlockDevice
|
2022-11-15 15:58:43 +00:00
|
|
|
|
or MediumTypes.ReadWriteBlockDevice)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
_speedMultiplier = -1;
|
|
|
|
|
|
Sbc(null, MediaType.Unknown, false);
|
2020-12-04 00:31:30 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2020-12-04 00:31:30 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(compactDisc)
|
|
|
|
|
|
{
|
|
|
|
|
|
_speedMultiplier *= 177;
|
|
|
|
|
|
CompactDisc();
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
_speedMultiplier *= 150;
|
2020-03-03 02:56:37 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
var scsiReader = new Reader(_dev, _dev.Timeout, null, _errorLog, _dumpRaw);
|
|
|
|
|
|
ulong blocks = scsiReader.GetDeviceBlocks();
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Device_reports_disc_has_0_blocks, blocks);
|
2022-11-15 15:58:43 +00:00
|
|
|
|
Dictionary<MediaTagType, byte[]> mediaTags = new();
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(dskType == MediaType.PD650)
|
2022-11-13 19:59:24 +00:00
|
|
|
|
dskType = (blocks + 1) switch
|
2022-11-15 15:58:43 +00:00
|
|
|
|
{
|
|
|
|
|
|
1281856 => MediaType.PD650_WORM,
|
|
|
|
|
|
58620544 => MediaType.REV120,
|
|
|
|
|
|
17090880 => MediaType.REV35,
|
|
|
|
|
|
34185728 => MediaType.REV70,
|
|
|
|
|
|
_ => dskType
|
|
|
|
|
|
};
|
2019-05-16 23:29:54 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
#region Nintendo
|
|
|
|
|
|
switch(dskType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case MediaType.Unknown when blocks > 0:
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Physical_Format_Information);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.PhysicalInformation, 0, _dev.Timeout, out _);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
PFI.PhysicalFormatInformation? nintendoPfi = PFI.Decode(cmdBuf, dskType);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-11-13 20:46:24 +00:00
|
|
|
|
if(nintendoPfi is { DiskCategory: DiskCategory.Nintendo, PartVersion: 15 })
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.
|
|
|
|
|
|
Dumping_Nintendo_GameCube_or_Wii_discs_is_not_yet_implemented);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-11-23 16:06:46 +00:00
|
|
|
|
StoppingErrorMessage?.Invoke(Localization.Core.
|
|
|
|
|
|
Dumping_Nintendo_GameCube_or_Wii_discs_is_not_yet_implemented);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
return;
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
2017-12-21 04:43:29 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
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:
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Physical_Format_Information);
|
2021-08-17 17:14:48 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +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
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
PFI.PhysicalFormatInformation? nullablePfi = PFI.Decode(cmdBuf, dskType);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(nullablePfi.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
|
|
|
|
mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf);
|
2020-11-20 19:29:04 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
PFI.PhysicalFormatInformation decPfi = nullablePfi.Value;
|
|
|
|
|
|
UpdateStatus?.Invoke($"PFI:\n{PFI.Prettify(decPfi)}");
|
2020-11-20 19:29:04 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// False book types
|
2022-11-13 19:59:24 +00:00
|
|
|
|
dskType = decPfi.DiskCategory switch
|
2022-11-15 15:58:43 +00:00
|
|
|
|
{
|
|
|
|
|
|
DiskCategory.DVDPR => MediaType.DVDPR,
|
|
|
|
|
|
DiskCategory.DVDPRDL => MediaType.DVDPRDL,
|
|
|
|
|
|
DiskCategory.DVDPRW => MediaType.DVDPRW,
|
|
|
|
|
|
DiskCategory.DVDPRWDL => MediaType.DVDPRWDL,
|
|
|
|
|
|
DiskCategory.DVDR => decPfi.PartVersion >= 6 ? MediaType.DVDRDL : MediaType.DVDR,
|
|
|
|
|
|
DiskCategory.DVDRAM => MediaType.DVDRAM,
|
|
|
|
|
|
DiskCategory.DVDRW => decPfi.PartVersion >= 15 ? MediaType.DVDRWDL : MediaType.DVDRW,
|
|
|
|
|
|
DiskCategory.HDDVDR => MediaType.HDDVDR,
|
|
|
|
|
|
DiskCategory.HDDVDRAM => MediaType.HDDVDRAM,
|
|
|
|
|
|
DiskCategory.HDDVDROM => MediaType.HDDVDROM,
|
|
|
|
|
|
DiskCategory.HDDVDRW => MediaType.HDDVDRW,
|
|
|
|
|
|
DiskCategory.Nintendo => decPfi.DiscSize == DVDSize.Eighty ? MediaType.GOD : MediaType.WOD,
|
|
|
|
|
|
DiskCategory.UMD => MediaType.UMD,
|
|
|
|
|
|
_ => MediaType.DVDROM
|
|
|
|
|
|
};
|
2021-08-17 17:14:48 +01:00
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
2021-08-17 21:23:10 +01:00
|
|
|
|
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Disc_Manufacturing_Information);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.DiscManufacturingInformation, 0, _dev.Timeout,
|
|
|
|
|
|
out _);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(DMI.IsXbox(cmdBuf) ||
|
|
|
|
|
|
DMI.IsXbox360(cmdBuf))
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(DMI.IsXbox(cmdBuf))
|
|
|
|
|
|
dskType = MediaType.XGD;
|
|
|
|
|
|
else if(DMI.IsXbox360(cmdBuf))
|
|
|
|
|
|
{
|
|
|
|
|
|
dskType = MediaType.XGD2;
|
2017-12-21 04:43:29 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// All XGD3 all have the same number of blocks
|
|
|
|
|
|
if(blocks + 1 == 25063 || // Locked (or non compatible drive)
|
|
|
|
|
|
blocks + 1 == 4229664 || // Xtreme unlock
|
|
|
|
|
|
blocks + 1 == 4246304) // Wxripper unlock
|
|
|
|
|
|
dskType = MediaType.XGD3;
|
|
|
|
|
|
}
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
isXbox = true;
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ScsiInquiry(out byte[] inqBuf, out _);
|
2020-10-23 02:11:24 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(sense || Inquiry.Decode(inqBuf)?.KreonPresent != true)
|
|
|
|
|
|
{
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.
|
|
|
|
|
|
Dumping_Xbox_Game_Discs_requires_a_drive_with_Kreon_firmware);
|
2017-11-20 05:07:16 +00:00
|
|
|
|
|
2022-11-23 16:06:46 +00:00
|
|
|
|
StoppingErrorMessage?.Invoke(Localization.Core.
|
|
|
|
|
|
Dumping_Xbox_Game_Discs_requires_a_drive_with_Kreon_firmware);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!_force)
|
2017-12-21 04:43:29 +00:00
|
|
|
|
return;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
|
|
isXbox = false;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(_dumpRaw && !_force)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2022-11-23 16:06:46 +00:00
|
|
|
|
StoppingErrorMessage?.Invoke(Localization.Core.
|
|
|
|
|
|
If_you_want_to_continue_reading_cooked_data_when_raw_is_not_available_use_the_force_option);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
|
|
// TODO: Exit more gracefully
|
|
|
|
|
|
return;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-21 04:43:29 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion Nintendo
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
#region All DVD and HD DVD types
|
|
|
|
|
|
#endregion All DVD and HD DVD types
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
#region DVD-ROM
|
2022-03-16 11:47:00 +00:00
|
|
|
|
if(dskType is MediaType.DVDDownload or MediaType.DVDROM)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Lead_in_Copyright_Information);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
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);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
CSS_CPRM.LeadInCopyright? cmi = CSS_CPRM.DecodeLeadInCopyright(cmdBuf);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(cmi?.CopyrightType == CopyrightType.NoProtection)
|
2022-11-23 16:06:46 +00:00
|
|
|
|
UpdateStatus?.Invoke(Localization.Core.Drive_reports_no_copy_protection_on_disc);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
else
|
|
|
|
|
|
{
|
2022-11-15 15:58:43 +00:00
|
|
|
|
if(!Settings.Settings.Current.EnableDecryption)
|
2022-11-23 16:06:46 +00:00
|
|
|
|
UpdateStatus?.Invoke(Localization.Core.
|
|
|
|
|
|
Drive_reports_the_disc_uses_copy_protection_The_dump_will_be_incorrect_unless_decryption_is_enabled);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
else
|
|
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(cmi?.CopyrightType == CopyrightType.CSS)
|
2021-01-13 23:37:05 +01:00
|
|
|
|
{
|
2022-11-23 16:06:46 +00:00
|
|
|
|
UpdateStatus?.Invoke(Localization.Core.Drive_reports_disc_uses_CSS_copy_protection);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
dvdDecrypt = new DVDDecryption(_dev);
|
|
|
|
|
|
|
|
|
|
|
|
sense = dvdDecrypt.ReadBusKey(out cmdBuf, out _,
|
2022-03-07 07:36:44 +00:00
|
|
|
|
CSS_CPRM.DecodeLeadInCopyright(cmdBuf)?.CopyrightType ??
|
|
|
|
|
|
CopyrightType.NoProtection, _dev.Timeout, out _);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
byte[] busKey = cmdBuf;
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-11-23 16:06:46 +00:00
|
|
|
|
UpdateStatus?.Invoke(Localization.Core.Reading_disc_key);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = dvdDecrypt.ReadDiscKey(out cmdBuf, out _, _dev.Timeout, out _);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
|
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
CSS_CPRM.DiscKey? decodedDiscKey = CSS.DecodeDiscKey(cmdBuf, busKey);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
|
sense = dvdDecrypt.ReadAsf(out cmdBuf, out _, DvdCssKeyClass.DvdCssCppmOrCprm,
|
|
|
|
|
|
_dev.Timeout, out _);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
|
|
|
|
|
if(!sense)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(cmdBuf[7] == 1)
|
|
|
|
|
|
{
|
2022-11-23 16:06:46 +00:00
|
|
|
|
UpdateStatus?.Invoke(Localization.Core.
|
|
|
|
|
|
Disc_and_drive_authentication_succeeded);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = dvdDecrypt.ReadRpc(out cmdBuf, out _,
|
|
|
|
|
|
DvdCssKeyClass.DvdCssCppmOrCprm,
|
|
|
|
|
|
_dev.Timeout, out _);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
2021-01-13 23:37:05 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
CSS_CPRM.RegionalPlaybackControlState? rpc =
|
|
|
|
|
|
CSS_CPRM.DecodeRegionalPlaybackControlState(cmdBuf);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(rpc.HasValue)
|
|
|
|
|
|
UpdateStatus?.Invoke(CSS.CheckRegion(rpc.Value, cmi.Value)
|
2022-11-23 16:06:46 +00:00
|
|
|
|
? Localization.Core.
|
|
|
|
|
|
Disc_and_drive_regions_match
|
|
|
|
|
|
: Localization.Core.
|
|
|
|
|
|
Disc_and_drive_regions_do_not_match_The_dump_will_be_incorrect);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(decodedDiscKey.HasValue)
|
|
|
|
|
|
{
|
2022-03-07 07:36:44 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVD_DiscKey, decodedDiscKey.Value.Key);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-11-23 16:06:46 +00:00
|
|
|
|
UpdateStatus?.Invoke(Localization.Core.Decrypting_disc_key);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
|
CSS.DecryptDiscKey(decodedDiscKey.Value.Key, out byte[] discKey);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(discKey != null)
|
|
|
|
|
|
{
|
2022-11-23 16:06:46 +00:00
|
|
|
|
UpdateStatus?.Invoke(Localization.Core.
|
|
|
|
|
|
Decryption_of_disc_key_succeeded);
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVD_DiscKey_Decrypted, discKey);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
else
|
2022-11-23 16:06:46 +00:00
|
|
|
|
UpdateStatus?.Invoke(Localization.Core.
|
|
|
|
|
|
Decryption_of_disc_key_failed);
|
2021-01-13 23:37:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
2022-11-23 16:06:46 +00:00
|
|
|
|
UpdateStatus?.
|
|
|
|
|
|
Invoke(string.
|
|
|
|
|
|
Format(Localization.Core.Drive_reports_0_copy_protection_not_yet_supported_dump_incorrect,
|
|
|
|
|
|
(CSS_CPRM.DecodeLeadInCopyright(cmdBuf)?.CopyrightType ??
|
|
|
|
|
|
CopyrightType.NoProtection).ToString()));
|
2021-01-13 23:37:05 +01:00
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion DVD-ROM
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
switch(dskType)
|
|
|
|
|
|
{
|
|
|
|
|
|
#region DVD-ROM and HD DVD-ROM
|
|
|
|
|
|
case MediaType.DVDDownload:
|
|
|
|
|
|
case MediaType.DVDROM:
|
|
|
|
|
|
case MediaType.HDDVDROM:
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Burst_Cutting_Area);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.BurstCuttingArea, 0, _dev.Timeout, out _);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
|
|
|
|
mediaTags.Add(MediaTagType.DVD_BCA, tmpBuf);
|
|
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion DVD-ROM and HD DVD-ROM
|
2017-12-23 17:41:23 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
#region DVD-RAM and HD DVD-RAM
|
|
|
|
|
|
case MediaType.DVDRAM:
|
|
|
|
|
|
case MediaType.HDDVDRAM:
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Disc_Description_Structure);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.DvdramDds, 0, _dev.Timeout, out _);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
if(DDS.Decode(cmdBuf).HasValue)
|
2017-05-31 01:00:58 +01:00
|
|
|
|
{
|
2018-04-10 02:39:41 +01:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-05-31 01:00:58 +01:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVDRAM_DDS, tmpBuf);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Spare_Area_Information);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.DvdramSpareAreaInformation, 0, _dev.Timeout,
|
|
|
|
|
|
out _);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
if(Spare.Decode(cmdBuf).HasValue)
|
2017-06-08 21:12:05 +01:00
|
|
|
|
{
|
2018-04-10 02:39:41 +01:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.DVDRAM_SpareArea, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion DVD-RAM and HD DVD-RAM
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
#region DVD-R and DVD-RW
|
|
|
|
|
|
case MediaType.DVDR:
|
|
|
|
|
|
case MediaType.DVDRW:
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Pre_Recorded_Information);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.PreRecordedInfo, 0, _dev.Timeout, out _);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
|
|
|
|
mediaTags.Add(MediaTagType.DVDR_PreRecordedInfo, tmpBuf);
|
|
|
|
|
|
}
|
2017-12-23 17:41:23 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion DVD-R and DVD-RW
|
|
|
|
|
|
}
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
switch(dskType)
|
|
|
|
|
|
{
|
|
|
|
|
|
#region DVD-R, DVD-RW and HD DVD-R
|
|
|
|
|
|
case MediaType.DVDR:
|
|
|
|
|
|
case MediaType.DVDRW:
|
|
|
|
|
|
case MediaType.HDDVDR:
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Media_Identifier);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.DvdrMediaIdentifier, 0, _dev.Timeout, out _);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
|
|
|
|
mediaTags.Add(MediaTagType.DVDR_MediaIdentifier, tmpBuf);
|
|
|
|
|
|
}
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Recordable_Physical_Information);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
2022-03-07 07:36:44 +00:00
|
|
|
|
MmcDiscStructureFormat.DvdrPhysicalInformation, 0, _dev.Timeout, out _);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
|
|
|
|
mediaTags.Add(MediaTagType.DVDR_PFI, tmpBuf);
|
|
|
|
|
|
}
|
2017-12-23 17:41:23 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion DVD-R, DVD-RW and HD DVD-R
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
#region All DVD+
|
|
|
|
|
|
case MediaType.DVDPR:
|
|
|
|
|
|
case MediaType.DVDPRDL:
|
|
|
|
|
|
case MediaType.DVDPRW:
|
|
|
|
|
|
case MediaType.DVDPRWDL:
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_ADdress_In_Pregroove);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.Adip, 0, _dev.Timeout, out _);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
|
|
|
|
mediaTags.Add(MediaTagType.DVD_ADIP, tmpBuf);
|
|
|
|
|
|
}
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Disc_Control_Blocks);
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.Dcb, 0, _dev.Timeout, out _);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
|
|
|
|
mediaTags.Add(MediaTagType.DCB, tmpBuf);
|
|
|
|
|
|
}
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion All DVD+
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
#region HD DVD-ROM
|
|
|
|
|
|
case MediaType.HDDVDROM:
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Lead_in_Copyright_Information);
|
2017-12-23 17:41:23 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Dvd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.HddvdCopyrightInformation, 0, _dev.Timeout,
|
|
|
|
|
|
out _);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
|
|
|
|
mediaTags.Add(MediaTagType.HDDVD_CPI, tmpBuf);
|
|
|
|
|
|
}
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion HD DVD-ROM
|
2017-05-31 01:00:58 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
#region All Blu-ray
|
|
|
|
|
|
case MediaType.BDR:
|
|
|
|
|
|
case MediaType.BDRE:
|
|
|
|
|
|
case MediaType.BDROM:
|
|
|
|
|
|
case MediaType.BDRXL:
|
|
|
|
|
|
case MediaType.BDREXL:
|
|
|
|
|
|
case MediaType.UHDBD:
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Disc_Information);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.DiscInformation, 0, _dev.Timeout, out _);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
if(DI.Decode(cmdBuf).HasValue)
|
2017-06-08 21:12:05 +01:00
|
|
|
|
{
|
2018-04-10 02:39:41 +01:00
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
2017-12-21 04:43:29 +00:00
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
mediaTags.Add(MediaTagType.BD_DI, tmpBuf);
|
2017-12-21 04:43:29 +00:00
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// 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
|
2018-01-19 01:21:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
switch(dskType)
|
2018-01-19 01:21:01 +00:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
#region BD-ROM only
|
|
|
|
|
|
case MediaType.BDROM:
|
|
|
|
|
|
case MediaType.UHDBD:
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Burst_Cutting_Area);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.BdBurstCuttingArea, 0, _dev.Timeout, out _);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
|
|
|
|
mediaTags.Add(MediaTagType.BD_BCA, tmpBuf);
|
|
|
|
|
|
}
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion BD-ROM only
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
#region Writable Blu-ray only
|
|
|
|
|
|
case MediaType.BDR:
|
|
|
|
|
|
case MediaType.BDRE:
|
|
|
|
|
|
case MediaType.BDRXL:
|
|
|
|
|
|
case MediaType.BDREXL:
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Disc_Definition_Structure);
|
2018-12-10 21:47:51 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
|
|
|
|
|
|
MmcDiscStructureFormat.BdDds, 0, _dev.Timeout, out _);
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
|
|
|
|
mediaTags.Add(MediaTagType.BD_DDS, tmpBuf);
|
|
|
|
|
|
}
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-11-23 16:06:46 +00:00
|
|
|
|
_dumpLog.WriteLine(Localization.Core.Reading_Spare_Area_Information);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
sense = _dev.ReadDiscStructure(out cmdBuf, out _, MmcDiscStructureMediaType.Bd, 0, 0,
|
2022-03-07 07:36:44 +00:00
|
|
|
|
MmcDiscStructureFormat.BdSpareAreaInformation, 0, _dev.Timeout, out _);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(!sense)
|
|
|
|
|
|
{
|
|
|
|
|
|
tmpBuf = new byte[cmdBuf.Length - 4];
|
|
|
|
|
|
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
|
|
|
|
|
mediaTags.Add(MediaTagType.BD_SpareArea, tmpBuf);
|
|
|
|
|
|
}
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
#endregion Writable Blu-ray only
|
|
|
|
|
|
}
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(isXbox)
|
|
|
|
|
|
{
|
|
|
|
|
|
Xgd(mediaTags, dskType);
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
Sbc(mediaTags, dskType, true, dvdDecrypt);
|
|
|
|
|
|
}
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
// TODO: Move somewhere else
|
2022-12-15 22:21:07 +00:00
|
|
|
|
internal static void AddMediaTagToSidecar(string outputPath, MediaTagType tagType, byte[] tag, ref Metadata sidecar)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
switch(tagType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case MediaTagType.DVD_PFI:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Pfi = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVD_DMI:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Dmi = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVD_CMI:
|
|
|
|
|
|
case MediaTagType.HDDVD_CPI:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Cmi = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
byte[] tmp = new byte[tag.Length + 4];
|
2022-03-06 13:29:38 +00:00
|
|
|
|
Array.Copy(tag, 0, tmp, 4, tag.Length);
|
|
|
|
|
|
tmp[0] = (byte)((tag.Length & 0xFF00) >> 8);
|
|
|
|
|
|
tmp[1] = (byte)(tag.Length & 0xFF);
|
|
|
|
|
|
|
|
|
|
|
|
CSS_CPRM.LeadInCopyright? cpy = CSS_CPRM.DecodeLeadInCopyright(tmp);
|
|
|
|
|
|
|
|
|
|
|
|
if(cpy.HasValue &&
|
|
|
|
|
|
cpy.Value.CopyrightType != CopyrightType.NoProtection)
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].CopyProtection = cpy.Value.CopyrightType.ToString();
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVD_BCA:
|
|
|
|
|
|
case MediaTagType.BD_BCA:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Bca = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.BD_DDS:
|
|
|
|
|
|
case MediaTagType.DVDRAM_DDS:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Dds = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVDRAM_SpareArea:
|
|
|
|
|
|
case MediaTagType.BD_SpareArea:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Sai = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVDR_PreRecordedInfo:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Pri = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVD_MediaIdentifier:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].MediaID = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVDR_PFI:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Pfir = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DVD_ADIP:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Adip = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.DCB:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Dcb = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.BD_DI:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Di = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.Xbox_SecuritySector:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Xbox ??= new Xbox();
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Xbox.SecuritySectors = new List<XboxSecuritySector>
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
2022-12-15 22:21:07 +00:00
|
|
|
|
new()
|
2018-01-19 01:21:01 +00:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
RequestNumber = 0,
|
|
|
|
|
|
RequestVersion = 1,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
SecuritySectors = new CommonTypes.AaruMetadata.Dump
|
2018-01-19 01:21:01 +00:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2018-01-19 01:21:01 +00:00
|
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
};
|
2018-01-19 01:21:01 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.Xbox_PFI:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Xbox ??= new Xbox();
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Xbox.Pfi = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.Xbox_DMI:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Xbox ??= new Xbox();
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Xbox.Dmi = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.CD_FullTOC:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Toc = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.CD_ATIP:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Atip = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.CD_PMA:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].Pma = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.CD_TEXT:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].LeadInCdText = new CommonTypes.AaruMetadata.Dump
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
|
|
|
|
|
Image = outputPath,
|
|
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.CD_FirstTrackPregap:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].FirstTrackPregrap = new List<Border>
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
2022-12-15 22:21:07 +00:00
|
|
|
|
new()
|
2018-01-20 17:12:01 +00:00
|
|
|
|
{
|
2020-07-20 04:34:16 +01:00
|
|
|
|
Image = outputPath,
|
2021-06-04 18:17:53 +01:00
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
};
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
|
|
|
|
|
case MediaTagType.CD_LeadIn:
|
2022-12-15 22:21:07 +00:00
|
|
|
|
sidecar.OpticalDiscs[0].LeadIn = new List<Border>
|
2022-03-06 13:29:38 +00:00
|
|
|
|
{
|
2022-12-15 22:21:07 +00:00
|
|
|
|
new()
|
2018-01-20 17:12:01 +00:00
|
|
|
|
{
|
2020-07-20 04:34:16 +01:00
|
|
|
|
Image = outputPath,
|
2021-06-04 18:17:53 +01:00
|
|
|
|
Size = (ulong)tag.Length,
|
2022-12-15 22:21:07 +00:00
|
|
|
|
Checksums = Checksum.GetChecksums(tag)
|
2022-03-06 13:29:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
};
|
2019-12-14 22:55:26 +00:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
break;
|
2017-05-31 01:00:58 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|