diff --git a/pcsx2/CDVD/IsoFileFormats.cpp b/pcsx2/CDVD/IsoFileFormats.cpp index 8bf9c560b8..3281881d1e 100644 --- a/pcsx2/CDVD/IsoFileFormats.cpp +++ b/pcsx2/CDVD/IsoFileFormats.cpp @@ -428,6 +428,7 @@ void isoClose(isoFile *iso) if (iso->handle) _closefile(iso->handle); if (iso->htable) _closefile(iso->htable); safe_free( iso->buffer ); + safe_free( iso->dtable ); safe_free( iso ); } diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index 5cc20e5310..97cb3c6bb5 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -542,12 +542,16 @@ void RelocateLogfile() // void AppConfig_OnChangedSettingsFolder( bool overwrite ) { - PathDefs::GetDocuments().Mkdir(); - PathDefs::GetSettings().Mkdir(); + if( !UseAdminMode ) + PathDefs::GetDocuments().Mkdir(); + + GetSettingsFolder().Mkdir(); + + const wxString iniFilename( GetSettingsFilename() ); if( overwrite ) { - if( !wxRemoveFile( GetSettingsFilename() ) ) + if( wxFileExists( iniFilename ) && !wxRemoveFile( iniFilename ) ) throw Exception::AccessDenied( "Failed to overwrite settings; permission to file was denied." ); } @@ -556,7 +560,7 @@ void AppConfig_OnChangedSettingsFolder( bool overwrite ) // Bind into wxConfigBase to allow wx to use our config internally, and delete whatever // comes out (cleans up prev config, if one). - delete wxConfigBase::Set( OpenFileConfig( GetSettingsFilename() ) ); + delete wxConfigBase::Set( OpenFileConfig( iniFilename ) ); GetAppConfig()->SetRecordDefaults(); //wxGetApp().Source_SettingsChanged().Dispatch( SettingsEvt_IniOpening ); diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 6307101c6f..45569cdbc0 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -316,6 +316,8 @@ void AppApplySettings( const AppConfig* oldconf, bool saveOnSuccess ) { AllowFromMainThreadOnly(); + g_Conf->Folders.ApplyDefaults(); + // Ensure existence of necessary documents folders. Plugins and other parts // of PCSX2 rely on them.