Use latest libwupsbackend version

This commit is contained in:
Maschell 2024-03-24 11:14:35 +01:00
parent aecc164dda
commit 38d4578c36
2 changed files with 25 additions and 23 deletions

View File

@ -1,7 +1,7 @@
FROM ghcr.io/wiiu-env/devkitppc:20231112
COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:0.8.0-dev-20240302-3b5cc2f /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libwupsbackend:20230621 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libwupsbackend:0.1.3-dev-20240323-9493c4f /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/librpxloader:20230621 /artifacts $DEVKITPRO
COPY --from=ghcr.io/wiiu-env/libnotifications:20230621 /artifacts $DEVKITPRO

View File

@ -183,39 +183,41 @@ TcpReceiver::eLoadResults TcpReceiver::tryLoadRPX(uint8_t *data, uint32_t fileSi
TcpReceiver::eLoadResults TcpReceiver::tryLoadWPS(uint8_t *data, uint32_t fileSize) {
if (data[0x7] == 0xCA && data[0x8] == 0xFE && data[0x9] == 0x50 && data[0xA] == 0x4C) {
auto newContainer = WUPSBackend::PluginUtils::getPluginForBuffer((char *) data, fileSize);
if (newContainer) {
auto plugins = WUPSBackend::PluginUtils::getLoadedPlugins(32);
auto &metaInformation = newContainer.value()->getMetaInformation();
PluginBackendApiErrorType err;
auto newContainerOpt = WUPSBackend::PluginUtils::getPluginForBuffer((char *) data, fileSize, err);
if (newContainerOpt) {
auto pluginList = WUPSBackend::PluginUtils::getLoadedPlugins(err);
if (err != PLUGIN_BACKEND_API_ERROR_NONE) {
DEBUG_FUNCTION_LINE_ERR("Failed to load plugin list.");
return PLUGIN_PARSE_FAILED;
}
const auto &metaInformation = newContainerOpt->getMetaInformation();
// remove plugins with the same name and author as our new plugin
plugins.erase(std::remove_if(plugins.begin(), plugins.end(),
[metaInformation](auto &plugin) {
return plugin->getMetaInformation()->getName() == metaInformation->getName() &&
plugin->getMetaInformation()->getAuthor() == metaInformation->getAuthor();
}),
plugins.end());
pluginList.erase(std::remove_if(pluginList.begin(), pluginList.end(),
[&metaInformation](auto &plugin) {
auto res = plugin.getMetaInformation().getName() == metaInformation.getName() &&
plugin.getMetaInformation().getAuthor() == metaInformation.getAuthor();
return res;
}),
pluginList.end());
// add the new plugin
plugins.push_back(std::move(newContainer.value()));
pluginList.push_back(std::move(newContainerOpt.value()));
#ifdef VERBOSE_DEBUG
for (auto &plugin : plugins) {
DEBUG_FUNCTION_LINE_VERBOSE("name: %s", plugin->getMetaInformation()->getName().c_str());
DEBUG_FUNCTION_LINE_VERBOSE("author: %s", plugin->getMetaInformation()->getAuthor().c_str());
DEBUG_FUNCTION_LINE_VERBOSE("handle: %08X", plugin->getPluginData()->getHandle());
for (const auto &plugin : pluginList) {
DEBUG_FUNCTION_LINE_VERBOSE("name: %s", plugin.getMetaInformation().getName().c_str());
DEBUG_FUNCTION_LINE_VERBOSE("author: %s", plugin.getMetaInformation().getAuthor().c_str());
DEBUG_FUNCTION_LINE_VERBOSE("handle: %08X", plugin.getPluginData().getHandle());
DEBUG_FUNCTION_LINE_VERBOSE("====");
}
#endif
if (WUPSBackend::PluginUtils::LoadAndLinkOnRestart(plugins) != 0) {
DEBUG_FUNCTION_LINE_ERR("WUPSBackend::PluginUtils::LoadAndLinkOnRestart failed");
if ((err = WUPSBackend::PluginUtils::LoadAndLinkOnRestart(pluginList)) != PLUGIN_BACKEND_API_ERROR_NONE) {
DEBUG_FUNCTION_LINE_ERR("WUPSBackend::PluginUtils::LoadAndLinkOnRestart failed. %s", WUPSBackend::GetStatusStr(err));
return PLUGIN_LOAD_LINK_FAILED;
}
return SUCCESS;
} else {
DEBUG_FUNCTION_LINE_ERR("Failed to parse plugin for buffer: %08X size %d", data, fileSize);
DEBUG_FUNCTION_LINE_ERR("Failed to parse plugin for buffer: %08X size %d. Error: %s", data, fileSize, WUPSBackend::GetStatusStr(err));
return PLUGIN_PARSE_FAILED;
}
}