mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-22 12:49:17 +01:00
Add option to delete or not delete the actual plugin data when unloading plugins
This commit is contained in:
parent
49fde27123
commit
b63723eb72
@ -93,10 +93,11 @@ void PluginManagement::RestorePatches(plugin_information_t *pluginInformation, B
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginManagement::unloadPlugins(plugin_information_t *gPluginInformation, MEMHeapHandle pluginHeap) {
|
void PluginManagement::unloadPlugins(plugin_information_t *gPluginInformation, MEMHeapHandle pluginHeap, BOOL freePluginData) {
|
||||||
RestorePatches(gPluginInformation, true);
|
RestorePatches(gPluginInformation, true);
|
||||||
for (int32_t plugin_index = 0; plugin_index < gPluginInformation->number_used_plugins; plugin_index++) {
|
for (int32_t plugin_index = 0; plugin_index < gPluginInformation->number_used_plugins; plugin_index++) {
|
||||||
plugin_information_single_t *plugin = &(gPluginInformation->plugin_data[plugin_index]);
|
plugin_information_single_t *plugin = &(gPluginInformation->plugin_data[plugin_index]);
|
||||||
|
if (freePluginData) {
|
||||||
if (plugin->data.buffer != nullptr) {
|
if (plugin->data.buffer != nullptr) {
|
||||||
if (plugin->data.memoryType == eMemTypeMEM2) {
|
if (plugin->data.memoryType == eMemTypeMEM2) {
|
||||||
DEBUG_FUNCTION_LINE("free %08X", plugin->data.buffer);
|
DEBUG_FUNCTION_LINE("free %08X", plugin->data.buffer);
|
||||||
@ -113,7 +114,7 @@ void PluginManagement::unloadPlugins(plugin_information_t *gPluginInformation, M
|
|||||||
} else {
|
} else {
|
||||||
DEBUG_FUNCTION_LINE("Plugin has no copy of elf save in memory, can't free it");
|
DEBUG_FUNCTION_LINE("Plugin has no copy of elf save in memory, can't free it");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (plugin->info.allocatedTextMemoryAddress != nullptr) {
|
if (plugin->info.allocatedTextMemoryAddress != nullptr) {
|
||||||
MEMFreeToExpHeap((MEMHeapHandle) pluginHeap, plugin->info.allocatedTextMemoryAddress);
|
MEMFreeToExpHeap((MEMHeapHandle) pluginHeap, plugin->info.allocatedTextMemoryAddress);
|
||||||
DEBUG_FUNCTION_LINE("Freed %08X", plugin->info.allocatedTextMemoryAddress);
|
DEBUG_FUNCTION_LINE("Freed %08X", plugin->info.allocatedTextMemoryAddress);
|
||||||
@ -130,6 +131,7 @@ void PluginManagement::unloadPlugins(plugin_information_t *gPluginInformation, M
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset((void *) gPluginInformation, 0, sizeof(plugin_information_t));
|
memset((void *) gPluginInformation, 0, sizeof(plugin_information_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
|
|
||||||
static bool doRelocation(const std::vector<RelocationData> &relocData, relocation_trampolin_entry_t *tramp_data, uint32_t tramp_length, uint32_t trampolinID);
|
static bool doRelocation(const std::vector<RelocationData> &relocData, relocation_trampolin_entry_t *tramp_data, uint32_t tramp_length, uint32_t trampolinID);
|
||||||
|
|
||||||
static void unloadPlugins(plugin_information_t * pluginInformation, MEMHeapHandle pluginHeap);
|
static void unloadPlugins(plugin_information_t * pluginInformation, MEMHeapHandle pluginHeap, BOOL freePluginData);
|
||||||
|
|
||||||
static std::vector<PluginContainer> loadPlugins(const std::vector<PluginData> &pluginList, MEMHeapHandle pHeader, relocation_trampolin_entry_t *trampolin_data, uint32_t trampolin_data_length);
|
static std::vector<PluginContainer> loadPlugins(const std::vector<PluginData> &pluginList, MEMHeapHandle pHeader, relocation_trampolin_entry_t *trampolin_data, uint32_t trampolin_data_length);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user