Skip to content

Commit

Permalink
CUERipper: Fix incorrect TOC entry of first track
Browse files Browse the repository at this point in the history
In rare cases, the first track is reported to start at a frame lower
than 150. This leads to an incorrect TOC entry. In such cases, the
StartSector is assigned a wrong value of e.g. 16777141 (16777216 - 75).

- Set StartSector to 0 in cases,
  where a value larger than (16777216 - 150) is reported.
- Fixes gchudov#236
- See also:
  https://hydrogenaud.io/index.php/topic,125779.0.html
  • Loading branch information
c72578 committed May 19, 2024
1 parent f52b795 commit 2987a5c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Bwg.Scsi/TocEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ public TocEntry(IntPtr buffer, int offset, int size, bool mode) : base(buffer, s
if (mode)
StartMSF = new MinuteSecondFrame(Get8(offset + 5), Get8(offset + 6), Get8(offset + 7));
else
StartSector = Get32(offset + 4) ;
{
StartSector = Get32(offset + 4);
if (StartSector > 16777216 - 150)
{
// Fix incorrect TOC, where the first track is reported to start at a frame smaller than 150
StartSector = 0;
}
}
}
}
}

0 comments on commit 2987a5c

Please sign in to comment.