Skip to content

Dvdraw edc#363

Merged
superg merged 6 commits intomainfrom
dvdraw_edc
Mar 8, 2026
Merged

Dvdraw edc#363
superg merged 6 commits intomainfrom
dvdraw_edc

Conversation

@superg
Copy link
Owner

@superg superg commented Mar 8, 2026

Summary by CodeRabbit

  • Breaking Changes

    • Removed the "verify" command.
  • Refactor

    • Unified dump vs refine paths for optical disc operations, consolidating progress/status reporting and error accounting.
    • Simplified mode selection to a binary dump/refine switch.
  • Behavioral Changes

    • Adjusted read-error handling, retries, and reporting for CD/DVD dumps and splits.
    • Final reports now show consolidated media/error summaries and clearer progress updates.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 8, 2026

Warning

Rate limit exceeded

@superg has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 29 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8bea8ce6-0925-42b8-9a20-2470b7d03e51

📥 Commits

Reviewing files that changed from the base of the PR and between f804dd0 and 09fa9e0.

📒 Files selected for processing (1)
  • dvd/dvd_dump.ixx
📝 Walkthrough

Walkthrough

Replaces the exported DumpMode enum with a boolean dump, removes centralized Errors/dump_errors from common, adds local Errors structs and status helpers in CD/DVD dump modules, refactors per-LBA dump/refine logic and logging, and removes the verify command and its help text.

Changes

Cohort / File(s) Summary
Core common API
common.ixx
Removed DumpMode enum and centralized Errors/dump_errors; added CHUNK_1KB and recomputed CHUNK_1MB.
CLI / dispatcher
redumper.ixx
Replaced DumpMode usage with boolean dump when calling dump/refine; removed redumper_verify and "verify" command; standardized time-check logging.
CD dump/refine
cd/cd_dump.ixx, cd/cd_split.ixx
Changed redumper_dump_cd signature to take bool dump; added local Errors struct and status_update; replaced DumpMode branching with dump flag across TOC, retries, error accounting, file modes, offset/lead-out handling, and final logging; removed initial dump-errors log in split.
DVD dump/refine
dvd/dvd_dump.ixx, dvd/dvd_split.ixx
Changed redumper_dump_dvd signature to take bool dump; added dvd::Errors; introduced helpers (refine_init_errors, status_update, sectors_data_*, edc_match_func); renamed fs_isofs_image in filesystem_search_size; reworked sector/state I/O, error counting and iso .state SCSI-error checks in split.
Small docs/help
options.ixx
Removed "verify" command help line from usage output.

Sequence Diagram(s)

sequenceDiagram
    participant CLI
    participant Redumper
    participant Drive as OpticalDrive
    participant FS as Filesystem/State
    participant Logger

    CLI->>Redumper: invoke dump/refine (dump: true/false)
    Redumper->>Drive: read sector (LBA)
    Drive-->>Redumper: sector data + status (SCSI/C2/Q/EDC)
    Redumper->>FS: read/write image & state files
    Redumper->>Logger: status_update(errors, percent, LBA range)
    alt refine (dump == false)
        Redumper->>Redumper: retries, subcode refinement, corrections
        Redumper->>FS: update refined image/state
    else dump (dump == true)
        Redumper->>FS: write raw dump without retries
    end
    Redumper->>Logger: final report & return code
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I nibble enums down to bits and stash a boolean seed,
Counters snug in burrowed structs, helpers tidy every read.
I hop LBAs and log my hops, whether dump or gentle mend,
Carrots for each corrected byte, tunnels clean until the end. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Dvdraw edc' is vague and does not clearly convey the scope or nature of the changes made across multiple files. Use a more descriptive title that summarizes the main changes, such as 'Refactor dump mode handling and consolidate error structures' or 'Replace DumpMode enum with boolean parameter and move error structs'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dvdraw_edc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
redumper.ixx (1)

124-146: ⚠️ Potential issue | 🟡 Minor

Remove verify from printUsage() too.

verify is no longer registered here, but options.ixx, Line 378 still advertises it. redumper --help will now point users to a command that immediately falls through to unknown command.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@redumper.ixx` around lines 124 - 146, The help text still advertises a
non-registered "verify" command; update printUsage() (the function that emits
the command list) to remove the "verify" entry and also remove or update the
corresponding help entry in the options help list so it no longer references
"verify" (make the printed commands match the COMMANDS map and ensure
printUsage() and any options help arrays/strings are consistent).
cd/cd_dump.ixx (1)

570-589: ⚠️ Potential issue | 🟠 Major

Include Q-only failures in the refine trigger.

redumper.ixx, Lines 73-79 only enter refine in aggregate disc mode when this function returns true. With the current return, a dump that only has invalid Q packets returns false, so options.refine_subchannel can never kick in even though Lines 360-361 and 521-529 still treat Q validity as part of completeness.

Possible fix
-    return errors.scsi || errors.c2;
+    return errors.scsi || errors.c2 || (options.refine_subchannel && errors.q);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cd/cd_dump.ixx` around lines 570 - 589, The function currently returns only
errors.scsi || errors.c2 which prevents Q-only failures from triggering refine;
change the final return to include Q errors (e.g., return errors.scsi ||
errors.c2 || errors.q) so that invalid Q packets cause options.refine_subchannel
to be considered; update the return expression that references errors.scsi,
errors.c2 and errors.q in cd_dump.ixx accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@dvd/dvd_dump.ixx`:
- Around line 571-594: The function refine_init_errors can underflow computing
count = lba_end - lba_start when lba_start >= lba_end; add an early no-op guard
at the top of refine_init_errors (e.g., if (lba_start >= lba_end) return;) so
the loop never runs for empty or inverted ranges, or alternatively compute count
using a signed-to-unsigned safe check before casting; update references to
count, lba_start, and lba_end accordingly to avoid the huge unsigned underflow.
- Around line 597-619: The conditional in edc_match_func incorrectly relies on
operator precedence, causing DiscType::BLURAY_R to match even when raw is false;
change the branch condition to require raw for both Blu-ray variants by grouping
the disc-type checks together (i.e., make the condition raw && (disc_type ==
DiscType::BLURAY || disc_type == DiscType::BLURAY_R)) so non-raw BD-R paths do
not use the raw-frame validator.

---

Outside diff comments:
In `@cd/cd_dump.ixx`:
- Around line 570-589: The function currently returns only errors.scsi ||
errors.c2 which prevents Q-only failures from triggering refine; change the
final return to include Q errors (e.g., return errors.scsi || errors.c2 ||
errors.q) so that invalid Q packets cause options.refine_subchannel to be
considered; update the return expression that references errors.scsi, errors.c2
and errors.q in cd_dump.ixx accordingly.

In `@redumper.ixx`:
- Around line 124-146: The help text still advertises a non-registered "verify"
command; update printUsage() (the function that emits the command list) to
remove the "verify" entry and also remove or update the corresponding help entry
in the options help list so it no longer references "verify" (make the printed
commands match the COMMANDS map and ensure printUsage() and any options help
arrays/strings are consistent).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2a9fca11-f3c5-4db8-bcb3-1e566f7617b5

📥 Commits

Reviewing files that changed from the base of the PR and between eefa3af and 7bf28c3.

📒 Files selected for processing (6)
  • cd/cd_dump.ixx
  • cd/cd_split.ixx
  • common.ixx
  • dvd/dvd_dump.ixx
  • dvd/dvd_split.ixx
  • redumper.ixx
💤 Files with no reviewable changes (2)
  • cd/cd_split.ixx
  • dvd/dvd_split.ixx

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cd/cd_dump.ixx`:
- Around line 282-285: The files are opened without std::fstream::in when
dump==true causing later reads from fs_scram, fs_state, and fs_subcode to fail;
change the open mode logic in the block that sets mode and constructs
fs_scram/fs_state/fs_subcode so that mode always includes std::fstream::in |
std::fstream::out and only adds std::fstream::trunc when dump is true (i.e.,
build mode = std::fstream::in | std::fstream::out and if (dump) mode |=
std::fstream::trunc) before creating the fstreams fs_scram, fs_state, and
fs_subcode.

In `@dvd/dvd_dump.ixx`:
- Around line 463-467: The code currently reads UDF VDS directly from
fs_image/fs_state using read_entry into sector_data_file and sector_state_file,
which is only valid for logical 2048-byte images; gate this block to run only
for non-raw images (e.g. when cfg.sector_size == FORM1_DATA_SIZE or a non-raw
mode flag) or replace the direct read_entry calls with the same logical-sector
extraction routine used elsewhere in this file to populate
sector_data_file/sector_state_file (the logical-sector extraction path
referenced at the earlier VDS-read site), ensuring ctx.udf_vds is read via
extracted user-data sectors rather than raw frames.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d1b81d84-5455-4707-89ac-3998323e25c4

📥 Commits

Reviewing files that changed from the base of the PR and between 7146373 and 46976ff.

📒 Files selected for processing (5)
  • cd/cd_dump.ixx
  • dvd/dvd_dump.ixx
  • dvd/dvd_split.ixx
  • options.ixx
  • redumper.ixx
💤 Files with no reviewable changes (1)
  • options.ixx

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@dvd/dvd_dump.ixx`:
- Around line 466-468: CI flagged a clang-format style violation around the two
read_entry calls (read_entry with parameters including fs_image,
sector_data_file.data(), FORM1_DATA_SIZE, ctx.udf_vds.back().first,
ctx.udf_vds.back().second, 0, 0 and the subsequent read_entry for fs_state); fix
it by running the project's formatter (clang-format -i) on the file or reflowing
those lines to match the project's formatting rules so the two read_entry calls
adhere to the style guide.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6883919a-7696-480a-a64e-d98354f6d6f7

📥 Commits

Reviewing files that changed from the base of the PR and between 46976ff and f804dd0.

📒 Files selected for processing (2)
  • cd/cd_dump.ixx
  • dvd/dvd_dump.ixx

@superg superg merged commit e9c7cb9 into main Mar 8, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant