aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore/cdriso.c
diff options
context:
space:
mode:
authornotaz2011-01-26 01:18:53 +0200
committernotaz2011-01-26 01:59:27 +0200
commit858ad5116a9f17609b101a7df7016092c694a415 (patch)
tree44b7262113db30e9ec8e13f38ea424a0685c12d3 /libpcsxcore/cdriso.c
parent53951880c5aa14c9add7ee9714459c94ba3a3052 (diff)
downloadpcsx_rearmed-858ad5116a9f17609b101a7df7016092c694a415.tar.gz
pcsx_rearmed-858ad5116a9f17609b101a7df7016092c694a415.tar.bz2
pcsx_rearmed-858ad5116a9f17609b101a7df7016092c694a415.zip
cdriso: adjust getTD and getStatus to pcsxr-svn
Diffstat (limited to 'libpcsxcore/cdriso.c')
-rw-r--r--libpcsxcore/cdriso.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c
index 091fd66..1e9aded 100644
--- a/libpcsxcore/cdriso.c
+++ b/libpcsxcore/cdriso.c
@@ -739,6 +739,7 @@ static long CALLBACK ISOopen(void) {
if (numtracks > 1 && ti[1].handle == NULL) {
ti[1].handle = fopen(GetIsoFile(), "rb");
}
+ cddaCurOffset = cddaStartOffset = 0;
return 0;
}
@@ -803,7 +804,17 @@ static long CALLBACK ISOgetTN(unsigned char *buffer) {
// byte 1 - second
// byte 2 - minute
static long CALLBACK ISOgetTD(unsigned char track, unsigned char *buffer) {
- if (numtracks > 0 && track <= numtracks) {
+ if (track == 0) {
+ // CD length according pcsxr-svn (done a bit different here)
+ unsigned int sect;
+ unsigned char time[3];
+ sect = msf2sec(ti[numtracks].start) + msf2sec(ti[numtracks].length);
+ sec2msf(sect, time);
+ buffer[2] = time[0];
+ buffer[1] = time[1];
+ buffer[0] = time[2];
+ }
+ else if (numtracks > 0 && track <= numtracks) {
buffer[2] = ti[track].start[0];
buffer[1] = ti[track].start[1];
buffer[0] = ti[track].start[2];
@@ -926,13 +937,14 @@ static long CALLBACK ISOgetStatus(struct CdrStat *stat) {
if (playing) {
stat->Type = 0x02;
stat->Status |= 0x80;
- sec = (cddaStartOffset + cddaCurOffset) / CD_FRAMESIZE_RAW;
- sec2msf(sec, (char *)stat->Time);
}
else {
stat->Type = 0x01;
}
+ sec = (cddaStartOffset + cddaCurOffset) / CD_FRAMESIZE_RAW;
+ sec2msf(sec, (char *)stat->Time);
+
return 0;
}