Skip to content

Commit

Permalink
negative leadin size correction
Browse files Browse the repository at this point in the history
options cleanup
  • Loading branch information
superg committed Dec 3, 2022
1 parent 970546a commit f624f70
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 61 deletions.
6 changes: 3 additions & 3 deletions main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ int main(int argc, char *argv[])
if(!options.image_name.empty())
Logger::Get().Reset((std::filesystem::path(options.image_path) / options.image_name).string() + ".log");

LOG("{} (print usage: {})\n", redumper_version(), Options::HelpKeys());

LOG("command: {}\n", options.command);
LOG("{} (print usage: --help,-h))\n", redumper_version());

if(options.help)
options.PrintUsage();
else
{
LOG("command: {}\n", options.command);

redumper(options);
}
}
Expand Down
99 changes: 46 additions & 53 deletions options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ Options::Options(int argc, const char *argv[])
, refine_subchannel(false)
, force_qtoc(false)
, skip_fill(0x55)
, skip_size(1 << 12)
, ring_size(1024)
, iso9660_trim(false)
, plextor_skip_leadin(false)
, asus_skip_leadout(false)
, correct_offset_shift(false)
, cdi_ready_normalize(false)
, perfect_audio_offset(false)
, audio_silence_threshold(48)
{
for(int i = 0; i < argc; ++i)
Expand Down Expand Up @@ -134,10 +131,6 @@ Options::Options(int argc, const char *argv[])
s_value = &skip;
else if(key == "--skip-fill")
i_value = &skip_fill;
else if(key == "--skip-size")
i_value = &skip_size;
else if(key == "--ring-size")
i_value = &ring_size;
else if(key == "--iso9660-trim")
iso9660_trim = true;
else if(key == "--plextor-skip-leadin")
Expand All @@ -153,8 +146,6 @@ Options::Options(int argc, const char *argv[])
force_offset = std::make_unique<int>();
i_value = force_offset.get();
}
else if(key == "--perfect-audio-offset")
perfect_audio_offset = true;
else if(key == "--audio-silence-threshold")
i_value = &audio_silence_threshold;
// unknown option
Expand Down Expand Up @@ -186,60 +177,62 @@ Options::Options(int argc, const char *argv[])
}


std::string Options::HelpKeys()
{
return "--help,-h";
}


void Options::PrintUsage()
{
LOG("usage: redumper [mode] [options]");
LOG("");

LOG("modes: ");
LOG("\tcd\taggregate \"Do It All\" mode {{dump => protection => refine => split => info}} (default)");
LOG("\tdump\tdumps CD");
LOG("MODES:");
LOG("\tcd \taggregate \"Do It All\" mode {{dump => protection => refine => split => info}} (default)");
LOG("\tdump \tdumps CD");
LOG("\tprotection\tscans dump for protection");
LOG("\trefine\trefines the dump from a CD by rereading erroneous sectors");
LOG("\tsplit\tperforms track splits and generates a CUE-sheet");
LOG("\tinfo\tredump.org specific text file with dump information");
LOG("\trefine \trefines the dump from a CD by rereading erroneous sectors");
LOG("\tsplit \tperforms track splits and generates a CUE-sheet");
LOG("\tinfo \tredump.org specific text file with dump information");
// LOG("\trings\tscans CD for protection rings, outputs ring ranges for CD dumping");
LOG("");

LOG("options: ");
LOG("\t{}\tprint usage", HelpKeys());
LOG("\t--verbose\tverbose output");
LOG("\t--image-path=VALUE\tdump files base directory");
LOG("\t--image-name=VALUE\tdump files prefix, autogenerated in dump mode, if not provided");
LOG("\t--overwrite\toverwrites previously generated dump files");
LOG("\t--force-split\t\tforce track split with errors");
LOG("\t--leave-unchanged\t\tdon't replace erroneous sectors with generated ones");
LOG("\t--drive=VALUE\t\tdrive to use, first available drive with disc, if not provided");
LOG("\t--drive-type=VALUE\t\toverride drive type, possible values: GENERIC, PLEXTOR, LG_ASUS");
LOG("\t--drive-read-offset=VALUE\t\toverride drive read offset");
LOG("\t--drive-c2-shift=VALUE\t\toverride drive C2 shift");
LOG("\t--drive-pregap-start=VALUE\t\toverride drive pre-gap start LBA");
LOG("\t--drive-read-method=VALUE\t\toverride drive read method, possible values: BE, D8, BE_CDDA");
LOG("\t--drive-sector-order=VALUE\t\toverride drive sector order, possible values: DATA_C2_SUB, DATA_SUB_C2");
LOG("\t--speed=VALUE\t\tdrive read speed, optimal drive speed will be used if not provided");
LOG("\t--retries=VALUE\tnumber of sector retries in case of SCSI/C2 error (default: {})", retries);
LOG("\t--refine-subchannel\tIn addition to SCSI/C2, refine subchannel");
LOG("\t--lba-start=VALUE\tLBA to start dumping from");
LOG("\t--lba-end=VALUE\tLBA to stop dumping at (everything before the value), useful for discs with fake TOC");
LOG("\t--force-qtoc\tForce QTOC based track split");
LOG("\t--skip=VALUE\tLBA ranges of sectors to skip");
LOG("\t--skip-fill=VALUE\tfill byte value for skipped sectors (default: 0x{:02X})", skip_fill);
LOG("\t--skip-size=VALUE\trings mode, number of sectors to skip on SCSI error (default: {})", skip_size);
LOG("\t--ring-size=VALUE\trings mode, maximum ring size to stop subdivision (rings, default: {})", ring_size);
LOG("\t--iso9660-trim\ttrim each ISO9660 data track to PVD volume size, useful for discs with fake TOC");
LOG("\t--plextor-skip-leadin\tskip dumping lead-in using negative range");
LOG("\t--asus-skip-leadout\tskip extracting lead-out from drive cache");
LOG("\t--correct-offset-shift\tcorrect disc write offset shift");
LOG("\t--cdi-ready-normalize\tseparate CDi-Ready track 1 index 0 to track 0");
LOG("\t--force-offset=VALUE\toverride offset autodetection and use supplied value");
LOG("\t--perfect-audio-offset\tintelligent silence based audio offset detection");
LOG("OPTIONS:");
LOG("\t(general)");
LOG("\t--help,-h \tprint usage");
LOG("\t--verbose \tverbose output");
LOG("\t--drive=VALUE \tdrive to use, first available drive with disc, if not provided");
LOG("\t--speed=VALUE \tdrive read speed, optimal drive speed will be used if not provided");
LOG("\t--retries=VALUE \tnumber of sector retries in case of SCSI/C2 error (default: {})", retries);
LOG("\t--image-path=VALUE \tdump files base directory");
LOG("\t--image-name=VALUE \tdump files prefix, autogenerated in dump mode if not provided");
LOG("\t--overwrite \toverwrites previously generated dump files");
LOG("");
LOG("\t(drive configuration)");
LOG("\t--drive-type=VALUE \toverride drive type, possible values: GENERIC, PLEXTOR, LG_ASUS");
LOG("\t--drive-read-offset=VALUE \toverride drive read offset");
LOG("\t--drive-c2-shift=VALUE \toverride drive C2 shift");
LOG("\t--drive-pregap-start=VALUE \toverride drive pre-gap start LBA");
LOG("\t--drive-read-method=VALUE \toverride drive read method, possible values: BE, D8, BE_CDDA");
LOG("\t--drive-sector-order=VALUE \toverride drive sector order, possible values: DATA_C2_SUB, DATA_SUB_C2");
LOG("");
LOG("\t(drive specific)");
LOG("\t--plextor-skip-leadin \tskip dumping lead-in using negative range");
LOG("\t--asus-skip-leadout \tskip extracting lead-out from drive cache");
LOG("");
LOG("\t(offset)");
LOG("\t--force-offset=VALUE \toverride offset autodetection and use supplied value");
LOG("\t--audio-silence-threshold=VALUE\tmaximum absolute sample value to treat it as silence (default: {})", audio_silence_threshold);
LOG("\t--correct-offset-shift \tcorrect disc write offset shift");
LOG("");
LOG("\t(split)");
LOG("\t--force-split \tforce track split with errors");
LOG("\t--leave-unchanged \tdon't replace erroneous sectors with generated ones");
LOG("\t--force-qtoc \tForce QTOC based track split");
LOG("\t--skip-fill=VALUE \tfill byte value for skipped sectors (default: 0x{:02X})", skip_fill);
LOG("\t--iso9660-trim \ttrim each ISO9660 data track to PVD volume size, useful for discs with fake TOC");
LOG("\t--cdi-ready-normalize \tseparate CDi-Ready track 1 index 0 to track 0");
LOG("");
LOG("\t(miscellaneous)");
LOG("\t--lba-start=VALUE \tLBA to start dumping from");
LOG("\t--lba-end=VALUE \tLBA to stop dumping at (everything before the value), useful for discs with fake TOC");
LOG("\t--refine-subchannel \tIn addition to SCSI/C2, refine subchannel");
LOG("\t--skip=VALUE \tLBA ranges of sectors to skip");
}

}
4 changes: 0 additions & 4 deletions options.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,16 @@ struct Options
bool force_qtoc;
std::string skip;
int skip_fill;
int skip_size;
int ring_size;
bool iso9660_trim;
bool plextor_skip_leadin;
bool asus_skip_leadout;
bool correct_offset_shift;
bool cdi_ready_normalize;
std::unique_ptr<int> force_offset;
bool perfect_audio_offset;
int audio_silence_threshold;

Options(int argc, const char *argv[]);

static std::string HelpKeys();
void PrintUsage();
};

Expand Down
4 changes: 3 additions & 1 deletion split.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,9 @@ void redumper_split(const Options &options)
t.lba_start = leadin_end;

// if it's not empty, construct 00 track with non-zero data
auto nonzero_count = find_non_zero_range(scm_fs, state_fs, leadin_start, leadin_end, write_offset, t.control & (uint8_t)ChannelQ::Control::DATA, false);
uint32_t nonzero_count = 0;
if(leadin_end > leadin_start)
nonzero_count = find_non_zero_range(scm_fs, state_fs, leadin_start, leadin_end, write_offset, t.control & (uint8_t)ChannelQ::Control::DATA, false);
if(nonzero_count)
{
auto t_00 = t;
Expand Down

0 comments on commit f624f70

Please sign in to comment.