From 4c39dd35a7b49edf2493cb054b3282dbd48595d7 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Thu, 27 Aug 2009 19:38:09 +0000 Subject: [PATCH] * Re-enabled PCH in release builds; fixes various mysterious crashes. * Restored Run->Execute's old behavior when the emu is in a reset condition (plain jane bootup using CDVD plugin). * Fixed some CDVD init stuff on the Linux side of things. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1691 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/CDVD/CDVDaccess.cpp | 14 ++++++------ pcsx2/Linux/LnxMain.cpp | 14 ++++++------ pcsx2/Plugins.cpp | 1 + pcsx2/windows/VCprojects/pcsx2_2008.vcproj | 3 +-- pcsx2/windows/WinMain.cpp | 25 ++++++++++++++-------- 5 files changed, 32 insertions(+), 25 deletions(-) diff --git a/pcsx2/CDVD/CDVDaccess.cpp b/pcsx2/CDVD/CDVDaccess.cpp index 96770f6e72..8bd9c0e57f 100644 --- a/pcsx2/CDVD/CDVDaccess.cpp +++ b/pcsx2/CDVD/CDVDaccess.cpp @@ -118,7 +118,7 @@ static int FindDiskType(int mType) } else if (mType < 0) { - static char bleh[2352]; + static u8 bleh[2352]; cdvdTD td; CDVD->getTD(0,&td); @@ -126,14 +126,14 @@ static int FindDiskType(int mType) { iCDType = CDVD_TYPE_DETCTDVDS; } - else if (DoCDVDreadSector((u8*)bleh,16,CDVD_MODE_2048) == 0) + else { - struct cdVolDesc* volDesc=(struct cdVolDesc *)bleh; - if (volDesc) - { - if(volDesc->rootToc.tocSize==2048) + if (DoCDVDreadSector(bleh, 16, CDVD_MODE_2048) == 0) + { + const cdVolDesc& volDesc = (cdVolDesc&)bleh; + if(volDesc.rootToc.tocSize == 2048) iCDType = CDVD_TYPE_DETCTCD; - else + else iCDType = CDVD_TYPE_DETCTDVDS; } } diff --git a/pcsx2/Linux/LnxMain.cpp b/pcsx2/Linux/LnxMain.cpp index fae6eeb4e1..94f093250f 100644 --- a/pcsx2/Linux/LnxMain.cpp +++ b/pcsx2/Linux/LnxMain.cpp @@ -132,7 +132,7 @@ int main(int argc, const char *argv[]) } CDVDsys_ChangeSource( g_Startup.CdvdSource ); - DoCDVDopen( g_Startup.ImageName ); + if( !OpenCDVD( g_Startup.ImageName ) ) return -1; if (OpenPlugins() == -1) return -1; SysPrepareExecution( (g_Startup.StartupMode == Startup_FromELF) ? g_Startup.ImageName : NULL, !g_Startup.SkipBios ); @@ -329,8 +329,8 @@ void OnFile_RunCD(GtkMenuItem *menuitem, gpointer user_data) { SysReset(); CDVDsys_ChangeSource( CDVDsrc_Plugin ); - DoCDVDopen( NULL ); - SysPrepareExecution(NULL); + if( OpenCDVD( NULL ) ) + SysPrepareExecution(NULL); } void OnFile_RunBIOS(GtkMenuItem *menuitem, gpointer user_data) @@ -350,8 +350,8 @@ void OnRunIso_Ok(GtkButton* button, gpointer user_data) SysReset(); CDVDsys_ChangeSource( CDVDsrc_Iso ); - DoCDVDopen( File ); - SysPrepareExecution( NULL ); + if( OpenCDVD( File ) ); + SysPrepareExecution( NULL ); } void OnRunIso_Cancel(GtkButton* button, gpointer user_data) @@ -398,8 +398,8 @@ void OnRunElf_Ok(GtkButton* button, gpointer user_data) SysReset(); CDVDsys_ChangeSource( source ); - OpenCDVD( NULL ); - SysPrepareExecution(elf_name); + if( OpenCDVD( NULL ) ) + SysPrepareExecution(elf_name); } void OnRunElf_Cancel(GtkButton* button, gpointer user_data) diff --git a/pcsx2/Plugins.cpp b/pcsx2/Plugins.cpp index 3de38d9b3c..534a3e8f28 100644 --- a/pcsx2/Plugins.cpp +++ b/pcsx2/Plugins.cpp @@ -814,6 +814,7 @@ void ShutdownPlugins() if (CDVDshutdown != NULL) CDVDshutdown(); cdvd_FileNameParam.clear(); + CDVD = NULL; if (DEV9shutdown != NULL) DEV9shutdown(); if (USBshutdown != NULL) USBshutdown(); diff --git a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj index bedd67b3ca..5b7be171f7 100644 --- a/pcsx2/windows/VCprojects/pcsx2_2008.vcproj +++ b/pcsx2/windows/VCprojects/pcsx2_2008.vcproj @@ -215,7 +215,7 @@ PreprocessorDefinitions="NDEBUG" ExceptionHandling="2" EnableEnhancedInstructionSet="0" - UsePrecompiledHeader="0" + UsePrecompiledHeader="2" PrecompiledHeaderThrough="PrecompiledHeader.h" PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch" CompileAs="2" @@ -2254,7 +2254,6 @@ RelativePath="..\..\Gif.cpp" > - diff --git a/pcsx2/windows/WinMain.cpp b/pcsx2/windows/WinMain.cpp index f7b77b43bd..682e7f6721 100644 --- a/pcsx2/windows/WinMain.cpp +++ b/pcsx2/windows/WinMain.cpp @@ -689,8 +689,8 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { SysReset(); CDVDsys_ChangeSource( CDVDsrc_Iso ); - OpenCDVD( isostr.c_str() ); - SysPrepareExecution( outstr.c_str() ); + if( OpenCDVD( isostr.c_str() ) ) + SysPrepareExecution( outstr.c_str() ); } } break; @@ -702,8 +702,8 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { SysReset(); CDVDsys_ChangeSource( CDVDsrc_Plugin ); - OpenCDVD( NULL ); // manually open the CDVD plugin even though we don't really have to. (See RUNCD for details) - SysPrepareExecution( outstr.c_str() ); + if( OpenCDVD( NULL ) ) // manually open the CDVD plugin even though we don't really have to. (See RUNCD for details) + SysPrepareExecution( outstr.c_str() ); } } break; @@ -715,8 +715,8 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { SysReset(); CDVDsys_ChangeSource( CDVDsrc_Iso ); - OpenCDVD( outstr.c_str() ); - SysPrepareExecution( NULL ); + if( OpenCDVD( outstr.c_str() ) ) + SysPrepareExecution( NULL ); } } break; @@ -729,7 +729,14 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case ID_RUN_EXECUTE: // Execute without reset -- resumes existing states or runs the BIOS if - // the state is cleared/reset. + // the state is cleared/reset. If the CDVD is NULL (system reset), then + // assume the cdvd plugin as the source. (retains legacy behavior) + + if( CDVD == NULL ) + { + CDVDsys_ChangeSource( CDVDsrc_Plugin ); + if( !OpenCDVD( NULL ) ) break; + } SysPrepareExecution( NULL, true ); break; @@ -739,8 +746,8 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) // Note: manually open the CDVD plugin here, even though we don't really have to. // This ensures that the CDVD plugin's popups (like cdvdiso's browser) don't get obscured // by the GS window. - OpenCDVD( NULL ); - SysPrepareExecution( NULL ); + if( OpenCDVD( NULL ) ) + SysPrepareExecution( NULL ); break; case ID_RUN_RESET: