When loading a plugin via wiiload the plugin loader now only closes when the plugin was linked successfully.

This commit is contained in:
Maschell 2018-06-14 16:15:31 +02:00
parent 982e013a30
commit 3066de2d76
3 changed files with 8 additions and 4 deletions

View File

@ -226,10 +226,9 @@ int TcpReceiver::loadToMemory(s32 clientSocket, u32 ipAddress) {
PluginLoader * pluginLoader = PluginLoader::getInstance();
pluginLoader->resetPluginLoader();
std::vector<PluginInformation* > 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;

View File

@ -90,13 +90,15 @@ std::vector<PluginInformation *> PluginLoader::getPluginsLoadedInMemory() {
return pluginInformation;
}
void PluginLoader::loadAndLinkPlugins(std::vector<PluginInformation *> pluginInformation) {
bool PluginLoader::loadAndLinkPlugins(std::vector<PluginInformation *> pluginInformation) {
std::vector<PluginData *> 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<PluginInformation *> 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 *> pluginData) {

View File

@ -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 *> pluginInformation);
bool loadAndLinkPlugins(std::vector<PluginInformation *> pluginInformation);
/**
\brief Iterates through the vector and delete all it's elements