mirror of
https://github.com/wiiu-env/WUMSLoader.git
synced 2024-11-27 10:04:16 +01:00
Only use OSDynload_Acquire if really needed
This commit is contained in:
parent
42d73fa539
commit
6e352b0085
@ -59,7 +59,10 @@ bool doRelocation(std::vector<RelocationData> &relocData, relocation_trampolin_e
|
|||||||
int32_t isData = curReloc.getImportRPLInformation().isData();
|
int32_t isData = curReloc.getImportRPLInformation().isData();
|
||||||
OSDynLoad_Module rplHandle = 0;
|
OSDynLoad_Module rplHandle = 0;
|
||||||
if (moduleCache.count(rplName) == 0) {
|
if (moduleCache.count(rplName) == 0) {
|
||||||
OSDynLoad_Acquire(rplName.c_str(), &rplHandle);
|
if(OSDynLoad_IsModuleLoaded(rplName.c_str(), &rplHandle) != OS_DYNLOAD_OK) {
|
||||||
|
// only acquire if not already loaded.
|
||||||
|
OSDynLoad_Acquire(rplName.c_str(), &rplHandle);
|
||||||
|
}
|
||||||
moduleCache[rplName] = rplHandle;
|
moduleCache[rplName] = rplHandle;
|
||||||
}
|
}
|
||||||
rplHandle = moduleCache.at(rplName);
|
rplHandle = moduleCache.at(rplName);
|
||||||
|
@ -46,7 +46,11 @@ bool doRelocation(std::vector<RelocationData> &relocData, relocation_trampolin_e
|
|||||||
std::string rplName = curReloc.getImportRPLInformation().getName();
|
std::string rplName = curReloc.getImportRPLInformation().getName();
|
||||||
int32_t isData = curReloc.getImportRPLInformation().isData();
|
int32_t isData = curReloc.getImportRPLInformation().isData();
|
||||||
OSDynLoad_Module rplHandle = nullptr;
|
OSDynLoad_Module rplHandle = nullptr;
|
||||||
OSDynLoad_Acquire(rplName.c_str(), &rplHandle);
|
|
||||||
|
if(OSDynLoad_IsModuleLoaded(rplName.c_str(), &rplHandle) != OS_DYNLOAD_OK) {
|
||||||
|
// only acquire if not already loaded.
|
||||||
|
OSDynLoad_Acquire(rplName.c_str(), &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);
|
||||||
|
Loading…
Reference in New Issue
Block a user