From b126e44b2017355fea6a086e5484cfe237de4f3d Mon Sep 17 00:00:00 2001 From: Hennadiy Brych Date: Mon, 30 Oct 2023 18:15:50 -0400 Subject: [PATCH] HD-DVD disc profiles, BluRay improvements, preserve DVD/BD PIC header --- commands.ixx | 2 +- dump.ixx | 1 + dvd/dvd_dump.ixx | 18 +++++++++++------- redumper.ixx | 27 +++++++++++++++++++++++---- scsi/mmc.ixx | 25 ++++++++++++++++++++++--- 5 files changed, 58 insertions(+), 15 deletions(-) diff --git a/commands.ixx b/commands.ixx index 1c9b069..c66afb1 100644 --- a/commands.ixx +++ b/commands.ixx @@ -57,7 +57,7 @@ export bool redumper_verify(Context &ctx, Options &options) { LOG("warning: CD verify is unsupported"); } - else if(ctx.disc_type == DiscType::DVD) + else { dump_dvd(ctx, options, DumpMode::VERIFY); complete = true; diff --git a/dump.ixx b/dump.ixx index 806c919..a6647bc 100644 --- a/dump.ixx +++ b/dump.ixx @@ -33,6 +33,7 @@ export enum class DiscType NONE, CD, DVD, + HDDVD, BLURAY }; diff --git a/dvd/dvd_dump.ixx b/dvd/dvd_dump.ixx index e5e8989..774a187 100644 --- a/dvd/dvd_dump.ixx +++ b/dvd/dvd_dump.ixx @@ -213,9 +213,8 @@ std::vector> read_physical_structures(SPTD &sptd, bool blur if(status.status_code) throw_line("failed to read disc physical structure, SCSI ({})", SPTD::StatusMessage(status)); - strip_response_header(structure); - - auto layer_descriptor = (READ_DVD_STRUCTURE_LayerDescriptor *)structure.data(); + //FIXME: bluray + auto layer_descriptor = (READ_DVD_STRUCTURE_LayerDescriptor *)&structure[sizeof(CMD_ParameterListHeader)]; if(!layers_count) layers_count = (layer_descriptor->track_path ? 0 : layer_descriptor->layers_number) + 1; } @@ -272,7 +271,6 @@ export bool dump_dvd(Context &ctx, const Options &options, DumpMode dump_mode) { std::vector manufacturer; cmd_read_disc_structure(*ctx.sptd, manufacturer, 0, 0, i, READ_DISC_STRUCTURE_Format::MANUFACTURER, 0); - strip_response_header(manufacturer); if(!manufacturer.empty()) write_vector(std::format("{}{}.manufacturer", image_prefix, physical_structures.size() > 1 ? std::format(".{}", i + 1) : ""), manufacturer); @@ -290,10 +288,12 @@ export bool dump_dvd(Context &ctx, const Options &options, DumpMode dump_mode) uint32_t layer_break = 0; for(uint32_t i = 0; i < physical_structures.size(); ++i) { - if(physical_structures[i].size() < sizeof(READ_DVD_STRUCTURE_LayerDescriptor)) + auto &structure = physical_structures[i]; + + if(structure.size() < sizeof(CMD_ParameterListHeader) + sizeof(READ_DVD_STRUCTURE_LayerDescriptor)) throw_line("invalid layer descriptor size (layer: {})", i); - auto layer_descriptor = (READ_DVD_STRUCTURE_LayerDescriptor *)physical_structures[i].data(); + auto layer_descriptor = (READ_DVD_STRUCTURE_LayerDescriptor *)&structure[sizeof(CMD_ParameterListHeader)]; // opposite if(layer_descriptor->track_path) @@ -310,7 +310,11 @@ export bool dump_dvd(Context &ctx, const Options &options, DumpMode dump_mode) LOG("disc structure:"); for(uint32_t i = 0; i < physical_structures.size(); ++i) - print_physical_structure(*(READ_DVD_STRUCTURE_LayerDescriptor *)physical_structures[i].data(), i); + { + auto &structure = physical_structures[i]; + + print_physical_structure(*(READ_DVD_STRUCTURE_LayerDescriptor *)&structure[sizeof(CMD_ParameterListHeader)], i); + } LOG(""); if(layer_break) diff --git a/redumper.ixx b/redumper.ixx index 8ab2483..c04a59f 100644 --- a/redumper.ixx +++ b/redumper.ixx @@ -110,21 +110,35 @@ DiscType query_disc_type(Context &ctx) case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_ROM: case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_R: case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_RAM: - case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_RW_RO: case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_RW: + case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_RW_SEQ: + case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_DASH_R_DL: + case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_DASH_R_LJ: case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_PLUS_RW: + case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_PLUS_R: + case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_PLUS_RW_DL: + case GET_CONFIGURATION_FeatureCode_ProfileList::DVD_PLUS_R_DL: disc_type = DiscType::DVD; break; case GET_CONFIGURATION_FeatureCode_ProfileList::BD_ROM: - case GET_CONFIGURATION_FeatureCode_ProfileList::BD_R: + case GET_CONFIGURATION_FeatureCode_ProfileList::BD_R_SRM: case GET_CONFIGURATION_FeatureCode_ProfileList::BD_R_RRM: - case GET_CONFIGURATION_FeatureCode_ProfileList::BD_RE: + case GET_CONFIGURATION_FeatureCode_ProfileList::BD_RW: disc_type = DiscType::BLURAY; break; + case GET_CONFIGURATION_FeatureCode_ProfileList::HDDVD_ROM: + case GET_CONFIGURATION_FeatureCode_ProfileList::HDDVD_R: + case GET_CONFIGURATION_FeatureCode_ProfileList::HDDVD_RAM: + case GET_CONFIGURATION_FeatureCode_ProfileList::HDDVD_RW: + case GET_CONFIGURATION_FeatureCode_ProfileList::HDDVD_R_DL: + case GET_CONFIGURATION_FeatureCode_ProfileList::HDDVD_RW_DL: + disc_type = DiscType::HDDVD; + break; + default: - throw_line("unsupported disc type (profile: {})", (uint16_t)current_profile); + throw_line("unsupported disc type (profile: {:02X})", (uint16_t)current_profile); } return disc_type; @@ -147,12 +161,15 @@ std::list get_cd_batch_commands(DiscType disc_type) const std::list CD_BATCH{"dump", "protection", "refine", "split", "info"}; const std::list DVD_BATCH{"dump", "refine", "dvdkey", "info"}; + const std::list HDDVD_BATCH{"dump", "refine", "dvdkey", "info"}; const std::list BD_BATCH{"dump", "refine", "info"}; if(disc_type == DiscType::CD) commands = CD_BATCH; else if(disc_type == DiscType::DVD) commands = DVD_BATCH; + else if(disc_type == DiscType::HDDVD) + commands = HDDVD_BATCH; else if(disc_type == DiscType::BLURAY) commands = BD_BATCH; else @@ -275,6 +292,8 @@ export int redumper(Options &options) float speed_modifier = 176.4; if(ctx.disc_type == DiscType::DVD) speed_modifier = 1385.0; + else if(ctx.disc_type == DiscType::HDDVD) + speed_modifier = 1385.0; else if(ctx.disc_type == DiscType::BLURAY) speed_modifier = 4500.0; diff --git a/scsi/mmc.ixx b/scsi/mmc.ixx index 3b72b79..9759384 100644 --- a/scsi/mmc.ixx +++ b/scsi/mmc.ixx @@ -86,22 +86,41 @@ export enum class GET_CONFIGURATION_FeatureCode_ProfileList : uint16_t MO_ERASABLE, MO_WRITE_ONCE, AS_MO, + CD_ROM = 0x08, CD_R, CD_RW, + DVD_ROM = 0x10, DVD_R, DVD_RAM, - DVD_RW_RO, DVD_RW, + DVD_RW_SEQ, + DVD_DASH_R_DL, + DVD_DASH_R_LJ, DVD_PLUS_RW = 0x1A, + DVD_PLUS_R, + DDCD_ROM = 0x20, DDCD_R, DDCD_RW, + + DVD_PLUS_RW_DL = 0x2A, + DVD_PLUS_R_DL, + BD_ROM = 0x40, - BD_R, + BD_R_SRM, BD_R_RRM, - BD_RE + BD_RW, + + HDDVD_ROM = 0x50, + HDDVD_R, + HDDVD_RAM, + HDDVD_RW, + HDDVD_R_DL = 0x58, + HDDVD_RW_DL = 0x5A, + + NON_STANDARD = 0xFFFF };