diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-11-26 07:49:42 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2009-11-26 07:49:42 +0000 |
| commit | ed3cea4b5034e2be8b90e458016f36949a538be1 (patch) | |
| tree | 691526c7b1f7737e2a78a29f1ed81e271512f7e2 /libpcsxcore | |
| parent | efc5951deee4a4953f76f5899094e8bbda2d455a (diff) | |
| download | pcsxr-ed3cea4b5034e2be8b90e458016f36949a538be1.tar.gz | |
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@38253 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'libpcsxcore')
| -rw-r--r-- | libpcsxcore/cdriso.c | 26 |
1 files changed, 23 insertions, 3 deletions
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; |
