diff --git a/source/PluginManagement.cpp b/source/PluginManagement.cpp index ba6414a..2d94788 100644 --- a/source/PluginManagement.cpp +++ b/source/PluginManagement.cpp @@ -15,23 +15,42 @@ static uint32_t sTrampolineID = 0; +bool CheckIfAllowed(const PluginMetaInformation &metaInfo) { + std::vector> allowList = { + {"Maschell", "Aroma Base Plugin"}, + {"Maschell", "DRC Region Free Plugin"}, + {"Maschell", "Homebrew on Wii U menu"}, + {"Maschell", "Region Free Plugin"}, + {"Maschell", "Wiiload"}, + {"mtheall, Maschell", "ftpiiu"}, + }; + return std::any_of(allowList.begin(), allowList.end(), [&metaInfo](const auto &cur) { + return metaInfo.getAuthor() == cur.first && metaInfo.getName() == cur.second; + }); +} + std::vector PluginManagement::loadPlugins(const std::set, PluginDataSharedPtrComparator> &pluginDataList, std::vector &trampolineData) { std::vector plugins; for (const auto &pluginData : pluginDataList) { PluginParseErrors error = PLUGIN_PARSE_ERROR_UNKNOWN; - - auto metaInfo = PluginMetaInformationFactory::loadPlugin(*pluginData, error); + auto metaInfo = PluginMetaInformationFactory::loadPlugin(*pluginData, error); if (metaInfo && error == PLUGIN_PARSE_ERROR_NONE) { - auto linkInfo = PluginLinkInformationFactory::load(*pluginData, trampolineData, sTrampolineID++); - if (!linkInfo) { - auto errMsg = string_format("Failed to load plugin: %s", pluginData->getSource().c_str()); - DEBUG_FUNCTION_LINE_ERR("%s", errMsg.c_str()); - DisplayErrorNotificationMessage(errMsg, 15.0f); - continue; + if (!pluginData->getSource().ends_with(".wps") || CheckIfAllowed(*metaInfo)) { + DEBUG_FUNCTION_LINE_INFO("We want to link %s by %s", metaInfo->getName().c_str(), metaInfo->getAuthor().c_str()); + auto linkInfo = PluginLinkInformationFactory::load(*pluginData, trampolineData, sTrampolineID++); + if (!linkInfo) { + auto errMsg = string_format("Failed to load plugin: %s", pluginData->getSource().c_str()); + DEBUG_FUNCTION_LINE_ERR("%s", errMsg.c_str()); + DisplayErrorNotificationMessage(errMsg, 15.0f); + continue; + } + plugins.emplace_back(std::move(*metaInfo), std::move(linkInfo), pluginData); + } else { + DEBUG_FUNCTION_LINE_INFO("We want to skip %s by %s", metaInfo->getName().c_str(), metaInfo->getAuthor().c_str()); + plugins.emplace_back(std::move(*metaInfo), std::nullopt, pluginData); } - plugins.emplace_back(std::move(*metaInfo), std::move(linkInfo), pluginData); } else { auto errMsg = string_format("Failed to load plugin: %s", pluginData->getSource().c_str()); if (error == PLUGIN_PARSE_ERROR_INCOMPATIBLE_VERSION) {