diff options
author | nhand42 <38346367+nhand42@users.noreply.github.com> | 2020-12-18 03:48:47 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-17 18:48:47 +0200 |
commit | ccacd0f16550cd104c7a0b1b10358b7e18aeabf3 (patch) | |
tree | 1787d8117ee659590316925601a4736c635a98b8 /src/tools | |
parent | 0e09ae932831a1f0907d330d5c392281340f3ef4 (diff) |
support Redump extended bin/cue format for Dreamcast discs (#7422)
* initial check-in of Redump bin/cue support for Dreamcast GDI
* correctly identifies multi-cue format and sets GDROM flags
* creates a working Crazy Taxi chd from a Redump bin/cue
* disabled debugging code and started tidying up
* simple tool to compare chdman bin/cue and bin/gdi conversions, should be identical
* final tidy up, the testing is going well
* testing failed for Aero Dancing i (Japan), didnt zero last track
* added some comments about .gdi compatibility
* addressing review feedback on pull request #7422
* match TOSEC layout for Pattern I discs (3 tracks)
* initial support for Pattern III discs
* Pattern III discs now work and match TOSEC layout
* reading datasize from wrong track, same result though
* identify the GDI pattern, makes the code clearer
* support for Pattern II and consecutive AUDIO tracks
* use C99 type not POSIX type to build on Windows
* support Redump tracks split across two .bin files
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/chdman.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp index 06f2373f5ca..516e2f5b057 100644 --- a/src/tools/chdman.cpp +++ b/src/tools/chdman.cpp @@ -395,10 +395,27 @@ public: uint64_t src_track_start = m_info.track[tracknum].offset; uint64_t src_track_end = src_track_start + bytesperframe * (uint64_t)trackinfo.frames; uint64_t pad_track_start = src_track_end - ((uint64_t)m_toc.tracks[tracknum].padframes * bytesperframe); + uint64_t split_track_start = pad_track_start - ((uint64_t)m_toc.tracks[tracknum].splitframes * bytesperframe); + + // dont split when split-bin read not required + if ((uint64_t)m_toc.tracks[tracknum].splitframes == 0L) + split_track_start = UINT64_MAX; + while (length_remaining != 0 && offset < endoffs) { // determine start of current frame uint64_t src_frame_start = src_track_start + ((offset - startoffs) / CD_FRAME_SIZE) * bytesperframe; + + // auto-advance next track for split-bin read + if (src_frame_start == split_track_start && m_lastfile.compare(m_info.track[tracknum+1].fname)!=0) + { + m_file.reset(); + m_lastfile = m_info.track[tracknum+1].fname; + osd_file::error filerr = util::core_file::open(m_lastfile, OPEN_FLAG_READ, m_file); + if (filerr != osd_file::error::NONE) + report_error(1, "Error opening input file (%s)'", m_lastfile.c_str()); + } + if (src_frame_start < src_track_end) { // read it in, or pad if we're into the padframes @@ -408,7 +425,9 @@ public: } else { - m_file->seek(src_frame_start, SEEK_SET); + m_file->seek((src_frame_start >= split_track_start) + ? src_frame_start - split_track_start + : src_frame_start, SEEK_SET); uint32_t count = m_file->read(dest, bytesperframe); if (count != bytesperframe) report_error(1, "Error reading input file (%s)'", m_lastfile.c_str()); |