mirror of
https://github.com/wiiu-env/MemoryMappingModule.git
synced 2025-06-13 18:58:24 +02:00
Use latest version of libfunctionpatcher
This commit is contained in:
4
source/functionpatcher.def
Normal file
4
source/functionpatcher.def
Normal file
@ -0,0 +1,4 @@
|
||||
:NAME homebrew_functionpatcher
|
||||
|
||||
:TEXT
|
||||
FPAddFunctionPatch
|
@ -14,6 +14,9 @@ WUMS_MODULE_EXPORT_NAME("homebrew_memorymapping");
|
||||
WUMS_MODULE_SKIP_INIT_FINI();
|
||||
WUMS_MODULE_INIT_BEFORE_RELOCATION_DONE_HOOK();
|
||||
|
||||
// We can't use the functions from libfunctionpatcher. Defined in functionpatcher.def
|
||||
extern "C" FunctionPatcherStatus FPAddFunctionPatch(function_replacement_data_t *function_data, PatchedFunctionHandle *outHandle, bool *outHasBeenPatched);
|
||||
|
||||
WUMS_INITIALIZE(args) {
|
||||
static uint8_t ucSetupRequired = 1;
|
||||
if (!ucSetupRequired) {
|
||||
@ -24,14 +27,20 @@ WUMS_INITIALIZE(args) {
|
||||
MemoryMapping_setupMemoryMapping();
|
||||
MemoryMapping_CreateHeaps();
|
||||
|
||||
/* We can not use FunctionPatcher_InitLibrary here because OSDynLoadAcquire is not patched yet.
|
||||
if (FunctionPatcher_InitLibrary() != FUNCTION_PATCHER_RESULT_SUCCESS) {
|
||||
OSFatal("homebrew_memorymapping: FunctionPatcher_InitLibrary failed");
|
||||
}*/
|
||||
|
||||
for (uint32_t i = 0; i < function_replacements_size; i++) {
|
||||
if (!FunctionPatcherPatchFunction(&function_replacements[i], nullptr)) {
|
||||
bool wasPatched = false;
|
||||
// We don't need to save the handles because we never restore them anyway.
|
||||
if (FPAddFunctionPatch(&function_replacements[i], nullptr, &wasPatched) != FUNCTION_PATCHER_RESULT_SUCCESS || !wasPatched) {
|
||||
OSFatal("homebrew_memorymapping: Failed to patch function");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WUMS_APPLICATION_STARTS() {
|
||||
OSReport("Running MemoryMappingModule " VERSION VERSION_EXTRA "\n");
|
||||
#ifdef DEBUG
|
||||
|
Reference in New Issue
Block a user