mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2025-01-09 11:09:22 +01:00
Only link allowed plugins for testing
This commit is contained in:
parent
10b5513ddf
commit
7b151f027f
@ -15,23 +15,42 @@
|
||||
|
||||
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>
|
||||
PluginManagement::loadPlugins(const std::set<std::shared_ptr<PluginData>, PluginDataSharedPtrComparator> &pluginDataList, std::vector<relocation_trampoline_entry_t> &trampolineData) {
|
||||
std::vector<PluginContainer> 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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user