Skip to content

OmniDrive raw dvd fixes#348

Merged
superg merged 2 commits intosuperg:mainfrom
Deterous:omnidrive-fixes
Feb 17, 2026
Merged

OmniDrive raw dvd fixes#348
superg merged 2 commits intosuperg:mainfrom
Deterous:omnidrive-fixes

Conversation

@Deterous
Copy link
Contributor

@Deterous Deterous commented Feb 16, 2026

  • Default to dump-read-size of 16 for the slim OmniDrive drives when dumping raw DVD
  • Dump up to the lead-out boundary, don't cross it in a single read command.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added specialized detection for OmniDrive Slim optical drive variants.
  • Improvements

    • Raw dumping on OmniDrive Slim drives now auto-adjusts sector transfer sizes and emits a warning when adjustments occur.
    • Enhanced boundary protection prevents read operations from exceeding disc limits during dumping, improving reliability.

@Deterous Deterous marked this pull request as ready for review February 16, 2026 02:38
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

📝 Walkthrough

Walkthrough

Adds a new public predicate is_omnidrive_slim() to detect OmniDrive Slim by product_id and firmware, adjusts runtime raw-dump sectors_at_once for Slim drives, and adds checks to clamp read ranges so reads do not cross the disc lead-out boundary.

Changes

Cohort / File(s) Summary
OmniDrive Slim Detection
drive.ixx
Adds public function bool is_omnidrive_slim(const DriveConfig &drive_config) that returns true when product_id is "BD-RE BU40N" and is_omnidrive_firmware is true.
Raw Dumping Adjustments & Safety
dvd/dvd_dump.ixx
Makes sectors_at_once mutable, reduces sectors_at_once from ≥32 to 16 at runtime when raw dumping on OmniDrive Slim (with warning), and clamps sectors_to_read so lba + sectors_to_read never exceeds disc.sectors_count.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A slim new drive hops into view,
Detected by name and firmware too.
I trim the sectors, keep reads in line,
No lead-out slips—everything's fine! 🥕

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'OmniDrive raw dvd fixes' directly reflects the main changes: adding OmniDrive Slim detection and applying runtime adjustments and lead-out boundary protection for raw DVD dumping on OmniDrive drives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ 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

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.

🧹 Nitpick comments (1)
dvd/dvd_dump.ixx (1)

854-859: Buffer allocation precedes sectors_at_once adjustment.

file_data and file_state are allocated at lines 830–831 using the original sectors_at_once value, but the adjustment to 16 happens here. The buffers end up oversized but never undersized, so there's no correctness issue — just a minor inefficiency.

Consider moving the slim drive adjustment before the buffer allocation for clarity and to avoid the over-allocation.

♻️ Suggested reordering
+    // TODO: can be implemented later
+    if(raw)
+    {
+        rom_update = false;
+        fs_ctx.search = false;
+
+        if(is_omnidrive_slim(ctx.drive_config) && sectors_at_once >= 32)
+        {
+            LOG("warning: setting dump read size to 16 for raw dumping");
+            sectors_at_once = 16;
+        }
+    }
+
     std::vector<uint8_t> file_data(sectors_at_once * cfg.sector_size);
     std::vector<State> file_state(sectors_at_once);
-    ...
-    // TODO: can be implemented later
-    if(raw)
-    {
-        rom_update = false;
-        fs_ctx.search = false;
-
-        if(is_omnidrive_slim(ctx.drive_config) && sectors_at_once >= 32)
-        {
-            LOG("warning: setting dump read size to 16 for raw dumping");
-            sectors_at_once = 16;
-        }
-    }

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.

🧹 Nitpick comments (1)
dvd/dvd_dump.ixx (1)

936-938: Signed/unsigned comparison is correct in practice but fragile.

lba is int32_t while sectors_count and sectors_to_read are uint32_t. When lba is negative (raw DVD pre-data area), implicit conversion to unsigned makes lba < sectors_count evaluate to false, which happens to be the desired behavior — but only by accident of two's complement wrapping.

An explicit cast or guard makes the intent clearer and future-proof:

Suggested clarification
-        // ensure requested sectors don't cross lead-out boundary
-        if(lba < sectors_count && lba + sectors_to_read > sectors_count)
-            sectors_to_read = sectors_count - lba;
+        // ensure requested sectors don't cross lead-out boundary
+        if(lba >= 0 && static_cast<uint32_t>(lba) < sectors_count && static_cast<uint32_t>(lba) + sectors_to_read > sectors_count)
+            sectors_to_read = sectors_count - static_cast<uint32_t>(lba);

@superg superg merged commit 4c6696e into superg:main Feb 17, 2026
11 checks passed
@Deterous Deterous deleted the omnidrive-fixes branch February 17, 2026 01:32
@coderabbitai coderabbitai bot mentioned this pull request Feb 25, 2026
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.

2 participants