diff --git a/loader/src/myutils/TcpReceiver.cpp b/loader/src/myutils/TcpReceiver.cpp index 81bcfc4..649c850 100644 --- a/loader/src/myutils/TcpReceiver.cpp +++ b/loader/src/myutils/TcpReceiver.cpp @@ -226,10 +226,9 @@ int TcpReceiver::loadToMemory(s32 clientSocket, u32 ipAddress) { PluginLoader * pluginLoader = PluginLoader::getInstance(); pluginLoader->resetPluginLoader(); std::vector pluginList = pluginLoader->getPluginInformation(WUPS_TEMP_PLUGIN_PATH); - if(pluginList.size() == 0) { + if(pluginList.size() == 0 || !pluginLoader->loadAndLinkPlugins(pluginList)) { return NOT_A_VALID_PLUGIN; } - pluginLoader->loadAndLinkPlugins(pluginList); Application::instance()->quit(APPLICATION_CLOSE_APPLY); return fileSize; diff --git a/loader/src/plugin/PluginLoader.cpp b/loader/src/plugin/PluginLoader.cpp index bba3bd6..60015fa 100644 --- a/loader/src/plugin/PluginLoader.cpp +++ b/loader/src/plugin/PluginLoader.cpp @@ -90,13 +90,15 @@ std::vector PluginLoader::getPluginsLoadedInMemory() { return pluginInformation; } -void PluginLoader::loadAndLinkPlugins(std::vector pluginInformation) { +bool PluginLoader::loadAndLinkPlugins(std::vector pluginInformation) { std::vector loadedPlugins; + bool success = true; for(size_t i = 0; i < pluginInformation.size(); i++) { PluginInformation * cur_info = pluginInformation[i]; PluginData * pluginData = loadAndLinkPlugin(cur_info); if(pluginData == NULL) { DEBUG_FUNCTION_LINE("loadAndLinkPlugins failed for %d\n",i) ; + success = false; continue; } else { loadedPlugins.push_back(pluginData); @@ -108,6 +110,7 @@ void PluginLoader::loadAndLinkPlugins(std::vector pluginInf DCFlushRange((void*)this->startAddress,(u32)this->endAddress - (u32)this->startAddress); ICInvalidateRange((void*)this->startAddress,(u32)this->endAddress - (u32)this->startAddress); + return success; } void PluginLoader::clearPluginData(std::vector pluginData) { diff --git a/loader/src/plugin/PluginLoader.h b/loader/src/plugin/PluginLoader.h index 8bbf42b..936a515 100644 --- a/loader/src/plugin/PluginLoader.h +++ b/loader/src/plugin/PluginLoader.h @@ -85,8 +85,10 @@ public: Also the hooks of the plugins will be called in the order their plugin where passed to this method. \param A list of plugin that should be linked (relocated) an loaded into memory + + \return Returns true if all plugins were linked successfully. Returns false if at least one plugin failed while linking. **/ - void loadAndLinkPlugins(std::vector pluginInformation); + bool loadAndLinkPlugins(std::vector pluginInformation); /** \brief Iterates through the vector and delete all it's elements