X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=libpcsxcore%2Fcdriso.c;h=dde21bcde7314b71b433533642ca827ff0efb1e5;hp=90c9d856fc3f2c067b8035b866616b4e5d68df48;hb=b861c0a92c13df8a8b3c59b87ad7924a3861a5ac;hpb=deebc67fc5c5027248842562e02d71d5f683a1e2 diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index 90c9d856..dde21bcd 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -470,10 +470,12 @@ static int parsecue(const char *isofile) { // build a path for files referenced in .cue strncpy(filepath, cuename, sizeof(filepath)); - tmp = strrchr(filepath, '/') + 1; - if (tmp == NULL) - tmp = strrchr(filepath, '\\') + 1; + tmp = strrchr(filepath, '/'); if (tmp == NULL) + tmp = strrchr(filepath, '\\'); + if (tmp != NULL) + tmp++; + else tmp = filepath; *tmp = 0; filepath[sizeof(filepath) - 1] = 0; @@ -1314,8 +1316,12 @@ static long CALLBACK ISOclose(void) { } } numtracks = 0; + ti[1].type = 0; UnloadSBI(); + memset(cdbuffer, 0, sizeof(cdbuffer)); + CDR_getBuffer = ISOgetBuffer; + return 0; } @@ -1398,6 +1404,7 @@ static void DecodeRawSubData(void) { // uses bcd format static long CALLBACK ISOreadTrack(unsigned char *time) { int sector = MSF2SECT(btoi(time[0]), btoi(time[1]), btoi(time[2])); + long ret; if (cdHandle == NULL) { return -1; @@ -1412,7 +1419,9 @@ static long CALLBACK ISOreadTrack(unsigned char *time) { } } - cdimg_read_func(cdHandle, 0, cdbuffer, sector); + ret = cdimg_read_func(cdHandle, 0, cdbuffer, sector); + if (ret < 0) + return -1; if (subHandle != NULL) { fseek(subHandle, sector * SUB_FRAMESIZE, SEEK_SET);