From b75b8d80e87c4bfb7d040385cb09b6f24eafe604 Mon Sep 17 00:00:00 2001 From: Maxime Gauduin Date: Sat, 6 Jan 2024 16:39:07 +0100 Subject: util/cdrom.cpp: Don't strip pregaps from Redump GD-ROM files (#11913) --- src/lib/util/cdrom.cpp | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/src/lib/util/cdrom.cpp b/src/lib/util/cdrom.cpp index 636e6385a09..36a51104d3c 100644 --- a/src/lib/util/cdrom.cpp +++ b/src/lib/util/cdrom.cpp @@ -2914,45 +2914,6 @@ std::error_condition cdrom_file::parse_gdicue(std::string_view tocfname, toc &ou disc_pattern = TYPE_I; } - /* - * Strip pregaps from Redump tracks and adjust the LBA offset to match TOSEC layout - */ - for (trknum = 1; trknum < outtoc.numtrks; trknum++) - { - uint32_t prev_pregap = outtoc.tracks[trknum-1].pregap; - uint32_t prev_offset = prev_pregap * (outtoc.tracks[trknum-1].datasize + outtoc.tracks[trknum-1].subsize); - uint32_t this_pregap = outtoc.tracks[trknum].pregap; - uint32_t this_offset = this_pregap * (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); - - if (outtoc.tracks[trknum-1].pgtype != CD_TRACK_AUDIO) - { - // pad previous DATA track to match TOSEC layout - outtoc.tracks[trknum-1].frames += this_pregap; - outtoc.tracks[trknum-1].padframes += this_pregap; - } - - if (outtoc.tracks[trknum-1].pgtype == CD_TRACK_AUDIO && outtoc.tracks[trknum].pgtype == CD_TRACK_AUDIO) - { - // shift previous AUDIO track to match TOSEC layout - outinfo.track[trknum-1].offset += prev_offset; - outtoc.tracks[trknum-1].splitframes += prev_pregap; - } - - if (outtoc.tracks[trknum-1].pgtype == CD_TRACK_AUDIO && outtoc.tracks[trknum].pgtype != CD_TRACK_AUDIO) - { - // shrink previous AUDIO track to match TOSEC layout - outtoc.tracks[trknum-1].frames -= prev_pregap; - outinfo.track[trknum-1].offset += prev_offset; - } - - if (outtoc.tracks[trknum].pgtype == CD_TRACK_AUDIO && trknum == outtoc.numtrks-1) - { - // shrink final AUDIO track to match TOSEC layout - outtoc.tracks[trknum].frames -= this_pregap; - outinfo.track[trknum].offset += this_offset; - } - } - /* * Special handling for TYPE_III_SPLIT, pregap in last track contains 75 frames audio and 150 frames data */ @@ -2972,7 +2933,7 @@ std::error_condition cdrom_file::parse_gdicue(std::string_view tocfname, toc &ou } /* - * TOC now matches TOSEC layout, set LBA for every track with HIGH-DENSITY area @ LBA 45000 + * Set LBA for every track with HIGH-DENSITY area @ LBA 45000 */ for (trknum = 1; trknum < outtoc.numtrks; trknum++) { @@ -2987,10 +2948,6 @@ std::error_condition cdrom_file::parse_gdicue(std::string_view tocfname, toc &ou { outtoc.tracks[trknum].physframeofs = outtoc.tracks[trknum-1].physframeofs + outtoc.tracks[trknum-1].frames; } - - // no longer need the pregap info, zeroed out to match TOSEC layout - outtoc.tracks[trknum].pregap = 0; - outtoc.tracks[trknum].pgtype = 0; } if (EXTRA_VERBOSE) -- cgit v1.2.3