diff --git a/pcsx2/CDVD/CDVDaccess.cpp b/pcsx2/CDVD/CDVDaccess.cpp index b111bd3292..cdcfd09b8c 100644 --- a/pcsx2/CDVD/CDVDaccess.cpp +++ b/pcsx2/CDVD/CDVDaccess.cpp @@ -124,7 +124,11 @@ int FindDiskType(int mType) { cdvdTD td,td2; DoCDVDgetTD(i,&td); - DoCDVDgetTD(i+1,&td2); + + if(tn.etrack>i) + DoCDVDgetTD(i+1,&td2); + else + DoCDVDgetTD(0,&td2); int tlength = td2.lsn - td.lsn; @@ -207,6 +211,9 @@ void DetectDiskType() s32 DoCDVDinit() { + // called even when not used + ISOinit(); + if(!loadFromISO) return CDVDinit(); @@ -307,6 +314,8 @@ void DoCDVDshutdown() { if (CDVDshutdown != NULL) CDVDshutdown(); } + + ISOshutdown(); } s32 DoCDVDreadSector(u8* buffer, u32 lsn, int mode) diff --git a/pcsx2/CDVD/CDVDisoReader.cpp b/pcsx2/CDVD/CDVDisoReader.cpp index 58b784f06b..14ceeb4e6f 100644 --- a/pcsx2/CDVD/CDVDisoReader.cpp +++ b/pcsx2/CDVD/CDVDisoReader.cpp @@ -34,32 +34,17 @@ bool loadFromISO=false; char isoFileName[256]; -char IsoCWD[256]; -char CdDev[256]; -_cdIso cdIso[8]; u8 *pbuffer; -int cdblocksize; -int cdblockofs; -int cdoffset; int cdtype; -int cdblocks; int psize; -int Zmode; // 1 Z - 2 bz2 -int fmode; // 0 - file / 1 - Zfile -char *Ztable; - int BlockDump; isoFile *iso; FILE *cdvdLog = NULL; -// This var is used to detect resume-style behavior of the Pcsx2 emulator, -// and skip prompting the user for a new CD when it's likely they want to run the existing one. -static char cdvdCurrentIso[MAX_PATH]; - char *methods[] = { ".Z - compress faster", @@ -123,14 +108,11 @@ s32 ISOinit() CDVD_LOG("CDVDinit\n"); #endif - cdvdCurrentIso[0] = 0; - memset(cdIso, 0, sizeof(cdIso)); return 0; } void ISOshutdown() { - cdvdCurrentIso[0] = 0; #ifdef CDVD_LOG if (cdvdLog != NULL) fclose(cdvdLog); #endif @@ -159,8 +141,6 @@ s32 ISOopen(const char* pTitle) void ISOclose() { - strcpy(cdvdCurrentIso, isoFileName); - isoClose(iso); } diff --git a/pcsx2/CDVD/CDVDisoReader.h b/pcsx2/CDVD/CDVDisoReader.h index 98d7afe71d..5a07bba26c 100644 --- a/pcsx2/CDVD/CDVDisoReader.h +++ b/pcsx2/CDVD/CDVDisoReader.h @@ -38,36 +38,10 @@ extern FILE *cdvdLog; void __Log(char *fmt, ...); -#define VERBOSE 1 - -typedef struct -{ - int slsn; - int elsn; -#ifdef _WIN32 - HANDLE handle; -#else - FILE *handle; -#endif -} _cdIso; - -extern _cdIso cdIso[8]; - -#define CD_FRAMESIZE_RAW 2352 -#define DATA_SIZE (CD_FRAMESIZE_RAW-12) - #define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */ #define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */ -#define MSF2SECT(m,s,f) (((m)*60+(s)-2)*75+(f)) - -extern const u8 version; -extern const u8 revision; -extern const u8 build; - extern char isoFileName[256]; -extern char IsoCWD[256]; -extern char CdDev[256]; extern int BlockDump; extern isoFile *blockDumpFile; @@ -75,15 +49,7 @@ extern isoFile *iso; extern u8 cdbuffer[]; extern u8 *pbuffer; -extern int cdblocksize; -extern int cdblockofs; -extern int cdoffset; extern int cdtype; -extern int cdblocks; - -extern int Zmode; // 1 Z - 2 bz2 -extern int fmode; // 0 - file / 1 - Zfile -extern char *Ztable; extern char *methods[]; diff --git a/pcsx2/Plugins.cpp b/pcsx2/Plugins.cpp index 7ca21df213..e691ca8d5e 100644 --- a/pcsx2/Plugins.cpp +++ b/pcsx2/Plugins.cpp @@ -929,7 +929,13 @@ void ClosePlugins( bool closegs ) } } - CLOSE_PLUGIN( CDVD ); + //CLOSE_PLUGIN( CDVD ); + if( OpenStatus.CDVD ) + { + DoCDVDclose(); + OpenStatus.CDVD = false; + } + CLOSE_PLUGIN( DEV9 ); CLOSE_PLUGIN( USB ); CLOSE_PLUGIN( FW );