X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fcdriso.c;h=8e11f5a66aba0aa7e07be9348ee96dbcacc131ef;hb=0e720fb13f7933930608b62854ea8f4a9d97c934;hp=8cd9ab5bc0da47b617c3ffe87e847d3d347e6eee;hpb=aeb8209980cab1c6e30f4d05a50c2b3c2a366d6a;p=pcsx_rearmed.git diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index 8cd9ab5b..8e11f5a6 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -36,18 +36,16 @@ #include #include #define strcasecmp _stricmp -#else +#elif P_HAVE_PTHREAD #include #include #include #endif -#ifndef _WIN32 // to enable the USE_READ_THREAD code, fix: // - https://github.com/notaz/pcsx_rearmed/issues/257 // - ISOgetBufferSub to not race with async code -//#define USE_READ_THREAD -#endif +#define USE_READ_THREAD 0 //P_HAVE_PTHREAD #ifdef USE_LIBRETRO_VFS #include @@ -124,7 +122,7 @@ struct trackinfo { char start[3]; // MSF-format char length[3]; // MSF-format FILE *handle; // for multi-track images CDDA - unsigned int start_offset; // byte offset from start of above file + unsigned int start_offset; // byte offset from start of above file (chd: sector offset) }; #define MAXTRACKS 100 /* How many tracks can a CD hold? */ @@ -1079,7 +1077,7 @@ static int opensbifile(const char *isoname) { return LoadSBI(sbiname, s); } -#ifndef USE_READ_THREAD +#if !USE_READ_THREAD static void readThreadStop() {} static void readThreadStart() {} #else @@ -1431,7 +1429,7 @@ static int cdread_chd(FILE *f, unsigned int base, void *dest, int sector) { int hunk; - assert(base == 0); + sector += base; hunk = sector / chd_img->sectors_per_hunk; chd_img->sector_in_hunk = sector % chd_img->sectors_per_hunk; @@ -1497,7 +1495,7 @@ static int cdread_2048(FILE *f, unsigned int base, void *dest, int sector) return 12*2 + ret; } -#ifdef USE_READ_THREAD +#if USE_READ_THREAD static int cdread_async(FILE *f, unsigned int base, void *dest, int sector) { boolean found = FALSE; @@ -1555,7 +1553,7 @@ static unsigned char * CALLBACK ISOgetBuffer_chd(void) { } #endif -#ifdef USE_READ_THREAD +#if USE_READ_THREAD static unsigned char * CALLBACK ISOgetBuffer_async(void) { unsigned char *buffer; pthread_mutex_lock(§orbuffer_lock); @@ -1563,7 +1561,6 @@ static unsigned char * CALLBACK ISOgetBuffer_async(void) { pthread_mutex_unlock(§orbuffer_lock); return buffer + 12; } - #endif static unsigned char * CALLBACK ISOgetBuffer(void) {