mirror of
https://github.com/wiiu-env/WUMSLoader.git
synced 2024-11-23 08:19:16 +01:00
Adopt the hook-call of WUMS_HOOK_INIT to provide a pointer to the module_information_t struct
This commit is contained in:
parent
3f6f956b70
commit
b46639975e
@ -20,8 +20,6 @@
|
||||
#include "globals.h"
|
||||
#include "hooks.h"
|
||||
|
||||
#define gModuleData ((module_information_t *) (0x00880000))
|
||||
|
||||
uint8_t gFunctionsPatched __attribute__((section(".data"))) = 0;
|
||||
uint8_t gInitCalled __attribute__((section(".data"))) = 0;
|
||||
|
||||
|
@ -3,4 +3,6 @@
|
||||
#include <cstdint>
|
||||
|
||||
extern uint32_t MemoryMappingEffectiveToPhysicalPTR;
|
||||
extern uint32_t MemoryMappingPhysicalToEffectivePTR;
|
||||
extern uint32_t MemoryMappingPhysicalToEffectivePTR;
|
||||
|
||||
#define gModuleData ((module_information_t *) (0x00880000))
|
@ -1,6 +1,7 @@
|
||||
#include <wums.h>
|
||||
#include "hooks.h"
|
||||
#include "utils/logger.h"
|
||||
#include "globals.h"
|
||||
|
||||
static const char **hook_names = (const char *[]) {
|
||||
"WUMS_HOOK_INIT",
|
||||
@ -19,19 +20,26 @@ void CallHook(const std::vector<ModuleData> &modules, wums_hook_type_t type) {
|
||||
|
||||
void CallHook(const ModuleData &module, wums_hook_type_t type) {
|
||||
for (auto &curHook : module.getHookDataList()) {
|
||||
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) &&
|
||||
type == curHook.getType()) {
|
||||
uint32_t func_ptr = (uint32_t) curHook.getTarget();
|
||||
if (func_ptr == 0) {
|
||||
DEBUG_FUNCTION_LINE("Hook ptr was NULL\n");
|
||||
} else {
|
||||
uint32_t func_ptr = (uint32_t) curHook.getTarget();
|
||||
if (func_ptr == 0) {
|
||||
DEBUG_FUNCTION_LINE("Hook ptr was NULL\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == curHook.getType()) {
|
||||
if ((type == WUMS_HOOK_APPLICATION_STARTS||
|
||||
type == WUMS_HOOK_APPLICATION_ENDS ||
|
||||
type == WUMS_HOOK_INIT_WUT ||
|
||||
type == WUMS_HOOK_FINI_WUT)) {
|
||||
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))();
|
||||
} else if (type == WUMS_HOOK_INIT) {
|
||||
DEBUG_FUNCTION_LINE("Calling hook of type %s [%d] %d for %s\n", hook_names[type], type, curHook.getType(), module.getExportName().c_str(), gModuleData);
|
||||
wums_app_init_args_t args;
|
||||
args.module_information = gModuleData;
|
||||
((void (*)(wums_app_init_args_t*)) ((uint32_t *) func_ptr))(&args);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user