From f63bea379a2106e9aa0e528080caa0a4f3f486c7 Mon Sep 17 00:00:00 2001 From: cottonvibes Date: Fri, 8 May 2009 05:44:02 +0000 Subject: [PATCH] better fix for my elf-fix a while back. basically if you run an elf file now, the cdvd plugin will attempt to open once, and if it has an error (like loading no-game), it'll let you continue running the elf file, and it won't bug you again. but if it did open successfully, it'll initiate the cdvd plugin normally (allowing elf files to read the cdvd contents, like the Snes emu for ps2...) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1154 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/HostGui.h | 3 ++- pcsx2/Plugins.cpp | 15 +++++++++++---- pcsx2/System.cpp | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pcsx2/HostGui.h b/pcsx2/HostGui.h index 3620d36cd8..d411f95acb 100644 --- a/pcsx2/HostGui.h +++ b/pcsx2/HostGui.h @@ -25,7 +25,8 @@ enum StartupMode { BootMode_Bios, BootMode_Quick, - BootMode_Elf + BootMode_Elf, + BootMode_Normal }; class StartupParams diff --git a/pcsx2/Plugins.cpp b/pcsx2/Plugins.cpp index bafd5a6012..dcd9709a4b 100644 --- a/pcsx2/Plugins.cpp +++ b/pcsx2/Plugins.cpp @@ -607,6 +607,7 @@ static PluginOpenStatusFlags OpenStatus = {0}; static bool loadp = false; static bool initp = false; +static bool cdvdElf = false; int LoadPlugins() { @@ -659,6 +660,7 @@ int InitPlugins() ret = FWinit(); if (ret != 0) { Msgbox::Alert("FWinit error: %d", params ret); return -1; } + cdvdElf = false; initp = true; return 0; } @@ -725,19 +727,24 @@ int OpenPlugins(const char* pTitleFilename) }*/ #endif - // Don't Open CDVD plugin if directly loading an elf file - if( !OpenStatus.CDVD && g_Startup.BootMode != BootMode_Elf) + // Don't Repetitively Open CDVD plugin if directly loading an elf file and Open failed once already + if( !OpenStatus.CDVD && !cdvdElf) { //first we need the data if (CDVDnewDiskCB) CDVDnewDiskCB(cdvdNewDiskCB); ret = CDVDopen(pTitleFilename); - if (ret != 0) { Msgbox::Alert("Error Opening CDVD Plugin"); goto OpenError; } + if (ret != 0) { + if (g_Startup.BootMode != BootMode_Elf) { Msgbox::Alert("Error Opening CDVD Plugin"); goto OpenError; } + else { Console::Notice("Running ELF File Without CDVD Plugin Support!"); cdvdElf = 1; goto skipOpenCDVD; } + } OpenStatus.CDVD = true; cdvdNewDiskCB(); } +skipOpenCDVD: + if( !OpenStatus.GS ) { ret = gsOpen(); if (ret != 0) { Msgbox::Alert("Error Opening GS Plugin"); goto OpenError; } @@ -833,7 +840,7 @@ OpenError: void ClosePlugins( bool closegs ) { - // Close pads first since they attatch to the GS's window. + // Close pads first since they attach to the GS's window. CLOSE_PLUGIN( PAD1 ); CLOSE_PLUGIN( PAD2 ); diff --git a/pcsx2/System.cpp b/pcsx2/System.cpp index eb06d7905d..aa1170d3b2 100644 --- a/pcsx2/System.cpp +++ b/pcsx2/System.cpp @@ -400,8 +400,8 @@ void SysPrepareExecution( const char* elf_file, bool use_bios ) return; } - // Don't Open CDVD plugin if directly loading an elf file - if (elf_file) { g_Startup.BootMode = BootMode_Elf; } + g_Startup.BootMode = (elf_file) ? BootMode_Elf : BootMode_Normal; + if (OpenPlugins(NULL) == -1) { return; }