summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2012-02-26 18:23:18 +0000
committer R. Belmont <rb6502@users.noreply.github.com>2012-02-26 18:23:18 +0000
commit782c568876540011b3949568bd32dfd8233f194a (patch)
tree60a350800c8bb42675ead37ae3c9806b6f2a46c1
parent939ed1febea667135af2e2d1f8d197c2a9bab93c (diff)
chdman: Properly handle and warn on bin/cue output of images with subcode data [R. Belmont]
-rw-r--r--src/tools/chdman.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/tools/chdman.c b/src/tools/chdman.c
index bea8f1a796d..095d77975ce 100644
--- a/src/tools/chdman.c
+++ b/src/tools/chdman.c
@@ -2240,8 +2240,23 @@ static void do_extract_cd(parameters_t &params)
const cdrom_track_info &trackinfo = toc->tracks[tracknum];
output_track_metadata(cuemode, output_toc_file, tracknum, trackinfo, *output_bin_file_str, discoffs, outputoffs);
+ UINT32 output_frame_size;
+
+ // If this is bin/cue output and the CHD contains subdata, warn the user and don't include
+ // the subdata size in the buffer calculation.
+ if ((trackinfo.subtype != CD_SUB_NONE) && (cuemode))
+ {
+ printf("Warning: Track %d has subcode data. bin/cue format cannot contain subcode data and it will be omitted.\n", tracknum+1);
+ printf(" : This may affect usage of the output image. Use bin/toc output to keep all data.\n");
+
+ output_frame_size = trackinfo.datasize;
+ }
+ else
+ {
+ output_frame_size = trackinfo.datasize + ((trackinfo.subtype != CD_SUB_NONE) ? trackinfo.subsize : 0);
+ }
+
// resize the buffer for the track
- UINT32 output_frame_size = trackinfo.datasize + ((trackinfo.subtype != CD_SUB_NONE) ? trackinfo.subsize : 0);
buffer.resize((TEMP_BUFFER_SIZE / output_frame_size) * output_frame_size);
// now read and output the actual data
@@ -2265,10 +2280,10 @@ static void do_extract_cd(parameters_t &params)
discoffs++;
// read the subcode data
- if (trackinfo.subtype != CD_SUB_NONE)
+ if ((trackinfo.subtype != CD_SUB_NONE) && (!cuemode))
{
- cdrom_read_subcode(cdrom, cdrom_get_track_start(cdrom, tracknum) + frame, &buffer[bufferoffs]);
- bufferoffs += trackinfo.subsize;
+ cdrom_read_subcode(cdrom, cdrom_get_track_start(cdrom, tracknum) + frame, &buffer[bufferoffs]);
+ bufferoffs += trackinfo.subsize;
}
// write it out if we need to