From 592781e7fcea60a716ae774f17663cc213c9c82e Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Thu, 3 Sep 2009 15:52:15 +0000 Subject: [PATCH] Minor changes to how the commandline auorun feature works, so that it initializes in the same general order/pattern as using the GUI. May fix some spotty problems. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1732 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/Plugins.cpp | 8 ++++++-- pcsx2/Saveslots.cpp | 3 ++- pcsx2/windows/WinMain.cpp | 17 +++++++++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/pcsx2/Plugins.cpp b/pcsx2/Plugins.cpp index ecfc55367..ecba8edd7 100644 --- a/pcsx2/Plugins.cpp +++ b/pcsx2/Plugins.cpp @@ -851,7 +851,11 @@ bool OpenCDVD( const char* pTitleFilename ) // if this assertion fails it means you didn't call CDVDsys_ChangeSource. You should. // You really should. Really. jASSUME( CDVD != NULL ); - + + // hack to fix the new cdvd system, to ensure the plugin is always initialized when it's manually + // opened separately from the rest. + if( InitPlugins() == -1 ) return -1; + // Don't repetitively open the CDVD plugin if directly loading an elf file and open failed once already. if (!OpenStatus.CDVD) { @@ -861,7 +865,7 @@ bool OpenCDVD( const char* pTitleFilename ) pTitleFilename = cdvd_FileNameParam.c_str(); if (DoCDVDopen(pTitleFilename) != 0) - { + { Msgbox::Alert("Error Opening CDVD Plugin"); ClosePlugins(true); return false; diff --git a/pcsx2/Saveslots.cpp b/pcsx2/Saveslots.cpp index ba2314c8f..183ebe085 100644 --- a/pcsx2/Saveslots.cpp +++ b/pcsx2/Saveslots.cpp @@ -48,7 +48,8 @@ static void _loadStateOrExcept( const string& file ) // Make sure the cpu and plugins are ready to be state-ified! cpuReset(); - OpenPlugins(); + if( OpenPlugins() == -1 ) + throw Exception::PluginFailure( "Could not open all configured plugins." ); joe.FreezeAll(); diff --git a/pcsx2/windows/WinMain.cpp b/pcsx2/windows/WinMain.cpp index cbe8f8a8a..e0886430e 100644 --- a/pcsx2/windows/WinMain.cpp +++ b/pcsx2/windows/WinMain.cpp @@ -368,8 +368,6 @@ static std::string str_Default( "default" ); void RunGui() { - MSG msg; - PCSX2_MEM_PROTECT_BEGIN(); LoadPatch( str_Default ); @@ -378,9 +376,19 @@ void RunGui() { // Initially bypass GUI and start PCSX2 directly. + SysReset(); CDVDsys_ChangeSource( g_Startup.CdvdSource ); - if( !OpenCDVD( g_Startup.ImageName ) ) return; - if( OpenPlugins() == -1 ) return; + if( !OpenCDVD( g_Startup.ImageName ) ) + { + Console::Error( "CDVD Initialization returned error, aborting autorun..." ); + return; + } + + if( OpenPlugins() == -1 ) + { + Console::Error( "Some plugin failed to open, aborting autorun..." ); + return; + } SysPrepareExecution( (g_Startup.StartupMode == Startup_FromELF) ? g_Startup.ImageName : NULL, !g_Startup.SkipBios ); } @@ -395,6 +403,7 @@ void RunGui() while( true ) { + MSG msg; if( PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE) != 0 ) { if( msg.message == WM_QUIT )