mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-22 04:39:17 +01:00
Save the address of memory allocated on the plugin heap
This commit is contained in:
parent
53f454f6ed
commit
c1c7594926
@ -64,6 +64,8 @@ struct plugin_info_t {
|
||||
uint32_t number_used_hooks; // Number of used hooks. Maximum is MAXIMUM_HOOKS_PER_PLUGIN
|
||||
replacement_data_hook_t hooks[MAXIMUM_HOOKS_PER_PLUGIN]; // Replacement information for each function.
|
||||
uint8_t trampolinId;
|
||||
void * allocatedTextMemoryAddress = nullptr;
|
||||
void * allocatedDataMemoryAddress = nullptr;
|
||||
};
|
||||
|
||||
struct plugin_data_t {
|
||||
|
@ -159,6 +159,9 @@ bool PluginContainerPersistence::savePlugin(plugin_information_t * pluginInforma
|
||||
}
|
||||
}
|
||||
plugin_data->info.trampolinId = pluginInfo.getTrampolinId();
|
||||
plugin_data->info.allocatedTextMemoryAddress = pluginInfo.allocatedTextMemoryAddress;
|
||||
plugin_data->info.allocatedDataMemoryAddress = pluginInfo.allocatedDataMemoryAddress;
|
||||
|
||||
|
||||
/* Copy plugin data */
|
||||
auto pluginData = plugin.getPluginData();
|
||||
@ -219,6 +222,8 @@ std::vector<PluginContainer> PluginContainerPersistence::loadPlugins(plugin_info
|
||||
PluginInformation pluginInformation;
|
||||
|
||||
pluginInformation.setTrampolinId(plugin_data->info.trampolinId);
|
||||
pluginInformation.allocatedTextMemoryAddress = plugin_data->info.allocatedTextMemoryAddress;
|
||||
pluginInformation.allocatedDataMemoryAddress = plugin_data->info.allocatedDataMemoryAddress;
|
||||
|
||||
for(uint32_t i = 0; i < MAXIMUM_PLUGIN_SECTION_LENGTH; i++) {
|
||||
plugin_section_info_t * sectionInfo = &(plugin_data->info.sectionInfos[i]);
|
||||
|
@ -81,6 +81,7 @@ public:
|
||||
uint8_t getTrampolinId() const {
|
||||
return trampolinId;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::vector<HookData> hook_data_list;
|
||||
@ -90,6 +91,9 @@ private:
|
||||
|
||||
uint8_t trampolinId = 0;
|
||||
|
||||
void* allocatedTextMemoryAddress = 0;
|
||||
void* allocatedDataMemoryAddress = 0;
|
||||
|
||||
friend class PluginInformationFactory;
|
||||
friend class PluginInformationPersistence;
|
||||
friend class PluginContainerPersistence;
|
||||
};
|
||||
|
@ -197,6 +197,10 @@ std::optional<PluginInformation> PluginInformationFactory::load(const PluginData
|
||||
}
|
||||
}
|
||||
|
||||
// Save the addresses for the allocated. This way we can free it again :)
|
||||
pluginInfo.allocatedDataMemoryAddress = data_data;
|
||||
pluginInfo.allocatedTextMemoryAddress = text_data;
|
||||
|
||||
return pluginInfo;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user