mirror of https://github.com/PCSX2/pcsx2.git
Some fixes and cleanups. Now the File->Run* options won't reset the emulation, so it might be possible to swap discs properly from nodisc, iso or whatever cdvd plugin has been selected (to switch between iso/cdvdplugin/nodisc, it's necessary to use the file menu options, as run->execute will not update the active cdvd interface).
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1514 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
e2c31ae72a
commit
f910d26c6e
|
@ -28,8 +28,6 @@
|
|||
|
||||
static cdvdStruct cdvd;
|
||||
|
||||
static u8 tempbuf[2352];
|
||||
|
||||
static __forceinline void SetResultSize(u8 size)
|
||||
{
|
||||
cdvd.ResultC = size;
|
||||
|
@ -522,18 +520,10 @@ void SaveState::cdvdFreeze()
|
|||
void cdvdNewDiskCB()
|
||||
{
|
||||
DoCDVDresetDiskTypeCache();
|
||||
cdvd.Type = CDVD.getDiskType();
|
||||
cdvd.Type = DoCDVDdetectDiskType();
|
||||
|
||||
|
||||
char str[g_MaxPath];
|
||||
int result = GetPS2ElfName(str);
|
||||
|
||||
if (cdvd.Type == CDVD_TYPE_PS2CD)
|
||||
{
|
||||
|
||||
// Does the SYSTEM.CNF file only say "BOOT="? PS1 CD then.
|
||||
if(result == 1) cdvd.Type = CDVD_TYPE_PSCD;
|
||||
}
|
||||
|
||||
// Now's a good time to reload the ELF info...
|
||||
if( ElfCRC == 0 )
|
||||
|
@ -542,7 +532,6 @@ void cdvdNewDiskCB()
|
|||
ElfApplyPatches();
|
||||
GSsetGameCRC( ElfCRC, 0 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void mechaDecryptBytes( u32 madr, int size )
|
||||
|
@ -725,8 +714,8 @@ __forceinline void cdvdReadInterrupt()
|
|||
|
||||
if (cdvd.RErr == 0)
|
||||
{
|
||||
cdr.RErr = DoCDVDgetBuffer(tempbuf);
|
||||
cdr.pTransfer = tempbuf;
|
||||
cdr.RErr = DoCDVDgetBuffer(cdr.Transfer);
|
||||
cdr.pTransfer = cdr.Transfer;
|
||||
}
|
||||
else
|
||||
cdr.pTransfer = NULL;
|
||||
|
|
|
@ -185,7 +185,7 @@ static void FindLayer1Start()
|
|||
int off = iso->blockofs;
|
||||
u8* tempbuffer;
|
||||
|
||||
Console::Status("CDVD: searching for layer1...");
|
||||
Console::Status("CDVD ISO: searching for layer1...");
|
||||
tempbuffer = (u8*)malloc(CD_FRAMESIZE_RAW);
|
||||
for (layer1start = (iso->blocks / 2 - 0x10) & ~0xf; layer1start < 0x200010; layer1start += 16)
|
||||
{
|
||||
|
@ -409,6 +409,8 @@ s32 CALLBACK ISOreadTrack(u32 lsn, int mode)
|
|||
break;
|
||||
}
|
||||
|
||||
DevCon::Status("* ISO: Reading Track %d mode %d\n", params lsn, psize);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -418,6 +420,11 @@ s32 CALLBACK ISOgetBuffer2(u8* buffer)
|
|||
return 0;
|
||||
}
|
||||
|
||||
u8* CALLBACK ISOgetBuffer()
|
||||
{
|
||||
return pbuffer;
|
||||
}
|
||||
|
||||
s32 CALLBACK ISOgetTrayStatus()
|
||||
{
|
||||
return CDVD_TRAY_CLOSE;
|
||||
|
@ -451,7 +458,7 @@ CDVDplugin ISO = {
|
|||
ISOclose,
|
||||
ISOshutdown,
|
||||
ISOreadTrack,
|
||||
NULL, // emu shouldn't try to use this one.
|
||||
ISOgetBuffer, // emu shouldn't use this one.
|
||||
ISOreadSubQ,
|
||||
ISOgetTN,
|
||||
ISOgetTD,
|
||||
|
|
|
@ -141,7 +141,7 @@ static void ReadTrack() {
|
|||
cdr.Prev[2] = itob(cdr.SetSector[2]);
|
||||
|
||||
CDR_LOG("KEY *** %x:%x:%x", cdr.Prev[0], cdr.Prev[1], cdr.Prev[2]);
|
||||
cdr.RErr = DoCDVDreadTrack(MSFtoLSN(cdr.SetSector), CDVD_MODE_2352);
|
||||
cdr.RErr = DoCDVDreadTrack(MSFtoLSN(cdr.SetSector), CDVD_MODE_2340);
|
||||
}
|
||||
|
||||
// cdr.Stat:
|
||||
|
@ -514,8 +514,7 @@ void cdrReadInterrupt() {
|
|||
cdr.Result[0] = cdr.StatP;
|
||||
|
||||
SysPrintf("Reading From CDR");
|
||||
cdr.RErr = DoCDVDgetBuffer(buf);
|
||||
|
||||
cdr.RErr = DoCDVDgetBuffer(cdr.Transfer);
|
||||
if (cdr.RErr == -1)
|
||||
{
|
||||
CDR_LOG(" err\n");
|
||||
|
@ -526,7 +525,6 @@ void cdrReadInterrupt() {
|
|||
CDREAD_INT((cdr.Mode & 0x80) ? (cdReadTime / 2) : cdReadTime);
|
||||
return;
|
||||
}
|
||||
memcpy_fast(cdr.Transfer, buf+12, 2340);
|
||||
cdr.Stat = DataReady;
|
||||
|
||||
CDR_LOG(" %x:%x:%x", cdr.Transfer[0], cdr.Transfer[1], cdr.Transfer[2]);
|
||||
|
|
|
@ -193,7 +193,7 @@ int IsoFS_getVolumeDescriptor(void)
|
|||
|
||||
cdVolDesc localVolDesc;
|
||||
|
||||
DbgCon::WriteLn("CDVD_GetVolumeDescriptor called");
|
||||
DbgCon::WriteLn("IsoFS_GetVolumeDescriptor called");
|
||||
|
||||
for (volDescSector = 16; volDescSector<20; volDescSector++)
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
|
||||
dirTocEntry* tocEntryPointer;
|
||||
|
||||
DbgCon::WriteLn("CDVD_findfile called");
|
||||
DbgCon::WriteLn("IsoFS_findfile(\"%s\" called", params fname);
|
||||
|
||||
_splitpath2(fname, pathname, filename);
|
||||
|
||||
|
@ -351,7 +351,7 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
// If we havent found the directory name we wanted then fail
|
||||
if (found_dir != TRUE)
|
||||
{
|
||||
Console::Notice( "CDVD_findfile: could not find dir" );
|
||||
Console::Notice( "IsoFS_findfile: could not find dir" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
strcpy(tocEntry->filename, localTocEntry.filename);
|
||||
memcpy(tocEntry->date, localTocEntry.date, 7);
|
||||
|
||||
DbgCon::WriteLn("CDVD_findfile: found file");
|
||||
DbgCon::WriteLn("IsoFS_findfile: found file");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ int IsoFS_findFile(const char* fname, TocEntry* tocEntry){
|
|||
}
|
||||
}
|
||||
|
||||
DbgCon::Notice("CDVD_findfile: could not find file");
|
||||
DbgCon::Notice("IsoFS_findfile: could not find file");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -479,11 +479,11 @@ void CALLBACK CDVD_about() {}
|
|||
s32 CALLBACK CDVD_test() { return 0; }
|
||||
void CALLBACK CDVD_newDiskCB(void (*callback)()) {}
|
||||
|
||||
extern int lastReadSize;
|
||||
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();
|
||||
|
@ -500,32 +500,26 @@ s32 CALLBACK CDVD_getBuffer2(u8* buffer)
|
|||
|
||||
s32 CALLBACK CDVD_readSector(u8* buffer, u32 lsn, int mode)
|
||||
{
|
||||
int ret;
|
||||
|
||||
CDVD.readTrack(lsn,mode);
|
||||
void* pbuffer = CDVD.getBuffer();
|
||||
if(pbuffer!=NULL)
|
||||
if(CDVD.readTrack(lsn,mode)<0)
|
||||
return -1;
|
||||
|
||||
// TEMP: until all the plugins use the new CDVDgetBuffer style
|
||||
switch (mode)
|
||||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
else ret = -1;
|
||||
|
||||
return ret;
|
||||
return CDVD.getBuffer2(buffer);
|
||||
}
|
||||
|
||||
s32 CALLBACK CDVD_getDualInfo(s32* dualType, u32* layer1Start)
|
||||
|
|
|
@ -677,19 +677,21 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
string outstr;
|
||||
if( Open_Iso_File_Proc( outstr ) )
|
||||
{
|
||||
CDVD = ISO;
|
||||
|
||||
strcpy(isoFileName,outstr.c_str());
|
||||
|
||||
SysReset();
|
||||
//SysReset();
|
||||
|
||||
// SysReset shuts down plugins so it's best in here
|
||||
CDVD = ISO;
|
||||
SysPrepareExecution( NULL );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_FILE_RUNBIOS:
|
||||
//SysReset();
|
||||
// SysReset shuts down plugins so it's best in here
|
||||
CDVD = NODISC;
|
||||
SysReset();
|
||||
SysPrepareExecution( NULL, true );
|
||||
break;
|
||||
|
||||
|
@ -700,8 +702,9 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
|
||||
case ID_FILE_RUNCD:
|
||||
//SysReset();
|
||||
// SysReset shuts down plugins so it's best in here
|
||||
CDVD = CDVD_plugin;
|
||||
SysReset();
|
||||
SysPrepareExecution( NULL );
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue