mirror of
https://github.com/wiiu-env/WUMSLoader.git
synced 2024-11-23 16:29:16 +01:00
Remove the skipAllocFunction parameter
This commit is contained in:
parent
1f7d853d65
commit
b5a4f7ca37
@ -53,13 +53,7 @@ bool ResolveRelocations(std::vector<std::shared_ptr<ModuleData>> &loadedModules,
|
|||||||
|
|
||||||
auto &relocData = curModule->getRelocationDataList();
|
auto &relocData = curModule->getRelocationDataList();
|
||||||
|
|
||||||
// On first usage we can't redirect the alloc functions to our custom heap
|
if (!doRelocation(gLoadedModules, relocData, nullptr, 0, usedRPls)) {
|
||||||
// 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)) {
|
|
||||||
wasSuccessful = false;
|
wasSuccessful = false;
|
||||||
DEBUG_FUNCTION_LINE_ERR("Failed to do Relocations for %s", curModule->getExportName().c_str());
|
DEBUG_FUNCTION_LINE_ERR("Failed to do Relocations for %s", curModule->getExportName().c_str());
|
||||||
OSFatal("Failed to do Relocations");
|
OSFatal("Failed to do Relocations");
|
||||||
@ -77,7 +71,6 @@ bool doRelocation(const std::vector<std::shared_ptr<ModuleData>> &moduleList,
|
|||||||
const std::vector<std::unique_ptr<RelocationData>> &relocData,
|
const std::vector<std::unique_ptr<RelocationData>> &relocData,
|
||||||
relocation_trampoline_entry_t *tramp_data,
|
relocation_trampoline_entry_t *tramp_data,
|
||||||
uint32_t tramp_length,
|
uint32_t tramp_length,
|
||||||
bool skipAllocReplacement,
|
|
||||||
std::map<std::string, OSDynLoad_Module> &usedRPls) {
|
std::map<std::string, OSDynLoad_Module> &usedRPls) {
|
||||||
for (auto const &curReloc : relocData) {
|
for (auto const &curReloc : relocData) {
|
||||||
auto &functionName = curReloc->getName();
|
auto &functionName = curReloc->getName();
|
||||||
@ -100,7 +93,6 @@ bool doRelocation(const std::vector<std::shared_ptr<ModuleData>> &moduleList,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skipAllocReplacement) {
|
|
||||||
if (functionName == "MEMAllocFromDefaultHeap") {
|
if (functionName == "MEMAllocFromDefaultHeap") {
|
||||||
functionAddress = reinterpret_cast<uint32_t>(&MEMAlloc);
|
functionAddress = reinterpret_cast<uint32_t>(&MEMAlloc);
|
||||||
} else if (functionName == "MEMAllocFromDefaultHeapEx") {
|
} else if (functionName == "MEMAllocFromDefaultHeapEx") {
|
||||||
@ -108,7 +100,6 @@ bool doRelocation(const std::vector<std::shared_ptr<ModuleData>> &moduleList,
|
|||||||
} else if (functionName == "MEMFreeToDefaultHeap") {
|
} else if (functionName == "MEMFreeToDefaultHeap") {
|
||||||
functionAddress = reinterpret_cast<uint32_t>(&MEMFree);
|
functionAddress = reinterpret_cast<uint32_t>(&MEMFree);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (functionAddress == 0) {
|
if (functionAddress == 0) {
|
||||||
int32_t isData = curReloc->getImportRPLInformation()->isData();
|
int32_t isData = curReloc->getImportRPLInformation()->isData();
|
||||||
|
@ -12,5 +12,4 @@ bool doRelocation(const std::vector<std::shared_ptr<ModuleData>> &moduleList,
|
|||||||
const std::vector<std::unique_ptr<RelocationData>> &relocData,
|
const std::vector<std::unique_ptr<RelocationData>> &relocData,
|
||||||
relocation_trampoline_entry_t *tramp_data,
|
relocation_trampoline_entry_t *tramp_data,
|
||||||
uint32_t tramp_length,
|
uint32_t tramp_length,
|
||||||
bool skipAllocReplacement,
|
|
||||||
std::map<std::string, OSDynLoad_Module> &usedRPls);
|
std::map<std::string, OSDynLoad_Module> &usedRPls);
|
Loading…
Reference in New Issue
Block a user