Skip to content

Bugfix/cue handling fixes#26

Merged
lloydsmart merged 7 commits intodevelopfrom
bugfix/cue-handling-fixes
Mar 7, 2026
Merged

Bugfix/cue handling fixes#26
lloydsmart merged 7 commits intodevelopfrom
bugfix/cue-handling-fixes

Conversation

@lloydsmart
Copy link
Copy Markdown
Owner

Summary

This PR fixes incorrect handling of CUE-based disc sets in archives and improves CUE validation for audio track references.

Previously, archives containing a .cue plus component .iso files could produce multiple CHDs for what should have been a single disc image. The script also incorrectly warned on valid .wav audio tracks referenced by CUE sheets.

This change makes archive/extracted disc selection descriptor-aware, allows valid WAV-based mixed-mode CUE sets, and adds stricter validation for lossy or otherwise unverified CUE audio references, with an explicit override flag for permissive workflows.

Changes

  • prioritise descriptor files when selecting disc candidates

    • prefer CUE, then GDI, then CCD, then ISO
    • apply this both when reading archive contents and when discovering extracted files
  • fix incorrect multi-CHD output for CUE-based archives

    • archives containing a .cue plus component .iso files now produce a single CHD from the descriptor instead of extra unintended CHDs
  • improve CUE audio validation

    • allow .wav audio tracks referenced by CUE sheets
    • reject lossy/unverified audio references by default:
      • mp3
      • ogg
      • opus
      • m4a
      • flac (conservatively blocked until chdman input support is confirmed)
    • add --allow-unverified-cue-audio / -a to permit these references with warnings
  • improve logging and diagnostics

    • add debug logging for selected archive entries
    • add debug logging for expected CHD name mapping
    • add debug logging for selected extracted files
    • add debug logging when CUE validation passes
    • update generic validation failure messages so they are no longer limited to “missing files”

Why

This fixes three practical problems:

  1. Incorrect output selection

    • descriptor-backed disc sets were being treated as multiple independent inputs
  2. False warnings

    • valid WAV audio tracks in mixed-mode CUE sets were incorrectly logged as unsupported
  3. Safer validation

    • lossy or unverified CUE audio references are now blocked by default unless explicitly allowed

Example fixed

A translated PC Engine CD archive containing:

  • Castlevania Rondo of Blood [English].cue
  • multiple referenced .wav tracks
  • component .iso files inside the archive

previously produced multiple CHDs and noisy warnings.

It now:

  • selects only the .cue
  • produces a single CHD
  • allows the .wav tracks without false warnings

Testing

Verified

  • archive containing .cue + component .iso files

    • only the descriptor is selected
    • only one CHD is created
  • WAV-based mixed-mode CUE set

    • validation passes
    • no false unsupported-audio warnings
    • CHD conversion succeeds
  • CHD accounting for the above case

    • summary now reflects the intended single output

Notes

  • a separate failing test case (Bonk III - Bonk's Big Adventure (USA).zip) still fails in chdman createcd, but this appears unrelated to descriptor selection or WAV validation and should be investigated separately

New CLI option

./chdtool.sh --allow-unverified-cue-audio /path/to/input

…ives

- add helper to prefer CUE, then GDI, then CCD, then ISO entries
- build expected CHD outputs from filtered archive entries only
- avoid treating descriptor-backed component files as separate discs
- add debug logging for selected archive entries
- prefer CUE, then GDI, then CCD, then ISO after archive extraction
- keep extracted file discovery consistent with archive entry selection
- add debug logging for selected extracted disc files
- avoid reintroducing duplicate component-file handling in extracted sets

refactor: reuse descriptor-priority selection for disc candidates
- stop warning for WAV files referenced by CUE sheets
- log WAV audio tracks at DEBUG level instead
- continue warning for lossy/unsupported audio formats such as MP3 and OGG
- allow WAV audio tracks referenced by CUE sheets
- reject lossy audio formats such as MP3 and OGG
- reject FLAC conservatively until chdman input support is confirmed
- keep missing referenced files as hard validation failures
- add --allow-unverified-cue-audio / -a flag
- allow lossy or unverified CUE audio references when explicitly requested
- keep strict validation as the default behaviour
- log a warning when the override is enabled
@lloydsmart lloydsmart merged commit 719beaa into develop Mar 7, 2026
6 checks passed
@lloydsmart lloydsmart deleted the bugfix/cue-handling-fixes branch March 7, 2026 23:02
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