mirror of
https://github.com/wiiu-env/WUMSLoader.git
synced 2025-01-27 23:45:36 +01:00
Add support for calling hooks of a single module
This commit is contained in:
parent
94d40374f9
commit
62dd3cc0c5
@ -11,21 +11,27 @@ static const char **hook_names = (const char *[]) {
|
|||||||
"WUMS_HOOK_FINI_WUT"};
|
"WUMS_HOOK_FINI_WUT"};
|
||||||
|
|
||||||
void CallHook(const std::vector<ModuleData> &modules, wums_hook_type_t type) {
|
void CallHook(const std::vector<ModuleData> &modules, wums_hook_type_t type) {
|
||||||
DEBUG_FUNCTION_LINE("Calling hook of type %s [%d]", hook_names[type], type);
|
DEBUG_FUNCTION_LINE("Calling hook of type %s [%d] for all modules\n", hook_names[type], type);
|
||||||
for (auto &curModule: modules) {
|
for (auto &curModule: modules) {
|
||||||
for (auto &curHook : curModule.getHookDataList()) {
|
CallHook(curModule, type);
|
||||||
if ((type == WUMS_HOOK_INIT ||
|
}
|
||||||
type == WUMS_HOOK_APPLICATION_STARTS ||
|
}
|
||||||
type == WUMS_HOOK_APPLICATION_ENDS ||
|
|
||||||
type == WUMS_HOOK_INIT_WUT ||
|
|
||||||
type == WUMS_HOOK_FINI_WUT) && curHook.getType() == type) {
|
void CallHook(const ModuleData &module, wums_hook_type_t type) {
|
||||||
uint32_t func_ptr = (uint32_t) curHook.getTarget();
|
for (auto &curHook : module.getHookDataList()) {
|
||||||
if (func_ptr == 0) {
|
if ((type == WUMS_HOOK_INIT ||
|
||||||
DEBUG_FUNCTION_LINE("Hook ptr was NULL\n");
|
type == WUMS_HOOK_APPLICATION_STARTS ||
|
||||||
} else {
|
type == WUMS_HOOK_APPLICATION_ENDS ||
|
||||||
DEBUG_FUNCTION_LINE("Calling for module [%s]\n", curModule.getExportName().c_str());
|
type == WUMS_HOOK_INIT_WUT ||
|
||||||
((void (*)(void)) ((uint32_t *) func_ptr))();
|
type == WUMS_HOOK_FINI_WUT) &&
|
||||||
}
|
type == curHook.getType()) {
|
||||||
|
uint32_t func_ptr = (uint32_t) curHook.getTarget();
|
||||||
|
if (func_ptr == 0) {
|
||||||
|
DEBUG_FUNCTION_LINE("Hook ptr was NULL\n");
|
||||||
|
} else {
|
||||||
|
DEBUG_FUNCTION_LINE("Calling hook of type %s [%d] %d for %s \n", hook_names[type], type, curHook.getType(), module.getExportName().c_str());
|
||||||
|
((void (*)(void)) ((uint32_t *) func_ptr))();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,3 +6,4 @@
|
|||||||
#include "../../source/module/ModuleData.h"
|
#include "../../source/module/ModuleData.h"
|
||||||
|
|
||||||
void CallHook(const std::vector<ModuleData> &modules, wums_hook_type_t type);
|
void CallHook(const std::vector<ModuleData> &modules, wums_hook_type_t type);
|
||||||
|
void CallHook(const ModuleData &module, wums_hook_type_t type);
|
Loading…
x
Reference in New Issue
Block a user