From ee6b27aeb805f064bfe6ca82598dcb17a1469764 Mon Sep 17 00:00:00 2001 From: ramapcsx2 Date: Thu, 11 Mar 2010 21:16:35 +0000 Subject: [PATCH] A few fixes to resets and shutdowns. Fixes a few memory leaks. Thanks a bunch, ksi3zyc :) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2698 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/CDVD/CDVD.cpp | 3 ++- pcsx2/Elfheader.cpp | 5 +++-- pcsx2/System.cpp | 8 ++++++++ pcsx2/gui/MainMenuClicks.cpp | 3 ++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 2ef8ec0466..08fec52989 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -322,13 +322,14 @@ static __forceinline ElfObject *loadElfCRC( const wxString filename ) static __forceinline void _reloadElfInfo(wxString str) { - ElfObject *elfptr; + ScopedPtr elfptr; // Now's a good time to reload the ELF info... ScopedLock locker( Mutex_NewDiskCB ); elfptr = loadElfCRC(str); elfptr->applyPatches(); + elfptr.Delete(); } static __forceinline void reloadElfInfo(u32 discType, wxString str) diff --git a/pcsx2/Elfheader.cpp b/pcsx2/Elfheader.cpp index 79f0c6ecc4..698925d849 100644 --- a/pcsx2/Elfheader.cpp +++ b/pcsx2/Elfheader.cpp @@ -447,7 +447,7 @@ void loadElfFile(const wxString& _filename) void loadElfFile(const wxString& filename) #endif { - ElfObject *elfptr; + ScopedPtr elfptr; bool iscdvd; #ifdef USE_HOSTFS @@ -546,7 +546,8 @@ void loadElfFile(const wxString& filename) elfptr->getCRC(); Console.WriteLn( L"loadElfFile: %s; CRC = %8.8X", filename.c_str(), ElfCRC ); elfptr->applyPatches(); - + elfptr.Delete(); + return; } diff --git a/pcsx2/System.cpp b/pcsx2/System.cpp index 0331d44535..88f34a5202 100644 --- a/pcsx2/System.cpp +++ b/pcsx2/System.cpp @@ -22,6 +22,9 @@ #include "System/PageFaultSource.h" #include "Utilities/EventSource.inl" +extern void closeNewVif(int idx); +extern void resetNewVif(int idx); + template class EventSource< IEventListener_PageFault >; SrcType_PageFault Source_PageFault; @@ -309,6 +312,8 @@ void SysCoreAllocations::CleanupMess() throw() recCpu.Shutdown(); vuMicroMemShutdown(); + closeNewVif(0); + closeNewVif(1); psxMemShutdown(); memShutdown(); vtlb_Core_Shutdown(); @@ -366,6 +371,9 @@ void SysClearExecutionCache() Cpu->Reset(); psxCpu->Reset(); + + resetNewVif(0); + resetNewVif(1); CpuVU0->Reset(); CpuVU1->Reset(); diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index 3c014aa8aa..9b353c5104 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -251,7 +251,8 @@ void MainEmuFrame::Menu_BootCdvd_Click( wxCommandEvent &event ) return; } } - + + sApp.SysReset(); sApp.SysExecute( g_Conf->CdvdSource ); }