Skip to content

omnidrive CD support#353

Merged
superg merged 2 commits intomainfrom
omnidrive_cd
Feb 22, 2026
Merged

omnidrive CD support#353
superg merged 2 commits intomainfrom
omnidrive_cd

Conversation

@superg
Copy link
Owner

@superg superg commented Feb 22, 2026

WIP

Summary by CodeRabbit

  • Bug Fixes

    • Improved disc reading reliability by eliminating unnecessary forced cache flushes during retries and preserving existing behavior when no flush is requested.
  • Improvements

    • Added optional pre-read cache flush control for sector reads, enabling finer-grained cache handling for better compatibility and consistent performance across drives.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

The sector-read API was changed to add a boolean flush_cache parameter to read_sector. Implementations optionally flush drive/cache when true. All call sites were updated to pass the new argument and previous read_sector_new usages were replaced.

Changes

Cohort / File(s) Summary
Core API
cd/cd_common.ixx
Exported read_sector signature updated to add bool flush_cache. Implementation conditionally issues a pre-read cache flush when flush_cache is true; preserves prior behavior when false.
Dump & Retry Logic
cd/cd_dump.ixx, cd/cd_dump_extra.ixx
Removed forced pre-read flush on retry; replaced read_sector_new calls with read_sector(..., r != 0) / read_sector(..., false) as appropriate to pass retry-aware flag.
Readers
readers/disc_read_cdda_reader.ixx
Replaced read_sector_new(...) with read_sector(..., false) in the reader loop; status/unscrambled handling unchanged.
Rings / Scrambled Reads
rings.ixx
Replaced read_sector_new(...) with read_sector(..., false) inside read_scrambled; control flow and error handling unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble bytes beneath the moonlit rack,
One extra flag to tell the cache to back—
read_sector now hops with purpose new,
No read_sector_new to chase askew.
A tiny tweak, a cleaner track ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'omnidrive CD support' directly aligns with the main objective of adding omnidrive CD functionality, which is reflected in the branch name and the primary changes to support cache flushing for omnidrive-compatible operations.
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 omnidrive_cd

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)
cd/cd_dump.ixx (1)

386-386: Implicit uint32_t → bool conversion for flush_cache — suggest making intent explicit.

r (a uint32_t retry counter) is passed directly as the bool flush_cache argument. The conversion is well-defined (0 → false, non-zero → true), so the behaviour is correct — flush cache on retries only — but the intent is opaque at the call site and may trigger a narrowing-conversion warning.

♻️ Proposed clarification
-            auto status = read_sector(*ctx.sptd, sector_buffer.data(), unscrambled, ctx.drive_config, lba, r);
+            auto status = read_sector(*ctx.sptd, sector_buffer.data(), unscrambled, ctx.drive_config, lba, r != 0);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cd/cd_dump.ixx` at line 386, The call to read_sector currently passes the
uint32_t retry counter r as the bool flush_cache parameter causing an implicit
conversion; make the intent explicit by converting r to a bool (e.g.,
static_cast<bool>(r) or (r != 0)) at the call site where read_sector(*ctx.sptd,
sector_buffer.data(), unscrambled, ctx.drive_config, lba, r) is invoked so it’s
clear that flush_cache should be true when r is non-zero.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@cd/cd_dump.ixx`:
- Line 386: The call to read_sector currently passes the uint32_t retry counter
r as the bool flush_cache parameter causing an implicit conversion; make the
intent explicit by converting r to a bool (e.g., static_cast<bool>(r) or (r !=
0)) at the call site where read_sector(*ctx.sptd, sector_buffer.data(),
unscrambled, ctx.drive_config, lba, r) is invoked so it’s clear that flush_cache
should be true when r is non-zero.

@superg superg merged commit 8e792ef into main Feb 22, 2026
11 checks passed
@superg superg deleted the omnidrive_cd branch February 28, 2026 15:26
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