mirror of https://github.com/PCSX2/pcsx2.git
Start improving the CDVD interface. Change the internal ISO interface to use it.
I will later work on getting the typical plugins to support these new functions. I have tried to also update the linux side, but I can't compile or test it so it might not work properly. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1511 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
eda0b1ab13
commit
3f28c12fe7
|
@ -393,6 +393,17 @@ void CALLBACK CDVDabout();
|
|||
s32 CALLBACK CDVDtest();
|
||||
void CALLBACK CDVDnewDiskCB(void (*callback)());
|
||||
|
||||
// new funcs
|
||||
|
||||
// read a track directly
|
||||
s32 CALLBACK CDVDreadSector(u8* buffer, s32 lsn, int mode);
|
||||
|
||||
// improved getBuffer
|
||||
s32 CALLBACK CDVDgetBuffer2(u8* buffer);
|
||||
|
||||
// tool function
|
||||
s32 CALLBACK CDVDgetDualInfo(s32* dualType, u32* _layer1start);
|
||||
|
||||
#endif
|
||||
|
||||
/* DEV9 plugin API */
|
||||
|
@ -615,12 +626,16 @@ typedef s32 (CALLBACK* _CDVDgetDiskType)();
|
|||
typedef s32 (CALLBACK* _CDVDgetTrayStatus)();
|
||||
typedef s32 (CALLBACK* _CDVDctrlTrayOpen)();
|
||||
typedef s32 (CALLBACK* _CDVDctrlTrayClose)();
|
||||
typedef s32 (CALLBACK* _CDVDreadSector)(u8* buffer, u32 lsn, int mode);
|
||||
typedef s32 (CALLBACK* _CDVDgetBuffer2)(u8* buffer);
|
||||
typedef s32 (CALLBACK* _CDVDgetDualInfo)(s32* dualType, u32* _layer1start);
|
||||
|
||||
typedef void (CALLBACK* _CDVDconfigure)();
|
||||
typedef s32 (CALLBACK* _CDVDtest)();
|
||||
typedef void (CALLBACK* _CDVDabout)();
|
||||
typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)());
|
||||
|
||||
|
||||
// DEV9
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
|
@ -802,25 +817,37 @@ extern _SPU2test SPU2test;
|
|||
extern _SPU2about SPU2about;
|
||||
|
||||
// CDVD
|
||||
extern _CDVDinit CDVDinit;
|
||||
extern _CDVDopen CDVDopen;
|
||||
extern _CDVDclose CDVDclose;
|
||||
extern _CDVDshutdown CDVDshutdown;
|
||||
extern _CDVDreadTrack CDVDreadTrack;
|
||||
extern _CDVDgetBuffer CDVDgetBuffer;
|
||||
extern _CDVDreadSubQ CDVDreadSubQ;
|
||||
extern _CDVDgetTN CDVDgetTN;
|
||||
extern _CDVDgetTD CDVDgetTD;
|
||||
extern _CDVDgetTOC CDVDgetTOC;
|
||||
extern _CDVDgetDiskType CDVDgetDiskType;
|
||||
extern _CDVDgetTrayStatus CDVDgetTrayStatus;
|
||||
extern _CDVDctrlTrayOpen CDVDctrlTrayOpen;
|
||||
extern _CDVDctrlTrayClose CDVDctrlTrayClose;
|
||||
struct CDVDplugin {
|
||||
_CDVDinit init;
|
||||
_CDVDopen open;
|
||||
_CDVDclose close;
|
||||
_CDVDshutdown shutdown;
|
||||
_CDVDreadTrack readTrack;
|
||||
_CDVDgetBuffer getBuffer;
|
||||
_CDVDreadSubQ readSubQ;
|
||||
_CDVDgetTN getTN;
|
||||
_CDVDgetTD getTD;
|
||||
_CDVDgetTOC getTOC;
|
||||
_CDVDgetDiskType getDiskType;
|
||||
_CDVDgetTrayStatus getTrayStatus;
|
||||
_CDVDctrlTrayOpen ctrlTrayOpen;
|
||||
_CDVDctrlTrayClose ctrlTrayClose;
|
||||
|
||||
extern _CDVDconfigure CDVDconfigure;
|
||||
extern _CDVDtest CDVDtest;
|
||||
extern _CDVDabout CDVDabout;
|
||||
extern _CDVDnewDiskCB CDVDnewDiskCB;
|
||||
_CDVDconfigure configure;
|
||||
_CDVDtest test;
|
||||
_CDVDabout about;
|
||||
_CDVDnewDiskCB newDiskCB;
|
||||
|
||||
// special functions, not in external interface yet
|
||||
_CDVDreadSector readSector;
|
||||
_CDVDgetBuffer2 getBuffer2;
|
||||
_CDVDgetDualInfo getDualInfo;
|
||||
|
||||
int* initCount;
|
||||
};
|
||||
extern CDVDplugin CDVD_plugin; // _plugin because of
|
||||
extern CDVDplugin CDVD;
|
||||
extern CDVDplugin ISO;
|
||||
|
||||
// DEV9
|
||||
extern _DEV9init DEV9init;
|
||||
|
|
|
@ -403,28 +403,28 @@ void cdvdReadKey(u8 arg0, u16 arg1, u32 arg2, u8* key) {
|
|||
|
||||
s32 cdvdGetToc(void* toc)
|
||||
{
|
||||
s32 ret = DoCDVDgetTOC(toc);
|
||||
s32 ret = CDVD.getTOC(toc);
|
||||
if (ret == -1) ret = 0x80;
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 cdvdReadSubQ(s32 lsn, cdvdSubQ* subq)
|
||||
{
|
||||
s32 ret = DoCDVDreadSubQ(lsn, subq);
|
||||
s32 ret = CDVD.readSubQ(lsn, subq);
|
||||
if (ret == -1) ret = 0x80;
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 cdvdCtrlTrayOpen()
|
||||
{
|
||||
s32 ret = DoCDVDctrlTrayOpen();
|
||||
s32 ret = CDVD.ctrlTrayOpen();
|
||||
if (ret == -1) ret = 0x80;
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 cdvdCtrlTrayClose()
|
||||
{
|
||||
s32 ret = DoCDVDctrlTrayClose();
|
||||
s32 ret = CDVD.ctrlTrayClose();
|
||||
if (ret == -1) ret = 0x80;
|
||||
return ret;
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ s32 cdvdCtrlTrayClose()
|
|||
// checks if tray was opened since last call to this func
|
||||
s32 cdvdGetTrayStatus()
|
||||
{
|
||||
s32 ret = DoCDVDgetTrayStatus();
|
||||
s32 ret = CDVD.getTrayStatus();
|
||||
|
||||
if (ret == -1)
|
||||
return(CDVD_TRAY_CLOSE);
|
||||
|
@ -460,41 +460,10 @@ static __forceinline void cdvdGetDiskType()
|
|||
// 0 if not on dual layer disc
|
||||
static s32 cdvdReadDvdDualInfo(s32* dualType, u32* layer1Start)
|
||||
{
|
||||
u8 toc[2064];
|
||||
*dualType = 0;
|
||||
*layer1Start = 0;
|
||||
|
||||
if(loadFromISO)
|
||||
{
|
||||
return ISOgetDualInfo(dualType,layer1Start);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if error getting toc, settle for single layer disc ;)
|
||||
if(cdvdGetToc(toc))
|
||||
return 0;
|
||||
if(toc[14] & 0x60)
|
||||
{
|
||||
if(toc[14] & 0x10)
|
||||
{
|
||||
// otp dvd
|
||||
*dualType = 2;
|
||||
*layer1Start = (toc[25]<<16) + (toc[26]<<8) + (toc[27]) - 0x30000 + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ptp dvd
|
||||
*dualType = 1;
|
||||
*layer1Start = (toc[21]<<16) + (toc[22]<<8) + (toc[23]) - 0x30000 + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// single layer dvd
|
||||
*dualType = 0;
|
||||
*layer1Start = (toc[21]<<16) + (toc[22]<<8) + (toc[23]) - 0x30000 + 1;
|
||||
}
|
||||
}
|
||||
CDVD.getDualInfo(dualType,layer1Start);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -554,7 +523,7 @@ void SaveState::cdvdFreeze()
|
|||
void cdvdNewDiskCB()
|
||||
{
|
||||
DoCDVDresetDiskTypeCache();
|
||||
cdvd.Type = CDVDgetDiskType();
|
||||
cdvd.Type = CDVD.getDiskType();
|
||||
|
||||
|
||||
char str[g_MaxPath];
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "IopCommon.h"
|
||||
#include "CDVD/CDVDaccess.h"
|
||||
|
||||
extern bool loadFromISO;
|
||||
extern char isoFileName[];
|
||||
|
||||
#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
static int diskTypeCached=-1;
|
||||
|
||||
static int psize;
|
||||
int lastReadSize;
|
||||
static int plsn=0;
|
||||
|
||||
static isoFile *blockDumpFile;
|
||||
|
@ -100,12 +100,12 @@ int FindDiskType(int mType)
|
|||
|
||||
cdvdTN tn;
|
||||
|
||||
DoCDVDgetTN(&tn);
|
||||
CDVD.getTN(&tn);
|
||||
|
||||
if((mt<0) || ((mt == CDVD_TYPE_DETCTDVDS) && (tn.strack != tn.etrack)))
|
||||
{
|
||||
cdvdTD td;
|
||||
DoCDVDgetTD(0,&td);
|
||||
CDVD.getTD(0,&td);
|
||||
if(td.lsn>452849)
|
||||
{
|
||||
iCDType = CDVD_TYPE_DETCTDVDS;
|
||||
|
@ -127,12 +127,12 @@ int FindDiskType(int mType)
|
|||
for(int i=tn.strack;i<=tn.etrack;i++)
|
||||
{
|
||||
cdvdTD td,td2;
|
||||
DoCDVDgetTD(i,&td);
|
||||
CDVD.getTD(i,&td);
|
||||
|
||||
if(tn.etrack>i)
|
||||
DoCDVDgetTD(i+1,&td2);
|
||||
CDVD.getTD(i+1,&td2);
|
||||
else
|
||||
DoCDVDgetTD(0,&td2);
|
||||
CDVD.getTD(0,&td2);
|
||||
|
||||
int tlength = td2.lsn - td.lsn;
|
||||
|
||||
|
@ -174,13 +174,13 @@ int FindDiskType(int mType)
|
|||
|
||||
void DetectDiskType()
|
||||
{
|
||||
if (DoCDVDgetTrayStatus() == CDVD_TRAY_OPEN)
|
||||
if (CDVD.getTrayStatus() == CDVD_TRAY_OPEN)
|
||||
{
|
||||
diskTypeCached = CDVD_TYPE_NODISC;
|
||||
return;
|
||||
}
|
||||
|
||||
int baseMediaType = DoCDVDgetDiskType();
|
||||
int baseMediaType = CDVD.getDiskType();
|
||||
int mType = -1;
|
||||
|
||||
switch(baseMediaType) // Paranoid mode: do not trust the plugin's detection system to work correctly.
|
||||
|
@ -212,31 +212,25 @@ void DetectDiskType()
|
|||
//
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
int cdvdInitCount=0;
|
||||
|
||||
s32 DoCDVDinit()
|
||||
{
|
||||
// called even when not used
|
||||
ISOinit();
|
||||
|
||||
if(!loadFromISO)
|
||||
{
|
||||
cdvdInitCount++; // used to handle the case where the plugin was inited at boot, but then iso takes over
|
||||
return CDVDinit();
|
||||
}
|
||||
|
||||
diskTypeCached=-1;
|
||||
|
||||
return 0;
|
||||
if(CDVD.initCount) *CDVD.initCount++; // used to handle the case where the plugin was inited at boot, but then iso takes over
|
||||
return CDVD.init();
|
||||
}
|
||||
|
||||
void DoCDVDshutdown()
|
||||
{
|
||||
if(CDVD.initCount) *CDVD.initCount--;
|
||||
CDVD.shutdown();
|
||||
}
|
||||
|
||||
s32 DoCDVDopen(const char* pTitleFilename)
|
||||
{
|
||||
int ret=0;
|
||||
if(loadFromISO)
|
||||
ret = ISOopen(pTitleFilename);
|
||||
else
|
||||
ret = CDVDopen(pTitleFilename);
|
||||
|
||||
ret = CDVD.open(pTitleFilename);
|
||||
|
||||
int cdtype = DoCDVDdetectDiskType();
|
||||
|
||||
|
@ -244,7 +238,7 @@ s32 DoCDVDopen(const char* pTitleFilename)
|
|||
{
|
||||
char fname_only[MAX_PATH];
|
||||
|
||||
if(loadFromISO)
|
||||
if(CDVD.init == ISO.init)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
char fname[MAX_PATH], ext[MAX_PATH];
|
||||
|
@ -298,7 +292,7 @@ s32 DoCDVDopen(const char* pTitleFilename)
|
|||
strcat(fname_only, ".dump");
|
||||
#endif
|
||||
cdvdTD td;
|
||||
DoCDVDgetTD(0, &td);
|
||||
CDVD.getTD(0, &td);
|
||||
|
||||
int blockofs=0;
|
||||
int blocksize=0;
|
||||
|
@ -330,58 +324,9 @@ s32 DoCDVDopen(const char* pTitleFilename)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void DoCDVDclose()
|
||||
{
|
||||
if(loadFromISO)
|
||||
ISOclose();
|
||||
else
|
||||
CDVDclose();
|
||||
|
||||
if (blockDumpFile != NULL) isoClose(blockDumpFile);
|
||||
}
|
||||
|
||||
void DoCDVDshutdown()
|
||||
{
|
||||
if((!loadFromISO)||(cdvdInitCount>0)) // handle the case where the plugin was inited at boot, but then iso takes over
|
||||
{
|
||||
cdvdInitCount--;
|
||||
if (CDVDshutdown != NULL) CDVDshutdown();
|
||||
}
|
||||
|
||||
ISOshutdown();
|
||||
}
|
||||
|
||||
s32 DoCDVDreadSector(u8* buffer, u32 lsn, int mode)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(loadFromISO)
|
||||
ret = ISOreadSector(buffer,lsn,mode);
|
||||
else
|
||||
{
|
||||
CDVDreadTrack(lsn,mode);
|
||||
void* pbuffer = CDVDgetBuffer();
|
||||
if(pbuffer!=NULL)
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case CDVD_MODE_2048:
|
||||
memcpy(buffer,pbuffer,2048);
|
||||
break;
|
||||
case CDVD_MODE_2328:
|
||||
memcpy(buffer,pbuffer,2328);
|
||||
break;
|
||||
case CDVD_MODE_2340:
|
||||
memcpy(buffer,pbuffer,2340);
|
||||
break;
|
||||
case CDVD_MODE_2352:
|
||||
memcpy(buffer,pbuffer,2352);
|
||||
break;
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
else ret = -1;
|
||||
}
|
||||
int ret = CDVD.readSector(buffer,lsn,mode);
|
||||
|
||||
if(ret==0)
|
||||
{
|
||||
|
@ -395,48 +340,31 @@ s32 DoCDVDreadSector(u8* buffer, u32 lsn, int mode)
|
|||
|
||||
s32 DoCDVDreadTrack(u32 lsn, int mode)
|
||||
{
|
||||
if(loadFromISO)
|
||||
return ISOreadTrack(lsn, mode);
|
||||
else
|
||||
// TEMP: until all the plugins use the new CDVDgetBuffer style
|
||||
switch (mode)
|
||||
{
|
||||
// TEMP: until I fix all the plugins to use the new CDVDgetBuffer style
|
||||
switch (mode)
|
||||
{
|
||||
case CDVD_MODE_2352:
|
||||
psize = 2352;
|
||||
break;
|
||||
case CDVD_MODE_2340:
|
||||
psize = 2340;
|
||||
break;
|
||||
case CDVD_MODE_2328:
|
||||
psize = 2328;
|
||||
break;
|
||||
case CDVD_MODE_2048:
|
||||
psize = 2048;
|
||||
break;
|
||||
}
|
||||
return CDVDreadTrack(lsn, mode);
|
||||
case CDVD_MODE_2352:
|
||||
lastReadSize = 2352;
|
||||
break;
|
||||
case CDVD_MODE_2340:
|
||||
lastReadSize = 2340;
|
||||
break;
|
||||
case CDVD_MODE_2328:
|
||||
lastReadSize = 2328;
|
||||
break;
|
||||
case CDVD_MODE_2048:
|
||||
lastReadSize = 2048;
|
||||
break;
|
||||
}
|
||||
|
||||
return CDVD.readTrack(lsn,mode);
|
||||
}
|
||||
|
||||
// return can be NULL (for async modes)
|
||||
|
||||
s32 DoCDVDgetBuffer(u8* buffer)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(loadFromISO)
|
||||
ret = ISOgetBuffer(buffer);
|
||||
else
|
||||
{
|
||||
// TEMP: until I fix all the plugins to use this function style
|
||||
u8* pb = CDVDgetBuffer();
|
||||
if(pb!=NULL)
|
||||
{
|
||||
memcpy(buffer,pb,psize);
|
||||
ret=0;
|
||||
}
|
||||
else ret= -1;
|
||||
}
|
||||
int ret = CDVD.getBuffer2(buffer);
|
||||
|
||||
if(ret==0)
|
||||
{
|
||||
|
@ -445,49 +373,10 @@ s32 DoCDVDgetBuffer(u8* buffer)
|
|||
isoWriteBlock(blockDumpFile, buffer, plsn);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 DoCDVDreadSubQ(u32 lsn, cdvdSubQ* subq)
|
||||
{
|
||||
if(loadFromISO)
|
||||
return ISOreadSubQ(lsn,subq);
|
||||
else
|
||||
return CDVDreadSubQ(lsn,subq);
|
||||
}
|
||||
|
||||
s32 DoCDVDgetTN(cdvdTN *Buffer)
|
||||
{
|
||||
if(loadFromISO)
|
||||
return ISOgetTN(Buffer);
|
||||
else
|
||||
return CDVDgetTN(Buffer);
|
||||
}
|
||||
|
||||
s32 DoCDVDgetTD(u8 Track, cdvdTD *Buffer)
|
||||
{
|
||||
if(loadFromISO)
|
||||
return ISOgetTD(Track,Buffer);
|
||||
else
|
||||
return CDVDgetTD(Track,Buffer);
|
||||
}
|
||||
|
||||
s32 DoCDVDgetTOC(void* toc)
|
||||
{
|
||||
if(loadFromISO)
|
||||
return ISOgetTOC(toc);
|
||||
else
|
||||
return CDVDgetTOC(toc);
|
||||
}
|
||||
|
||||
s32 DoCDVDgetDiskType()
|
||||
{
|
||||
if(loadFromISO)
|
||||
return ISOgetDiskType();
|
||||
else
|
||||
return CDVDgetDiskType();
|
||||
}
|
||||
|
||||
s32 DoCDVDdetectDiskType()
|
||||
{
|
||||
if(diskTypeCached<0)
|
||||
|
@ -498,38 +387,5 @@ s32 DoCDVDdetectDiskType()
|
|||
|
||||
void DoCDVDresetDiskTypeCache()
|
||||
{
|
||||
diskTypeCached=-1;
|
||||
}
|
||||
|
||||
s32 DoCDVDgetTrayStatus()
|
||||
{
|
||||
if(loadFromISO)
|
||||
return ISOgetTrayStatus();
|
||||
else
|
||||
return CDVDgetTrayStatus();
|
||||
|
||||
}
|
||||
|
||||
s32 DoCDVDctrlTrayOpen()
|
||||
{
|
||||
if(loadFromISO)
|
||||
return ISOctrlTrayOpen();
|
||||
else
|
||||
return CDVDctrlTrayOpen();
|
||||
}
|
||||
|
||||
s32 DoCDVDctrlTrayClose()
|
||||
{
|
||||
if(loadFromISO)
|
||||
return ISOctrlTrayClose();
|
||||
else
|
||||
return CDVDctrlTrayClose();
|
||||
}
|
||||
|
||||
void DoCDVDnewDiskCB(void (*callback)())
|
||||
{
|
||||
if(!loadFromISO)
|
||||
{
|
||||
if (CDVDnewDiskCB) CDVDnewDiskCB(callback);
|
||||
}
|
||||
diskTypeCached = -1;
|
||||
}
|
||||
|
|
|
@ -27,13 +27,6 @@ extern s32 DoCDVDreadSector(u8* buffer, u32 lsn, int mode);
|
|||
extern s32 DoCDVDreadTrack(u32 lsn, int mode);
|
||||
extern s32 DoCDVDgetBuffer(u8* buffer);
|
||||
extern s32 DoCDVDreadSubQ(u32 lsn, cdvdSubQ* subq);
|
||||
extern s32 DoCDVDgetTN(cdvdTN *Buffer);
|
||||
extern s32 DoCDVDgetTD(u8 Track, cdvdTD *Buffer);
|
||||
extern s32 DoCDVDgetTOC(void* toc);
|
||||
extern s32 DoCDVDgetDiskType();
|
||||
extern s32 DoCDVDgetTrayStatus();
|
||||
extern s32 DoCDVDctrlTrayOpen();
|
||||
extern s32 DoCDVDctrlTrayClose();
|
||||
extern void DoCDVDnewDiskCB(void (*callback)());
|
||||
extern s32 DoCDVDdetectDiskType();
|
||||
extern void DoCDVDresetDiskTypeCache();
|
||||
|
|
|
@ -27,14 +27,12 @@
|
|||
|
||||
#include "CDVDisoReader.h"
|
||||
|
||||
bool loadFromISO=false;
|
||||
|
||||
char isoFileName[256];
|
||||
|
||||
u8 *pbuffer;
|
||||
int cdtype;
|
||||
|
||||
int psize;
|
||||
static int psize;
|
||||
|
||||
isoFile *iso;
|
||||
|
||||
|
@ -78,8 +76,7 @@ void __Log(char *fmt, ...)
|
|||
#define __Log 0&&
|
||||
#endif
|
||||
|
||||
|
||||
s32 ISOinit()
|
||||
s32 CALLBACK ISOinit()
|
||||
{
|
||||
#ifdef PCSX2_DEBUG
|
||||
cdvdLog = fopen("logs/cdvdLog.txt", "w");
|
||||
|
@ -99,14 +96,14 @@ s32 ISOinit()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ISOshutdown()
|
||||
void CALLBACK ISOshutdown()
|
||||
{
|
||||
#ifdef CDVD_LOG
|
||||
if (cdvdLog != NULL) fclose(cdvdLog);
|
||||
#endif
|
||||
}
|
||||
|
||||
s32 ISOopen(const char* pTitle)
|
||||
s32 CALLBACK ISOopen(const char* pTitle)
|
||||
{
|
||||
//if (pTitle != NULL) strcpy(isoFileName, pTitle);
|
||||
|
||||
|
@ -127,12 +124,12 @@ s32 ISOopen(const char* pTitle)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ISOclose()
|
||||
void CALLBACK ISOclose()
|
||||
{
|
||||
isoClose(iso);
|
||||
}
|
||||
|
||||
s32 ISOreadSubQ(u32 lsn, cdvdSubQ* subq)
|
||||
s32 CALLBACK ISOreadSubQ(u32 lsn, cdvdSubQ* subq)
|
||||
{
|
||||
// fake it
|
||||
u8 min, sec, frm;
|
||||
|
@ -155,7 +152,7 @@ s32 ISOreadSubQ(u32 lsn, cdvdSubQ* subq)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 ISOgetTN(cdvdTN *Buffer)
|
||||
s32 CALLBACK ISOgetTN(cdvdTN *Buffer)
|
||||
{
|
||||
Buffer->strack = 1;
|
||||
Buffer->etrack = 1;
|
||||
|
@ -163,7 +160,7 @@ s32 ISOgetTN(cdvdTN *Buffer)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 ISOgetTD(u8 Track, cdvdTD *Buffer)
|
||||
s32 CALLBACK ISOgetTD(u8 Track, cdvdTD *Buffer)
|
||||
{
|
||||
if (Track == 0)
|
||||
{
|
||||
|
@ -209,7 +206,7 @@ static void FindLayer1Start()
|
|||
}
|
||||
}
|
||||
|
||||
s32 ISOgetDualInfo(s32* dualType, u32* _layer1start)
|
||||
s32 CALLBACK ISOgetDualInfo(s32* dualType, u32* _layer1start)
|
||||
{
|
||||
FindLayer1Start();
|
||||
|
||||
|
@ -226,9 +223,14 @@ s32 ISOgetDualInfo(s32* dualType, u32* _layer1start)
|
|||
return 1;
|
||||
}
|
||||
|
||||
s32 ISOgetTOC(void* toc)
|
||||
s32 CALLBACK ISOgetDiskType()
|
||||
{
|
||||
u8 type = CDVDgetDiskType();
|
||||
return cdtype;
|
||||
}
|
||||
|
||||
s32 CALLBACK ISOgetTOC(void* toc)
|
||||
{
|
||||
u8 type = ISOgetDiskType();
|
||||
u8* tocBuff = (u8*)toc;
|
||||
|
||||
//__Log("CDVDgetTOC\n");
|
||||
|
@ -291,12 +293,12 @@ s32 ISOgetTOC(void* toc)
|
|||
cdvdTN diskInfo;
|
||||
cdvdTD trackInfo;
|
||||
memset(tocBuff, 0, 1024);
|
||||
if (CDVDgetTN(&diskInfo) == -1)
|
||||
if (ISOgetTN(&diskInfo) == -1)
|
||||
{
|
||||
diskInfo.etrack = 0;
|
||||
diskInfo.strack = 1;
|
||||
}
|
||||
if (CDVDgetTD(0, &trackInfo) == -1) trackInfo.lsn = 0;
|
||||
if (ISOgetTD(0, &trackInfo) == -1) trackInfo.lsn = 0;
|
||||
|
||||
tocBuff[0] = 0x41;
|
||||
tocBuff[1] = 0x00;
|
||||
|
@ -317,7 +319,7 @@ s32 ISOgetTOC(void* toc)
|
|||
|
||||
for (i = diskInfo.strack; i <= diskInfo.etrack; i++)
|
||||
{
|
||||
err = CDVDgetTD(i, &trackInfo);
|
||||
err = ISOgetTD(i, &trackInfo);
|
||||
lba_to_msf(trackInfo.lsn, &min, &sec, &frm);
|
||||
tocBuff[i*10+30] = trackInfo.type;
|
||||
tocBuff[i*10+32] = err == -1 ? 0 : itob(i); //number
|
||||
|
@ -332,7 +334,7 @@ s32 ISOgetTOC(void* toc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 ISOreadSector(u8* tempbuffer, u32 lsn, int mode)
|
||||
s32 CALLBACK ISOreadSector(u8* tempbuffer, u32 lsn, int mode)
|
||||
{
|
||||
int _lsn = lsn;
|
||||
|
||||
|
@ -375,7 +377,7 @@ s32 ISOreadSector(u8* tempbuffer, u32 lsn, int mode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 ISOreadTrack(u32 lsn, int mode)
|
||||
s32 CALLBACK ISOreadTrack(u32 lsn, int mode)
|
||||
{
|
||||
int _lsn = lsn;
|
||||
|
||||
|
@ -410,28 +412,63 @@ s32 ISOreadTrack(u32 lsn, int mode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 ISOgetBuffer(u8* buffer)
|
||||
s32 CALLBACK ISOgetBuffer2(u8* buffer)
|
||||
{
|
||||
memcpy_fast(buffer,pbuffer,psize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 ISOgetDiskType()
|
||||
{
|
||||
return cdtype;
|
||||
}
|
||||
|
||||
s32 ISOgetTrayStatus()
|
||||
s32 CALLBACK ISOgetTrayStatus()
|
||||
{
|
||||
return CDVD_TRAY_CLOSE;
|
||||
}
|
||||
|
||||
s32 ISOctrlTrayOpen()
|
||||
s32 CALLBACK ISOctrlTrayOpen()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
s32 ISOctrlTrayClose()
|
||||
s32 CALLBACK ISOctrlTrayClose()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 CALLBACK ISOdummyS32()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CALLBACK ISOdummyVOID()
|
||||
{
|
||||
}
|
||||
|
||||
void CALLBACK ISOnewDiskCB(void(CALLBACK*)())
|
||||
{
|
||||
}
|
||||
|
||||
CDVDplugin ISO = {
|
||||
ISOinit,
|
||||
ISOopen,
|
||||
ISOclose,
|
||||
ISOshutdown,
|
||||
ISOreadTrack,
|
||||
NULL, // emu shouldn't try to use this one.
|
||||
ISOreadSubQ,
|
||||
ISOgetTN,
|
||||
ISOgetTD,
|
||||
ISOgetTOC,
|
||||
ISOgetDiskType,
|
||||
ISOdummyS32,
|
||||
ISOdummyS32,
|
||||
ISOdummyS32,
|
||||
|
||||
ISOdummyVOID,
|
||||
ISOdummyS32,
|
||||
ISOdummyVOID,
|
||||
ISOnewDiskCB,
|
||||
|
||||
ISOreadSector,
|
||||
ISOgetBuffer2,
|
||||
ISOgetDualInfo,
|
||||
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -45,21 +45,4 @@ void __Log(char *fmt, ...);
|
|||
extern char isoFileName[256];
|
||||
extern isoFile *iso;
|
||||
|
||||
extern s32 ISOinit();
|
||||
extern void ISOshutdown();
|
||||
extern s32 ISOopen(const char* pTitle);
|
||||
extern void ISOclose();
|
||||
extern s32 ISOreadSubQ(u32 lsn, cdvdSubQ* subq);
|
||||
extern s32 ISOgetTN(cdvdTN *Buffer);
|
||||
extern s32 ISOgetTD(u8 tn, cdvdTD *Buffer);
|
||||
extern s32 ISOgetDiskType();
|
||||
extern s32 ISOgetTrayStatus();
|
||||
extern s32 ISOctrlTrayOpen();
|
||||
extern s32 ISOctrlTrayClose();
|
||||
extern s32 ISOreadSector(u8* tempbuffer, u32 lsn, int mode);
|
||||
extern s32 ISOgetTOC(void* toc);
|
||||
extern s32 ISOreadTrack(u32 lsn, int mode);
|
||||
extern s32 ISOgetBuffer(u8* buffer);
|
||||
extern s32 ISOgetDualInfo(s32* dualType, u32* _layer1start);
|
||||
|
||||
#endif
|
|
@ -332,7 +332,7 @@ void cdrInterrupt() {
|
|||
SetResultSize(3);
|
||||
cdr.StatP|= 0x2;
|
||||
cdr.Result[0] = cdr.StatP;
|
||||
if (DoCDVDgetTN(&cdr.ResultTN) == -1) {
|
||||
if (CDVD.getTN(&cdr.ResultTN) == -1) {
|
||||
cdr.Stat = DiskError;
|
||||
cdr.Result[0]|= 0x01;
|
||||
} else {
|
||||
|
@ -347,7 +347,7 @@ void cdrInterrupt() {
|
|||
cdr.Track = btoi(cdr.Param[0]);
|
||||
SetResultSize(4);
|
||||
cdr.StatP|= 0x2;
|
||||
if (DoCDVDgetTD(cdr.Track, &trackInfo) == -1) {
|
||||
if (CDVD.getTD(cdr.Track, &trackInfo) == -1) {
|
||||
cdr.Stat = DiskError;
|
||||
cdr.Result[0]|= 0x01;
|
||||
} else {
|
||||
|
|
|
@ -335,7 +335,7 @@ void OnLanguage(GtkMenuItem *menuitem, gpointer user_data)
|
|||
|
||||
void OnFile_RunCD(GtkMenuItem *menuitem, gpointer user_data)
|
||||
{
|
||||
loadFromISO = false;
|
||||
CDVD = CDVD_plugin;
|
||||
SysReset();
|
||||
SysPrepareExecution(NULL);
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ void OnFile_RunCD(GtkMenuItem *menuitem, gpointer user_data)
|
|||
void OnRunIso_Ok(GtkButton* button, gpointer user_data)
|
||||
{
|
||||
gchar *File;
|
||||
loadFromISO = true;
|
||||
CDVD = ISO;
|
||||
|
||||
File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
||||
strcpy(isoFileName, File);
|
||||
|
|
|
@ -138,25 +138,8 @@ _SPU2test SPU2test;
|
|||
_SPU2about SPU2about;
|
||||
|
||||
// CDVD
|
||||
_CDVDinit CDVDinit;
|
||||
_CDVDopen CDVDopen;
|
||||
_CDVDclose CDVDclose;
|
||||
_CDVDshutdown CDVDshutdown;
|
||||
_CDVDreadTrack CDVDreadTrack;
|
||||
_CDVDgetBuffer CDVDgetBuffer;
|
||||
_CDVDreadSubQ CDVDreadSubQ;
|
||||
_CDVDgetTN CDVDgetTN;
|
||||
_CDVDgetTD CDVDgetTD;
|
||||
_CDVDgetTOC CDVDgetTOC;
|
||||
_CDVDgetDiskType CDVDgetDiskType;
|
||||
_CDVDgetTrayStatus CDVDgetTrayStatus;
|
||||
_CDVDctrlTrayOpen CDVDctrlTrayOpen;
|
||||
_CDVDctrlTrayClose CDVDctrlTrayClose;
|
||||
|
||||
_CDVDconfigure CDVDconfigure;
|
||||
_CDVDtest CDVDtest;
|
||||
_CDVDabout CDVDabout;
|
||||
_CDVDnewDiskCB CDVDnewDiskCB;
|
||||
CDVDplugin CDVD_plugin = {0};
|
||||
CDVDplugin CDVD = {0};
|
||||
|
||||
// DEV9
|
||||
_DEV9init DEV9init;
|
||||
|
@ -218,18 +201,21 @@ _FWabout FWabout;
|
|||
DEV9handler dev9Handler;
|
||||
USBhandler usbHandler;
|
||||
|
||||
enum PluginTypes
|
||||
namespace PluginTypes
|
||||
{
|
||||
GS = 0,
|
||||
PAD,
|
||||
PAD1,
|
||||
PAD2,
|
||||
SPU2,
|
||||
CDVD,
|
||||
DEV9,
|
||||
USB,
|
||||
FW
|
||||
};
|
||||
enum PluginTypes
|
||||
{
|
||||
GS = 0,
|
||||
PAD,
|
||||
PAD1,
|
||||
PAD2,
|
||||
SPU2,
|
||||
CDVD,
|
||||
DEV9,
|
||||
USB,
|
||||
FW
|
||||
};
|
||||
}
|
||||
|
||||
int PS2E_LT[9] = {
|
||||
PS2E_LT_GS,
|
||||
|
@ -265,6 +251,10 @@ PS2E_FW_VERSION};
|
|||
#define MapSymbol_Fallback(name,fallback) MapSymbolVar_Fallback(name,name,fallback)
|
||||
#define MapSymbol_Error(name) MapSymbolVar_Error(name,name)
|
||||
|
||||
#define MapSymbol2(base,name) MapSymbolVar(base##_plugin.name,base##name)
|
||||
#define MapSymbol2_Fallback(base,name,fallback) MapSymbolVar_Fallback(base##_plugin.name,base##name,fallback)
|
||||
#define MapSymbol2_Error(base,name) MapSymbolVar_Error(base##_plugin.name,base##name)
|
||||
|
||||
// for pad1/2
|
||||
#define MapSymbolPAD(var,name) MapSymbolVar(var##name,PAD##name)
|
||||
#define MapSymbolPAD_Fallback(var,name) if((MapSymbolVarType(var##name,_PAD##name,PAD##name))==NULL) var##name = var##_##name
|
||||
|
@ -292,7 +282,7 @@ static int _TestPS2Esyms(void* drv, int type, int expected_version, const string
|
|||
return 0;
|
||||
}
|
||||
|
||||
static __forceinline bool TestPS2Esyms(void* &drv, PluginTypes type, const string& filename)
|
||||
static __forceinline bool TestPS2Esyms(void* &drv, PluginTypes::PluginTypes type, const string& filename)
|
||||
{
|
||||
if (_TestPS2Esyms(drv, PS2E_LT[type],PS2E_VERSION[type],filename) < 0) return false;
|
||||
return true;
|
||||
|
@ -324,7 +314,7 @@ int LoadGSplugin(const string& filename)
|
|||
GSplugin = SysLoadLibrary(filename.c_str());
|
||||
if (GSplugin == NULL) { Msgbox::Alert ("Could Not Load GS Plugin '%hs': %s", params &filename, SysLibError()); return -1; }
|
||||
drv = GSplugin;
|
||||
if (!TestPS2Esyms(drv, GS, filename)) return -1;
|
||||
if (!TestPS2Esyms(drv, PluginTypes::GS, filename)) return -1;
|
||||
MapSymbol_Error(GSinit);
|
||||
MapSymbol_Error(GSshutdown);
|
||||
MapSymbol_Error(GSopen);
|
||||
|
@ -379,7 +369,7 @@ int LoadPAD1plugin(const string& filename) {
|
|||
PAD1plugin = SysLoadLibrary(filename.c_str());
|
||||
if (PAD1plugin == NULL) { Msgbox::Alert("Could Not Load PAD1 Plugin '%hs': %s", params &filename, SysLibError()); return -1; }
|
||||
drv = PAD1plugin;
|
||||
if (!TestPS2Esyms(drv, PAD, filename)) return -1;
|
||||
if (!TestPS2Esyms(drv, PluginTypes::PAD, filename)) return -1;
|
||||
MapSymbolPAD_Error(PAD1,init);
|
||||
MapSymbolPAD_Error(PAD1,shutdown);
|
||||
MapSymbolPAD_Error(PAD1,open);
|
||||
|
@ -416,7 +406,7 @@ int LoadPAD2plugin(const string& filename) {
|
|||
PAD2plugin = SysLoadLibrary(filename.c_str());
|
||||
if (PAD2plugin == NULL) { Msgbox::Alert("Could Not Load PAD2 Plugin '%hs': %s", params &filename, SysLibError()); return -1; }
|
||||
drv = PAD2plugin;
|
||||
if (!TestPS2Esyms(drv, PAD, filename)) return -1;
|
||||
if (!TestPS2Esyms(drv, PluginTypes::PAD, filename)) return -1;
|
||||
MapSymbolPAD_Error(PAD2,init);
|
||||
MapSymbolPAD_Error(PAD2,shutdown);
|
||||
MapSymbolPAD_Error(PAD2,open);
|
||||
|
@ -451,7 +441,7 @@ int LoadSPU2plugin(const string& filename) {
|
|||
SPU2plugin = SysLoadLibrary(filename.c_str());
|
||||
if (SPU2plugin == NULL) { Msgbox::Alert("Could Not Load SPU2 Plugin '%hs': %s", params &filename, SysLibError()); return -1; }
|
||||
drv = SPU2plugin;
|
||||
if (!TestPS2Esyms(drv, SPU2, filename)) return -1;
|
||||
if (!TestPS2Esyms(drv, PluginTypes::SPU2, filename)) return -1;
|
||||
MapSymbol_Error(SPU2init);
|
||||
MapSymbol_Error(SPU2shutdown);
|
||||
MapSymbol_Error(SPU2open);
|
||||
|
@ -489,32 +479,119 @@ void CALLBACK CDVD_about() {}
|
|||
s32 CALLBACK CDVD_test() { return 0; }
|
||||
void CALLBACK CDVD_newDiskCB(void (*callback)()) {}
|
||||
|
||||
s32 CALLBACK CDVD_getBuffer2(u8* buffer)
|
||||
{
|
||||
int ret;
|
||||
|
||||
extern int lastReadSize;
|
||||
|
||||
// TEMP: until I fix all the plugins to use this function style
|
||||
u8* pb = CDVD.getBuffer();
|
||||
if(pb!=NULL)
|
||||
{
|
||||
memcpy(buffer,pb,lastReadSize);
|
||||
ret=0;
|
||||
}
|
||||
else ret= -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
s32 CALLBACK CDVD_readSector(u8* buffer, u32 lsn, int mode)
|
||||
{
|
||||
int ret;
|
||||
|
||||
CDVD.readTrack(lsn,mode);
|
||||
void* pbuffer = CDVD.getBuffer();
|
||||
if(pbuffer!=NULL)
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case CDVD_MODE_2048:
|
||||
memcpy(buffer,pbuffer,2048);
|
||||
break;
|
||||
case CDVD_MODE_2328:
|
||||
memcpy(buffer,pbuffer,2328);
|
||||
break;
|
||||
case CDVD_MODE_2340:
|
||||
memcpy(buffer,pbuffer,2340);
|
||||
break;
|
||||
case CDVD_MODE_2352:
|
||||
memcpy(buffer,pbuffer,2352);
|
||||
break;
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
else ret = -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 CALLBACK CDVD_getDualInfo(s32* dualType, u32* layer1Start)
|
||||
{
|
||||
u8 toc[2064];
|
||||
|
||||
// if error getting toc, settle for single layer disc ;)
|
||||
if(CDVD.getTOC(toc))
|
||||
return 0;
|
||||
if(toc[14] & 0x60)
|
||||
{
|
||||
if(toc[14] & 0x10)
|
||||
{
|
||||
// otp dvd
|
||||
*dualType = 2;
|
||||
*layer1Start = (toc[25]<<16) + (toc[26]<<8) + (toc[27]) - 0x30000 + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ptp dvd
|
||||
*dualType = 1;
|
||||
*layer1Start = (toc[21]<<16) + (toc[22]<<8) + (toc[23]) - 0x30000 + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// single layer dvd
|
||||
*dualType = 0;
|
||||
*layer1Start = (toc[21]<<16) + (toc[22]<<8) + (toc[23]) - 0x30000 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
int cdvdInitCount;
|
||||
int LoadCDVDplugin(const string& filename) {
|
||||
void *drv;
|
||||
|
||||
CDVDplugin = SysLoadLibrary(filename.c_str());
|
||||
if (CDVDplugin == NULL) { Msgbox::Alert("Could Not Load CDVD Plugin '%hs': %s", params &filename, SysLibError()); return -1; }
|
||||
drv = CDVDplugin;
|
||||
if (!TestPS2Esyms(drv, CDVD, filename)) return -1;
|
||||
MapSymbol_Error(CDVDinit);
|
||||
MapSymbol_Error(CDVDshutdown);
|
||||
MapSymbol_Error(CDVDopen);
|
||||
MapSymbol_Error(CDVDclose);
|
||||
MapSymbol_Error(CDVDreadTrack);
|
||||
MapSymbol_Error(CDVDgetBuffer);
|
||||
MapSymbol_Error(CDVDreadSubQ);
|
||||
MapSymbol_Error(CDVDgetTN);
|
||||
MapSymbol_Error(CDVDgetTD);
|
||||
MapSymbol_Error(CDVDgetTOC);
|
||||
MapSymbol_Error(CDVDgetDiskType);
|
||||
MapSymbol_Error(CDVDgetTrayStatus);
|
||||
MapSymbol_Error(CDVDctrlTrayOpen);
|
||||
MapSymbol_Error(CDVDctrlTrayClose);
|
||||
if (!TestPS2Esyms(drv, PluginTypes::CDVD, filename)) return -1;
|
||||
MapSymbol2_Error(CDVD,init);
|
||||
MapSymbol2_Error(CDVD,shutdown);
|
||||
MapSymbol2_Error(CDVD,open);
|
||||
MapSymbol2_Error(CDVD,close);
|
||||
MapSymbol2_Error(CDVD,readTrack);
|
||||
MapSymbol2_Error(CDVD,getBuffer);
|
||||
MapSymbol2_Error(CDVD,readSubQ);
|
||||
MapSymbol2_Error(CDVD,getTN);
|
||||
MapSymbol2_Error(CDVD,getTD);
|
||||
MapSymbol2_Error(CDVD,getTOC);
|
||||
MapSymbol2_Error(CDVD,getDiskType);
|
||||
MapSymbol2_Error(CDVD,getTrayStatus);
|
||||
MapSymbol2_Error(CDVD,ctrlTrayOpen);
|
||||
MapSymbol2_Error(CDVD,ctrlTrayClose);
|
||||
|
||||
MapSymbol_Fallback(CDVDconfigure,CDVD_configure);
|
||||
MapSymbol_Fallback(CDVDabout,CDVD_about);
|
||||
MapSymbol_Fallback(CDVDtest,CDVD_test);
|
||||
MapSymbol(CDVDnewDiskCB);
|
||||
MapSymbol2_Fallback(CDVD,configure,CDVD_configure);
|
||||
MapSymbol2_Fallback(CDVD,about,CDVD_about);
|
||||
MapSymbol2_Fallback(CDVD,test,CDVD_test);
|
||||
MapSymbol2_Fallback(CDVD,newDiskCB,CDVD_newDiskCB);
|
||||
|
||||
MapSymbol2_Fallback(CDVD,readSector,CDVD_readSector);
|
||||
MapSymbol2_Fallback(CDVD,getBuffer2,CDVD_getBuffer2);
|
||||
MapSymbol2_Fallback(CDVD,getDualInfo,CDVD_getDualInfo);
|
||||
|
||||
CDVD.initCount = &cdvdInitCount;
|
||||
cdvdInitCount=0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -532,7 +609,7 @@ int LoadDEV9plugin(const string& filename) {
|
|||
DEV9plugin = SysLoadLibrary(filename.c_str());
|
||||
if (DEV9plugin == NULL) { Msgbox::Alert("Could Not Load DEV9 Plugin '%hs': %s", params &filename, SysLibError()); return -1; }
|
||||
drv = DEV9plugin;
|
||||
if (!TestPS2Esyms(drv, DEV9, filename)) return -1;
|
||||
if (!TestPS2Esyms(drv, PluginTypes::DEV9, filename)) return -1;
|
||||
MapSymbol_Error(DEV9init);
|
||||
MapSymbol_Error(DEV9shutdown);
|
||||
MapSymbol_Error(DEV9open);
|
||||
|
@ -569,7 +646,7 @@ int LoadUSBplugin(const string& filename) {
|
|||
USBplugin = SysLoadLibrary(filename.c_str());
|
||||
if (USBplugin == NULL) { Msgbox::Alert("Could Not Load USB Plugin '%hs': %s", params &filename, SysLibError()); return -1; }
|
||||
drv = USBplugin;
|
||||
if (!TestPS2Esyms(drv, USB, filename)) return -1;
|
||||
if (!TestPS2Esyms(drv, PluginTypes::USB, filename)) return -1;
|
||||
MapSymbol_Error(USBinit);
|
||||
MapSymbol_Error(USBshutdown);
|
||||
MapSymbol_Error(USBopen);
|
||||
|
@ -606,7 +683,7 @@ int LoadFWplugin(const string& filename) {
|
|||
FWplugin = SysLoadLibrary(filename.c_str());
|
||||
if (FWplugin == NULL) { Msgbox::Alert("Could Not Load FW Plugin '%hs': %s", params &filename, SysLibError()); return -1; }
|
||||
drv = FWplugin;
|
||||
if (!TestPS2Esyms(drv, FW, filename)) return -1;
|
||||
if (!TestPS2Esyms(drv, PluginTypes::FW, filename)) return -1;
|
||||
MapSymbol_Error(FWinit);
|
||||
MapSymbol_Error(FWshutdown);
|
||||
MapSymbol_Error(FWopen);
|
||||
|
@ -721,6 +798,10 @@ void ShutdownPlugins()
|
|||
|
||||
//if (CDVDshutdown != NULL) CDVDshutdown();
|
||||
DoCDVDshutdown();
|
||||
|
||||
// safety measures, in case ISO is currently loaded.
|
||||
if(cdvdInitCount>0)
|
||||
CDVD_plugin.shutdown();
|
||||
|
||||
if (DEV9shutdown != NULL) DEV9shutdown();
|
||||
if (USBshutdown != NULL) USBshutdown();
|
||||
|
@ -764,9 +845,9 @@ bool OpenCDVD(const char* pTitleFilename)
|
|||
if (!OpenStatus.CDVD && !only_loading_elf)
|
||||
{
|
||||
//First, we need the data.
|
||||
DoCDVDnewDiskCB(cdvdNewDiskCB);
|
||||
CDVD.newDiskCB(cdvdNewDiskCB);
|
||||
|
||||
if (DoCDVDopen(pTitleFilename) != 0)
|
||||
if (CDVD.open(pTitleFilename) != 0)
|
||||
{
|
||||
if (g_Startup.BootMode != BootMode_Elf)
|
||||
{
|
||||
|
@ -904,6 +985,12 @@ int OpenPlugins(const char* pTitleFilename)
|
|||
OpenStatus.name = false; \
|
||||
}
|
||||
|
||||
#define CLOSE_PLUGIN2( name ) \
|
||||
if( OpenStatus.name ) { \
|
||||
name.close(); \
|
||||
OpenStatus.name = false; \
|
||||
}
|
||||
|
||||
|
||||
void ClosePlugins( bool closegs )
|
||||
{
|
||||
|
@ -929,12 +1016,7 @@ void ClosePlugins( bool closegs )
|
|||
}
|
||||
}
|
||||
|
||||
//CLOSE_PLUGIN( CDVD );
|
||||
if( OpenStatus.CDVD )
|
||||
{
|
||||
DoCDVDclose();
|
||||
OpenStatus.CDVD = false;
|
||||
}
|
||||
CLOSE_PLUGIN2( CDVD );
|
||||
|
||||
CLOSE_PLUGIN( DEV9 );
|
||||
CLOSE_PLUGIN( USB );
|
||||
|
|
|
@ -388,6 +388,10 @@ void SysEndExecution()
|
|||
// use_bios - forces the game to boot through the PS2 bios, instead of bypassing it.
|
||||
void SysPrepareExecution( const char* elf_file, bool use_bios )
|
||||
{
|
||||
// solve a little crash
|
||||
if(CDVD.init == NULL)
|
||||
CDVD = CDVD_plugin;
|
||||
|
||||
if( !g_EmulationInProgress )
|
||||
{
|
||||
try
|
||||
|
|
|
@ -676,7 +676,7 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
string outstr;
|
||||
if( Open_Iso_File_Proc( outstr ) )
|
||||
{
|
||||
loadFromISO = true;
|
||||
CDVD = ISO;
|
||||
|
||||
strcpy(isoFileName,outstr.c_str());
|
||||
|
||||
|
@ -693,7 +693,7 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
|
||||
case ID_FILE_RUNCD:
|
||||
loadFromISO = false;
|
||||
CDVD = CDVD_plugin;
|
||||
SysReset();
|
||||
SysPrepareExecution( NULL );
|
||||
break;
|
||||
|
@ -738,7 +738,7 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
|
||||
case ID_CONFIG_CDVDROM:
|
||||
if (CDVDconfigure) CDVDconfigure();
|
||||
if (CDVD.configure) CDVD.configure();
|
||||
break;
|
||||
|
||||
case ID_CONFIG_DEV9:
|
||||
|
|
Loading…
Reference in New Issue