summaryrefslogtreecommitdiff
path: root/libpcsxcore/cdriso.c
diff options
context:
space:
mode:
authorSND\shalma_cp <SND\shalma_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-09-05 00:59:20 +0000
committerSND\shalma_cp <SND\shalma_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2010-09-05 00:59:20 +0000
commit37edbb7d48a17b7321ebeb5bcf992c7d77fd2662 (patch)
tree64eab93ebf70b7ac2e09b8ddc234830f9ef15aae /libpcsxcore/cdriso.c
parent133b4ad99615539e8b5b70475617b1378e4e86fd (diff)
downloadpcsxr-37edbb7d48a17b7321ebeb5bcf992c7d77fd2662.tar.gz
Vib Ribbon CD swapping needed fixing (CDROM)
- Game still not working (SPU CDDA timing problems.. maybe) dfsound: feed CDDA data to SPU RAM for decoded buffer IRQs git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@56823 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'libpcsxcore/cdriso.c')
-rw-r--r--libpcsxcore/cdriso.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c
index 18b0de92..a6812e1e 100644
--- a/libpcsxcore/cdriso.c
+++ b/libpcsxcore/cdriso.c
@@ -31,6 +31,9 @@
#include <sys/time.h>
#endif
+#define btoi(b) ((b) / 16 * 10 + (b) % 16) /* BCD to u_char */
+#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
+
static FILE *cdHandle = NULL;
static FILE *cddaHandle = NULL;
static FILE *subHandle = NULL;
@@ -172,12 +175,16 @@ static void *playthread(void *param)
s += d;
- // skip the subchannel data
- fseek(cddaHandle, SUB_FRAMESIZE, SEEK_CUR);
+ fread( subbuffer, 1, SUB_FRAMESIZE, cddaHandle );
}
}
else {
s = fread(sndbuffer, 1, sizeof(sndbuffer), cddaHandle);
+
+ if (subHandle != NULL) {
+ fseek(subHandle, sec * SUB_FRAMESIZE, SEEK_SET);
+ fread(subbuffer, 1, SUB_FRAMESIZE, subHandle);
+ }
}
if (s == 0) {
@@ -740,7 +747,26 @@ 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 ) {
+ unsigned int pos, size;
+ unsigned char time[3];
+
+ // Vib Ribbon: return size of CD
+ // - ex. 20 min, 22 sec, 66 fra
+ pos = ftell( cdHandle );
+ fseek( cdHandle, 0, SEEK_END );
+ size = ftell( cdHandle );
+ fseek( cdHandle, pos, SEEK_SET );
+
+ // relative -> absolute time (+2 seconds)
+ size += 150 * 2352;
+
+ sec2msf( size / 2352, 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];