diff --git a/wumsloader/src/utils/RelocationUtils.cpp b/wumsloader/src/utils/RelocationUtils.cpp index d6b626e..d48a788 100644 --- a/wumsloader/src/utils/RelocationUtils.cpp +++ b/wumsloader/src/utils/RelocationUtils.cpp @@ -53,13 +53,7 @@ bool ResolveRelocations(std::vector> &loadedModules, auto &relocData = curModule->getRelocationDataList(); - // On first usage we can't redirect the alloc functions to our custom heap - // because threads can't run it on it. In order to patch the kernel - // to fully support our memory region, we have to run the MemoryMapping once with the default heap. - // Afterwards we can just rely on the custom heap. - bool skipAllocFunction = skipMemoryMappingModule && (std::string_view(curModule->getExportName()) == "homebrew_memorymapping"); - DEBUG_FUNCTION_LINE_VERBOSE("Skip alloc replace? %d", skipAllocFunction); - if (!doRelocation(gLoadedModules, relocData, nullptr, 0, skipAllocFunction, usedRPls)) { + if (!doRelocation(gLoadedModules, relocData, nullptr, 0, usedRPls)) { wasSuccessful = false; DEBUG_FUNCTION_LINE_ERR("Failed to do Relocations for %s", curModule->getExportName().c_str()); OSFatal("Failed to do Relocations"); @@ -77,7 +71,6 @@ bool doRelocation(const std::vector> &moduleList, const std::vector> &relocData, relocation_trampoline_entry_t *tramp_data, uint32_t tramp_length, - bool skipAllocReplacement, std::map &usedRPls) { for (auto const &curReloc : relocData) { auto &functionName = curReloc->getName(); @@ -100,14 +93,12 @@ bool doRelocation(const std::vector> &moduleList, } } - if (!skipAllocReplacement) { - if (functionName == "MEMAllocFromDefaultHeap") { - functionAddress = reinterpret_cast(&MEMAlloc); - } else if (functionName == "MEMAllocFromDefaultHeapEx") { - functionAddress = reinterpret_cast(&MEMAllocEx); - } else if (functionName == "MEMFreeToDefaultHeap") { - functionAddress = reinterpret_cast(&MEMFree); - } + if (functionName == "MEMAllocFromDefaultHeap") { + functionAddress = reinterpret_cast(&MEMAlloc); + } else if (functionName == "MEMAllocFromDefaultHeapEx") { + functionAddress = reinterpret_cast(&MEMAllocEx); + } else if (functionName == "MEMFreeToDefaultHeap") { + functionAddress = reinterpret_cast(&MEMFree); } if (functionAddress == 0) { diff --git a/wumsloader/src/utils/RelocationUtils.h b/wumsloader/src/utils/RelocationUtils.h index 49112f2..880dfe9 100644 --- a/wumsloader/src/utils/RelocationUtils.h +++ b/wumsloader/src/utils/RelocationUtils.h @@ -12,5 +12,4 @@ bool doRelocation(const std::vector> &moduleList, const std::vector> &relocData, relocation_trampoline_entry_t *tramp_data, uint32_t tramp_length, - bool skipAllocReplacement, std::map &usedRPls); \ No newline at end of file