mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-17 02:09:17 +01:00
Update ipc interface, some functions are not static in the PluginLoader
This commit is contained in:
parent
82f5f6eb05
commit
73640c01f5
@ -68,7 +68,7 @@ public:
|
||||
|
||||
\return a list of PluginInformation objects, one for each valid plugin.
|
||||
**/
|
||||
std::vector<PluginInformation *> getPluginInformation(const char * path);
|
||||
static std::vector<PluginInformation *> getPluginInformation(const char * path);
|
||||
|
||||
/**
|
||||
\brief Gets plugin information from the global struct.
|
||||
@ -76,7 +76,7 @@ public:
|
||||
\return a list of MetaInformation objects for all plugins currently loaded and linked (relocated). Will only contain
|
||||
plugin which are still on the sd card.
|
||||
**/
|
||||
std::vector<PluginInformation *> getPluginsLoadedInMemory();
|
||||
static std::vector<PluginInformation *> getPluginsLoadedInMemory();
|
||||
|
||||
/**
|
||||
\brief Takes a list of plugins that should be linked (relocated) loaded into the memory.
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "ipc.h"
|
||||
#include "common/retain_vars.h"
|
||||
|
||||
extern void RestoreEverything();
|
||||
extern void afterLoadAndLink();
|
||||
@ -53,12 +54,11 @@ int ipc_ioctl(ipcmessage *message) {
|
||||
}
|
||||
case IOCTL_PLUGIN_LOADER_GET_INFORMATION_FOR_PATH: {
|
||||
DEBUG_FUNCTION_LINE("IOCTL_PLUGIN_LOADER_GET_INFORMATION_FOR_PATH\n");
|
||||
if(message->ioctl.length_in != 8 || message->ioctl.length_io < 4) {
|
||||
if(message->ioctl.length_in != 4 || message->ioctl.length_io < 4) {
|
||||
DEBUG_FUNCTION_LINE("IPC_ERROR_INVALID_SIZE\n");
|
||||
res = IPC_ERROR_INVALID_SIZE;
|
||||
} else {
|
||||
void * ptr = (void *) message->ioctl.buffer_in[0];
|
||||
char * path = (char *) message->ioctl.buffer_in[1];
|
||||
char * path = (char *) message->ioctl.buffer_in[0];
|
||||
uint32_t * filledCount = (uint32_t *)message->ioctl.buffer_io;
|
||||
plugin_information_handle * io_handles = (plugin_information_handle *) &(message->ioctl.buffer_io[1]);
|
||||
uint32_t lengthIo = message->ioctl.length_io - 4;
|
||||
@ -67,9 +67,7 @@ int ipc_ioctl(ipcmessage *message) {
|
||||
|
||||
//DEBUG_FUNCTION_LINE("path %08X %s, filledcount_ptr %08X io_handles%08X lengthio%d\n", path,path, filledCount,io_handles,lengthIo);
|
||||
|
||||
if(ptr != NULL && path != NULL/* && (PluginLoader* pluginLoader = dynamic_cast<PluginLoader*>(ptr))*/) {
|
||||
PluginLoader* pluginLoader = (PluginLoader * )ptr;
|
||||
std::vector<PluginInformation *> pluginList = pluginLoader->getPluginInformation(path);
|
||||
std::vector<PluginInformation *> pluginList = PluginLoader::getPluginInformation(path);
|
||||
uint32_t pluginInfoSpace = lengthIo / sizeof(plugin_information_handle);
|
||||
|
||||
//DEBUG_FUNCTION_LINE("pluginInfoSpace %d\n", pluginInfoSpace);
|
||||
@ -79,42 +77,36 @@ int ipc_ioctl(ipcmessage *message) {
|
||||
for (std::vector<PluginInformation *>::iterator it = pluginList.begin() ; it != pluginList.end(); ++it) {
|
||||
|
||||
PluginInformation * curPlugin = *it;
|
||||
DEBUG_FUNCTION_LINE("cur %d filledCount %d curPlugin %08X\n", cur, *filledCount,curPlugin);
|
||||
//DEBUG_FUNCTION_LINE("cur %d filledCount %d curPlugin %08X\n", cur, *filledCount,curPlugin);
|
||||
if(cur >= pluginInfoSpace) {
|
||||
DEBUG_FUNCTION_LINE("deleted plugins because they don't fit in buffer..\n");
|
||||
//DEBUG_FUNCTION_LINE("deleted plugins because they don't fit in buffer..\n");
|
||||
// delete all that don't fit into the target list.
|
||||
delete curPlugin;
|
||||
continue;
|
||||
}
|
||||
io_handles[cur] = (plugin_information_handle) curPlugin;
|
||||
DEBUG_FUNCTION_LINE("%08X = %08X\n", &(io_handles[cur]), io_handles[cur]);
|
||||
//DEBUG_FUNCTION_LINE("%08X = %08X\n", &(io_handles[cur]), io_handles[cur]);
|
||||
cur++;
|
||||
(*filledCount)++;
|
||||
}
|
||||
|
||||
DCFlushRange(message->ioctl.buffer_io,message->ioctl.length_io);
|
||||
ICInvalidateRange(message->ioctl.buffer_io,message->ioctl.length_io);
|
||||
} else {
|
||||
res = IPC_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IOCTL_PLUGIN_LOADER_GET_INFORMATION_LOADED: {
|
||||
if(message->ioctl.length_in != 4 || message->ioctl.length_io < 4) {
|
||||
if(message->ioctl.length_in != 0 || message->ioctl.length_io < 4) {
|
||||
res = IPC_ERROR_INVALID_SIZE;
|
||||
} else {
|
||||
void * ptr = (void *) message->ioctl.buffer_in[0];
|
||||
uint32_t * filledCount = (uint32_t *)message->ioctl.buffer_io;
|
||||
plugin_information_handle * io_handles = (plugin_information_handle *) &(message->ioctl.buffer_io[1]);
|
||||
uint32_t lengthIo = message->ioctl.length_io - 4;
|
||||
|
||||
*filledCount = 0;
|
||||
|
||||
if(ptr != NULL) {
|
||||
PluginLoader* pluginLoader = (PluginLoader * )ptr;
|
||||
std::vector<PluginInformation *> pluginList = pluginLoader->getPluginsLoadedInMemory();
|
||||
std::vector<PluginInformation *> pluginList = PluginLoader::getPluginsLoadedInMemory();
|
||||
uint32_t pluginInfoSpace = lengthIo / sizeof(plugin_information_handle);
|
||||
|
||||
uint32_t cur = 0;
|
||||
@ -134,9 +126,7 @@ int ipc_ioctl(ipcmessage *message) {
|
||||
}
|
||||
DCFlushRange(message->ioctl.buffer_io,message->ioctl.length_io);
|
||||
ICInvalidateRange(message->ioctl.buffer_io,message->ioctl.length_io);
|
||||
} else {
|
||||
res = IPC_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -175,9 +165,12 @@ int ipc_ioctl(ipcmessage *message) {
|
||||
if(message->ioctl.length_io < plugin_information_handle_list_size * sizeof(plugin_information)) {
|
||||
res = IPC_ERROR_INVALID_SIZE;
|
||||
} else {
|
||||
if(plugin_information_handle_list != NULL && plugin_information_handle_list != NULL) {
|
||||
if(plugin_information_handle_list != NULL && plugin_information_handle_list_size != 0) {
|
||||
for(uint32_t i = 0; i < plugin_information_handle_list_size; i++ ) {
|
||||
PluginInformation* curHandle = (PluginInformation * )plugin_information_handle_list[i];
|
||||
if(curHandle == NULL){
|
||||
continue;
|
||||
}
|
||||
plugin_information_list[i].handle = plugin_information_handle_list[i];
|
||||
strncpy(plugin_information_list[i].path, curHandle->getPath().c_str(),255);
|
||||
strncpy(plugin_information_list[i].name, curHandle->getName().c_str(),255);
|
||||
@ -221,11 +214,10 @@ int ipc_ioctl(ipcmessage *message) {
|
||||
//DEBUG_FUNCTION_LINE("willBeLoaded size is %d\n",willBeLoaded.size());
|
||||
|
||||
|
||||
//if(willBeLoaded.size() > 0){
|
||||
RestoreEverything();
|
||||
pluginLoader->loadAndLinkPlugins(willBeLoaded);
|
||||
afterLoadAndLink();
|
||||
//}
|
||||
|
||||
|
||||
*linkedCount = willBeLoaded.size();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user