Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions core/logic/ExtensionSys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,24 @@ bool CExtensionManager::LibraryExists(const char *library)
return false;
}

void CExtensionManager::ForEachLibrary(ke::Function<void(const char *)> callback)
{
for (List<CExtension *>::iterator iter = m_Libs.begin();
iter != m_Libs.end();
iter++)
{
CExtension *pExt = (*iter);
if (!pExt->IsLoaded())
continue;
for (List<String>::iterator s_iter = pExt->m_Libraries.begin();
s_iter != pExt->m_Libraries.end();
s_iter++)
{
callback((*s_iter).c_str());
}
}
}

IExtension *CExtensionManager::LoadExternal(IExtensionInterface *pInterface,
const char *filepath,
const char *filename,
Expand Down
2 changes: 2 additions & 0 deletions core/logic/ExtensionSys.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "NativeOwner.h"
#include "ShareSys.h"
#include <bridge/include/IExtensionBridge.h>
#include <am-function.h>

class CPlayer;

Expand Down Expand Up @@ -175,6 +176,7 @@ class CExtensionManager :
void TryAutoload();
void AddLibrary(IExtension *pSource, const char *library);
bool LibraryExists(const char *library);
void ForEachLibrary(ke::Function<void(const char *)> callback);
void CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
void CallOnCoreMapEnd();
void AddRawDependency(IExtension *ext, IdentityToken_t *other, void *iface);
Expand Down
5 changes: 5 additions & 0 deletions core/logic/PluginSys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,11 @@ bool CPluginManager::RunSecondPass(CPlugin *pPlugin)
});
}

// Go through all loaded extension libraries and tell this plugin they're loaded.
g_Extensions.ForEachLibrary([pPlugin] (const char *lib) -> void {
pPlugin->Call_OnLibraryAdded(lib);
});

return true;
}

Expand Down