summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-11-26 07:49:42 +0000
committerSND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2009-11-26 07:49:42 +0000
commited3cea4b5034e2be8b90e458016f36949a538be1 (patch)
tree691526c7b1f7737e2a78a29f1ed81e271512f7e2
parentefc5951deee4a4953f76f5899094e8bbda2d455a (diff)
downloadpcsxr-ed3cea4b5034e2be8b90e458016f36949a538be1.tar.gz
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@38253 e17a0e51-4ae3-4d35-97c3-1a29b211df97
-rw-r--r--ChangeLog1
-rw-r--r--libpcsxcore/cdriso.c26
2 files changed, 24 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b821f6e8..b39626a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,7 @@ November 26, 2009 Wei Mingzhi <weimingzhi@gmail.com>
* plugins/dfcdrom/Makefile.am: Likewise.
* libpcsxcore/psxbios.c: Fixed MSVC6 errors when psxbios logging is enabled.
* debian/changelog: Changed version number.
+ * libpcsxcore/cdriso.c: Added support for reporting current CDDA play time.
November 25, 2009 Wei Mingzhi <weimingzhi@gmail.com>
diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c
index fee82551..53de714e 100644
--- a/libpcsxcore/cdriso.c
+++ b/libpcsxcore/cdriso.c
@@ -56,9 +56,10 @@ static HANDLE threadid;
#else
static pthread_t threadid;
#endif
-static int initial_offset = 0;
+static unsigned int initial_offset = 0;
static volatile char playing = 0;
static char cddaBigEndian = 0;
+static volatile unsigned int cddaCurOffset = 0;
char* CALLBACK CDR__getDriveLetter(void);
long CALLBACK CDR__configure(void);
@@ -204,6 +205,8 @@ static void *playthread(void *param)
SPU_playCDDAchannel((short *)sndbuffer, s);
}
+
+ cddaCurOffset += s;
}
#ifdef _WIN32
@@ -250,9 +253,11 @@ static void startCDDA(unsigned int offset) {
}
initial_offset = offset;
+ cddaCurOffset = initial_offset;
fseek(cddaHandle, initial_offset, SEEK_SET);
playing = 1;
+
#ifdef _WIN32
threadid = (HANDLE)_beginthread(playthread, 0, NULL);
#else
@@ -767,7 +772,7 @@ static long CALLBACK ISOstop(void) {
}
// gets subchannel data
-unsigned char* CALLBACK ISOgetBufferSub(void) {
+static unsigned char* CALLBACK ISOgetBufferSub(void) {
if (subHandle != NULL || subChanInterleaved) {
return subbuffer;
}
@@ -775,6 +780,21 @@ unsigned char* CALLBACK ISOgetBufferSub(void) {
return NULL;
}
+static long CALLBACK ISOgetStatus(struct CdrStat *stat) {
+ int sec;
+
+ CDR__getStatus(stat);
+
+ if (playing) {
+ stat->Type = 0x02;
+ stat->Status |= 0x80;
+ sec = cddaCurOffset / CD_FRAMESIZE_RAW;
+ sec2msf(sec, (char *)stat->Time);
+ }
+
+ return 0;
+}
+
void imageReaderInit(void) {
assert(hCDRDriver == NULL);
@@ -789,8 +809,8 @@ void imageReaderInit(void) {
CDR_play = ISOplay;
CDR_stop = ISOstop;
CDR_getBufferSub = ISOgetBufferSub;
+ CDR_getStatus = ISOgetStatus;
- CDR_getStatus = CDR__getStatus;
CDR_getDriveLetter = CDR__getDriveLetter;
CDR_configure = CDR__configure;
CDR_test = CDR__test;