mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-06-06 06:35:00 -06:00
coreinit: Implement OSDynLoad_IsModuleLoaded
This commit is contained in:
parent
0b661488d7
commit
a8bd6f84f7
@ -59,7 +59,7 @@ namespace coreinit
|
|||||||
PPCCoreCallback(_osDynLoadFuncFree, _mem);
|
PPCCoreCallback(_osDynLoadFuncFree, _mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 OSDynLoad_Acquire(const char* libName, uint32be* moduleHandleOut)
|
uint32 OSDynLoad_AcquireInternal(const char* libName, uint32be* moduleHandleOut, bool checkOnly)
|
||||||
{
|
{
|
||||||
// truncate path
|
// truncate path
|
||||||
sint32 fileNameStartIndex = 0;
|
sint32 fileNameStartIndex = 0;
|
||||||
@ -72,7 +72,7 @@ namespace coreinit
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// truncate file extension
|
// truncate file extension
|
||||||
char tempLibName[512];
|
char tempLibName[512];
|
||||||
strcpy(tempLibName, libName + fileNameStartIndex);
|
strcpy(tempLibName, libName + fileNameStartIndex);
|
||||||
tempLen = (sint32)strlen(tempLibName);
|
tempLen = (sint32)strlen(tempLibName);
|
||||||
@ -88,6 +88,11 @@ namespace coreinit
|
|||||||
uint32 rplHandle = RPLLoader_GetHandleByModuleName(libName);
|
uint32 rplHandle = RPLLoader_GetHandleByModuleName(libName);
|
||||||
if (rplHandle == RPL_INVALID_HANDLE && !RPLLoader_HasDependency(libName))
|
if (rplHandle == RPL_INVALID_HANDLE && !RPLLoader_HasDependency(libName))
|
||||||
{
|
{
|
||||||
|
if (checkOnly)
|
||||||
|
{
|
||||||
|
*moduleHandleOut = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
RPLLoader_AddDependency(libName);
|
RPLLoader_AddDependency(libName);
|
||||||
RPLLoader_UpdateDependencies();
|
RPLLoader_UpdateDependencies();
|
||||||
RPLLoader_Link();
|
RPLLoader_Link();
|
||||||
@ -106,6 +111,11 @@ namespace coreinit
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 OSDynLoad_Acquire(const char* libName, uint32be* moduleHandleOut)
|
||||||
|
{
|
||||||
|
return OSDynLoad_AcquireInternal(libName, moduleHandleOut, false);
|
||||||
|
}
|
||||||
|
|
||||||
void OSDynLoad_Release(uint32 moduleHandle)
|
void OSDynLoad_Release(uint32 moduleHandle)
|
||||||
{
|
{
|
||||||
if (moduleHandle == RPL_INVALID_HANDLE)
|
if (moduleHandle == RPL_INVALID_HANDLE)
|
||||||
@ -114,6 +124,11 @@ namespace coreinit
|
|||||||
RPLLoader_UpdateDependencies();
|
RPLLoader_UpdateDependencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 OSDynLoad_IsModuleLoaded(const char* libName, uint32be* moduleHandleOut)
|
||||||
|
{
|
||||||
|
return OSDynLoad_AcquireInternal(libName, moduleHandleOut, true);
|
||||||
|
}
|
||||||
|
|
||||||
uint32 OSDynLoad_FindExport(uint32 moduleHandle, uint32 isData, const char* exportName, betype<MPTR>* addrOut)
|
uint32 OSDynLoad_FindExport(uint32 moduleHandle, uint32 isData, const char* exportName, betype<MPTR>* addrOut)
|
||||||
{
|
{
|
||||||
if (moduleHandle == 0xFFFFFFFF)
|
if (moduleHandle == 0xFFFFFFFF)
|
||||||
@ -140,6 +155,7 @@ namespace coreinit
|
|||||||
|
|
||||||
cafeExportRegister("coreinit", OSDynLoad_Acquire, LogType::Placeholder);
|
cafeExportRegister("coreinit", OSDynLoad_Acquire, LogType::Placeholder);
|
||||||
cafeExportRegister("coreinit", OSDynLoad_Release, LogType::Placeholder);
|
cafeExportRegister("coreinit", OSDynLoad_Release, LogType::Placeholder);
|
||||||
|
cafeExportRegister("coreinit", OSDynLoad_IsModuleLoaded, LogType::Placeholder);
|
||||||
cafeExportRegister("coreinit", OSDynLoad_FindExport, LogType::Placeholder);
|
cafeExportRegister("coreinit", OSDynLoad_FindExport, LogType::Placeholder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user