#include "plugins.h"
#include "cdrom.h"
#include "cdriso.h"
+#include "ppf.h"
#ifdef _WIN32
#include <process.h>
#else
usleep(d * 1000);
#endif
+ // HACK: stop feeding data while emu is paused
+ extern int stop;
+ if (stop) {
+ usleep(100000);
+ continue;
+ }
t = GetTickCount() + CDDA_FRAMETIME;
return 0;
}
+static int opensbifile(const char *isoname) {
+ char sbiname[MAXPATHLEN];
+ int s;
+
+ strncpy(sbiname, isoname, sizeof(sbiname));
+ sbiname[MAXPATHLEN - 1] = '\0';
+ if (strlen(sbiname) >= 4) {
+ strcpy(sbiname + strlen(sbiname) - 4, ".sbi");
+ }
+ else {
+ return -1;
+ }
+
+ fseek(cdHandle, 0, SEEK_END);
+ s = ftell(cdHandle) / 2352;
+
+ return LoadSBI(sbiname, s);
+}
+
static void PrintTracks(void) {
int i;
if (!subChanMixed && opensubfile(GetIsoFile()) == 0) {
SysPrintf("[+sub]");
}
+ if (opensbifile(GetIsoFile()) == 0) {
+ SysPrintf("[+sbi]");
+ }
SysPrintf(".\n");
if (numtracks > 1 && ti[1].handle == NULL) {
ti[1].handle = fopen(GetIsoFile(), "rb");
}
+ cddaCurOffset = cddaStartOffset = 0;
return 0;
}
}
}
numtracks = 0;
+ UnloadSBI();
return 0;
}
// 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];
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;
}