MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / cdvdReadInterrupt

Function cdvdReadInterrupt

pcsx2/CDVD/CDVD.cpp:1282–1441  ·  view source on GitHub ↗

inlined due to being referenced in only one place.

Source from the content-addressed store, hash-verified

1280
1281// inlined due to being referenced in only one place.
1282__fi void cdvdReadInterrupt()
1283{
1284 //Console.WriteLn("cdvdReadInterrupt %x %x %x %x %x", cpuRegs.interrupt, cdvd.Readed, cdvd.Reading, cdvd.nSectors, (HW_DMA3_BCR_H16 * HW_DMA3_BCR_L16) *4);
1285
1286 cdvdUpdateReady(CDVD_DRIVE_BUSY);
1287 cdvdUpdateStatus(CDVD_STATUS_READ);
1288 cdvd.WaitingDMA = false;
1289
1290 if (!cdvd.SeekCompleted)
1291 {
1292 // Seeking finished. Process the track we requested before, and
1293 // then schedule another CDVD read int for when the block read finishes.
1294
1295 // NOTE: The first CD track was read when the seek was initiated, so no need
1296 // to call CDVDReadTrack here.
1297
1298 cdvd.Spinning = true;
1299 cdvd.CurrentRetryCnt = 0;
1300 cdvd.Reading = 1;
1301 cdvd.SeekCompleted = 1;
1302 cdvd.CurrentSector = cdvd.SeekToSector;
1303 CDVD_LOG("Cdvd Seek Complete at iopcycle=%8.8x.", psxRegs.cycle);
1304 }
1305
1306 if (cdvd.AbortRequested)
1307 {
1308 // Code in the CDVD controller suggest there is an alignment thing with DVD's but this seems to just break stuff (Auto Modellista).
1309 // Needs more investigation
1310 //if (!cdvdIsDVD() || !(cdvd.Sector & 0xF))
1311 {
1312 Console.Warning("Read Abort");
1313 cdvd.Error = 0x1; // Abort Error
1314 cdvdUpdateReady(CDVD_DRIVE_READY | CDVD_DRIVE_ERROR);
1315 cdvdUpdateStatus(CDVD_STATUS_PAUSE);
1316 cdvd.WaitingDMA = false;
1317 CDVDCancelReadAhead();
1318 cdvdSetIrq();
1319 return;
1320 }
1321 }
1322
1323 if (cdvd.CurrentSector >= cdvd.MaxSector)
1324 {
1325 DevCon.Warning("Read past end of disc Sector %d Max Sector %d", cdvd.CurrentSector, cdvd.MaxSector);
1326 cdvd.Error = 0x32; // Outermost track reached during playback
1327 cdvdUpdateReady(CDVD_DRIVE_READY | CDVD_DRIVE_ERROR);
1328 cdvdUpdateStatus(CDVD_STATUS_PAUSE);
1329 cdvd.WaitingDMA = false;
1330 cdvdSetIrq();
1331 return;
1332 }
1333
1334 if (cdvd.Reading)
1335 {
1336 if (cdvd.ReadErr == 0)
1337 {
1338 while ((cdvd.ReadErr = DoCDVDgetBuffer(&cdr.Transfer[0])), cdvd.ReadErr == -2)
1339 {

Callers

nothing calls this directly

Calls 11

cdvdUpdateReadyFunction · 0.85
cdvdUpdateStatusFunction · 0.85
CDVDCancelReadAheadFunction · 0.85
cdvdSetIrqFunction · 0.85
DoCDVDgetBufferFunction · 0.85
DoCDVDreadTrackFunction · 0.85
CDVDREAD_INTFunction · 0.85
cdvdReadSectorFunction · 0.85
CDVDSECTORREADY_INTFunction · 0.85
psxRemainingCyclesFunction · 0.85
WarningMethod · 0.45

Tested by

no test coverage detected