CDVD: Only take ADR and track index/num from host IOCTL SUBQ

Fixes the OSDSYS CD player minute:second counter
This commit is contained in:
Ty Lamontagne 2024-11-24 18:26:58 -05:00 committed by Ty
parent 849fa57bf6
commit c9642b70f6
3 changed files with 21 additions and 32 deletions

View File

@ -273,8 +273,6 @@ static s32 DISCreadSubQ(u32 lsn, cdvdSubQ* subq)
memset(subq, 0, sizeof(cdvdSubQ));
if (!src->ReadTrackSubQ(subq))
{
lsn_to_msf(&subq->discM, &subq->discS, &subq->discF, lsn + 150);
u8 i = strack;
@ -285,8 +283,18 @@ static s32 DISCreadSubQ(u32 lsn, cdvdSubQ* subq)
lsn_to_msf(&subq->trackM, &subq->trackS, &subq->trackF, lsn);
subq->adr = 1;
subq->ctrl = tracks[i].type;
// It's important to note that we do _not_ use the current MSF values
// from the host's device. We use the MSF values from the lsn.
// An easy way to test an implementation is to see if the OSDSYS
// CD player can display the correct minute and second values.
// From my testing, the IOCTL returns 0 for ctrl. This also breaks
// the OSDSYS player. The only "safe" values to receive from the IOCTL
// are ADR, trackNum and trackIndex.
if (!src->ReadTrackSubQ(subq))
{
subq->adr = 1;
subq->trackNum = i;
subq->trackIndex = 1;
}

View File

@ -208,18 +208,8 @@ bool IOCtlSrc::ReadTrackSubQ(cdvdSubQ* subQ) const
}
subQ->adr = osSubQ.cdsc_adr;
subQ->ctrl = osSubQ.cdsc_ctrl;
subQ->trackNum = osSubQ.cdsc_trk;
subQ->trackIndex = osSubQ.cdsc_ind;
subQ->discM = osSubQ.cdsc_absaddr.msf.minute;
subQ->discS = osSubQ.cdsc_absaddr.msf.second;
subQ->discF = osSubQ.cdsc_absaddr.msf.frame;
subQ->trackM = osSubQ.cdsc_reladdr.msf.minute;
subQ->trackS = osSubQ.cdsc_reladdr.msf.second;
subQ->trackF = osSubQ.cdsc_reladdr.msf.frame;
return true;
}

View File

@ -320,17 +320,8 @@ bool IOCtlSrc::ReadTrackSubQ(cdvdSubQ* subQ) const
else
{
subQ->adr = osSubQ.CurrentPosition.ADR;
subQ->ctrl = osSubQ.CurrentPosition.Control;
subQ->trackNum = osSubQ.CurrentPosition.TrackNumber;
subQ->trackIndex = osSubQ.CurrentPosition.IndexNumber;
subQ->trackM = osSubQ.CurrentPosition.TrackRelativeAddress[0];
subQ->trackS = osSubQ.CurrentPosition.TrackRelativeAddress[1];
subQ->trackF = osSubQ.CurrentPosition.TrackRelativeAddress[2];
subQ->discM = osSubQ.CurrentPosition.AbsoluteAddress[0];
subQ->discS = osSubQ.CurrentPosition.AbsoluteAddress[1];
subQ->discF = osSubQ.CurrentPosition.AbsoluteAddress[2];
}
return true;