notaz.gp2x.de
/
pcsx_rearmed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make RGB565 support into compile-time option - all libretro frontends
[pcsx_rearmed.git]
/
libpcsxcore
/
cdriso.c
diff --git
a/libpcsxcore/cdriso.c
b/libpcsxcore/cdriso.c
index
0089cfe
..
c9d94f2
100644
(file)
--- a/
libpcsxcore/cdriso.c
+++ b/
libpcsxcore/cdriso.c
@@
-59,8
+59,11
@@
static pthread_t threadid;
static unsigned int initial_offset = 0;
static boolean playing = FALSE;
static boolean cddaBigEndian = FALSE;
static unsigned int initial_offset = 0;
static boolean playing = FALSE;
static boolean cddaBigEndian = FALSE;
+// offsets of cddaHandle file
static unsigned int cdda_cur_sector;
static unsigned int cdda_cur_sector;
-static unsigned int cdda_start_sector;
+static unsigned int cdda_first_sector;
+// toc_sector - file_sector
+static unsigned int cdda_toc_delta;
/* Frame offset into CD image where pregap data would be found if it was there.
* If a game seeks there we must *not* return subchannel data since it's
* not in the CD image, so that cdrom code can fake subchannel data instead.
/* Frame offset into CD image where pregap data would be found if it was there.
* If a game seeks there we must *not* return subchannel data since it's
* not in the CD image, so that cdrom code can fake subchannel data instead.
@@
-181,17
+184,13
@@
static void *playthread(void *param)
if (d < CD_FRAMESIZE_RAW)
break;
if (d < CD_FRAMESIZE_RAW)
break;
+ if (cdda_cur_sector < cdda_first_sector)
+ memset(sndbuffer + s, 0, CD_FRAMESIZE_RAW);
+
s += d;
cdda_cur_sector++;
}
s += d;
cdda_cur_sector++;
}
- if (subHandle != NULL) {
- fseek(subHandle, cdda_cur_sector * SUB_FRAMESIZE, SEEK_SET);
- fread(subbuffer, 1, SUB_FRAMESIZE, subHandle);
-
- if (subChanRaw) DecodeRawSubData();
- }
-
if (s == 0) {
playing = FALSE;
initial_offset = 0;
if (s == 0) {
playing = FALSE;
initial_offset = 0;
@@
-1230,7
+1229,7
@@
static long CALLBACK ISOopen(void) {
if (numtracks > 1 && ti[1].handle == NULL) {
ti[1].handle = fopen(GetIsoFile(), "rb");
}
if (numtracks > 1 && ti[1].handle == NULL) {
ti[1].handle = fopen(GetIsoFile(), "rb");
}
- cdda_cur_sector = cdda_
start_sector
= 0;
+ cdda_cur_sector = cdda_
toc_delta
= 0;
return 0;
}
return 0;
}
@@
-1377,19
+1376,22
@@
static long CALLBACK ISOreadTrack(unsigned char *time) {
// sector: byte 0 - minute; byte 1 - second; byte 2 - frame
// does NOT uses bcd format
static long CALLBACK ISOplay(unsigned char *time) {
// sector: byte 0 - minute; byte 1 - second; byte 2 - frame
// does NOT uses bcd format
static long CALLBACK ISOplay(unsigned char *time) {
- unsigned int i, abs_sect;
- int file_sect;
+ unsigned int i, abs_sect
, start_sect = 0
;
+ int
track_offset,
file_sect;
if (numtracks <= 1)
return 0;
// find the track
abs_sect = msf2sec((char *)time);
if (numtracks <= 1)
return 0;
// find the track
abs_sect = msf2sec((char *)time);
- for (i = numtracks; i > 1; i--)
- if (msf2sec(ti[i].start) <= abs_sect + 2 * 75)
+ for (i = numtracks; i > 1; i--) {
+ start_sect = msf2sec(ti[i].start);
+ if (start_sect <= abs_sect + 2 * 75)
break;
break;
+ }
- file_sect = ti[i].start_offset + (abs_sect - msf2sec(ti[i].start));
+ track_offset = abs_sect - start_sect;
+ file_sect = ti[i].start_offset + track_offset;
if (file_sect < 0)
file_sect = 0;
if (file_sect < 0)
file_sect = 0;
@@
-1398,13
+1400,12
@@
static long CALLBACK ISOplay(unsigned char *time) {
if (ti[i].handle != NULL)
break;
if (ti[i].handle != NULL)
break;
- cdda_start_sector = abs_sect - file_sect;
- cddaHandle = ti[i].handle;
+ cdda_first_sector = 0;
+ if (i == 1)
+ cdda_first_sector = file_sect - track_offset;
- if (pregapOffset && (unsigned int)(pregapOffset - file_sect) < 2 * 75) {
- // get out of the missing pregap to avoid noise
- file_sect = pregapOffset;
- }
+ cdda_toc_delta = abs_sect - file_sect;
+ cddaHandle = ti[i].handle;
if (SPU_playCDDAchannel != NULL) {
startCDDA(file_sect);
if (SPU_playCDDAchannel != NULL) {
startCDDA(file_sect);
@@
-1440,7
+1441,7
@@
static long CALLBACK ISOgetStatus(struct CdrStat *stat) {
stat->Type = 0x01;
}
stat->Type = 0x01;
}
- sec = cdda_
start_sector + cdda_cur_sector
;
+ sec = cdda_
cur_sector + cdda_toc_delta
;
sec2msf(sec, (char *)stat->Time);
return 0;
sec2msf(sec, (char *)stat->Time);
return 0;