From c0ee7ac6dbe0e4ec289f7cfd2ee1224890751025 Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 15 Mar 2013 01:49:37 +0200 Subject: [PATCH] cdriso: handle no disk state better --- libpcsxcore/cdriso.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); -- 2.39.5