From: <sag...@us...> - 2011-10-24 20:07:52
|
Revision: 1121 http://modplug.svn.sourceforge.net/modplug/?rev=1121&view=rev Author: saga-games Date: 2011-10-24 20:07:46 +0000 (Mon, 24 Oct 2011) Log Message: ----------- [Imp] If a plugin fails to load and crashes OpenMPT, it should not be loaded the next time OpenMPT is started anymore. [Mod] OpenMPT: Version is now 1.20.00.48 Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/version.h Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2011-10-23 20:34:22 UTC (rev 1120) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2011-10-24 20:07:46 UTC (rev 1121) @@ -495,7 +495,7 @@ if (!gpDLSBanks[i] || !gpDLSBanks[i]->GetFileName() || !gpDLSBanks[i]->GetFileName()[0]) continue; - _tcsncpy(szPath, gpDLSBanks[i]->GetFileName(), ARRAYELEMCOUNT(szPath) - 1); + _tcsncpy(szPath, gpDLSBanks[i]->GetFileName(), CountOf(szPath) - 1); if(theApp.IsPortableMode()) { theApp.AbsolutePathToRelative(szPath); @@ -2152,6 +2152,8 @@ CString nonFoundPlugs; + const CString failedPlugin = CMainFrame::GetPrivateProfileCString("VST Plugins", "FailedPlugin", "", m_szConfigFileName); + for (LONG iPlug=0; iPlug<nPlugins; iPlug++) { s[0] = 0; @@ -2160,7 +2162,15 @@ if (s[0]) { RelativePathToAbsolute(s); - m_pPluginManager->AddPlugin(s, TRUE, true, &nonFoundPlugs); + + if(failedPlugin.Compare(s) != 0) + { + m_pPluginManager->AddPlugin(s, TRUE, true, &nonFoundPlugs); + } else + { + const CString text = "The following plugin has previously crashed OpenMPT during initialisation and will thus not be loaded:\n\n" + failedPlugin; + Reporting::Information(text); + } } } if(nonFoundPlugs.GetLength() > 0) Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2011-10-23 20:34:22 UTC (rev 1120) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2011-10-24 20:07:46 UTC (rev 1121) @@ -278,6 +278,9 @@ HINSTANCE hLib = NULL; + // If this key contains a file name on program launch, a plugin previously crashed OpenMPT. + WritePrivateProfileString("VST Plugins", "FailedPlugin", pszDllPath, theApp.GetConfigFileName()); + try { hLib = LoadLibrary(pszDllPath); @@ -421,18 +424,19 @@ #endif // VST_LOG } - //try { - FreeLibrary(hLib); - //} catch (...) { - // CVstPluginManager::ReportPlugException("Exception in FreeLibrary(\"%s\")!\n", pszDllPath); - //} + FreeLibrary(hLib); + // Now it should be safe to assume that this plugin loaded properly. :) + WritePrivateProfileString("VST Plugins", "FailedPlugin", NULL, theApp.GetConfigFileName()); + return (bOk) ? m_pVstHead : nullptr; } else { #ifdef VST_LOG Log("LoadLibrary(%s) failed!\n", pszDllPath); #endif // VST_LOG + + WritePrivateProfileString("VST Plugins", "FailedPlugin", NULL, theApp.GetConfigFileName()); } return nullptr; } @@ -1394,7 +1398,7 @@ MemsetZero(sa); sa.numChannels = 2; sa.type = kSpeakerArrStereo; - for(int i = 0; i < ARRAYELEMCOUNT(sa.speakers); i++) + for(int i = 0; i < CountOf(sa.speakers); i++) { sa.speakers[i].azimuth = 0.0f; sa.speakers[i].elevation = 0.0f; Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2011-10-23 20:34:22 UTC (rev 1120) +++ trunk/OpenMPT/mptrack/version.h 2011-10-24 20:07:46 UTC (rev 1121) @@ -15,7 +15,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 47 +#define VER_MINORMINOR 48 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |