From 59300aad2261a31f187f1986cdb03771b1096d04 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 8 May 2022 20:43:03 +0200 Subject: [PATCH] Use latest version of libfunctionpatcher --- source/function_replacements.cpp | 2 +- source/main.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/function_replacements.cpp b/source/function_replacements.cpp index fdb767f..e9238b0 100644 --- a/source/function_replacements.cpp +++ b/source/function_replacements.cpp @@ -87,7 +87,7 @@ function_replacement_data_t function_replacements[] __attribute__((section(".dat REPLACE_FUNCTION_VIA_ADDRESS(KiIsEffectiveRangeValid, 0xffee0d6c, 0xffee0d6c), REPLACE_FUNCTION_VIA_ADDRESS(IPCKDriver_ValidatePhysicalAddress, 0xfff0cb5c, 0xfff0cb5c), REPLACE_FUNCTION_VIA_ADDRESS(KiGetOrPutUserData, 0xffee0794, 0xffee0794), - REPLACE_FUNCTION(MEMFindContainHeap, LIBRARY_COREINIT, MEMFindContainHeap), + REPLACE_FUNCTION(MEMFindContainHeap, LIBRARY_COREINIT, MEMFindContainHeap), }; // clang-format on diff --git a/source/main.cpp b/source/main.cpp index 64a3964..cdd68d0 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,8 +1,11 @@ #include "function_replacements.h" -#include "logger.h" #include "memory_mapping.h" +#include #include #include +#ifdef DEBUG +#include "logger.h" +#endif WUMS_MODULE_EXPORT_NAME("homebrew_memorymapping"); WUMS_MODULE_SKIP_INIT_FINI(); @@ -13,11 +16,16 @@ WUMS_INITIALIZE(args) { if (!ucSetupRequired) { return; } + ucSetupRequired = 0; MemoryMapping_setupMemoryMapping(); MemoryMapping_CreateHeaps(); - FunctionPatcherPatchFunction(function_replacements, function_replacements_size); + for (uint32_t i = 0; i < function_replacements_size; i++) { + if (!FunctionPatcherPatchFunction(&function_replacements[i], nullptr)) { + OSFatal("homebrew_memorymapping: Failed to patch function"); + } + } } #ifdef DEBUG