|
|
|
@@ -35,14 +35,16 @@ |
|
|
|
// OF THE POSSIBILITY OF SUCH DAMAGE. |
|
|
|
//----------------------------------------------------------------------------- |
|
|
|
|
|
|
|
#include "base/source/fcommandline.h" |
|
|
|
#include "pluginterfaces/base/fplatform.h" |
|
|
|
#include "pluginterfaces/base/iplugincompatibility.h" |
|
|
|
#include "pluginterfaces/vst/vsttypes.h" |
|
|
|
#include "public.sdk/source/common/memorystream.h" |
|
|
|
#include "public.sdk/source/common/readfile.h" |
|
|
|
#include "public.sdk/source/vst/hosting/module.h" |
|
|
|
#include "public.sdk/source/vst/moduleinfo/moduleinfocreator.h" |
|
|
|
#include "public.sdk/source/vst/moduleinfo/moduleinfoparser.h" |
|
|
|
#include "public.sdk/source/vst/utility/stringconvert.h" |
|
|
|
#include "public.sdk/source/common/readfile.h" |
|
|
|
#include "base/source/fcommandline.h" |
|
|
|
#include "pluginterfaces/vst/vsttypes.h" |
|
|
|
#include "pluginterfaces/base/fplatform.h" |
|
|
|
#include <cstdio> |
|
|
|
#include <fstream> |
|
|
|
#include <iostream> |
|
|
|
@@ -96,6 +98,35 @@ std::optional<ModuleInfo::CompatibilityList> openAndParseCompatJSON (const std:: |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
//------------------------------------------------------------------------ |
|
|
|
std::optional<ModuleInfo::CompatibilityList> loadCompatibilityFromModule (const VST3::Hosting::Module& module) |
|
|
|
{ |
|
|
|
const auto& factory = module.getFactory(); |
|
|
|
const auto& infos = factory.classInfos(); |
|
|
|
|
|
|
|
const auto iter = std::find_if (infos.begin(), infos.end(), [&] (const auto& info) |
|
|
|
{ |
|
|
|
return info.category() == kPluginCompatibilityClass; |
|
|
|
}); |
|
|
|
|
|
|
|
if (iter == infos.end()) |
|
|
|
return {}; |
|
|
|
|
|
|
|
const auto compatibility = factory.createInstance<Steinberg::IPluginCompatibility> (iter->ID()); |
|
|
|
|
|
|
|
if (compatibility == nullptr) |
|
|
|
return {}; |
|
|
|
|
|
|
|
Steinberg::MemoryStream stream; |
|
|
|
|
|
|
|
if (compatibility->getCompatibilityJSON (&stream) != kResultOk) |
|
|
|
return {}; |
|
|
|
|
|
|
|
const std::string_view streamView (stream.getData(), stream.getSize()); |
|
|
|
|
|
|
|
return ModuleInfoLib::parseCompatibilityJson (streamView, nullptr); |
|
|
|
} |
|
|
|
|
|
|
|
//------------------------------------------------------------------------ |
|
|
|
int createJSON (const std::optional<ModuleInfo::CompatibilityList>& compat, |
|
|
|
const std::string& modulePath, const std::string& moduleVersion, |
|
|
|
@@ -111,6 +142,9 @@ int createJSON (const std::optional<ModuleInfo::CompatibilityList>& compat, |
|
|
|
auto moduleInfo = ModuleInfoLib::createModuleInfo (*module, false); |
|
|
|
if (compat) |
|
|
|
moduleInfo.compatibility = *compat; |
|
|
|
else if (auto loaded = loadCompatibilityFromModule (*module)) |
|
|
|
moduleInfo.compatibility = *loaded; |
|
|
|
|
|
|
|
moduleInfo.version = moduleVersion; |
|
|
|
|
|
|
|
std::stringstream output; |
|
|
|
|