From: notaz Date: Thu, 14 Mar 2013 23:49:37 +0000 (+0200) Subject: cdriso: handle no disk state better X-Git-Tag: r19~5 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0ee7ac6dbe0e4ec289f7cfd2ee1224890751025;p=pcsx_rearmed.git cdriso: handle no disk state better --- diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index 21203da8..dde21bcd 100644 --- a/libpcsxcore/cdriso.c +++ b/libpcsxcore/cdriso.c @@ -1316,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; } @@ -1400,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; @@ -1414,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);