mirror of
https://github.com/wiiu-env/EnvironmentLoader.git
synced 2025-02-18 22:16:23 +01:00
Fix OSAcquire
This commit is contained in:
parent
4808320121
commit
13055af2ca
@ -117,14 +117,20 @@ bool ElfUtils::doRelocation(std::vector<std::shared_ptr<RelocationData>> &relocD
|
|||||||
int32_t isData = curReloc->getImportRPLInformation()->isData();
|
int32_t isData = curReloc->getImportRPLInformation()->isData();
|
||||||
OSDynLoad_Module rplHandle = nullptr;
|
OSDynLoad_Module rplHandle = nullptr;
|
||||||
|
|
||||||
if (OSDynLoad_IsModuleLoaded(rplName.c_str(), &rplHandle) != OS_DYNLOAD_OK) {
|
|
||||||
|
auto err = OSDynLoad_IsModuleLoaded(rplName.c_str(), &rplHandle);
|
||||||
|
if (err != OS_DYNLOAD_OK || rplHandle == 0) {
|
||||||
// only acquire if not already loaded.
|
// only acquire if not already loaded.
|
||||||
OSDynLoad_Acquire(rplName.c_str(), &rplHandle);
|
auto res = OSDynLoad_Acquire(rplName.c_str(), &rplHandle);
|
||||||
|
DEBUG_FUNCTION_LINE("OSDynLoad_Acquire %s: %d", rplName.c_str(), res);
|
||||||
|
} else {
|
||||||
|
DEBUG_FUNCTION_LINE("already acquired %08X", rplHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t functionAddress = 0;
|
uint32_t functionAddress = 0;
|
||||||
OSDynLoad_FindExport(rplHandle, isData, functionName.c_str(), (void **) &functionAddress);
|
OSDynLoad_FindExport(rplHandle, isData, functionName.c_str(), (void **) &functionAddress);
|
||||||
if (functionAddress == 0) {
|
if (functionAddress == 0) {
|
||||||
|
DEBUG_FUNCTION_LINE("Failed to find export for %s %s %d", functionName.c_str(), rplName.c_str(), isData);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ElfUtils::elfLinkOne(curReloc->getType(), curReloc->getOffset(), curReloc->getAddend(), (uint32_t) curReloc->getDestination(), functionAddress, tramp_data, tramp_length,
|
if (!ElfUtils::elfLinkOne(curReloc->getType(), curReloc->getOffset(), curReloc->getAddend(), (uint32_t) curReloc->getDestination(), functionAddress, tramp_data, tramp_length,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user