System: Don't try to read SYSTEM.CNF from Audio CD

This commit is contained in:
Stenzek 2024-09-26 13:39:01 +10:00
parent 991927151c
commit 4d74b203af
No known key found for this signature in database
2 changed files with 10 additions and 1 deletions

View File

@ -1086,8 +1086,11 @@ DiscRegion System::GetRegionFromSystemArea(CDImage* cdi)
{
// The license code is on sector 4 of the disc.
u8 sector[CDImage::DATA_SECTOR_SIZE];
if (!cdi->Seek(1, 4) || cdi->Read(CDImage::ReadMode::DataOnly, 1, sector) != 1)
if (cdi->GetTrackMode(1) == CDImage::TrackMode::Audio || !cdi->Seek(1, 4) ||
cdi->Read(CDImage::ReadMode::DataOnly, 1, sector) != 1)
{
return DiscRegion::Other;
}
static constexpr char ntsc_u_string[] = " Licensed by Sony Computer Entertainment Amer ica ";
static constexpr char ntsc_j_string[] = " Licensed by Sony Computer Entertainment Inc.";

View File

@ -29,6 +29,12 @@ bool IsoReader::Open(CDImage* image, u32 track_number, Error* error)
m_image = image;
m_track_number = track_number;
if (image->GetTrackMode(static_cast<u8>(track_number)) == CDImage::TrackMode::Audio)
{
Error::SetStringFmt(error, "Track {} is an audio track.", track_number);
return false;
}
if (!ReadPVD(error))
return false;