mirror of https://github.com/PCSX2/pcsx2.git
cdvdgigaherz: Don't calculate the track length
Not really necessary. Also fix 2 off-by-ones.
This commit is contained in:
parent
1f60e3101e
commit
327515366f
|
@ -292,11 +292,7 @@ s32 CALLBACK CDVDreadTrack(u32 lsn, int mode)
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (lsn > tracks[0].length) { // track 0 is total disc.
|
||||
return -1;
|
||||
}
|
||||
|
||||
return cdvdRequestSector(lsn, mode);
|
||||
return lsn < src->GetSectorCount() ? cdvdRequestSector(lsn, mode) : -1;
|
||||
}
|
||||
|
||||
// return can be NULL (for async modes)
|
||||
|
@ -344,7 +340,7 @@ s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ *subq)
|
|||
{
|
||||
// the formatted subq command returns: control/adr, track, index, trk min, trk sec, trk frm, 0x00, abs min, abs sec, abs frm
|
||||
|
||||
if (lsn > tracks[0].length) // track 0 is total disc.
|
||||
if (lsn >= src->GetSectorCount())
|
||||
return -1;
|
||||
|
||||
memset(subq, 0, sizeof(cdvdSubQ));
|
||||
|
@ -377,7 +373,7 @@ s32 CALLBACK CDVDgetTN(cdvdTN *Buffer)
|
|||
s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer)
|
||||
{
|
||||
if (Track == 0) {
|
||||
Buffer->lsn = tracks[0].length;
|
||||
Buffer->lsn = src->GetSectorCount();
|
||||
Buffer->type = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
struct track
|
||||
{
|
||||
u32 start_lba;
|
||||
u32 length;
|
||||
u8 type;
|
||||
};
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ DWORD CALLBACK cdvdThread(PVOID param)
|
|||
|
||||
s32 count = 16;
|
||||
|
||||
s32 left = tracks[0].length - info.lsn;
|
||||
s32 left = src->GetSectorCount() - info.lsn;
|
||||
|
||||
if (left < count)
|
||||
count = left;
|
||||
|
@ -268,7 +268,7 @@ void cdvdStopThread()
|
|||
|
||||
s32 cdvdRequestSector(u32 sector, s32 mode)
|
||||
{
|
||||
if (sector >= tracks[0].length)
|
||||
if (sector >= src->GetSectorCount())
|
||||
return -1;
|
||||
|
||||
sector &= ~15; //align to 16-sector block
|
||||
|
@ -321,7 +321,7 @@ s32 cdvdDirectReadSector(s32 first, s32 mode, char *buffer)
|
|||
{
|
||||
static char data[16 * 2352];
|
||||
|
||||
if ((u32)first >= tracks[0].length)
|
||||
if ((u32)first >= src->GetSectorCount())
|
||||
return -1;
|
||||
|
||||
s32 sector = first & (~15); //align to 16-sector block
|
||||
|
@ -333,7 +333,7 @@ s32 cdvdDirectReadSector(s32 first, s32 mode, char *buffer)
|
|||
|
||||
s32 count = 16;
|
||||
|
||||
s32 left = tracks[0].length - sector;
|
||||
s32 left = src->GetSectorCount() - sector;
|
||||
|
||||
if (left < count)
|
||||
count = left;
|
||||
|
|
|
@ -21,16 +21,12 @@ s32 cdvdParseTOC()
|
|||
{
|
||||
memset(&cdtoc, 0, sizeof(cdtoc));
|
||||
|
||||
s32 len = src->GetSectorCount();
|
||||
|
||||
tracks[0].length = len;
|
||||
tracks[0].start_lba = 0;
|
||||
tracks[0].type = 0;
|
||||
tracks[1].start_lba = 0;
|
||||
|
||||
if (len <= 0) {
|
||||
if (!src->GetSectorCount()) {
|
||||
curDiskType = CDVD_TYPE_NODISC;
|
||||
tracks[0].length = 0;
|
||||
strack = 1;
|
||||
etrack = 0;
|
||||
return 0;
|
||||
|
@ -39,7 +35,6 @@ s32 cdvdParseTOC()
|
|||
s32 mt = src->GetMediaType();
|
||||
|
||||
if (mt >= 0) {
|
||||
tracks[1].length = tracks[0].length;
|
||||
tracks[1].type = 0;
|
||||
|
||||
strack = 1;
|
||||
|
@ -81,7 +76,6 @@ s32 cdvdParseTOC()
|
|||
sec = cdtoc.Descriptors[i].Msf[1];
|
||||
frm = cdtoc.Descriptors[i].Msf[2];
|
||||
|
||||
tracks[0].length = MSF_TO_LBA(min, sec, frm);
|
||||
tracks[0].type = 0;
|
||||
}
|
||||
break;
|
||||
|
@ -102,8 +96,6 @@ s32 cdvdParseTOC()
|
|||
frm = cdtoc.Descriptors[i].Msf[2];
|
||||
|
||||
tracks[tn].start_lba = MSF_TO_LBA(min, sec, frm);
|
||||
if (tn > 1)
|
||||
tracks[tn - 1].length = tracks[tn].start_lba - tracks[tn - 1].start_lba;
|
||||
|
||||
if ((cdtoc.Descriptors[i].Control & 4) == 0) {
|
||||
tracks[tn].type = CDVD_AUDIO_TRACK;
|
||||
|
@ -120,8 +112,6 @@ s32 cdvdParseTOC()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tracks[etrack].length = tracks[0].length - tracks[etrack].start_lba;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue