Skip to content

Commit

Permalink
HD-DVD disc profiles, BluRay improvements, preserve DVD/BD PIC header
Browse files Browse the repository at this point in the history
  • Loading branch information
superg committed Oct 30, 2023
1 parent 1e2a479 commit b126e44
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 15 deletions.
2 changes: 1 addition & 1 deletion commands.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions dump.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export enum class DiscType
NONE,
CD,
DVD,
HDDVD,
BLURAY
};

Expand Down
18 changes: 11 additions & 7 deletions dvd/dvd_dump.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,8 @@ std::vector<std::vector<uint8_t>> 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;
}
Expand Down Expand Up @@ -272,7 +271,6 @@ export bool dump_dvd(Context &ctx, const Options &options, DumpMode dump_mode)
{
std::vector<uint8_t> 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);
Expand All @@ -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)
Expand All @@ -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)
Expand Down
27 changes: 23 additions & 4 deletions redumper.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -147,12 +161,15 @@ std::list<std::string> get_cd_batch_commands(DiscType disc_type)

const std::list<std::string> CD_BATCH{"dump", "protection", "refine", "split", "info"};
const std::list<std::string> DVD_BATCH{"dump", "refine", "dvdkey", "info"};
const std::list<std::string> HDDVD_BATCH{"dump", "refine", "dvdkey", "info"};
const std::list<std::string> 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
Expand Down Expand Up @@ -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;

Expand Down
25 changes: 22 additions & 3 deletions scsi/mmc.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -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
};


Expand Down

0 comments on commit b126e44

Please sign in to comment.