Skip to content

Dvd lba start end#308

Merged
superg merged 3 commits intomainfrom
dvd_lba_start_end
Dec 6, 2025
Merged

Dvd lba start end#308
superg merged 3 commits intomainfrom
dvd_lba_start_end

Conversation

@superg
Copy link
Owner

@superg superg commented Dec 6, 2025

Summary by CodeRabbit

  • Refactor
    • Standardized internal addressing and naming across disc handling to improve consistency; no change to user-facing behavior.
  • Chores
    • Added a missing header to support internal operations.
  • Notes
    • No functional or behavioral changes exposed to end users.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 6, 2025

Walkthrough

Refactors DVD dumping and Xbox context naming to use LBA/PSN-aligned fields and range-based LBA logic, and adds a missing <string> include to the SD-616 flash module. Also updates a public progress_output signature in the DVD dump module.

Changes

Cohort / File(s) Summary
Header dependency
drive/flash_sd616.ixx
Added #include <string>; no functional changes.
DVD dumping refactor
dvd/dvd_dump.ixx
Replaced sector/count-centered flow with explicit LBA ranges (lba, lba_end); renamed many internal variables (e.g., sector_shiftlba_shift); moved logging and displays to LBA/PSN terminology; updated reads/writes and lock logic to use LBA; changed public signature progress_output(uint32_t sector, uint32_t sectors_count, uint32_t errors)progress_output(uint32_t lba, uint32_t lba_end, uint32_t errors).
Xbox context alignment
dvd/xbox.ixx
Renamed Context members lock_sector_startlock_lba_start and layer1_video_startlayer1_video_lba_start; initialize logic now uses psn_first / ss_psn_first for padding and start calculations.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay close attention to all updated boundary checks and loop termination in dvd/dvd_dump.ixx to ensure LBA-range progression and off-by-one handling are correct.
  • Verify all call sites updated for the progress_output signature change.
  • Confirm Context member renames in dvd/xbox.ixx don't break external uses or serialization; check any references across the codebase.
  • Validate locking and Kreon-specific logic now operating on LBA boundaries.

Possibly related PRs

Poem

🐇
I hopped through bytes with nimble paws,
Renamed a field without a pause;
LBA and PSN now hold hands tight,
Progress marches on — all right!
A tiny include, a tidy night.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Dvd lba start end' is vague and uses generic technical terms without clarifying the main purpose of the changes. Consider a more descriptive title like 'Refactor DVD dump logic to use LBA-based addressing instead of sector-based' to clearly communicate the primary change.
✅ 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.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dvd_lba_start_end

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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e629ba4 and 70bd4fc.

📒 Files selected for processing (3)
  • drive/flash_sd616.ixx (1 hunks)
  • dvd/dvd_dump.ixx (17 hunks)
  • dvd/xbox.ixx (3 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: superg
Repo: superg/redumper PR: 302
File: dvd/dvd_dump.ixx:395-405
Timestamp: 2025-11-28T01:02:39.542Z
Learning: In dvd/dvd_dump.ixx, the sector count determination logic (around lines 641-647) is intentionally centralized to support multiple sources: READ_CAPACITY, physical structures, and future options like ISO/UDF filesystem size. For Xbox/Kreon XGD discs, the physical structure sector count is correct to use because xbox::initialize() updates the layer0_ld.layer0_end_sector with the true value from the security sector before sectors_count_physical is calculated.
Learnt from: superg
Repo: superg/redumper PR: 283
File: scsi/cmd.ixx:558-571
Timestamp: 2025-09-07T19:05:32.220Z
Learning: In the scsi/cmd.ixx file, there are multiple functions that use pointer-byte indexing for endianness conversion that could be prone to endianness issues. The maintainer prefers to address these systematically in a centralized manner rather than piecemeal fixes.
📚 Learning: 2025-12-06T17:20:03.210Z
Learnt from: superg
Repo: superg/redumper PR: 307
File: drive/flash_sd616.ixx:26-27
Timestamp: 2025-12-06T17:20:03.210Z
Learning: In drive/flash_sd616.ixx, the SD-616T model is intentionally excluded from the automatic support guard (only SD-616F is explicitly allowed) because SD-616T support is untested. Users must use --force-flash to flash SD-616T drives until testing confirms it works properly.

Applied to files:

  • drive/flash_sd616.ixx
📚 Learning: 2025-11-28T01:02:39.542Z
Learnt from: superg
Repo: superg/redumper PR: 302
File: dvd/dvd_dump.ixx:395-405
Timestamp: 2025-11-28T01:02:39.542Z
Learning: In dvd/dvd_dump.ixx, the sector count determination logic (around lines 641-647) is intentionally centralized to support multiple sources: READ_CAPACITY, physical structures, and future options like ISO/UDF filesystem size. For Xbox/Kreon XGD discs, the physical structure sector count is correct to use because xbox::initialize() updates the layer0_ld.layer0_end_sector with the true value from the security sector before sectors_count_physical is calculated.

Applied to files:

  • dvd/xbox.ixx
  • dvd/dvd_dump.ixx
📚 Learning: 2025-09-07T19:05:32.220Z
Learnt from: superg
Repo: superg/redumper PR: 283
File: scsi/cmd.ixx:558-571
Timestamp: 2025-09-07T19:05:32.220Z
Learning: In the scsi/cmd.ixx file, there are multiple functions that use pointer-byte indexing for endianness conversion that could be prone to endianness issues. The maintainer prefers to address these systematically in a centralized manner rather than piecemeal fixes.

Applied to files:

  • dvd/dvd_dump.ixx
📚 Learning: 2025-12-06T17:38:03.895Z
Learnt from: superg
Repo: superg/redumper PR: 307
File: drive/flash_plextor.ixx:0-0
Timestamp: 2025-12-06T17:38:03.895Z
Learning: In drive/flash_plextor.ixx, the default block size of 0x1000 (from PLEXTOR_SUPPORTED_DRIVES.begin()->second) is intentionally used as a safe fallback when force_flash is enabled and the drive product_id is not found in the supported drives map. This default is considered safe enough for force-flash use with Plextor drives.

Applied to files:

  • dvd/dvd_dump.ixx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: build-macos (arm64)
  • GitHub Check: build-macos (x64)
  • GitHub Check: build-linux (x86, ubuntu-24.04)
  • GitHub Check: build-linux (x64, ubuntu-24.04)
  • GitHub Check: build-linux (arm64, ubuntu-24.04-arm)
  • GitHub Check: build-windows (arm64, ARM64)
  • GitHub Check: build-windows (x64, x64)
  • GitHub Check: build-windows (x86, Win32)
🔇 Additional comments (11)
drive/flash_sd616.ixx (1)

5-5: LGTM!

The <string> header is correctly added as std::string is used for SAMSUNG_SUPPORTED_DRIVES and function parameter types in this module.

dvd/xbox.ixx (2)

26-31: LGTM!

The renamed struct members (lock_lba_start, layer1_video_lba_start) are more descriptive and align with the LBA-centric terminology used throughout the codebase.


296-314: LGTM!

The variable renaming from lba_first/ss_lba_first to psn_first/ss_psn_first correctly reflects that data_start_sector contains Physical Sector Numbers. The calculations remain equivalent, and the resulting LBA-named struct members are assigned appropriately after PSN-to-LBA conversions.

dvd/dvd_dump.ixx (8)

164-176: LGTM!

The renaming to psn_first/psn_last correctly reflects that data_start_sector and data_end_sector contain Physical Sector Numbers. The length calculation logic remains unchanged.


195-207: Potential label/value mismatch in log output.

The log message at line 205 labels the values as "LBA" but now displays psn_first and psn_last (Physical Sector Numbers). For DVD layer structures, PSN and LBA are different addressing schemes. Consider updating the label to "PSN" for consistency with the variable names, or verify this is intentional display of PSN values with an "LBA" label.


361-366: LGTM!

The progress_output function signature and implementation correctly reflect the shift to LBA-based range tracking. The completion check and percentage calculation are correct.


397-404: LGTM!

Clean renaming of capacity variables to use LBA terminology.


582-586: LGTM!

The layer break calculation correctly uses the renamed psn_first variable while preserving the original computation logic.


689-721: LGTM!

The renamed lba_shift variable and updated references to xbox->lock_lba_start and xbox->layer1_video_lba_start are consistent with the struct member renaming in dvd/xbox.ixx. The Kreon drive locking logic is preserved correctly.


730-854: LGTM!

The read/write entry operations and verbose logging consistently use the LBA-based indices and terminology. The refactor maintains the original logic while improving naming consistency throughout the dump loop.


866-866: LGTM!

The final progress output correctly displays 100% completion by passing lba_end as both the current position and the target.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70bd4fc and 72130ae.

📒 Files selected for processing (1)
  • dvd/dvd_dump.ixx (17 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: superg
Repo: superg/redumper PR: 302
File: dvd/dvd_dump.ixx:395-405
Timestamp: 2025-11-28T01:02:39.542Z
Learning: In dvd/dvd_dump.ixx, the sector count determination logic (around lines 641-647) is intentionally centralized to support multiple sources: READ_CAPACITY, physical structures, and future options like ISO/UDF filesystem size. For Xbox/Kreon XGD discs, the physical structure sector count is correct to use because xbox::initialize() updates the layer0_ld.layer0_end_sector with the true value from the security sector before sectors_count_physical is calculated.
📚 Learning: 2025-11-28T01:02:39.542Z
Learnt from: superg
Repo: superg/redumper PR: 302
File: dvd/dvd_dump.ixx:395-405
Timestamp: 2025-11-28T01:02:39.542Z
Learning: In dvd/dvd_dump.ixx, the sector count determination logic (around lines 641-647) is intentionally centralized to support multiple sources: READ_CAPACITY, physical structures, and future options like ISO/UDF filesystem size. For Xbox/Kreon XGD discs, the physical structure sector count is correct to use because xbox::initialize() updates the layer0_ld.layer0_end_sector with the true value from the security sector before sectors_count_physical is calculated.

Applied to files:

  • dvd/dvd_dump.ixx
📚 Learning: 2025-09-07T19:05:32.220Z
Learnt from: superg
Repo: superg/redumper PR: 283
File: scsi/cmd.ixx:558-571
Timestamp: 2025-09-07T19:05:32.220Z
Learning: In the scsi/cmd.ixx file, there are multiple functions that use pointer-byte indexing for endianness conversion that could be prone to endianness issues. The maintainer prefers to address these systematically in a centralized manner rather than piecemeal fixes.

Applied to files:

  • dvd/dvd_dump.ixx
📚 Learning: 2025-12-06T17:38:03.895Z
Learnt from: superg
Repo: superg/redumper PR: 307
File: drive/flash_plextor.ixx:0-0
Timestamp: 2025-12-06T17:38:03.895Z
Learning: In drive/flash_plextor.ixx, the default block size of 0x1000 (from PLEXTOR_SUPPORTED_DRIVES.begin()->second) is intentionally used as a safe fallback when force_flash is enabled and the drive product_id is not found in the supported drives map. This default is considered safe enough for force-flash use with Plextor drives.

Applied to files:

  • dvd/dvd_dump.ixx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: build-macos (arm64)
  • GitHub Check: build-linux (x86, ubuntu-24.04)
  • GitHub Check: build-linux (arm64, ubuntu-24.04-arm)
  • GitHub Check: build-macos (x64)
  • GitHub Check: build-linux (x64, ubuntu-24.04)
  • GitHub Check: build-windows (x64, x64)
  • GitHub Check: build-windows (x86, Win32)
  • GitHub Check: build-windows (arm64, ARM64)
🔇 Additional comments (3)
dvd/dvd_dump.ixx (3)

166-176: Good refactoring to PSN terminology, but verify log message accuracy.

The renaming from lba_first/lba_last to psn_first/psn_last improves semantic clarity by distinguishing Physical Sector Numbers from Logical Block Addresses. However, at line 205, the log message displays "LBA:" while using PSN values. Confirm this is intentional and that PSN values are being displayed in LBA context, or update the log message to clarify the distinction.

Also applies to: 195-207


361-366: LGTM! Function signature correctly updated to LBA-based parameters.

The progress_output function signature change from sector-based to LBA-based parameters is consistent with the overall refactoring. The logic correctly handles progress calculation and animation, and all call sites have been updated appropriately.


698-867: LGTM! Main loop correctly refactored to LBA-based iteration.

The main dump loop has been thoroughly refactored from sector-based to LBA-based logic:

  • Loop control uses lba_start and lba_end correctly with exclusive end boundary
  • All arithmetic operations (lba + i, lba_end - lba, lba + lba_shift) are correct
  • Protection range checks properly use lba + offset
  • Kreon drive locking logic correctly operates on LBA boundaries
  • All read/write operations consistently use LBA-based indexing
  • Log messages uniformly updated to [LBA: ...] format

The refactoring maintains the original logic while improving terminology consistency.

@superg superg merged commit b42a493 into main Dec 6, 2025
11 checks passed
@superg superg deleted the dvd_lba_start_end branch December 12, 2025 01:14
This was referenced Jan 18, 2026
@coderabbitai coderabbitai bot mentioned this pull request Feb 7, 2026
This was referenced Feb 23, 2026
@coderabbitai coderabbitai bot mentioned this pull request Mar 8, 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.

1 participant