mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2025-01-10 03:29:22 +01:00
Only link allowed plugins for testing
This commit is contained in:
parent
10b5513ddf
commit
7b151f027f
@ -15,15 +15,30 @@
|
|||||||
|
|
||||||
static uint32_t sTrampolineID = 0;
|
static uint32_t sTrampolineID = 0;
|
||||||
|
|
||||||
|
bool CheckIfAllowed(const PluginMetaInformation &metaInfo) {
|
||||||
|
std::vector<std::pair<std::string, std::string>> 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<PluginContainer>
|
std::vector<PluginContainer>
|
||||||
PluginManagement::loadPlugins(const std::set<std::shared_ptr<PluginData>, PluginDataSharedPtrComparator> &pluginDataList, std::vector<relocation_trampoline_entry_t> &trampolineData) {
|
PluginManagement::loadPlugins(const std::set<std::shared_ptr<PluginData>, PluginDataSharedPtrComparator> &pluginDataList, std::vector<relocation_trampoline_entry_t> &trampolineData) {
|
||||||
std::vector<PluginContainer> plugins;
|
std::vector<PluginContainer> plugins;
|
||||||
|
|
||||||
for (const auto &pluginData : pluginDataList) {
|
for (const auto &pluginData : pluginDataList) {
|
||||||
PluginParseErrors error = PLUGIN_PARSE_ERROR_UNKNOWN;
|
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) {
|
if (metaInfo && error == PLUGIN_PARSE_ERROR_NONE) {
|
||||||
|
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++);
|
auto linkInfo = PluginLinkInformationFactory::load(*pluginData, trampolineData, sTrampolineID++);
|
||||||
if (!linkInfo) {
|
if (!linkInfo) {
|
||||||
auto errMsg = string_format("Failed to load plugin: %s", pluginData->getSource().c_str());
|
auto errMsg = string_format("Failed to load plugin: %s", pluginData->getSource().c_str());
|
||||||
@ -32,6 +47,10 @@ PluginManagement::loadPlugins(const std::set<std::shared_ptr<PluginData>, Plugin
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
plugins.emplace_back(std::move(*metaInfo), std::move(linkInfo), pluginData);
|
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);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
auto errMsg = string_format("Failed to load plugin: %s", pluginData->getSource().c_str());
|
auto errMsg = string_format("Failed to load plugin: %s", pluginData->getSource().c_str());
|
||||||
if (error == PLUGIN_PARSE_ERROR_INCOMPATIBLE_VERSION) {
|
if (error == PLUGIN_PARSE_ERROR_INCOMPATIBLE_VERSION) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user