summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\notaz_cp <SND\notaz_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-03-11 23:36:10 +0000
committerSND\notaz_cp <SND\notaz_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-03-11 23:36:10 +0000
commitf95ebb9d83f9637366580b44d0a4489b689ea4b8 (patch)
treec64924c600b9900f7bf8b57f40dfd7b23df971ad
parent2cf09c4ba88d3bcdcf4252a2b52745ac6eb69152 (diff)
downloadpcsxr-f95ebb9d83f9637366580b44d0a4489b689ea4b8.tar.gz
cdrom: use single read/play cursor, handle cdlRead for cdda
cdlRead on cdda tested on real hardware git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@83456 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rwxr-xr-xlibpcsxcore/cdrom.c68
-rwxr-xr-xlibpcsxcore/cdrom.h5
2 files changed, 38 insertions, 35 deletions
diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c
index cb019ad2..d0539bf4 100755
--- a/libpcsxcore/cdrom.c
+++ b/libpcsxcore/cdrom.c
@@ -558,7 +558,10 @@ void cdrPlayInterrupt()
setIrq();
}
- memcpy(cdr.SetSectorPlay, cdr.SetSector, 4);
+ if (cdr.SetlocPending) {
+ memcpy(cdr.SetSectorPlay, cdr.SetSector, 4);
+ cdr.SetlocPending = 0;
+ }
Find_CurTrack(cdr.SetSectorPlay);
ReadTrack(cdr.SetSectorPlay);
cdr.TrackChanged = FALSE;
@@ -650,13 +653,17 @@ void cdrInterrupt() {
case CdlSetloc:
break;
+ do_CdlPlay:
case CdlPlay:
StopCdda();
if (cdr.Seeked == SEEK_PENDING) {
// XXX: wrong, should seek instead..
- memcpy( cdr.SetSectorPlay, cdr.SetSector, 4 );
cdr.Seeked = SEEK_DONE;
}
+ if (cdr.SetlocPending) {
+ memcpy(cdr.SetSectorPlay, cdr.SetSector, 4);
+ cdr.SetlocPending = 0;
+ }
// BIOS CD Player
// - Pause player, hit Track 01/02/../xx (Setloc issued!!)
@@ -983,24 +990,23 @@ void cdrInterrupt() {
case CdlReadN:
case CdlReadS:
+ if (cdr.SetlocPending) {
+ memcpy(cdr.SetSectorPlay, cdr.SetSector, 4);
+ cdr.SetlocPending = 0;
+ }
+ Find_CurTrack(cdr.SetSectorPlay);
+
+ if ((cdr.Mode & MODE_CDDA) && cdr.CurTrack > 1)
+ // Read* acts as play for cdda tracks in cdda mode
+ goto do_CdlPlay;
+
cdr.Reading = 1;
cdr.FirstSector = 1;
-
- /* FIXME: break Twisted Metal 2
- // Mortal Kombat Trilogy - resume CDDA playback from pause
- if ((cdr.Mode & MODE_CDDA)) {
-#ifdef CDR_LOG
- CDR_LOG("Resuming CDDA playback at track %d.\n", cdr.CurTrack);
-#endif
- AddIrqQueue(CdlPlay, cdReadTime * 75 / 4);
- break;
- } else {
- */
- // Fighting Force 2 - update subq time immediately
- // - fixes new game
- Find_CurTrack(cdr.SetSector);
- ReadTrack(cdr.SetSector);
- //}
+
+ // Fighting Force 2 - update subq time immediately
+ // - fixes new game
+ ReadTrack(cdr.SetSectorPlay);
+
// Crusaders of Might and Magic - update getlocl now
// - fixes cutscene speech
@@ -1155,7 +1161,7 @@ void cdrReadInterrupt() {
cdr.Result[0] = cdr.StatP;
cdr.Seeked = SEEK_DONE;
- ReadTrack(cdr.SetSector);
+ ReadTrack(cdr.SetSectorPlay);
buf = CDR_getBuffer();
if (buf == NULL)
@@ -1199,13 +1205,13 @@ void cdrReadInterrupt() {
}
}
- cdr.SetSector[2]++;
- if (cdr.SetSector[2] == 75) {
- cdr.SetSector[2] = 0;
- cdr.SetSector[1]++;
- if (cdr.SetSector[1] == 60) {
- cdr.SetSector[1] = 0;
- cdr.SetSector[0]++;
+ cdr.SetSectorPlay[2]++;
+ if (cdr.SetSectorPlay[2] == 75) {
+ cdr.SetSectorPlay[2] = 0;
+ cdr.SetSectorPlay[1]++;
+ if (cdr.SetSectorPlay[1] == 60) {
+ cdr.SetSectorPlay[1] = 0;
+ cdr.SetSectorPlay[0]++;
}
}
@@ -1226,7 +1232,7 @@ void cdrReadInterrupt() {
}
// update for CdlGetlocP
- ReadTrack(cdr.SetSector);
+ ReadTrack(cdr.SetSectorPlay);
}
/*
@@ -1322,18 +1328,14 @@ void cdrWrite1(unsigned char rt) {
for (i = 0; i < 3; i++)
set_loc[i] = btoi(cdr.Param[i]);
- // FIXME: clean up this SetSector/SetSectorPlay mess,
- // there should be single var tracking current sector pos
- if (cdr.Play)
- i = msf2sec(cdr.SetSectorPlay);
- else
- i = msf2sec(cdr.SetSector);
+ i = msf2sec(cdr.SetSectorPlay);
i = abs(i - msf2sec(set_loc));
if (i > 16)
cdr.Seeked = SEEK_PENDING;
memcpy(cdr.SetSector, set_loc, 3);
cdr.SetSector[3] = 0;
+ cdr.SetlocPending = 1;
break;
case CdlReadN:
diff --git a/libpcsxcore/cdrom.h b/libpcsxcore/cdrom.h
index 31336c0c..290758ce 100755
--- a/libpcsxcore/cdrom.h
+++ b/libpcsxcore/cdrom.h
@@ -66,13 +66,14 @@ typedef struct {
unsigned char ResultReady;
unsigned char Cmd;
unsigned char Readed;
+ unsigned char SetlocPending;
u32 Reading;
unsigned char ResultTN[6];
unsigned char ResultTD[4];
- unsigned char SetSector[4];
- unsigned char SetSectorEnd[4];
unsigned char SetSectorPlay[4];
+ unsigned char SetSectorEnd[4];
+ unsigned char SetSector[4];
unsigned char Track;
boolean Play, Muted;
int CurTrack;