From: <sag...@us...> - 2014-03-25 23:26:11
|
Revision: 3964 http://sourceforge.net/p/modplug/code/3964 Author: saga-games Date: 2014-03-25 23:26:04 +0000 (Tue, 25 Mar 2014) Log Message: ----------- [Imp] Write plugin bitness to plugin cache [Fix] Small memory leak was introduced in previous commit. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/soundlib/plugins/PluginManager.cpp Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-25 23:01:50 UTC (rev 3963) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-25 23:26:04 UTC (rev 3964) @@ -1589,6 +1589,7 @@ { gpSplashScreen = NULL; m_Bitmap->DeleteObject(); + delete m_Bitmap; } Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2014-03-25 23:01:50 UTC (rev 3963) +++ trunk/OpenMPT/mptrack/Vstplug.h 2014-03-25 23:26:04 UTC (rev 3964) @@ -65,7 +65,7 @@ bool isInstrument; bool useBridge, shareBridgeInstance; protected: - uint8 dllBits; + mutable uint8 dllBits; public: VSTPluginLib(const mpt::PathString &dllPath, const mpt::PathString &libraryName) @@ -79,15 +79,19 @@ } // Check whether a plugin can be hosted inside OpenMPT or requires bridging - uint8 GetDllBits(); - bool IsNative() { return GetDllBits() == sizeof(void *) * 8; } + uint8 GetDllBits(bool fromCache = true) const; + bool IsNative(bool fromCache = true) const { return GetDllBits(fromCache) == sizeof(void *) * 8; } void WriteToCache() const; uint32 EncodeCacheFlags() const { - // Format: 00000000.00000000.000000SB.CCCCCCCI - return (isInstrument ? 1 : 0) | (category << 1) | (useBridge ? 0x100 : 0) | (shareBridgeInstance ? 0x200 : 0); + // Format: 00000000.00000000.DDDDDDSB.CCCCCCCI + return (isInstrument ? 1 : 0) + | (category << 1) + | (useBridge ? 0x100 : 0) + | (shareBridgeInstance ? 0x200 : 0) + | (dllBits / 8) << 10; } void DecodeCacheFlags(uint32 flags) @@ -110,6 +114,7 @@ { shareBridgeInstance = true; } + dllBits = ((flags >> 10) & 0x3F) * 8; } }; Modified: trunk/OpenMPT/soundlib/plugins/PluginManager.cpp =================================================================== --- trunk/OpenMPT/soundlib/plugins/PluginManager.cpp 2014-03-25 23:01:50 UTC (rev 3963) +++ trunk/OpenMPT/soundlib/plugins/PluginManager.cpp 2014-03-25 23:26:04 UTC (rev 3964) @@ -44,10 +44,10 @@ static const wchar_t *const cacheSectionW = L"PluginCache"; -uint8 VSTPluginLib::GetDllBits() -//------------------------------ +uint8 VSTPluginLib::GetDllBits(bool fromCache) const +//-------------------------------------------------- { - if(!dllBits) + if(!dllBits || !fromCache) { dllBits = static_cast<uint8>(BridgeWrapper::GetPluginBinaryType(dllPath)); } @@ -198,7 +198,7 @@ AEffect *effect = nullptr; library = nullptr; - const bool isNative = BridgeWrapper::IsPluginNative(pluginPath); + const bool isNative = plugin.IsNative(false); if(forceBridge || plugin.useBridge || !isNative) { try @@ -558,16 +558,10 @@ { validPlugin = true; - const bool oldIsInstrument = pFound->isInstrument; - const VSTPluginLib::PluginCategory oldCategory = pFound->category; - GetPluginInformation(pEffect, *pFound); - if(oldIsInstrument != pFound->isInstrument || oldCategory != pFound->category) - { - // Update cached information - pFound->WriteToCache(); - } + // Update cached information + pFound->WriteToCache(); CVstPlugin *pVstPlug = new (std::nothrow) CVstPlugin(hLibrary, *pFound, mixPlugin, *pEffect, sndFile); if(pVstPlug == nullptr) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |